-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(docker/switch/component): implement new design [EE-3688] (#1932
) * merge capabilities changes from Chaim * refactor(docker/switch/component): implement new design [EE=3688] * code review issues * merge code * feat(ui): UI improvements node details screen EE-3468 (#1926) * merge code * fix encode secret toggle bug on adding secret page * fixed a bug for service webhook toggle
- Loading branch information
Zhang Hao
committed
Jul 20, 2022
1 parent
a98f3dc
commit 77f9277
Showing
16 changed files
with
209 additions
and
100 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
app/docker/components/container-capabilities/container-capabilities.controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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)])); | ||
} | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
app/docker/components/container-capabilities/container-capabilities.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
import controller from './container-capabilities.controller'; | ||
|
||
angular.module('portainer.docker').component('containerCapabilities', { | ||
templateUrl: './containerCapabilities.html', | ||
bindings: { | ||
capabilities: '=', | ||
}, | ||
controller, | ||
}); |
23 changes: 10 additions & 13 deletions
23
app/docker/components/container-capabilities/containerCapabilities.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
<form class="form-horizontal" style="margin-top: 15px"> | ||
<div class="col-sm-12 form-section-title"> Container capabilities </div> | ||
<div class="form-group"> | ||
<div ng-repeat="cap in $ctrl.capabilities" class="col-xs-12 col-sm-6 col-md-4"> | ||
<div class="row"> | ||
<div class="col-xs-8"> | ||
<label for="capability" class="control-label text-left" style="display: flex; padding: 0"> | ||
{{ cap.capability }} | ||
<portainer-tooltip message="cap.description"></portainer-tooltip> | ||
</label> | ||
</div> | ||
<div class="col-xs-4"> | ||
<label class="switch"> <input type="checkbox" name="capability" ng-model="cap.allowed" /><i></i> </label> | ||
</div> | ||
</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.