Update replication controllers for v1beta3 api

This commit is contained in:
BC Broussard
2015-05-20 18:47:09 -07:00
parent 1fd4050450
commit f8762ccd12
6 changed files with 156 additions and 102 deletions

View File

@@ -6,7 +6,7 @@
app.controller('ListReplicationControllersCtrl', [
'$scope',
'$routeParams',
'k8sApi',
'k8sv1Beta3Api',
'$location',
function($scope, $routeParams, k8sApi, $location) {
'use strict';
@@ -62,27 +62,26 @@ app.controller('ListReplicationControllersCtrl', [
var _name = '', _image = '';
if (replicationController.desiredState.podTemplate.desiredState.manifest.containers) {
Object.keys(replicationController.desiredState.podTemplate.desiredState.manifest.containers)
if (replicationController.spec.template.spec.containers) {
Object.keys(replicationController.spec.template.spec.containers)
.forEach(function(key) {
_name += replicationController.desiredState.podTemplate.desiredState.manifest.containers[key].name;
_image += replicationController.desiredState.podTemplate.desiredState.manifest.containers[key].image;
_name += replicationController.spec.template.spec.containers[key].name;
_image += replicationController.spec.template.spec.containers[key].image;
});
}
var _name_selector = '';
var _selectors = '';
if (replicationController.desiredState.replicaSelector) {
Object.keys(replicationController.desiredState.replicaSelector)
.forEach(function(key) { _name_selector += replicationController.desiredState.replicaSelector[key]; });
if (replicationController.spec.selector) {
_selectors = _.map(replicationController.spec.selector, function(v, k) { return k + '=' + v }).join(', ');
}
$scope.content.push({
controller: replicationController.id,
controller: replicationController.metadata.name,
containers: _name,
images: _image,
selector: _name_selector,
replicas: replicationController.currentState.replicas
selector: _selectors,
replicas: replicationController.status.replicas
});
});

View File

@@ -22,7 +22,7 @@ ReplicationController.prototype.handleError = function(data, status, headers, co
app.controller('ReplicationControllerCtrl', [
'$scope',
'$routeParams',
'k8sApi',
'k8sv1Beta3Api',
function($scope, $routeParams, k8sApi) {
$scope.controller = new ReplicationController();
$scope.controller.k8sApi = k8sApi;
@@ -30,6 +30,7 @@ app.controller('ReplicationControllerCtrl', [
$scope.controller.getData($routeParams.replicationControllerId);
$scope.doTheBack = function() { window.history.back(); };
$scope.getSelectorUrlFragment = function(sel){ return _.map(sel, function(v, k) { return k + '=' + v }).join(','); };
}
]);

View File

@@ -10,37 +10,46 @@
<div class="heading">
<span class="label">Replication Controller: </span>
<span>{{replicationController.id}}</span>
<span>{{replicationController.metadata.name}}</span>
</div>
<table>
<table class="align-top">
<tbody>
<tr>
<td class="name">Created</td>
<td class="value">
{{replicationController.creationTimestamp | date:'medium'}}
{{replicationController.metadata.creationTimestamp | date:'medium'}}
</td>
</tr>
<tr>
<td class="name">Desired Replicas</td>
<td class="value">
{{replicationController.desiredState.replicas}}
{{replicationController.spec.replicas}}
</td>
</tr>
<tr>
<td class="name">Current Replicas</td>
<td class="value">
{{replicationController.currentState.replicas}}
{{replicationController.status.replicas}}
</td>
</tr>
<tr ng-show="replicationController.spec.selector">
<td class="name">Selector</td>
<td class="value">
<span ng-repeat="(label, value) in replicationController.spec.selector">
{{label}}={{value}}{{$last ? '' : ', '}}
</span>
</td>
</tr>
<tr>
<td class="name">Labels</td>
<td class="value">
<div ng-repeat="(label, value) in replicationController.labels">
<div ng-repeat="(label, value) in replicationController.metadata.labels">
{{label}}: {{value}}
</div>
</td>
@@ -49,9 +58,13 @@
<tr>
<td class="name">Related Pods</td>
<td class="value">
<div ng-repeat="(label, value) in replicationController.desiredState.replicaSelector">
<a ng-href="#/dashboard/groups/type/selector/{{label}}={{value}},type=pod">{{label}}: {{value}}</a>
</div>
<div ng-show="replicationController.spec.selector && Object.keys(replicationController.spec.selector).length > 1">
<a ng-href="#/dashboard/groups/type/selector/{{getSelectorUrlFragment(replicationController.spec.selector)}},type=pod">{{getSelectorUrlFragment(replicationController.spec.selector)}}</a>
</div>
<div ng-repeat="(label, value) in replicationController.spec.selector">
<a ng-href="#/dashboard/groups/type/selector/{{label}}={{value}},type=pod">{{label}}={{value}}</a>
</div>
</td>
</tr>
@@ -59,8 +72,13 @@
<tr>
<td class="name">Related Services</td>
<td class="value">
<div ng-repeat="(label, value) in replicationController.desiredState.replicaSelector">
<a ng-href="#/dashboard/groups/type/selector/{{label}}={{value}},type=service">{{label}}: {{value}}</a>
<div ng-show="replicationController.spec.selector && Object.keys(replicationController.spec.selector).length > 1">
<a ng-href="#/dashboard/groups/type/selector/{{getSelectorUrlFragment(replicationController.spec.selector)}},type=pod">{{getSelectorUrlFragment(replicationController.spec.selector)}}</a>
</div>
<div ng-repeat="(label, value) in replicationController.spec.selector">
<a ng-href="#/dashboard/groups/type/selector/{{label}}={{value}},type=service">{{label}}={{value}}</a>
</div>
</td>
</tr>