Merge "Add attributes for cluster to show"
This commit is contained in:
commit
8f7a4ec5f0
@ -31,6 +31,15 @@
|
||||
];
|
||||
|
||||
function controller() {
|
||||
}
|
||||
var ctrl = this;
|
||||
ctrl.objLen = objLen;
|
||||
|
||||
function objLen(obj) {
|
||||
var length = 0;
|
||||
if (typeof obj === 'object') {
|
||||
length = Object.keys(obj).length;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License. You may obtain
|
||||
* a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
* License for the specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
describe('cluster drawer controller', function() {
|
||||
|
||||
var ctrl;
|
||||
|
||||
beforeEach(module('horizon.dashboard.container-infra.clusters'));
|
||||
|
||||
beforeEach(inject(function($controller) {
|
||||
ctrl = $controller('horizon.dashboard.container-infra.clusters.DrawerController', {});
|
||||
}));
|
||||
|
||||
it('objLen returns number of attributes of object', inject(function() {
|
||||
expect(ctrl.objLen(undefined)).toBe(0);
|
||||
expect(ctrl.objLen({a: 0})).toBe(1);
|
||||
}));
|
||||
});
|
||||
})();
|
@ -1,27 +1,43 @@
|
||||
<div ng-controller="horizon.dashboard.container-infra.clusters.DrawerController as drawerCtrl">
|
||||
<div class="row">
|
||||
<span class="rsp-alt-p2">
|
||||
<dl class="col-md-5">
|
||||
<dl class="col-md-6">
|
||||
<dt translate>ID</dt>
|
||||
<dd>{$ item.id $}</dd>
|
||||
</dl>
|
||||
<dl class="col-md-3">
|
||||
<dl class="col-md-2">
|
||||
<dt translate>Master Count</dt>
|
||||
<dd>{$ item.master_count $}</dd>
|
||||
</dl>
|
||||
<dl class="col-md-3">
|
||||
<dl class="col-md-2">
|
||||
<dt translate>Node Count</dt>
|
||||
<dd>{$ item.node_count $}</dd>
|
||||
</dl>
|
||||
<dl class="col-md-2">
|
||||
<dt translate>Keypair</dt>
|
||||
<dd>{$ item.keypair $}</dd>
|
||||
</dl>
|
||||
</span>
|
||||
</div>
|
||||
<div class="row">
|
||||
<dl class="col-md-5">
|
||||
<dl class="col-md-6">
|
||||
<dt translate>Cluster Template</dt>
|
||||
<dd><a ng-href="ngdetails/OS::Magnum::ClusterTemplate/{$ item.cluster_template_id $}">{$ item.cluster_template_id $}</a></dd>
|
||||
</dl>
|
||||
<dl class="col-md-3">
|
||||
<dl class="col-md-6">
|
||||
<dt translate>API Address</dt>
|
||||
<dd>{$ item.api_address $}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="row">
|
||||
<dl class="col-md-6">
|
||||
<dt translate>Master Addresses</dt>
|
||||
<dd ng-if="drawerCtrl.objLen(item.master_addresses) === 0" translate>None</dd>
|
||||
<dd ng-repeat="addr in item.master_addresses">{$ addr $}</dd>
|
||||
</dl>
|
||||
<dl class="col-md-6">
|
||||
<dt translate>Node Addresses</dt>
|
||||
<dd ng-if="drawerCtrl.objLen(item.node_addresses) === 0" translate>None</dd>
|
||||
<dd ng-repeat="addr in item.node_addresses">{$ addr $}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
@ -30,6 +30,7 @@
|
||||
var ctrl = this;
|
||||
ctrl.cluster = {};
|
||||
ctrl.cluster_template = {};
|
||||
ctrl.objLen = objLen;
|
||||
|
||||
$scope.context.loadPromise.then(onGetCluster);
|
||||
|
||||
@ -41,5 +42,13 @@
|
||||
function onGetClusterTemplate(clusterTemplate) {
|
||||
ctrl.cluster_template = clusterTemplate.data;
|
||||
}
|
||||
|
||||
function objLen(obj) {
|
||||
var length = 0;
|
||||
if (typeof obj === 'object') {
|
||||
length = Object.keys(obj).length;
|
||||
}
|
||||
return length;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
@ -41,5 +41,9 @@
|
||||
expect(ctrl.cluster).toBeDefined();
|
||||
}));
|
||||
|
||||
it('objLen returns number of attributes of object', inject(function() {
|
||||
expect(ctrl.objLen(undefined)).toBe(0);
|
||||
expect(ctrl.objLen({a: 0})).toBe(1);
|
||||
}));
|
||||
});
|
||||
})();
|
||||
|
@ -25,13 +25,11 @@
|
||||
<dt translate>API Address</dt>
|
||||
<dd>{$ ctrl.cluster.api_address $}</dd>
|
||||
<dt translate>Master Addresses</dt>
|
||||
<dd>
|
||||
<div ng-repeat="addr in ctrl.cluster.master_addresses">{$ addr $}</div>
|
||||
</dd>
|
||||
<dd ng-if="ctrl.objLen(ctrl.cluster.master_addresses) === 0" translate>None</dd>
|
||||
<dd ng-repeat="addr in ctrl.cluster.master_addresses">{$ addr $}</dd>
|
||||
<dt translate>Node Addresses</dt>
|
||||
<dd>
|
||||
<div ng-repeat="addr in ctrl.cluster.node_addresses">{$ addr $}</div>
|
||||
</dd>
|
||||
<dd ng-if="ctrl.objLen(ctrl.cluster.node_addresses) === 0" translate>None</dd>
|
||||
<dd ng-repeat="addr in ctrl.cluster.node_addresses">{$ addr $}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
@ -40,10 +38,6 @@
|
||||
<h3 translate>Miscellaneous</h3>
|
||||
<hr>
|
||||
<dl class="dl-horizontal">
|
||||
<dt translate>Stack ID</dt>
|
||||
<dd><a ng-href="project/stacks/stack/{$ ctrl.cluster.stack_id $}" target="_self">
|
||||
{$ ctrl.cluster.stack_id $}
|
||||
</a></dd>
|
||||
<dt translate>Discovery URL</dt>
|
||||
<dd>{$ ctrl.cluster.discovery_url $}</dd>
|
||||
<dt translate>Cluster Create Timeout</dt>
|
||||
@ -59,6 +53,38 @@
|
||||
</dd>
|
||||
<dt translate>Keypair</dt>
|
||||
<dd>{$ ctrl.cluster.keypair $}</dd>
|
||||
<dt translate>Docker Volume Size</dt>
|
||||
<dd>{$ ctrl.cluster.docker_volume_size | noValue $} GB</dd>
|
||||
<dt translate>Master Flavor ID</dt>
|
||||
<dd>{$ ctrl.cluster.master_flavor_id | noValue $}</dd>
|
||||
<dt translate>COE Version</dt>
|
||||
<dd>{$ ctrl.cluster.coe_version | noValue $}</dd>
|
||||
<dt translate>Container Version</dt>
|
||||
<dd>{$ ctrl.cluster.container_version | noValue $}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-md-6 detail">
|
||||
<h3 translate>Labels</h3>
|
||||
<hr>
|
||||
<dl class="dl-horizontal">
|
||||
<dd ng-if="ctrl.objLen(ctrl.cluster.labels) === 0" translate>None</dd>
|
||||
<dt ng-repeat-start="(key, value) in ctrl.cluster.labels">{$ key $}</dt>
|
||||
<dd ng-repeat-end>{$ value $}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-md-6 detail">
|
||||
<h3 translate>Stack</h3>
|
||||
<hr>
|
||||
<dl class="dl-horizontal">
|
||||
<dt translate>Stack ID</dt>
|
||||
<dd><a ng-href="project/stacks/stack/{$ ctrl.cluster.stack_id $}" target="_self">
|
||||
{$ ctrl.cluster.stack_id $}
|
||||
</a></dd>
|
||||
<dt translate>Stack Faults</dt>
|
||||
<dd ng-if="ctrl.objLen(ctrl.cluster.faults) === 0" translate>None</dd>
|
||||
<dd ng-if="ctrl.objLen(ctrl.cluster.faults) > 0" translate>as follows:</dd>
|
||||
<dt ng-repeat-start="(key, value) in ctrl.cluster.faults">{$ key $}</dt>
|
||||
<dd ng-repeat-end>{$ value $}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="col-md-6 detail">
|
||||
@ -73,6 +99,8 @@
|
||||
<dd>{$ ctrl.cluster.id $}</dd>
|
||||
<dt translate>Status</dt>
|
||||
<dd>{$ ctrl.cluster.status $}</dd>
|
||||
<dt translate>Status Reason</dt>
|
||||
<dd>{$ ctrl.cluster.status_reason | noValue $}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user