1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-09 15:55:23 +02:00

fix(storidge): display modifications + fix js errors

This commit is contained in:
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> <rd-widget-body>
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-group"> <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"> <div class="col-sm-9 col-lg-10">
<input type="text" class="form-control" id="comment" ng-model="$ctrl.formValues.Comment"> <input type="text" class="form-control" id="comment" ng-model="$ctrl.formValues.Comment">
</div> </div>

View file

@ -23,7 +23,7 @@
<td>{{ $ctrl.volume.Name }}</td> <td>{{ $ctrl.volume.Name }}</td>
</tr> </tr>
<tr> <tr>
<td>Uuid</td> <td>UUID</td>
<td>{{ $ctrl.volume.Uuid }}</td> <td>{{ $ctrl.volume.Uuid }}</td>
</tr> </tr>
<tr> <tr>
@ -66,10 +66,6 @@
<td>Redundancy</td> <td>Redundancy</td>
<td>{{ $ctrl.volume.Redundancy }}</td> <td>{{ $ctrl.volume.Redundancy }}</td>
</tr> </tr>
<tr>
<td>Type</td>
<td>{{ $ctrl.volume.Type }}</td>
</tr>
<tr> <tr>
<td>Vdisk</td> <td>Vdisk</td>
<td>{{ $ctrl.volume.Vdisk }}</td> <td>{{ $ctrl.volume.Vdisk }}</td>
@ -83,17 +79,9 @@
<td>{{ $ctrl.volume.Volume}}</td> <td>{{ $ctrl.volume.Volume}}</td>
</tr> </tr>
<tr> <tr>
<td>DriveType</td> <td>Drive Type</td>
<td>{{ $ctrl.volume.DriveType}}</td> <td>{{ $ctrl.volume.DriveType}}</td>
</tr> </tr>
<tr>
<td>Compression</td>
<td>{{ $ctrl.volume.Compression}}</td>
</tr>
<tr>
<td>Dedup</td>
<td>{{ $ctrl.volume.Dedup}}</td>
</tr>
<tr> <tr>
<td>Encryption</td> <td>Encryption</td>
<td>{{ $ctrl.volume.Encryption}}</td> <td>{{ $ctrl.volume.Encryption}}</td>
@ -142,14 +130,6 @@
</div> </div>
</div> </div>
<!-- !Node --> <!-- !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 --> <!-- Capacity -->
<div class="form-group"> <div class="form-group">
<label for="volume_capacity" class="col-sm-2 col-lg-1 control-label text-left">Capacity</label> <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, IOPSMin: this.volume.IOPSMin,
IOPSMax: this.volume.IOPSMax, IOPSMax: this.volume.IOPSMax,
Node: this.volume.Node, Node: this.volume.Node,
NodeID: this.volume.NodeID,
Capacity: this.volume.Capacity, Capacity: this.volume.Capacity,
BandwidthMin: this.volume.BandwidthMin, BandwidthMin: this.volume.BandwidthMin,
BandwidthMax: this.volume.BandwidthMax, BandwidthMax: this.volume.BandwidthMax,
@ -62,9 +61,6 @@ function ($state, StoridgeVolumeService, Notifications) {
if (volume.Node === data.Node || !volume.Node) { if (volume.Node === data.Node || !volume.Node) {
delete volume.Node; delete volume.Node;
} }
if (volume.NodeID === data.NodeID || !volume.NodeID) {
delete volume.NodeID;
}
if (volume.Capacity === data.Capacity || !volume.Capacity) { if (volume.Capacity === data.Capacity || !volume.Capacity) {
delete volume.Capacity; delete volume.Capacity;
} }

View file

@ -10,7 +10,7 @@ angular.module('extension.storidge')
.filter('drivestatusbadge', function () { .filter('drivestatusbadge', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
var status = _.toLower(text); var status = text ? _.toLower(text) : '';
if (includeString(status, ['normal'])) { if (includeString(status, ['normal'])) {
return 'success'; return 'success';
} else if (includeString(status, ['available'])) { } else if (includeString(status, ['available'])) {
@ -24,7 +24,7 @@ angular.module('extension.storidge')
.filter('nodeStatusBadge', function () { .filter('nodeStatusBadge', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
var status = _.toLower(text); var status = text ? _.toLower(text) : '';
if (status === 'maintenance') { if (status === 'maintenance') {
return 'orange-icon'; return 'orange-icon';
} }
@ -34,10 +34,22 @@ angular.module('extension.storidge')
.filter('clusterStatusBadge', function () { .filter('clusterStatusBadge', function () {
'use strict'; 'use strict';
return function (text) { return function (text) {
var status = _.toLower(text); var status = text ? _.toLower(text) : '';
if (status === 'alert') { if (status === 'alert') {
return 'red-icon'; return 'red-icon';
} }
return 'green-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.NodeID = data.nodeid;
this.Provisioning = data.provisioning; this.Provisioning = data.provisioning;
this.Redundancy = data.redundancy; this.Redundancy = data.redundancy;
this.Type = data.type;
this.Uuid = data.uuid; this.Uuid = data.uuid;
this.Vdisk = data.vdisk; this.Vdisk = data.vdisk;
this.Labels = data.labels; this.Labels = data.labels;
@ -18,8 +17,6 @@ export function StoridgeVolumeModel(data) {
this.IP = data.ipaddr; this.IP = data.ipaddr;
this.Volume = data.volume; this.Volume = data.volume;
this.DriveType = data.type; this.DriveType = data.type;
this.Compression = data.compression;
this.Dedup = data.dedup;
this.Encryption = data.encryption; this.Encryption = data.encryption;
this.Replication = data.replication; this.Replication = data.replication;
this.SnapshotEnabled = data.snapshot; this.SnapshotEnabled = data.snapshot;

View file

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

View file

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