diff --git a/app/docker/views/volumes/edit/volumeController.js b/app/docker/views/volumes/edit/volumeController.js index 734dc332b..270090a97 100644 --- a/app/docker/views/volumes/edit/volumeController.js +++ b/app/docker/views/volumes/edit/volumeController.js @@ -22,7 +22,7 @@ function ($scope, $state, $transition$, $q, ModalService, VolumeService, Contain StoridgeSnapshotService.remove(item.Id) .then(function success() { Notifications.success('Snapshot successfully removed', item.Id); - var index = $scope.containerGroups.indexOf(item); + var index = $scope.storidgeSnapshots.indexOf(item); $scope.storidgeSnapshots.splice(index, 1); }) .catch(function error(err) { diff --git a/app/extensions/storidge/components/nodes-datatable/storidgeNodesDatatable.html b/app/extensions/storidge/components/nodes-datatable/storidgeNodesDatatable.html index 0f1d1f077..4a8857844 100644 --- a/app/extensions/storidge/components/nodes-datatable/storidgeNodesDatatable.html +++ b/app/extensions/storidge/components/nodes-datatable/storidgeNodesDatatable.html @@ -71,7 +71,7 @@ {{ item.IP }} {{ item.Role }} - + {{ item.Status }} diff --git a/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.html b/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.html index ea4fd544c..11f6b570c 100644 --- a/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.html +++ b/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreation.html @@ -4,9 +4,9 @@
- +
- +
diff --git a/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreationController.js b/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreationController.js index f8d82c682..c47f89f21 100644 --- a/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreationController.js +++ b/app/extensions/storidge/components/snapshot-creation/storidgeSnapshotCreationController.js @@ -10,7 +10,7 @@ function (StoridgeSnapshotService, Notifications, $state) { this.createSnapshot = function () { ctrl.state.actionInProgress = true; - StoridgeSnapshotService.create(ctrl.volumeId, ctrl.formValues.Comment) + StoridgeSnapshotService.create(ctrl.volumeId, ctrl.formValues.Description) .then(function success() { Notifications.success('Success', 'Snapshot successfully created'); $state.reload(); diff --git a/app/extensions/storidge/components/snapshots-datatable/storidgeSnapshotsDatatable.html b/app/extensions/storidge/components/snapshots-datatable/storidgeSnapshotsDatatable.html index 2134b7192..bd652567a 100644 --- a/app/extensions/storidge/components/snapshots-datatable/storidgeSnapshotsDatatable.html +++ b/app/extensions/storidge/components/snapshots-datatable/storidgeSnapshotsDatatable.html @@ -8,7 +8,7 @@
@@ -54,7 +54,7 @@ - + {{ item.Id }} {{ item.Date }} {{ item.Description }} diff --git a/app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfo.html b/app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfo.html index 3fccb9174..ad9162965 100644 --- a/app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfo.html +++ b/app/extensions/storidge/components/volume-storidge-info/volumeStoridgeInfo.html @@ -96,7 +96,7 @@ Snapshot Interval - {{ $ctrl.volume.SnapshotInterval}} + {{ $ctrl.volume.SnapshotInterval}} minute(s) Max Snapshots diff --git a/app/extensions/storidge/filters/filters.js b/app/extensions/storidge/filters/filters.js index a20d7948a..22100b84d 100644 --- a/app/extensions/storidge/filters/filters.js +++ b/app/extensions/storidge/filters/filters.js @@ -21,12 +21,14 @@ angular.module('extension.storidge') return 'info'; }; }) -.filter('nodeStatusBadge', function () { +.filter('storidgeNodeStatusBadge', function () { 'use strict'; return function (text) { var status = text ? _.toLower(text) : ''; - if (status === 'maintenance') { + if (status === 'cordoned') { return 'orange-icon'; + } else if (status === 'alert') { + return 'red-icon' } return 'green-icon'; }; diff --git a/app/extensions/storidge/models/profile.js b/app/extensions/storidge/models/profile.js index dd49ff9e4..173bdd08f 100644 --- a/app/extensions/storidge/models/profile.js +++ b/app/extensions/storidge/models/profile.js @@ -10,8 +10,8 @@ export function StoridgeProfileDefaultModel() { this.MaxBandwidth = 100; this.Filesystem = 'btrfs'; this.SnapshotEnabled = false; - this.SnapshotInterval = 0; - this.SnapshotMax = 0; + this.SnapshotInterval = 1440; + this.SnapshotMax = 1; this.EncryptionEnabled = false; this.InterfaceType = 'nfs'; this.InterfaceDriver = ''; diff --git a/app/extensions/storidge/services/snapshotService.js b/app/extensions/storidge/services/snapshotService.js index 605e932f5..2f6cbf448 100644 --- a/app/extensions/storidge/services/snapshotService.js +++ b/app/extensions/storidge/services/snapshotService.js @@ -16,7 +16,13 @@ angular.module('extension.storidge') Storidge.querySnapshots({id: volumeId}).$promise .then(function success(data) { var snapshotsData = data.snapshots; - var snapshots = snapshotsData.map(function (snapshot) { + let snapshotsArray = []; + for (const key in snapshotsData) { + if (snapshotsData.hasOwnProperty(key)) { + snapshotsArray.push(snapshotsData[key]); + } + } + var snapshots = snapshotsArray.map(function (snapshot) { return new StoridgeSnapshotModel(snapshot); }); deferred.resolve(snapshots); @@ -43,9 +49,9 @@ angular.module('extension.storidge') return deferred.promise; } - function create(volumeId, comment) { + function create(volumeId, description) { var deferred = $q.defer(); - Storidge.createSnapshot({id: volumeId, comment: comment}).$promise + Storidge.createSnapshot({id: volumeId, description: description}).$promise .then(function success(data) { deferred.resolve(data); }) diff --git a/app/extensions/storidge/views/drives/drivesController.js b/app/extensions/storidge/views/drives/drivesController.js index 5d4714f10..e07f2abf5 100644 --- a/app/extensions/storidge/views/drives/drivesController.js +++ b/app/extensions/storidge/views/drives/drivesController.js @@ -19,7 +19,7 @@ function ($q, $scope, $state, Notifications, ModalService, StoridgeDriveService) return item.Status === 'faulty'; }); angular.forEach(selectedItems, function (drive) { - StoridgeDriveService.delete(drive.Id) + StoridgeDriveService.remove(drive.Id) .then(function success() { Notifications.success('Drive successfully removed', drive.Id); }) diff --git a/app/extensions/storidge/views/nodes/inspect/node.html b/app/extensions/storidge/views/nodes/inspect/node.html index 33232c289..6909c3515 100644 --- a/app/extensions/storidge/views/nodes/inspect/node.html +++ b/app/extensions/storidge/views/nodes/inspect/node.html @@ -10,15 +10,16 @@
- diff --git a/app/extensions/storidge/views/profiles/create/createProfileController.js b/app/extensions/storidge/views/profiles/create/createProfileController.js index 84901871a..73c65690c 100644 --- a/app/extensions/storidge/views/profiles/create/createProfileController.js +++ b/app/extensions/storidge/views/profiles/create/createProfileController.js @@ -52,15 +52,19 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService) { delete profile.MaxBandwidth; } - if (profile.SnapshotEnabled && $scope.state.RecurringSnapshotEnabled) { - if (!profile.SnapshotInterval) { - profile.SnapshotInterval = 1; + if (profile.SnapshotEnabled) { + if (!profile.SnapshotMax || profile.SnapshotMax <= 0) { + profile.SnapshotMax = 1; } - profile.SnapshotInterval *= 60; - } - - if (!$scope.state.RecurringSnapshotEnabled) { - profile.SnapshotInterval = 0; + if (!$scope.state.RecurringSnapshotEnabled) { + delete profile.SnapshotInterval; + } + if ($scope.state.RecurringSnapshotEnabled && (!profile.SnapshotInterval || profile.SnapshotInterval <= 0)) { + profile.SnapshotInterval = 1440; + } + } else { + delete profile.SnapshotMax; + delete profile.SnapshotInterval; } prepareLabels(profile); diff --git a/app/extensions/storidge/views/profiles/create/createprofile.html b/app/extensions/storidge/views/profiles/create/createprofile.html index 2d3ae352b..8fccb14cb 100644 --- a/app/extensions/storidge/views/profiles/create/createprofile.html +++ b/app/extensions/storidge/views/profiles/create/createprofile.html @@ -105,31 +105,49 @@
-
- - + + +
+ + +
+ +
+
-
- - +
+
+
+

+ Snapshot max (count) +

+
+
+ + +
+ +
-
+
- +
@@ -141,34 +159,14 @@
- -
- -
- -
-
- -
-
-

- Snapshot max (count) -

-
-
-
-
- - -
+ +
@@ -239,14 +237,14 @@ IOPS
-
+
-
+
@@ -284,14 +282,14 @@ Bandwidth
-
+
-
+
diff --git a/app/extensions/storidge/views/profiles/edit/profile.html b/app/extensions/storidge/views/profiles/edit/profile.html index 0391efc0e..b26cc54ec 100644 --- a/app/extensions/storidge/views/profiles/edit/profile.html +++ b/app/extensions/storidge/views/profiles/edit/profile.html @@ -98,31 +98,49 @@
-
- - + + +
+ + +
+ +
+
-
- - +
+
+
+

+ Snapshot max (count) +

+
+
+ + +
+ +
-
+
- +
@@ -134,34 +152,14 @@
- -
- -
- -
-
- -
-
-

- Snapshot max (count) -

-
-
-
-
- - -
+ +
diff --git a/app/extensions/storidge/views/profiles/edit/profileController.js b/app/extensions/storidge/views/profiles/edit/profileController.js index e6eb3a0d5..ecafae46f 100644 --- a/app/extensions/storidge/views/profiles/edit/profileController.js +++ b/app/extensions/storidge/views/profiles/edit/profileController.js @@ -45,7 +45,6 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService, M ]; $scope.update = function() { - var profile = $scope.profile; if (!$scope.state.LimitIOPS) { @@ -58,15 +57,19 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService, M delete profile.MaxBandwidth; } - if (profile.SnapshotEnabled && $scope.state.RecurringSnapshotEnabled) { - if (!profile.SnapshotInterval) { - profile.SnapshotInterval = 1; + if (profile.SnapshotEnabled) { + if (!profile.SnapshotMax || profile.SnapshotMax <= 0) { + profile.SnapshotMax = 1; } - profile.SnapshotInterval *= 60; - } - - if (!$scope.state.RecurringSnapshotEnabled) { - profile.SnapshotInterval = 0; + if (!$scope.state.RecurringSnapshotEnabled) { + delete profile.SnapshotInterval; + } + if ($scope.state.RecurringSnapshotEnabled && (!profile.SnapshotInterval || profile.SnapshotInterval <= 0)) { + profile.SnapshotInterval = 1440; + } + } else { + delete profile.SnapshotMax; + delete profile.SnapshotInterval; } prepareLabels(profile); @@ -123,9 +126,8 @@ function ($scope, $state, $transition$, Notifications, StoridgeProfileService, M } else { $scope.state.NoLimit = true; } - if (profile.SnapshotEnabled && profile.SnapshotInterval) { + if (profile.SnapshotEnabled && profile.SnapshotInterval !== 0) { $scope.state.RecurringSnapshotEnabled = true; - profile.SnapshotInterval /= 60; } initLabels(profile.Labels); $scope.profile = profile; diff --git a/app/extensions/storidge/views/profiles/profilesController.js b/app/extensions/storidge/views/profiles/profilesController.js index 2214739c7..ce25e36a3 100644 --- a/app/extensions/storidge/views/profiles/profilesController.js +++ b/app/extensions/storidge/views/profiles/profilesController.js @@ -35,6 +35,7 @@ function ($q, $scope, $state, Notifications, StoridgeProfileService) { $scope.create = function() { var model = new StoridgeProfileDefaultModel(); + model.Labels = {}; model.Name = $scope.formValues.Name; model.Directory = model.Directory + model.Name;