feat(storidge): wip on update 6

storidge-standalone
Anthony Lapenna 2019-04-17 12:23:28 +12:00
parent bf109f29f5
commit 99e9afe4c8
5 changed files with 71 additions and 67 deletions

View File

@ -7,14 +7,14 @@
</div> </div>
</div> </div>
<div class="actionBar"> <div class="actionBar">
<button type="button" class="btn btn-sm btn-danger" <!-- <button type="button" class="btn btn-sm btn-danger"
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)"> ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.removeAction($ctrl.state.selectedItems)">
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove <i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
</button> </button>
<button type="button" class="btn btn-sm btn-primary" <button type="button" class="btn btn-sm btn-primary"
ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.addAction($ctrl.state.selectedItems)"> ng-disabled="$ctrl.state.selectedItemCount === 0" ng-click="$ctrl.addAction($ctrl.state.selectedItems)">
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add to storage pool <i class="fa fa-plus space-right" aria-hidden="true"></i>Add to storage pool
</button> </button> -->
<button type="button" class="btn btn-sm btn-primary" ng-click="$ctrl.rescanAction()"> <button type="button" class="btn btn-sm btn-primary" ng-click="$ctrl.rescanAction()">
<i class="fa fa-sync space-right" aria-hidden="true"></i>Rescan drives <i class="fa fa-sync space-right" aria-hidden="true"></i>Rescan drives
</button> </button>
@ -28,10 +28,10 @@
<thead> <thead>
<tr> <tr>
<th> <th>
<span class="md-checkbox"> <!-- <span class="md-checkbox">
<input id="select_all" type="checkbox" ng-model="$ctrl.state.selectAll" ng-change="$ctrl.selectAll()" /> <input id="select_all" type="checkbox" ng-model="$ctrl.state.selectAll" ng-change="$ctrl.selectAll()" />
<label for="select_all"></label> <label for="select_all"></label>
</span> </span> -->
<a ng-click="$ctrl.changeOrderBy('Id')"> <a ng-click="$ctrl.changeOrderBy('Id')">
Id Id
<i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Id' && !$ctrl.state.reverseOrder"></i> <i class="fa fa-sort-alpha-down" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Id' && !$ctrl.state.reverseOrder"></i>
@ -85,10 +85,10 @@
<tbody> <tbody>
<tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" ng-class="{active: item.Checked}"> <tr dir-paginate="item in ($ctrl.state.filteredDataSet = ($ctrl.dataset | filter:$ctrl.state.textFilter | orderBy:$ctrl.state.orderBy:$ctrl.state.reverseOrder | itemsPerPage: $ctrl.state.paginatedItemLimit))" ng-class="{active: item.Checked}">
<td> <td>
<span class="md-checkbox"> <!-- <span class="md-checkbox">
<input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)" ng-disabled="item.Status === 'normal'"/> <input id="select_{{ $index }}" type="checkbox" ng-model="item.Checked" ng-change="$ctrl.selectItem(item)" ng-disabled="item.Status === 'normal'"/>
<label for="select_{{ $index }}"></label> <label for="select_{{ $index }}"></label>
</span> </span> -->
<a ui-sref="storidge.drives.drive({id: item.Id})"> {{ item.Id }}</a> <a ui-sref="storidge.drives.drive({id: item.Id})"> {{ item.Id }}</a>
</td> </td>
<td>{{ item.Node }}</td> <td>{{ item.Node }}</td>

View File

@ -13,7 +13,8 @@ export function StoridgeProfileDefaultModel() {
this.SnapshotInterval = 1440; this.SnapshotInterval = 1440;
this.SnapshotMax = 1; this.SnapshotMax = 1;
this.EncryptionEnabled = false; this.EncryptionEnabled = false;
this.InterfaceType = 'nfs'; // this.InterfaceType = 'nfs';
this.InterfaceType = '';
this.InterfaceDriver = ''; this.InterfaceDriver = '';
this.InterfaceNetwork = ''; this.InterfaceNetwork = '';
this.InterfaceConf = ''; this.InterfaceConf = '';
@ -89,6 +90,7 @@ export function StoridgeCreateProfileRequest(model) {
}; };
} }
// TODO: investigate bandwith
if (model.MinBandwidth && model.MaxBandwidth) { if (model.MinBandwidth && model.MaxBandwidth) {
this.bandwidth = { this.bandwidth = {
min: model.MinBandwidth, min: model.MinBandwidth,
@ -100,6 +102,7 @@ export function StoridgeCreateProfileRequest(model) {
var service = {}; var service = {};
// TODO: investigate snapshot
service.snapshot = { service.snapshot = {
enabled: model.SnapshotEnabled enabled: model.SnapshotEnabled
}; };

View File

@ -62,6 +62,7 @@
</div> </div>
</div> </div>
// TODO: remove
<!-- <div class="row" ng-if="clusterInfo"> <!-- <div class="row" ng-if="clusterInfo">
<div class="col-sm-12"> <div class="col-sm-12">
<rd-widget> <rd-widget>

View File

@ -14,9 +14,9 @@
<storidge-drives-datatable <storidge-drives-datatable
title-text="Drives" title-icon="fa-hdd" title-text="Drives" title-icon="fa-hdd"
dataset="drives" table-key="storidge_drives" dataset="drives" table-key="storidge_drives"
order-by="Id" order-by="Id"
remove-action="removeAction" <!-- remove-action="removeAction" -->
add-action="addAction" <!-- add-action="addAction" -->
rescan-action="rescanAction" rescan-action="rescanAction"
></storidge-drives-datatable> ></storidge-drives-datatable>
</div> </div>

View File

@ -1,63 +1,63 @@
angular.module('extension.storidge') angular.module('extension.storidge')
.controller('StoridgeDrivesController', ['$q', '$scope', '$state', 'Notifications', 'ModalService', 'StoridgeDriveService', .controller('StoridgeDrivesController', ['$q', '$scope', '$state', 'Notifications', 'StoridgeDriveService',
function ($q, $scope, $state, Notifications, ModalService, StoridgeDriveService) { function ($q, $scope, $state, Notifications, StoridgeDriveService) {
$scope.removeAction = function(selectedItems) { // $scope.removeAction = function(selectedItems) {
ModalService.confirm({ // ModalService.confirm({
title: 'Are you sure?', // title: 'Are you sure?',
message: 'Do you want really want to remove the drives from the storage pool?', // message: 'Do you want really want to remove the drives from the storage pool?',
buttons: { // buttons: {
confirm: { // confirm: {
label: 'Remove', // label: 'Remove',
className: 'btn-danger' // className: 'btn-danger'
} // }
}, // },
callback: function onConfirm(confirmed) { // callback: function onConfirm(confirmed) {
if(!confirmed) { return; } // if(!confirmed) { return; }
var actionCount = selectedItems.length; // var actionCount = selectedItems.length;
selectedItems = selectedItems.filter(function (item) { // selectedItems = selectedItems.filter(function (item) {
return item.Status === 'faulty'; // return item.Status === 'faulty';
}); // });
angular.forEach(selectedItems, function (drive) { // angular.forEach(selectedItems, function (drive) {
StoridgeDriveService.remove(drive.Id) // StoridgeDriveService.remove(drive.Id)
.then(function success() { // .then(function success() {
Notifications.success('Drive successfully removed', drive.Id); // Notifications.success('Drive successfully removed', drive.Id);
}) // })
.catch(function error(err) { // .catch(function error(err) {
Notifications.error('Failure', err, 'Unable to remove drive'); // Notifications.error('Failure', err, 'Unable to remove drive');
}) // })
.finally(function final() { // .finally(function final() {
--actionCount; // --actionCount;
if (actionCount === 0) { // if (actionCount === 0) {
$state.reload(); // $state.reload();
} // }
}); // });
}); // });
} // }
}); // });
}; // };
$scope.addAction = function (selectedItems) { // $scope.addAction = function (selectedItems) {
var actionCount = selectedItems.length; // var actionCount = selectedItems.length;
selectedItems = selectedItems.filter(function (item) { // selectedItems = selectedItems.filter(function (item) {
return item.Status === 'available'; // return item.Status === 'available';
}); // });
angular.forEach(selectedItems, function (drive) { // angular.forEach(selectedItems, function (drive) {
StoridgeDriveService.add(drive.Device, drive.Node) // StoridgeDriveService.add(drive.Device, drive.Node)
.then(function success() { // .then(function success() {
Notifications.success('Drive ' + drive.Device + ' successfully added on node ' + drive.Node); // Notifications.success('Drive ' + drive.Device + ' successfully added on node ' + drive.Node);
}) // })
.catch(function error(err) { // .catch(function error(err) {
Notifications.error('Failure', err, 'Unable to add drive'); // Notifications.error('Failure', err, 'Unable to add drive');
}) // })
.finally(function final() { // .finally(function final() {
--actionCount; // --actionCount;
if (actionCount === 0) { // if (actionCount === 0) {
$state.reload(); // $state.reload();
} // }
}); // });
}); // });
}; // };
$scope.rescanAction = function () { $scope.rescanAction = function () {
StoridgeDriveService.rescan() StoridgeDriveService.rescan()