1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-02 20:35:25 +02:00

refactor(ui): replace ng selectors with react-select [EE-3608] (#7203)

Co-authored-by: LP B <xAt0mZ@users.noreply.github.com>
This commit is contained in:
Chaim Lev-Ari 2022-09-21 10:10:58 +03:00 committed by GitHub
parent 1e21961e6a
commit ceaee4e175
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 1188 additions and 625 deletions

View file

@ -1,20 +0,0 @@
<!-- on-select/on-remove are called with model because ui-select uses 2-way-binding -->
<ui-select
multiple
ng-model="$ctrl.model"
close-on-select="false"
on-select="$ctrl.onChange($ctrl.model)"
on-remove="$ctrl.onChange($ctrl.model)"
data-cy="edgeGroupCreate-edgeGroupsSelector"
>
<ui-select-match placeholder="Select one or multiple group(s)">
<span>
{{ $item.Name }}
</span>
</ui-select-match>
<ui-select-choices repeat="item.Id as item in $ctrl.items | filter: { Name: $select.search }">
<span>
{{ item.Name }}
</span>
</ui-select-choices>
</ui-select>

View file

@ -1,10 +0,0 @@
import angular from 'angular';
angular.module('portainer.edge').component('edgeGroupsSelector', {
templateUrl: './edgeGroupsSelector.html',
bindings: {
model: '<',
items: '<',
onChange: '<',
},
});

View file

@ -2,7 +2,7 @@
<div class="col-sm-12 form-section-title"> Edge Groups </div>
<div class="form-group">
<div class="col-sm-12">
<edge-groups-selector model="$ctrl.model.EdgeGroups" items="$ctrl.edgeGroups" on-change="($ctrl.onChangeGroups)"></edge-groups-selector>
<edge-groups-selector value="$ctrl.model.EdgeGroups" items="$ctrl.edgeGroups" on-change="($ctrl.onChangeGroups)"></edge-groups-selector>
</div>
</div>

View file

@ -2,7 +2,8 @@ import { PortainerEndpointTypes } from '@/portainer/models/endpoint/models';
export class EditEdgeStackFormController {
/* @ngInject */
constructor() {
constructor($scope) {
this.$scope = $scope;
this.state = {
endpointTypes: [],
};
@ -32,9 +33,11 @@ export class EditEdgeStackFormController {
}
onChangeGroups(groups) {
this.model.EdgeGroups = groups;
return this.$scope.$evalAsync(() => {
this.model.EdgeGroups = groups;
this.checkEndpointTypes(groups);
this.checkEndpointTypes(groups);
});
}
isFormValid() {