refactor(storidge): webpack migration

storidge-standalone
baron_l 2019-03-25 23:12:06 +01:00
parent f9bfb0fc26
commit fa3005e9df
16 changed files with 31 additions and 17 deletions

View File

@ -37,7 +37,7 @@ angular.module('extension.storidge', [])
url: '/drives', url: '/drives',
views: { views: {
'content@': { 'content@': {
templateUrl: 'app/extensions/storidge/views/drives/drives.html', templateUrl: './views/drives/drives.html',
controller: 'StoridgeDrivesController' controller: 'StoridgeDrivesController'
} }
} }
@ -48,7 +48,7 @@ angular.module('extension.storidge', [])
url: '/:id', url: '/:id',
views: { views: {
'content@': { 'content@': {
templateUrl: 'app/extensions/storidge/views/drives/inspect/drive.html', templateUrl: './views/drives/inspect/drive.html',
controller: 'StoridgeDriveController' controller: 'StoridgeDriveController'
} }
} }
@ -59,7 +59,7 @@ angular.module('extension.storidge', [])
url: '/:snapshotId', url: '/:snapshotId',
views: { views: {
'content@': { 'content@': {
templateUrl: 'app/extensions/storidge/views/snapshots/inspect/snapshot.html', templateUrl: './views/snapshots/inspect/snapshot.html',
controller: 'StoridgeSnapshotController' controller: 'StoridgeSnapshotController'
} }
} }
@ -95,7 +95,7 @@ angular.module('extension.storidge', [])
url: '/:name', url: '/:name',
views: { views: {
'content@': { 'content@': {
templateUrl: 'app/extensions/storidge/views/nodes/inspect/node.html', templateUrl: './views/nodes/inspect/node.html',
controller: 'StoridgeNodeController' controller: 'StoridgeNodeController'
} }
} }

View File

@ -1,5 +1,5 @@
angular.module('extension.storidge').component('storidgeDrivesDatatable', { angular.module('extension.storidge').component('storidgeDrivesDatatable', {
templateUrl: 'app/extensions/storidge/components/drives-datatable/storidgeDrivesDatatable.html', templateUrl: './storidgeDrivesDatatable.html',
controller: 'StoridgeDrivesDatatableController', controller: 'StoridgeDrivesDatatableController',
bindings: { bindings: {
titleText: '@', titleText: '@',

View File

@ -1,5 +1,5 @@
angular.module('portainer.docker').component('storidgeSnapshotCreation', { angular.module('portainer.docker').component('storidgeSnapshotCreation', {
templateUrl: 'app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.html', templateUrl: './storidgeSnapshotCreation.html',
controller: 'StoridgeSnapshotCreationController', controller: 'StoridgeSnapshotCreationController',
bindings: { bindings: {
volumeId: '<' volumeId: '<'

View File

@ -1,6 +1,6 @@
angular.module('portainer.docker') angular.module('portainer.docker')
.controller('StoridgeSnapshotCreationController', ['StoridgeSnapshotService', 'Notifications', .controller('StoridgeSnapshotCreationController', ['StoridgeSnapshotService', 'Notifications', '$state',
function (StoridgeSnapshotService, Notifications) { function (StoridgeSnapshotService, Notifications, $state) {
var ctrl = this; var ctrl = this;
this.formValues = {}; this.formValues = {};

View File

@ -1,5 +1,5 @@
angular.module('extension.storidge').component('storidgeSnapshotsDatatable', { angular.module('extension.storidge').component('storidgeSnapshotsDatatable', {
templateUrl: 'app/extensions/storidge/components/snapshots-datatable/storidgeSnapshotsDatatable.html', templateUrl: './storidgeSnapshotsDatatable.html',
controller: 'StoridgeSnapshotsDatatableController', controller: 'StoridgeSnapshotsDatatableController',
bindings: { bindings: {
titleText: '@', titleText: '@',

View File

@ -1,5 +1,5 @@
angular.module('portainer.docker').component('volumeStoridgeInfo', { angular.module('portainer.docker').component('volumeStoridgeInfo', {
templateUrl: 'app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfo.html', templateUrl: './volumeStoridgeInfo.html',
controller: 'VolumeStoridgeInfoController', controller: 'VolumeStoridgeInfoController',
bindings: { bindings: {
volume: '<' volume: '<'

View File

@ -1,3 +1,11 @@
import _ from 'lodash-es';
function includeString(text, values) {
return values.some(function(val){
return text.indexOf(val) !== -1;
});
}
angular.module('extension.storidge') angular.module('extension.storidge')
.filter('drivestatusbadge', function () { .filter('drivestatusbadge', function () {
'use strict'; 'use strict';

View File

@ -1,4 +1,4 @@
function StoridgeDriveModel(data) { export function StoridgeDriveModel(data) {
this.Id = data.driveid; this.Id = data.driveid;
this.Node = data.node; this.Node = data.node;
this.Use = data.use; this.Use = data.use;

View File

@ -5,7 +5,7 @@ export function StoridgeNodeModel(name, data) {
this.Status = data.status; this.Status = data.status;
} }
function StoridgeNodeDetailedModel(name, properties) { export function StoridgeNodeDetailedModel(name, properties) {
this.Name = name; this.Name = name;
this.Domain = properties.domain; this.Domain = properties.domain;
this.DomainID = properties.domainID; this.DomainID = properties.domainID;

View File

@ -1,4 +1,4 @@
function StoridgeSnapshotModel(data) { export function StoridgeSnapshotModel(data) {
this.Id = data.identifier; this.Id = data.identifier;
this.Date = data.date; this.Date = data.date;
this.Description = data.description; this.Description = data.description;

View File

@ -1,4 +1,4 @@
function StoridgeVolumeModel(data) { export function StoridgeVolumeModel(data) {
this.Allocated = data['alloc percent']; this.Allocated = data['alloc percent'];
this.Capacity = data.capacity; this.Capacity = data.capacity;
this.Directory = data.directory; this.Directory = data.directory;
@ -28,7 +28,7 @@ function StoridgeVolumeModel(data) {
this.Filesystem = data.filesystem; this.Filesystem = data.filesystem;
} }
function StoridgeVolumeUpdateModel(data) { export function StoridgeVolumeUpdateModel(data) {
this.name = data.Name; this.name = data.Name;
this.opts = { this.opts = {
node: data.Node, node: data.Node,

View File

@ -1,3 +1,5 @@
import { StoridgeDriveModel } from '../models/drive';
angular.module('extension.storidge') angular.module('extension.storidge')
.factory('StoridgeDriveService', ['$q', 'Storidge', function StoridgeDriveServiceFactory($q, Storidge) { .factory('StoridgeDriveService', ['$q', 'Storidge', function StoridgeDriveServiceFactory($q, Storidge) {
'use strict'; 'use strict';

View File

@ -1,4 +1,4 @@
import { StoridgeNodeModel } from '../models/node'; import { StoridgeNodeModel, StoridgeNodeDetailedModel } from '../models/node';
angular.module('extension.storidge') angular.module('extension.storidge')
.factory('StoridgeNodeService', ['$q', 'Storidge', function StoridgeNodeServiceFactory($q, Storidge) { .factory('StoridgeNodeService', ['$q', 'Storidge', function StoridgeNodeServiceFactory($q, Storidge) {

View File

@ -1,3 +1,5 @@
import { StoridgeSnapshotModel } from '../models/snapshot'
angular.module('extension.storidge') angular.module('extension.storidge')
.factory('StoridgeSnapshotService', ['$q', 'Storidge', function StoridgeSnapshotServiceFactory($q, Storidge) { .factory('StoridgeSnapshotService', ['$q', 'Storidge', function StoridgeSnapshotServiceFactory($q, Storidge) {
'use strict'; 'use strict';

View File

@ -1,3 +1,5 @@
import { StoridgeVolumeModel, StoridgeVolumeUpdateModel } from '../models/volume';
angular.module('extension.storidge') angular.module('extension.storidge')
.factory('StoridgeVolumeService', ['$q', 'Storidge', function StoridgeVolumeServiceFactory($q, Storidge) { .factory('StoridgeVolumeService', ['$q', 'Storidge', function StoridgeVolumeServiceFactory($q, Storidge) {
'use strict'; 'use strict';

View File

@ -64,7 +64,7 @@ function ($q, $scope, $state, Notifications, ModalService, StoridgeDriveService)
.then(function sucess() { .then(function sucess() {
$state.reload(); $state.reload();
}) })
.catch(function error() { .catch(function error(err) {
Notifications.error('Failure', err, 'Unable to scan drives'); Notifications.error('Failure', err, 'Unable to scan drives');
}); });
}; };