mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 13:55:21 +02:00
refactor(containers): migrate caps tab to react [EE-5215] (#10366)
This commit is contained in:
parent
9dde610da3
commit
57e04c3544
14 changed files with 324 additions and 190 deletions
|
@ -1,23 +0,0 @@
|
|||
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)]));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
import controller from './container-capabilities.controller';
|
||||
|
||||
angular.module('portainer.docker').component('containerCapabilities', {
|
||||
templateUrl: './containerCapabilities.html',
|
||||
bindings: {
|
||||
capabilities: '=',
|
||||
},
|
||||
controller,
|
||||
});
|
|
@ -1,15 +0,0 @@
|
|||
<form class="form-horizontal" style="margin-top: 15px">
|
||||
<div class="col-sm-12 form-section-title"> Container capabilities </div>
|
||||
<div class="form-group flex flex-wrap gap-y-2 px-5">
|
||||
<div ng-repeat="cap in $ctrl.capabilities" class="w-1/3 text-center">
|
||||
<por-switch-field
|
||||
label-class="'col-sm-6'"
|
||||
tooltip="cap.description"
|
||||
checked="cap.allowed"
|
||||
label="cap.capability"
|
||||
name="'capability'"
|
||||
on-change="($ctrl.capabilitiesOnChange[cap.capability])"
|
||||
></por-switch-field>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
Loading…
Add table
Add a link
Reference in a new issue