mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
* refactor(edge/groups): load edge groups in selector fix(edge/stacks): remove double groups title * feat(edge): supply meta fields to edge script [EE-5043] * feat(edge): auto assign aeec envs to groups and tags [EE-5043] fix [EE-5043] fix(envs): fix global key test * fix(edge/groups): save group type * refactor(edge/devices): move loading of devices to table * refactor(tags): select paramter for query * feat(edge/devices): show meta fields * refactor(home): simplify filter * feat(edge/devices): filter by meta fields * refactor(edge/devices): break filter and loading hook
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
export class EditEdgeGroupController {
|
|
/* @ngInject */
|
|
constructor(EdgeGroupService, GroupService, Notifications, $state, $async) {
|
|
this.EdgeGroupService = EdgeGroupService;
|
|
this.GroupService = GroupService;
|
|
this.Notifications = Notifications;
|
|
this.$state = $state;
|
|
this.$async = $async;
|
|
|
|
this.state = {
|
|
actionInProgress: false,
|
|
loaded: false,
|
|
};
|
|
|
|
this.updateGroup = this.updateGroup.bind(this);
|
|
}
|
|
|
|
async $onInit() {
|
|
const [endpointGroups, group] = await Promise.all([this.GroupService.groups(), this.EdgeGroupService.group(this.$state.params.groupId)]);
|
|
|
|
if (!group) {
|
|
this.Notifications.error('Failed to find edge group', {});
|
|
this.$state.go('edge.groups');
|
|
}
|
|
this.endpointGroups = endpointGroups;
|
|
this.model = group;
|
|
this.state.loaded = true;
|
|
}
|
|
|
|
updateGroup(group) {
|
|
return this.$async(async () => {
|
|
this.state.actionInProgress = true;
|
|
try {
|
|
await this.EdgeGroupService.update(group);
|
|
this.Notifications.success('Success', 'Edge group successfully updated');
|
|
this.$state.go('edge.groups');
|
|
} catch (err) {
|
|
this.Notifications.error('Failure', err, 'Unable to update edge group');
|
|
} finally {
|
|
this.state.actionInProgress = false;
|
|
}
|
|
});
|
|
}
|
|
}
|