fix(storidge): update 9 - move add storage button + api profile filesystem kv to obj

storidge-standalone
baron_l 2019-04-28 11:26:12 +02:00
parent 3c97a88a5a
commit c6f083cd6f
4 changed files with 29 additions and 33 deletions

View File

@ -10,10 +10,6 @@
<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>
<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>
</div>
<div class="searchBar">
<i class="fa fa-search searchIcon" aria-hidden="true"></i>
@ -24,10 +20,6 @@
<thead>
<tr>
<th>
<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>
<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>
@ -76,15 +68,14 @@
<i class="fa fa-sort-alpha-up" aria-hidden="true" ng-if="$ctrl.state.orderBy === 'Status' && $ctrl.state.reverseOrder"></i>
</a>
</th>
<th>
Actions
</th>
</tr>
</thead>
<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">
<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>
<a ui-sref="storidge.drives.drive({id: item.Id})"> {{ item.Id }}</a>
</td>
<td>{{ item.Node }}</td>
@ -95,6 +86,11 @@
<td>
<span class="label label-{{ item.Status|drivestatusbadge }}">{{ item.Status|capitalize }}</span>
</td>
<td>
<button ng-if="item.Status === 'available'" type="button" class="btn btn-sm btn-primary btn-datatable" ng-click="$ctrl.addAction(item)">
<i class="fa fa-plus space-right" aria-hidden="true"></i>Add to storage pool
</button>
</td>
</tr>
<tr ng-if="!$ctrl.dataset">
<td colspan="7" class="text-center text-muted">Loading...</td>

View File

@ -43,7 +43,10 @@ export function StoridgeProfileModel(name, data) {
this.MaxBandwidth = data.bandwidth.max;
}
this.Filesystem = data.filesystem;
if (data.filesystem) {
this.Filesystem = data.filesystem.type;
}
// this.Filesystem = data.filesystem;
var service = data.service;
@ -96,7 +99,9 @@ export function StoridgeCreateProfileRequest(model) {
};
}
this.filesystem = model.Filesystem;
this.filesystem = {
type: model.Filesystem
};
var service = {};

View File

@ -2,25 +2,14 @@ angular.module('extension.storidge')
.controller('StoridgeDrivesController', ['$scope', '$state', 'Notifications', 'StoridgeDriveService',
function ($scope, $state, Notifications, StoridgeDriveService) {
$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 (drive) {
StoridgeDriveService.add(drive.Device, drive.Node)
.then(function success() {
Notifications.success('Drive ' + drive.Device + ' successfully added on node ' + drive.Node);
$state.reload();
})
.catch(function error(err) {
Notifications.error('Failure', err, 'Unable to add drive');
});
};

View File

@ -256,6 +256,12 @@ a[ng-click]{
border-radius: 3px;
}
.btn-datatable {
padding: 2.6px 7.8px 3.9px;
line-height: 1;
margin: 0px 0px 0px 0px;
}
@media screen and (min-width: 1107px) {
.btn-responsive {
padding: 6px 12px;