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

refactor(edge/groups): migrate view to react [EE-4683] (#10592)

This commit is contained in:
Chaim Lev-Ari 2023-11-14 12:57:27 +02:00 committed by GitHub
parent 1f2f4525e3
commit 99b39da03d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 199 additions and 228 deletions

View file

@ -1,7 +0,0 @@
<page-header title="'Edge Groups'" breadcrumbs="['Edge Groups']" reload="true"> </page-header>
<div class="row">
<div class="col-sm-12">
<edge-groups-datatable title-icon="dice-4" table-key="EdgeGroups" order-by="Name" dataset="$ctrl.items" remove-action="$ctrl.removeAction"></edge-groups-datatable>
</div>
</div>

View file

@ -1,47 +0,0 @@
import _ from 'lodash-es';
import { confirmDelete } from '@@/modals/confirm';
export class EdgeGroupsController {
/* @ngInject */
constructor($async, $state, EdgeGroupService, Notifications) {
this.$async = $async;
this.$state = $state;
this.EdgeGroupService = EdgeGroupService;
this.Notifications = Notifications;
this.removeAction = this.removeAction.bind(this);
this.removeActionAsync = this.removeActionAsync.bind(this);
}
async $onInit() {
try {
this.items = await this.EdgeGroupService.groups();
} catch (err) {
this.items = [];
this.Notifications.error('Failure', err, 'Unable to retrieve Edge groups');
}
}
removeAction(selectedItems) {
return this.$async(this.removeActionAsync, selectedItems);
}
async removeActionAsync(selectedItems) {
if (!(await confirmDelete('Do you want to remove the selected Edge Group(s)?'))) {
return;
}
for (let item of selectedItems) {
try {
await this.EdgeGroupService.remove(item.Id);
this.Notifications.success('Edge Group successfully removed', item.Name);
_.remove(this.items, item);
} catch (err) {
this.Notifications.error('Failure', err, 'Unable to remove Edge Group');
}
}
this.$state.reload();
}
}

View file

@ -1,8 +0,0 @@
import angular from 'angular';
import { EdgeGroupsController } from './edgeGroupsViewController';
angular.module('portainer.edge').component('edgeGroupsView', {
templateUrl: './edgeGroupsView.html',
controller: EdgeGroupsController,
});