mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
* refactor(docker/switch/component): implement new design [EE=3688] * revert create volume * revert por-switch on exec.html * refactor(container): switch fields on container creation page and edition page * refactor(container): switch fields on networking/secret/servicewebhook/swarmvisual * bug fixed * code review issues * merge code * fix teaser for container edition * fix encode secret toggle bug on adding secret page * fixed a bug for service webhook toggle
23 lines
601 B
JavaScript
23 lines
601 B
JavaScript
export default class ContainerCapabilitiesController {
|
|
/* @ngInject */
|
|
constructor($scope) {
|
|
this.$scope = $scope;
|
|
|
|
this.oldCapabilities = [];
|
|
}
|
|
|
|
createOnChangeHandler(capability) {
|
|
return (checked) => {
|
|
this.$scope.$evalAsync(() => {
|
|
capability.allowed = checked;
|
|
});
|
|
};
|
|
}
|
|
|
|
$doCheck() {
|
|
if (this.oldCapabilities.length !== this.capabilities.length) {
|
|
this.oldCapabilities = this.capabilities;
|
|
this.capabilitiesOnChange = Object.fromEntries(this.capabilities.map((cap) => [cap.capability, this.createOnChangeHandler(cap)]));
|
|
}
|
|
}
|
|
}
|