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

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 imports
This commit is contained in:
Chaim Lev-Ari 2020-07-06 10:35:13 +03:00 committed by GitHub
parent af6bea5acc
commit 42aa8ceb00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 99 additions and 115 deletions

View file

@ -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;

View file

@ -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: '@',

View file

@ -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: '<',

View file

@ -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;

View file

@ -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',

View file

@ -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;

View file

@ -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', {

View file

@ -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;

View file

@ -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: '@',

View file

@ -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;

View file

@ -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: '<',
},

View file

@ -1,3 +1,5 @@
import angular from 'angular';
angular.module('portainer.edge').component('edgeStacksDatatable', {
templateUrl: './edgeStacksDatatable.html',
controller: 'GenericDatatableController',

View file

@ -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;

View file

@ -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: '<',

View file

@ -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;

View file

@ -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: '<',

View file

@ -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;

View file

@ -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: '@',