fix(storidge): display modifications + fix js errors

storidge-standalone
baron_l 2019-03-26 01:30:32 +01:00
parent fa3005e9df
commit 77d51a8465
7 changed files with 23 additions and 38 deletions

View File

@ -4,7 +4,7 @@
<rd-widget-body>
<form class="form-horizontal">
<div class="form-group">
<label for="comment" class="col-sm-3 col-lg-2 control-label text-left">Comment</label>
<label for="comment" class="col-sm-3 col-lg-2 control-label text-left">Description</label>
<div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" id="comment" ng-model="$ctrl.formValues.Comment">
</div>

View File

@ -23,7 +23,7 @@
<td>{{ $ctrl.volume.Name }}</td>
</tr>
<tr>
<td>Uuid</td>
<td>UUID</td>
<td>{{ $ctrl.volume.Uuid }}</td>
</tr>
<tr>
@ -66,10 +66,6 @@
<td>Redundancy</td>
<td>{{ $ctrl.volume.Redundancy }}</td>
</tr>
<tr>
<td>Type</td>
<td>{{ $ctrl.volume.Type }}</td>
</tr>
<tr>
<td>Vdisk</td>
<td>{{ $ctrl.volume.Vdisk }}</td>
@ -86,14 +82,6 @@
<td>Drive Type</td>
<td>{{ $ctrl.volume.DriveType}}</td>
</tr>
<tr>
<td>Compression</td>
<td>{{ $ctrl.volume.Compression}}</td>
</tr>
<tr>
<td>Dedup</td>
<td>{{ $ctrl.volume.Dedup}}</td>
</tr>
<tr>
<td>Encryption</td>
<td>{{ $ctrl.volume.Encryption}}</td>
@ -142,14 +130,6 @@
</div>
</div>
<!-- !Node -->
<!-- Node ID -->
<div class="form-group">
<label for="volume_nodeid" class="col-sm-2 col-lg-1 control-label text-left">Node ID</label>
<div class="col-sm-10 col-lg-11">
<input type="text" class="form-control" ng-model="$ctrl.formValues.NodeID" name="volume_nodeid" placeholder="2">
</div>
</div>
<!-- !Node ID -->
<!-- Capacity -->
<div class="form-group">
<label for="volume_capacity" class="col-sm-2 col-lg-1 control-label text-left">Capacity</label>

View File

@ -31,7 +31,6 @@ function ($state, StoridgeVolumeService, Notifications) {
IOPSMin: this.volume.IOPSMin,
IOPSMax: this.volume.IOPSMax,
Node: this.volume.Node,
NodeID: this.volume.NodeID,
Capacity: this.volume.Capacity,
BandwidthMin: this.volume.BandwidthMin,
BandwidthMax: this.volume.BandwidthMax,
@ -62,9 +61,6 @@ function ($state, StoridgeVolumeService, Notifications) {
if (volume.Node === data.Node || !volume.Node) {
delete volume.Node;
}
if (volume.NodeID === data.NodeID || !volume.NodeID) {
delete volume.NodeID;
}
if (volume.Capacity === data.Capacity || !volume.Capacity) {
delete volume.Capacity;
}

View File

@ -10,7 +10,7 @@ angular.module('extension.storidge')
.filter('drivestatusbadge', function () {
'use strict';
return function (text) {
var status = _.toLower(text);
var status = text ? _.toLower(text) : '';
if (includeString(status, ['normal'])) {
return 'success';
} else if (includeString(status, ['available'])) {
@ -24,7 +24,7 @@ angular.module('extension.storidge')
.filter('nodeStatusBadge', function () {
'use strict';
return function (text) {
var status = _.toLower(text);
var status = text ? _.toLower(text) : '';
if (status === 'maintenance') {
return 'orange-icon';
}
@ -34,10 +34,22 @@ angular.module('extension.storidge')
.filter('clusterStatusBadge', function () {
'use strict';
return function (text) {
var status = _.toLower(text);
var status = text ? _.toLower(text) : '';
if (status === 'alert') {
return 'red-icon';
}
return 'green-icon';
};
}).filter('bytes', function() {
return function(bytes, precision) {
bytes = parseFloat(bytes);
if (isNaN(bytes) || !isFinite(bytes)) return '-';
if (!precision) precision = 1;
var units = ['B', 'kB', 'MB', 'GB', 'TB', 'PB'];
var number = Math.floor(Math.log(bytes) / Math.log(1024));
if (bytes === 0) {
return ('0 B');
}
return (bytes / Math.pow(1024, Math.floor(number))).toFixed(precision) + ' ' + units[number];
}
});

View File

@ -10,7 +10,6 @@ export function StoridgeVolumeModel(data) {
this.NodeID = data.nodeid;
this.Provisioning = data.provisioning;
this.Redundancy = data.redundancy;
this.Type = data.type;
this.Uuid = data.uuid;
this.Vdisk = data.vdisk;
this.Labels = data.labels;
@ -18,8 +17,6 @@ export function StoridgeVolumeModel(data) {
this.IP = data.ipaddr;
this.Volume = data.volume;
this.DriveType = data.type;
this.Compression = data.compression;
this.Dedup = data.dedup;
this.Encryption = data.encryption;
this.Replication = data.replication;
this.SnapshotEnabled = data.snapshot;

View File

@ -107,19 +107,19 @@
<tbody>
<tr>
<td>Free</td>
<td>{{ node.FreeCapacity }}</td>
<td>{{ node.FreeCapacity | bytes }}</td>
</tr>
<tr>
<td>Used</td>
<td>{{ node.UsedCapacity }}</td>
<td>{{ node.UsedCapacity | bytes }}</td>
</tr>
<tr>
<td>Provisioned</td>
<td>{{ node.ProvisionedCapacity }}</td>
<td>{{ node.ProvisionedCapacity | bytes }}</td>
</tr>
<tr>
<td>Total</td>
<td>{{ node.TotalCapacity }}</td>
<td>{{ node.TotalCapacity | bytes }}</td>
</tr>
</tbody>
</table>

View File

@ -38,7 +38,7 @@ angular.module('portainer.app')
.filter('capitalize', function () {
'use strict';
return function (text) {
return _.capitalize(text);
return text ? _.capitalize(text) : '';
};
})
.filter('stripprotocol', function() {