1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-05 22:05:23 +02:00

refactor(groups): migrate groups selectors to react [EE-3842] (#8936)

This commit is contained in:
Chaim Lev-Ari 2023-06-22 21:11:10 +07:00 committed by GitHub
parent 2018529add
commit e91b4f5c83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 543 additions and 627 deletions

View file

@ -173,14 +173,7 @@
<div class="col-sm-12 form-section-title"> Target environments </div>
<!-- node-selection -->
<associated-endpoints-selector
endpoint-ids="$ctrl.model.Endpoints"
tags="$ctrl.tags"
groups="$ctrl.groups"
has-backend-pagination="true"
on-associate="($ctrl.associateEndpoint)"
on-dissociate="($ctrl.dissociateEndpoint)"
></associated-endpoints-selector>
<associated-edge-environments-selector value="$ctrl.model.Endpoints" on-change="($ctrl.onChangeEnvironments)"></associated-edge-environments-selector>
<!-- !node-selection -->
<!-- actions -->
<div class="col-sm-12 form-section-title"> Actions </div>

View file

@ -1,4 +1,3 @@
import _ from 'lodash-es';
import moment from 'moment';
import { editor, upload } from '@@/BoxSelector/common-options/build-methods';
@ -45,8 +44,7 @@ export class EdgeJobFormController {
this.action = this.action.bind(this);
this.editorUpdate = this.editorUpdate.bind(this);
this.associateEndpoint = this.associateEndpoint.bind(this);
this.dissociateEndpoint = this.dissociateEndpoint.bind(this);
this.onChangeEnvironments = this.onChangeEnvironments.bind(this);
this.onChangeGroups = this.onChangeGroups.bind(this);
this.onChange = this.onChange.bind(this);
this.onCronMethodChange = this.onCronMethodChange.bind(this);
@ -115,14 +113,10 @@ export class EdgeJobFormController {
this.isEditorDirty = true;
}
associateEndpoint(endpoint) {
if (!_.includes(this.model.Endpoints, endpoint.Id)) {
this.model.Endpoints = [...this.model.Endpoints, endpoint.Id];
}
}
dissociateEndpoint(endpoint) {
this.model.Endpoints = _.filter(this.model.Endpoints, (id) => id !== endpoint.Id);
onChangeEnvironments(value) {
return this.$scope.$evalAsync(() => {
this.model.Endpoints = value;
});
}
$onInit() {