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(','); };
}
]);