Skip to content

Commit

Permalink
Update replication controllers for v1beta3 api
Browse files Browse the repository at this point in the history
  • Loading branch information
bcbroussard committed May 28, 2015
1 parent 1fd4050 commit f8762cc
Show file tree
Hide file tree
Showing 6 changed files with 156 additions and 102 deletions.
126 changes: 72 additions & 54 deletions pkg/ui/datafile.go

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions www/app/assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,7 @@ app.controller('ListPodsCtrl', [
app.controller('ListReplicationControllersCtrl', [
'$scope',
'$routeParams',
'k8sApi',
'k8sv1Beta3Api',
'$location',
function($scope, $routeParams, k8sApi, $location) {
'use strict';
Expand Down Expand Up @@ -1658,27 +1658,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
});

});
Expand Down Expand Up @@ -1892,14 +1891,15 @@ 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;
$scope.controller.scope = $scope;
$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(','); };

}
]);
Expand Down
40 changes: 29 additions & 11 deletions www/app/components/dashboard/views/replication.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -49,18 +58,27 @@
<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>


<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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
app.controller('ListReplicationControllersCtrl', [
'$scope',
'$routeParams',
'k8sApi',
'k8sv1Beta3Api',
'$location',
function($scope, $routeParams, k8sApi, $location) {
'use strict';
Expand Down Expand Up @@ -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
});

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ 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;
$scope.controller.scope = $scope;
$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(','); };

}
]);
40 changes: 29 additions & 11 deletions www/master/components/dashboard/views/replication.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -49,18 +58,27 @@
<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>


<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>
Expand Down

0 comments on commit f8762cc

Please sign in to comment.