Skip to content

Commit 2a28378

Browse files
Add select to env tab on pod page
1 parent 03b49b4 commit 2a28378

File tree

2 files changed

+48
-11
lines changed

2 files changed

+48
-11
lines changed

Diff for: app/scripts/controllers/pod.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,14 @@ angular.module('openshiftConsole')
4747

4848
// Must always be initialized so we can watch selectedTab
4949
$scope.selectedTab = {};
50-
50+
// we might want to start structuring this data more?
51+
$scope.tabs = {
52+
env: {
53+
selected: {
54+
container: null
55+
}
56+
}
57+
};
5158
var watches = [];
5259

5360
// Check if the metrics service is available so we know when to show the tab.
@@ -217,6 +224,7 @@ angular.module('openshiftConsole')
217224
function(pod) {
218225
$scope.loaded = true;
219226
$scope.pod = pod;
227+
$scope.tabs.env.selected.container = pod.spec.containers[0].name;
220228
setLogVars(pod);
221229
setContainerVars();
222230
var pods = {};

Diff for: app/views/browse/pod.html

+39-10
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,46 @@ <h1>
5959
</uib-tab>
6060
<uib-tab heading="Environment" active="selectedTab.environment">
6161
<uib-tab-heading>Environment</uib-tab-heading>
62-
<div ng-repeat="container in pod.spec.containers">
63-
<h3>Container {{container.name}} Environment Variables</h3>
64-
<key-value-editor
65-
entries="container.env"
66-
is-readonly
67-
cannot-add
68-
cannot-sort
69-
cannot-delete
70-
ng-if="container.env.length"></key-value-editor>
71-
<em ng-if="!container.env.length">The container specification has no environment variables set.</em>
62+
63+
<div class="row">
64+
<div class="col-sm-6 col-lg-4">
65+
<span ng-if="pod.spec.containers.length === 1">
66+
<label for="selectLogContainer">Container:</label>
67+
{{pod.spec.containers[0].name}}
68+
</span>
69+
<ui-select
70+
ng-if="pod.spec.containers.length > 1"
71+
ng-model="tabs.env.selected.container">
72+
<ui-select-match
73+
class="truncate"
74+
placeholder="Container Name">
75+
<span ng-bind="tabs.env.selected.container"></span>
76+
</ui-select-match>
77+
<ui-select-choices
78+
repeat="container.name as container in pod.spec.containers">
79+
{{container.name}}
80+
</ui-select-choices>
81+
</ui-select>
82+
</div>
83+
</div>
84+
85+
<div
86+
class="row"
87+
ng-repeat="container in pod.spec.containers"
88+
ng-show="tabs.env.selected.container === container.name">
89+
<div class="col-sm-12">
90+
<h3>Container {{container.name}} Environment Variables</h3>
91+
<key-value-editor
92+
entries="container.env"
93+
is-readonly
94+
cannot-add
95+
cannot-sort
96+
cannot-delete
97+
ng-if="container.env.length"></key-value-editor>
98+
<em ng-if="!container.env.length">The container specification has no environment variables set.</em>
99+
</div>
72100
</div>
101+
73102
</uib-tab>
74103
<uib-tab ng-if="metricsAvailable" heading="Metrics" active="selectedTab.metrics">
75104
<!-- Use ng-if to remove the metrics directive when the tab is not active so

0 commit comments

Comments
 (0)