mirror of https://github.com/portainer/portainer
refactor(edge-compute): enforce es6 good practices (#3961)
* refactor(edge-groups): use es6 imports * refactor(edge-jobs): es6 imports * refactor(edge-stacks): use es6 imports * refactor(edge-compute): use es6 imports in components * refactor(edge-compute): use named importspull/4015/head
parent
af6bea5acc
commit
42aa8ceb00
|
@ -1,6 +1,6 @@
|
|||
import angular from 'angular';
|
||||
|
||||
class AssociatedEndpointsDatatableController {
|
||||
export class AssociatedEndpointsDatatableController {
|
||||
constructor($scope, $controller, DatatableService, PaginationService) {
|
||||
this.extendGenericController($controller, $scope);
|
||||
this.DatatableService = DatatableService;
|
||||
|
@ -98,6 +98,3 @@ class AssociatedEndpointsDatatableController {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('AssociatedEndpointsDatatableController', AssociatedEndpointsDatatableController);
|
||||
export default AssociatedEndpointsDatatableController;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { AssociatedEndpointsDatatableController } from './associatedEndpointsDatatableController';
|
||||
|
||||
angular.module('portainer.edge').component('associatedEndpointsDatatable', {
|
||||
templateUrl: './associatedEndpointsDatatable.html',
|
||||
controller: 'AssociatedEndpointsDatatableController',
|
||||
controller: AssociatedEndpointsDatatableController,
|
||||
bindings: {
|
||||
titleText: '@',
|
||||
titleIcon: '@',
|
|
@ -1,5 +1,7 @@
|
|||
import angular from 'angular';
|
||||
|
||||
angular.module('portainer.edge').component('edgeGroupsSelector', {
|
||||
templateUrl: './edge-groups-selector.html',
|
||||
templateUrl: './edgeGroupsSelector.html',
|
||||
bindings: {
|
||||
model: '=',
|
||||
items: '<',
|
|
@ -1,8 +1,7 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
import moment from 'moment';
|
||||
|
||||
class EdgeJobFormController {
|
||||
export class EdgeJobFormController {
|
||||
/* @ngInject */
|
||||
constructor() {
|
||||
this.state = {
|
||||
|
@ -102,6 +101,3 @@ function datetimeToCron(datetime) {
|
|||
var date = moment(datetime);
|
||||
return [date.minutes(), date.hours(), date.date(), date.month() + 1, '*'].join(' ');
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeJobFormController', EdgeJobFormController);
|
||||
export default EdgeJobFormController;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import EdgeJobFormController from './edgeJobFormController';
|
||||
import angular from 'angular';
|
||||
|
||||
import { EdgeJobFormController } from './edgeJobFormController';
|
||||
|
||||
angular.module('portainer.edge').component('edgeJobForm', {
|
||||
templateUrl: './edgeJobForm.html',
|
|
@ -1,6 +1,7 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
export default class EdgeJobResultsDatatableController {
|
||||
export class EdgeJobResultsDatatableController {
|
||||
/* @ngInject */
|
||||
constructor($controller, $scope, $state) {
|
||||
this.$state = $state;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import EdgeJobResultsDatatableController from './edgeJobResultsDatatableController';
|
||||
|
||||
import { EdgeJobResultsDatatableController } from './edgeJobResultsDatatableController';
|
||||
import './edgeJobResultsDatatable.css';
|
||||
|
||||
angular.module('portainer.edge').component('edgeJobResultsDatatable', {
|
|
@ -1,6 +1,6 @@
|
|||
import angular from 'angular';
|
||||
|
||||
class EdgeStackEndpointsDatatableController {
|
||||
export class EdgeStackEndpointsDatatableController {
|
||||
constructor($async, $scope, $controller, DatatableService, PaginationService, Notifications) {
|
||||
this.extendGenericController($controller, $scope);
|
||||
this.DatatableService = DatatableService;
|
||||
|
@ -106,6 +106,3 @@ class EdgeStackEndpointsDatatableController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeStackEndpointsDatatableController', EdgeStackEndpointsDatatableController);
|
||||
export default EdgeStackEndpointsDatatableController;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EdgeStackEndpointsDatatableController } from './edgeStackEndpointsDatatableController';
|
||||
|
||||
angular.module('portainer.edge').component('edgeStackEndpointsDatatable', {
|
||||
templateUrl: './edgeStackEndpointsDatatable.html',
|
||||
controller: 'EdgeStackEndpointsDatatableController',
|
||||
controller: EdgeStackEndpointsDatatableController,
|
||||
bindings: {
|
||||
titleText: '@',
|
||||
titleIcon: '@',
|
|
@ -1,12 +1,10 @@
|
|||
import angular from 'angular';
|
||||
|
||||
const statusMap = {
|
||||
1: 'ok',
|
||||
2: 'error',
|
||||
3: 'acknowledged',
|
||||
};
|
||||
|
||||
class EdgeStackStatusController {
|
||||
export class EdgeStackStatusController {
|
||||
$onChanges({ stackStatus }) {
|
||||
if (!stackStatus || !stackStatus.currentValue) {
|
||||
return;
|
||||
|
@ -20,6 +18,3 @@ class EdgeStackStatusController {
|
|||
this.status = aggregateStatus;
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeStackStatusController', EdgeStackStatusController);
|
||||
export default EdgeStackStatusController;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EdgeStackStatusController } from './edgeStackStatusController';
|
||||
import './edgeStackStatus.css';
|
||||
|
||||
angular.module('portainer.edge').component('edgeStackStatus', {
|
||||
templateUrl: './edgeStackStatus.html',
|
||||
controller: 'EdgeStackStatusController',
|
||||
controller: EdgeStackStatusController,
|
||||
bindings: {
|
||||
stackStatus: '<',
|
||||
},
|
|
@ -1,3 +1,5 @@
|
|||
import angular from 'angular';
|
||||
|
||||
angular.module('portainer.edge').component('edgeStacksDatatable', {
|
||||
templateUrl: './edgeStacksDatatable.html',
|
||||
controller: 'GenericDatatableController',
|
|
@ -1,6 +1,4 @@
|
|||
import angular from 'angular';
|
||||
|
||||
class EditEdgeStackFormController {
|
||||
export class EditEdgeStackFormController {
|
||||
constructor() {
|
||||
this.editorUpdate = this.editorUpdate.bind(this);
|
||||
}
|
||||
|
@ -9,6 +7,3 @@ class EditEdgeStackFormController {
|
|||
this.model.StackFileContent = cm.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EditEdgeStackFormController', EditEdgeStackFormController);
|
||||
export default EditEdgeStackFormController;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EditEdgeStackFormController } from './editEdgeStackFormController';
|
||||
|
||||
angular.module('portainer.edge').component('editEdgeStackForm', {
|
||||
templateUrl: './editEdgeStackForm.html',
|
||||
controller: 'EditEdgeStackFormController',
|
||||
controller: EditEdgeStackFormController,
|
||||
bindings: {
|
||||
model: '<',
|
||||
actionInProgress: '<',
|
|
@ -1,7 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
class EdgeGroupFormController {
|
||||
export class EdgeGroupFormController {
|
||||
/* @ngInject */
|
||||
constructor(EndpointService, $async, $scope) {
|
||||
this.EndpointService = EndpointService;
|
||||
|
@ -59,6 +58,3 @@ class EdgeGroupFormController {
|
|||
this.endpoints.state.totalCount = totalCount;
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeGroupFormController', EdgeGroupFormController);
|
||||
export default EdgeGroupFormController;
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EdgeGroupFormController } from './groupFormController';
|
||||
|
||||
angular.module('portainer.edge').component('edgeGroupForm', {
|
||||
templateUrl: './groupForm.html',
|
||||
controller: 'EdgeGroupFormController',
|
||||
controller: EdgeGroupFormController,
|
||||
bindings: {
|
||||
model: '<',
|
||||
groups: '<',
|
|
@ -1,6 +1,6 @@
|
|||
import angular from 'angular';
|
||||
|
||||
class EdgeGroupsDatatableController {
|
||||
export class EdgeGroupsDatatableController {
|
||||
constructor($scope, $controller) {
|
||||
const allowSelection = this.allowSelection;
|
||||
angular.extend(this, $controller('GenericDatatableController', { $scope: $scope }));
|
||||
|
@ -14,6 +14,3 @@ class EdgeGroupsDatatableController {
|
|||
return !item.HasEdgeStack;
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeGroupsDatatableController', EdgeGroupsDatatableController);
|
||||
export default EdgeGroupsDatatableController;
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EdgeGroupsDatatableController } from './groupsDatatableController';
|
||||
|
||||
angular.module('portainer.edge').component('edgeGroupsDatatable', {
|
||||
templateUrl: './groupsDatatable.html',
|
||||
controller: 'EdgeGroupsDatatableController',
|
||||
controller: EdgeGroupsDatatableController,
|
||||
bindings: {
|
||||
dataset: '<',
|
||||
titleIcon: '@',
|
|
@ -1,6 +1,4 @@
|
|||
import angular from 'angular';
|
||||
|
||||
class CreateEdgeGroupController {
|
||||
export class CreateEdgeGroupController {
|
||||
/* @ngInject */
|
||||
constructor(EdgeGroupService, GroupService, TagService, Notifications, $state, $async) {
|
||||
this.EdgeGroupService = EdgeGroupService;
|
||||
|
@ -51,6 +49,3 @@ class CreateEdgeGroupController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('CreateEdgeGroupController', CreateEdgeGroupController);
|
||||
export default CreateEdgeGroupController;
|
|
@ -0,0 +1,8 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { CreateEdgeGroupController } from './createEdgeGroupViewController';
|
||||
|
||||
angular.module('portainer.edge').component('createEdgeGroupView', {
|
||||
templateUrl: './createEdgeGroupView.html',
|
||||
controller: CreateEdgeGroupController,
|
||||
});
|
|
@ -1,7 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
class EdgeGroupsController {
|
||||
export class EdgeGroupsController {
|
||||
/* @ngInject */
|
||||
constructor($async, $state, EdgeGroupService, Notifications) {
|
||||
this.$async = $async;
|
||||
|
@ -41,5 +40,3 @@ class EdgeGroupsController {
|
|||
this.$state.reload();
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeGroupsController', EdgeGroupsController);
|
|
@ -1,6 +1,8 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EdgeGroupsController } from './edgeGroupsViewController';
|
||||
|
||||
angular.module('portainer.edge').component('edgeGroupsView', {
|
||||
templateUrl: './edgeGroupsView.html',
|
||||
controller: 'EdgeGroupsController',
|
||||
controller: EdgeGroupsController,
|
||||
});
|
|
@ -1,6 +1,4 @@
|
|||
import angular from 'angular';
|
||||
|
||||
class EditEdgeGroupController {
|
||||
export class EditEdgeGroupController {
|
||||
/* @ngInject */
|
||||
constructor(EdgeGroupService, GroupService, TagService, Notifications, $state, $async, EndpointService, EndpointHelper) {
|
||||
this.EdgeGroupService = EdgeGroupService;
|
||||
|
@ -51,6 +49,3 @@ class EditEdgeGroupController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EditEdgeGroupController', EditEdgeGroupController);
|
||||
export default EditEdgeGroupController;
|
|
@ -0,0 +1,8 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EditEdgeGroupController } from './editEdgeGroupViewController';
|
||||
|
||||
angular.module('portainer.edge').component('editEdgeGroupView', {
|
||||
templateUrl: './editEdgeGroupView.html',
|
||||
controller: EditEdgeGroupController,
|
||||
});
|
|
@ -1,6 +1,4 @@
|
|||
import angular from 'angular';
|
||||
|
||||
class CreateEdgeJobController {
|
||||
export class CreateEdgeJobViewController {
|
||||
constructor($async, $q, $state, EdgeJobService, GroupService, Notifications, TagService) {
|
||||
this.state = {
|
||||
actionInProgress: false,
|
||||
|
@ -63,6 +61,3 @@ class CreateEdgeJobController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('CreateEdgeJobController', CreateEdgeJobController);
|
||||
export default CreateEdgeJobController;
|
|
@ -1,5 +1,5 @@
|
|||
import angular from 'angular';
|
||||
import CreateEdgeJobViewController from './createEdgeJobViewController';
|
||||
import { CreateEdgeJobViewController } from './createEdgeJobViewController';
|
||||
|
||||
angular.module('portainer.edge').component('createEdgeJobView', {
|
||||
templateUrl: './createEdgeJobView.html',
|
|
@ -1,7 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
class EdgeJobController {
|
||||
export class EdgeJobController {
|
||||
constructor($async, $q, $state, EdgeJobService, EndpointService, FileSaver, GroupService, HostBrowserService, Notifications, TagService) {
|
||||
this.state = {
|
||||
actionInProgress: false,
|
||||
|
@ -154,6 +153,3 @@ class EdgeJobController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeJobController', EdgeJobController);
|
||||
export default EdgeJobController;
|
|
@ -1,5 +1,5 @@
|
|||
import angular from 'angular';
|
||||
import EdgeJobController from './edgeJobController';
|
||||
import { EdgeJobController } from './edgeJobController';
|
||||
|
||||
angular.module('portainer.edge').component('edgeJobView', {
|
||||
templateUrl: './edgeJob.html',
|
|
@ -1,7 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
class EdgeJobsController {
|
||||
export class EdgeJobsViewController {
|
||||
constructor($async, $state, EdgeJobService, ModalService, Notifications) {
|
||||
this.$async = $async;
|
||||
this.$state = $state;
|
||||
|
@ -51,6 +50,3 @@ class EdgeJobsController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeJobsController', EdgeJobsController);
|
||||
export default EdgeJobsController;
|
|
@ -1,5 +1,5 @@
|
|||
import angular from 'angular';
|
||||
import EdgeJobsViewController from './edgeJobsViewController';
|
||||
import { EdgeJobsViewController } from './edgeJobsViewController';
|
||||
|
||||
angular.module('portainer.edge').component('edgeJobsView', {
|
||||
templateUrl: './edgeJobsView.html',
|
|
@ -1,4 +0,0 @@
|
|||
angular.module('portainer.edge').component('createEdgeStackView', {
|
||||
templateUrl: './createEdgeStackView.html',
|
||||
controller: 'CreateEdgeStackViewController',
|
||||
});
|
|
@ -1,7 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
class CreateEdgeStackViewController {
|
||||
export class CreateEdgeStackViewController {
|
||||
constructor($state, EdgeStackService, EdgeGroupService, EdgeTemplateService, Notifications, FormHelper, $async) {
|
||||
Object.assign(this, { $state, EdgeStackService, EdgeGroupService, EdgeTemplateService, Notifications, FormHelper, $async });
|
||||
|
||||
|
@ -151,6 +150,3 @@ class CreateEdgeStackViewController {
|
|||
this.formValues.StackFileContent = cm.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('CreateEdgeStackViewController', CreateEdgeStackViewController);
|
||||
export default CreateEdgeStackViewController;
|
|
@ -0,0 +1,8 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { CreateEdgeStackViewController } from './createEdgeStackViewController';
|
||||
|
||||
angular.module('portainer.edge').component('createEdgeStackView', {
|
||||
templateUrl: './createEdgeStackView.html',
|
||||
controller: CreateEdgeStackViewController,
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
angular.module('portainer.edge').component('edgeStacksView', {
|
||||
templateUrl: './edgeStacksView.html',
|
||||
controller: 'EdgeStacksViewController',
|
||||
});
|
|
@ -1,7 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
class EdgeStacksViewController {
|
||||
export class EdgeStacksViewController {
|
||||
constructor($state, Notifications, EdgeStackService, $scope, $async) {
|
||||
this.$state = $state;
|
||||
this.Notifications = Notifications;
|
||||
|
@ -47,6 +46,3 @@ class EdgeStacksViewController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EdgeStacksViewController', EdgeStacksViewController);
|
||||
export default EdgeStacksViewController;
|
|
@ -0,0 +1,8 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EdgeStacksViewController } from './edgeStacksViewController';
|
||||
|
||||
angular.module('portainer.edge').component('edgeStacksView', {
|
||||
templateUrl: './edgeStacksView.html',
|
||||
controller: EdgeStacksViewController,
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
angular.module('portainer.edge').component('editEdgeStackView', {
|
||||
templateUrl: './editEdgeStackView.html',
|
||||
controller: 'EditEdgeStackViewController',
|
||||
});
|
|
@ -1,7 +1,6 @@
|
|||
import angular from 'angular';
|
||||
import _ from 'lodash-es';
|
||||
|
||||
class EditEdgeStackViewController {
|
||||
export class EditEdgeStackViewController {
|
||||
constructor($async, $state, EdgeGroupService, EdgeStackService, EndpointService, Notifications) {
|
||||
this.$async = $async;
|
||||
this.$state = $state;
|
||||
|
@ -91,6 +90,3 @@ class EditEdgeStackViewController {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
angular.module('portainer.edge').controller('EditEdgeStackViewController', EditEdgeStackViewController);
|
||||
export default EditEdgeStackViewController;
|
|
@ -0,0 +1,8 @@
|
|||
import angular from 'angular';
|
||||
|
||||
import { EditEdgeStackViewController } from './editEdgeStackViewController';
|
||||
|
||||
angular.module('portainer.edge').component('editEdgeStackView', {
|
||||
templateUrl: './editEdgeStackView.html',
|
||||
controller: EditEdgeStackViewController,
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
angular.module('portainer.edge').component('createEdgeGroupView', {
|
||||
templateUrl: './createEdgeGroupView.html',
|
||||
controller: 'CreateEdgeGroupController',
|
||||
});
|
|
@ -1,4 +0,0 @@
|
|||
angular.module('portainer.edge').component('editEdgeGroupView', {
|
||||
templateUrl: './editEdgeGroupView.html',
|
||||
controller: 'EditEdgeGroupController',
|
||||
});
|
Loading…
Reference in New Issue