mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
* feat(dockerhub): introduce local status endpoint * feat(proxy): rewrite request with dockerhub credentials * feat(endpoint): check env type * feat(endpoint): check for local endpoint * feat(docker): introduce client side service to get limits * feat(container): add info about rate limits in container * feat(dockerhub): load rate limits just for specific endpoints * feat(images): show specific dockerhub messages for admin * feat(service-create): show docker rate limits * feat(service-edit): show rate limit messages * fix(images): fix loading of page * refactor(images): move rate limits check to container * feat(kubernetes): proxy agent requests * feat(kubernetes/apps): show pull limits in application creation * refactor(image-registry): move warning to end of field * fix(image-registry): show right message for admin * fix(images): silently fail when loading rate limits * fix(kube/apps): use new rate limits comp * fix(images): move rate warning to end * fix(registry): move search to right place * fix(service): remove service warning * fix(endpoints): check if kube endpoint is local
31 lines
997 B
JavaScript
31 lines
997 B
JavaScript
export default class porImageRegistryContainerController {
|
|
/* @ngInject */
|
|
constructor(EndpointHelper, DockerHubService, Notifications) {
|
|
this.EndpointHelper = EndpointHelper;
|
|
this.DockerHubService = DockerHubService;
|
|
this.Notifications = Notifications;
|
|
|
|
this.pullRateLimits = null;
|
|
}
|
|
|
|
$onChanges({ isDockerHubRegistry }) {
|
|
if (isDockerHubRegistry && isDockerHubRegistry.currentValue) {
|
|
this.fetchRateLimits();
|
|
}
|
|
}
|
|
|
|
async fetchRateLimits() {
|
|
this.pullRateLimits = null;
|
|
if (this.EndpointHelper.isAgentEndpoint(this.endpoint) || this.EndpointHelper.isLocalEndpoint(this.endpoint)) {
|
|
try {
|
|
this.pullRateLimits = await this.DockerHubService.checkRateLimits(this.endpoint);
|
|
this.setValidity(this.pullRateLimits.remaining >= 0);
|
|
} catch (e) {
|
|
// eslint-disable-next-line no-console
|
|
console.error('Failed loading DockerHub pull rate limits', e);
|
|
}
|
|
} else {
|
|
this.setValidity(true);
|
|
}
|
|
}
|
|
}
|