mirror of https://github.com/portainer/portainer
feat(storidge): wip on update 6
parent
bf109f29f5
commit
99e9afe4c8
|
@ -7,14 +7,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<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)">
|
||||
<i class="fa fa-trash-alt space-right" aria-hidden="true"></i>Remove
|
||||
</button>
|
||||
<button type="button" class="btn btn-sm btn-primary"
|
||||
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
|
||||
</button>
|
||||
</button> -->
|
||||
<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
|
||||
</button>
|
||||
|
@ -28,10 +28,10 @@
|
|||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<span class="md-checkbox">
|
||||
<!-- <span class="md-checkbox">
|
||||
<input id="select_all" type="checkbox" ng-model="$ctrl.state.selectAll" ng-change="$ctrl.selectAll()" />
|
||||
<label for="select_all"></label>
|
||||
</span>
|
||||
</span> -->
|
||||
<a ng-click="$ctrl.changeOrderBy('Id')">
|
||||
Id
|
||||
<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>
|
||||
<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>
|
||||
<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'"/>
|
||||
<label for="select_{{ $index }}"></label>
|
||||
</span>
|
||||
</span> -->
|
||||
<a ui-sref="storidge.drives.drive({id: item.Id})"> {{ item.Id }}</a>
|
||||
</td>
|
||||
<td>{{ item.Node }}</td>
|
||||
|
|
|
@ -13,7 +13,8 @@ export function StoridgeProfileDefaultModel() {
|
|||
this.SnapshotInterval = 1440;
|
||||
this.SnapshotMax = 1;
|
||||
this.EncryptionEnabled = false;
|
||||
this.InterfaceType = 'nfs';
|
||||
// this.InterfaceType = 'nfs';
|
||||
this.InterfaceType = '';
|
||||
this.InterfaceDriver = '';
|
||||
this.InterfaceNetwork = '';
|
||||
this.InterfaceConf = '';
|
||||
|
@ -89,6 +90,7 @@ export function StoridgeCreateProfileRequest(model) {
|
|||
};
|
||||
}
|
||||
|
||||
// TODO: investigate bandwith
|
||||
if (model.MinBandwidth && model.MaxBandwidth) {
|
||||
this.bandwidth = {
|
||||
min: model.MinBandwidth,
|
||||
|
@ -100,6 +102,7 @@ export function StoridgeCreateProfileRequest(model) {
|
|||
|
||||
var service = {};
|
||||
|
||||
// TODO: investigate snapshot
|
||||
service.snapshot = {
|
||||
enabled: model.SnapshotEnabled
|
||||
};
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
// TODO: remove
|
||||
<!-- <div class="row" ng-if="clusterInfo">
|
||||
<div class="col-sm-12">
|
||||
<rd-widget>
|
||||
|
|
|
@ -14,9 +14,9 @@
|
|||
<storidge-drives-datatable
|
||||
title-text="Drives" title-icon="fa-hdd"
|
||||
dataset="drives" table-key="storidge_drives"
|
||||
order-by="Id"
|
||||
remove-action="removeAction"
|
||||
add-action="addAction"
|
||||
order-by="Id"
|
||||
<!-- remove-action="removeAction" -->
|
||||
<!-- add-action="addAction" -->
|
||||
rescan-action="rescanAction"
|
||||
></storidge-drives-datatable>
|
||||
</div>
|
||||
|
|
|
@ -1,63 +1,63 @@
|
|||
angular.module('extension.storidge')
|
||||
.controller('StoridgeDrivesController', ['$q', '$scope', '$state', 'Notifications', 'ModalService', 'StoridgeDriveService',
|
||||
function ($q, $scope, $state, Notifications, ModalService, StoridgeDriveService) {
|
||||
.controller('StoridgeDrivesController', ['$q', '$scope', '$state', 'Notifications', 'StoridgeDriveService',
|
||||
function ($q, $scope, $state, Notifications, StoridgeDriveService) {
|
||||
|
||||
$scope.removeAction = function(selectedItems) {
|
||||
ModalService.confirm({
|
||||
title: 'Are you sure?',
|
||||
message: 'Do you want really want to remove the drives from the storage pool?',
|
||||
buttons: {
|
||||
confirm: {
|
||||
label: 'Remove',
|
||||
className: 'btn-danger'
|
||||
}
|
||||
},
|
||||
callback: function onConfirm(confirmed) {
|
||||
if(!confirmed) { return; }
|
||||
var actionCount = selectedItems.length;
|
||||
selectedItems = selectedItems.filter(function (item) {
|
||||
return item.Status === 'faulty';
|
||||
});
|
||||
angular.forEach(selectedItems, function (drive) {
|
||||
StoridgeDriveService.remove(drive.Id)
|
||||
.then(function success() {
|
||||
Notifications.success('Drive successfully removed', drive.Id);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to remove drive');
|
||||
})
|
||||
.finally(function final() {
|
||||
--actionCount;
|
||||
if (actionCount === 0) {
|
||||
$state.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
// $scope.removeAction = function(selectedItems) {
|
||||
// ModalService.confirm({
|
||||
// title: 'Are you sure?',
|
||||
// message: 'Do you want really want to remove the drives from the storage pool?',
|
||||
// buttons: {
|
||||
// confirm: {
|
||||
// label: 'Remove',
|
||||
// className: 'btn-danger'
|
||||
// }
|
||||
// },
|
||||
// callback: function onConfirm(confirmed) {
|
||||
// if(!confirmed) { return; }
|
||||
// var actionCount = selectedItems.length;
|
||||
// selectedItems = selectedItems.filter(function (item) {
|
||||
// return item.Status === 'faulty';
|
||||
// });
|
||||
// angular.forEach(selectedItems, function (drive) {
|
||||
// StoridgeDriveService.remove(drive.Id)
|
||||
// .then(function success() {
|
||||
// Notifications.success('Drive successfully removed', drive.Id);
|
||||
// })
|
||||
// .catch(function error(err) {
|
||||
// Notifications.error('Failure', err, 'Unable to remove drive');
|
||||
// })
|
||||
// .finally(function final() {
|
||||
// --actionCount;
|
||||
// if (actionCount === 0) {
|
||||
// $state.reload();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// };
|
||||
|
||||
$scope.addAction = function (selectedItems) {
|
||||
var actionCount = selectedItems.length;
|
||||
selectedItems = selectedItems.filter(function (item) {
|
||||
return item.Status === 'available';
|
||||
});
|
||||
angular.forEach(selectedItems, function (drive) {
|
||||
StoridgeDriveService.add(drive.Device, drive.Node)
|
||||
.then(function success() {
|
||||
Notifications.success('Drive ' + drive.Device + ' successfully added on node ' + drive.Node);
|
||||
})
|
||||
.catch(function error(err) {
|
||||
Notifications.error('Failure', err, 'Unable to add drive');
|
||||
})
|
||||
.finally(function final() {
|
||||
--actionCount;
|
||||
if (actionCount === 0) {
|
||||
$state.reload();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
// $scope.addAction = function (selectedItems) {
|
||||
// var actionCount = selectedItems.length;
|
||||
// selectedItems = selectedItems.filter(function (item) {
|
||||
// return item.Status === 'available';
|
||||
// });
|
||||
// angular.forEach(selectedItems, function (drive) {
|
||||
// StoridgeDriveService.add(drive.Device, drive.Node)
|
||||
// .then(function success() {
|
||||
// Notifications.success('Drive ' + drive.Device + ' successfully added on node ' + drive.Node);
|
||||
// })
|
||||
// .catch(function error(err) {
|
||||
// Notifications.error('Failure', err, 'Unable to add drive');
|
||||
// })
|
||||
// .finally(function final() {
|
||||
// --actionCount;
|
||||
// if (actionCount === 0) {
|
||||
// $state.reload();
|
||||
// }
|
||||
// });
|
||||
// });
|
||||
// };
|
||||
|
||||
$scope.rescanAction = function () {
|
||||
StoridgeDriveService.rescan()
|
||||
|
|
Loading…
Reference in New Issue