Skip to content

Commit 42b11b1

Browse files
committed
Deployment configs on the web console, with deployments grouped
1 parent 3f3b951 commit 42b11b1

File tree

3 files changed

+283
-11
lines changed

3 files changed

+283
-11
lines changed

assets/app/scripts/controllers/deployments.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
angular.module('openshiftConsole')
1111
.controller('DeploymentsController', function ($scope, DataService, $filter, LabelFilter, Logger, ImageStreamResolver) {
1212
$scope.deployments = {};
13-
$scope.podTemplates = {};
1413
$scope.unfilteredDeployments = {};
14+
$scope.deploymentConfigs = {};
15+
$scope.deploymentsByDeploymentConfig = {};
16+
$scope.podTemplates = {};
1517
$scope.imageStreams = {};
1618
$scope.imagesByDockerReference = {};
1719
$scope.imageStreamImageRefByDockerReference = {}; // lets us determine if a particular container's docker image reference belongs to an imageStream
@@ -36,9 +38,25 @@ angular.module('openshiftConsole')
3638
ImageStreamResolver.fetchReferencedImageStreamImages($scope.podTemplates, $scope.imagesByDockerReference, $scope.imageStreamImageRefByDockerReference, $scope);
3739
$scope.emptyMessage = "No deployments to show";
3840
updateFilterWarning();
41+
42+
$scope.deploymentsByDeploymentConfig = {};
43+
angular.forEach($scope.deployments, function(deployment, deploymentName) {
44+
var deploymentConfigName = "";
45+
if (deployment.metadata.annotations) {
46+
deploymentConfigName = deployment.metadata.annotations.deploymentConfig || "";
47+
}
48+
$scope.deploymentsByDeploymentConfig[deploymentConfigName] = $scope.deploymentsByDeploymentConfig[deploymentConfigName] || {};
49+
$scope.deploymentsByDeploymentConfig[deploymentConfigName][deploymentName] = deployment;
50+
});
51+
3952
Logger.log("deployments (subscribe)", $scope.deployments);
4053
}));
4154

55+
watches.push(DataService.watch("deploymentConfigs", $scope, function(deploymentConfigs) {
56+
$scope.deploymentConfigs = deploymentConfigs.by("metadata.name");
57+
Logger.log("deploymentConfigs (subscribe)", $scope.deploymentConfigs);
58+
}));
59+
4260
// Sets up subscription for imageStreams
4361
watches.push(DataService.watch("imageStreams", $scope, function(imageStreams) {
4462
$scope.imageStreams = imageStreams.by("metadata.name");

assets/app/views/deployments.html

Lines changed: 135 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,142 @@ <h1>Deployments</h1>
1010
<em>{{emptyMessage}}</em>
1111
</div>
1212
</div>
13-
<div style="margin-bottom: 10px;" ng-repeat="deployment in deployments">
14-
<h3>{{deployment.metadata.annotations.deploymentConfig}} <span class="small">({{deployment.metadata.name}})</span></h3>
15-
<div>Created: <relative-timestamp timestamp="deployment.metadata.creationTimestamp"></relative-timestamp></div>
16-
<div>Status: {{deployment.metadata.annotations.deploymentStatus}}</div>
17-
<div>Version: {{deployment.metadata.annotations.deploymentVersion}}</div>
18-
<div>Replicas: {{deployment.spec.replicas}}</div>
19-
<pod-template ng-init="podTemplate = deployment.spec.template"></pod-template>
13+
<div class="tile" ng-repeat="(deploymentConfigName, deploymentConfig) in deploymentConfigs track by (deploymentConfig | uid)">
14+
<div>
15+
<h2>{{deploymentConfigName}}</h2>
16+
<dl class="dl-horizontal left indent">
17+
<div>
18+
<dt>Created:</dt>
19+
<dd><relative-timestamp timestamp="deploymentConfig.metadata.creationTimestamp"></relative-timestamp></dd>
20+
</div>
21+
<div>
22+
<dt>Labels:</dt><dd ng-if="!deploymentConfig.metadata.labels">none</dd>
23+
<dd ng-repeat="(labelKey, labelValue) in deploymentConfig.metadata.labels">{{labelKey}}={{labelValue}}<span ng-show="!$last">, </span></dd>
24+
</div>
25+
<div>
26+
<dt>Latest Version:</dt>
27+
<dd>{{deploymentConfig.latestVersion}}</dd>
28+
</div>
29+
<div>
30+
<dt>Strategy:</dt>
31+
<dd>{{deploymentConfig.template.strategy.type}}</dd>
32+
</div>
33+
34+
<div>
35+
<h3>Template:</h3>
36+
<dl class="dl-horizontal left indent">
37+
<dt>Selectors:</dt><dd ng-if="!deploymentConfig.template.controllerTemplate.replicaSelector">none</dd>
38+
<dd ng-repeat="(selectorLabel, selectorValue) in deploymentConfig.template.controllerTemplate.replicaSelector">{{selectorLabel}}={{selectorValue}}<span ng-show="!$last">, </span></dd>
39+
<dt>Replicas:</dt>
40+
<dd>
41+
{{deploymentConfig.template.controllerTemplate.replicas}}
42+
</dd>
43+
</dl>
44+
</div>
45+
46+
<div>
47+
<h3>Triggers:</h3>
48+
<dl class="dl-horizontal left indent">
49+
<dt>Manual:</dt>
50+
<dd>
51+
<span>
52+
<button class="btn btn-primary" ng-click="" ng-disabled="">Start Deployment</button>
53+
<span>
54+
</dd>
55+
</dl>
56+
57+
<dl class="dl-horizontal left indent">
58+
<dt>Manual (CLI):
59+
<a href="{{'start-deployment' | helpLink}}" target="_blank">
60+
<span class="learn-more-block">Learn more <i class="fa fa-external-link"> </i></span>
61+
</a>
62+
</dt>
63+
<dd>
64+
<code>osc deploy {{deploymentConfigName}} --latest -n {{project.metadata.name}}</code>
65+
<copy-to-clipboard-button clipboard-text="'osc deploy ' + deploymentConfigName + ' --latest -n ' + project.metadata.name"></copy-to-clipboard-button>
66+
</dd>
67+
</dl>
68+
69+
<dl class="dl-horizontal left indent">
70+
<div ng-repeat="trigger in deploymentConfig.triggers">
71+
<span ng-switch="trigger.type">
72+
<span ng-switch-default>{{trigger.type}}</span>
73+
<span ng-switch-when="ImageChange">
74+
<div ng-switch="deploymentConfig.template.strategy.type">
75+
<div ng-switch-when="Recreate">
76+
<dl class="dl-horizontal" ng-if="trigger.imageChangeParams.from">
77+
<dt>
78+
New image for:
79+
</dt>
80+
<dd>
81+
Image stream {{trigger.imageChangeParams.from | imageRepoReference : trigger.imageChangeParams.from.kind : trigger.imageChangeParams.tag}}
82+
</dd>
83+
</dl>
84+
</div>
85+
</div>
86+
</span>
87+
<span ng-switch-when="ConfigChange">
88+
<dt>Change of:</dt>
89+
<dd>Config</dd>
90+
</span>
91+
</span>
92+
</div>
93+
</dl>
94+
</div>
95+
96+
<div class="well" style="margin-bottom: 10px;" ng-repeat="deployment in deploymentsByDeploymentConfig[deploymentConfigName] | orderObjectsByDate : true">
97+
<h3>
98+
Deployment #{{deployment.metadata.annotations.deploymentVersion}}
99+
<span ng-if="deployment.metadata.annotations.deploymentVersion == deploymentConfig.latestVersion">(latest)</span>
100+
</h3>
101+
<div>Name: {{deployment.metadata.name}}</div>
102+
<div>Created: <relative-timestamp timestamp="deployment.metadata.creationTimestamp"></relative-timestamp></div>
103+
<div>
104+
<span>Status: {{deployment.metadata.annotations.deploymentStatus}}</span>
105+
<span ng-switch="deployment.metadata.annotations.deploymentStatus" class="hide-ng-leave">
106+
<span ng-switch-when="Running"> for <duration-until-now timestamp="deployment.metadata.creationTimestamp"></duration-until-now></span>
107+
<span ng-switch-when="New"> for <duration-until-now timestamp="deployment.metadata.creationTimestamp"></duration-until-now></span>
108+
<span ng-switch-when="Pending"> for <duration-until-now timestamp="deployment.metadata.creationTimestamp"></duration-until-now></span>
109+
</span>
110+
<span ng-switch="deployment.metadata.annotations.deploymentStatus" class="hide-ng-leave">
111+
<span style="margin-left: 5px;" ng-switch-default class="fa fa-refresh fa-spin" aria-hidden="true"></span>
112+
<span ng-switch-when="Complete" class="fa fa-check text-success" aria-hidden="true"></span>
113+
<span ng-switch-when="Failed" class="fa fa-times text-danger" aria-hidden="true"></span>
114+
</span>
115+
</div>
116+
<div>
117+
Labels: <span ng-if="!deployment.metadata.labels">none</span>
118+
<span ng-repeat="(labelKey, labelValue) in deployment.metadata.labels">{{labelKey}}={{labelValue}}<span ng-show="!$last">, </span></span>
119+
</div>
120+
<div>
121+
Selectors: <span ng-if="!deployment.spec.selector">none</span>
122+
<span ng-repeat="(labelKey, labelValue) in deployment.spec.selector">{{labelKey}}={{labelValue}}<span ng-show="!$last">, </span></span>
123+
</div>
124+
<div>Replicas: {{deployment.spec.replicas}}</div>
125+
<pod-template ng-init="podTemplate = deployment.spec.template"></pod-template>
126+
</div>
127+
</div>
128+
</div>
129+
130+
<!-- render any deployments whose deployment configs no longer exist -->
131+
<div class="tile" ng-repeat="(deploymentConfigName, deployments) in deploymentsByDeploymentConfig" ng-if="!deploymentConfigs[deploymentConfigName]">
132+
<h2 ng-if="deploymentConfigName != ''">
133+
{{deploymentConfigName}}
134+
<span class="pficon-layered" data-toggle="tooltip" data-placement="right" title="This deployment config no longer exists" style="cursor: help;">
135+
<span class="pficon pficon-warning-triangle"></span>
136+
<span class="pficon pficon-warning-exclamation"></span>
137+
</span>
138+
</h2>
139+
<div style="margin-bottom: 10px;" ng-repeat="deployment in deployments track by (deployment | uid) | orderObjectsByDate : true">
140+
<h3>{{deployment.metadata.annotations.deploymentConfig}} <span class="small">({{deployment.metadata.name}})</span></h3>
141+
<div>Created: <relative-timestamp timestamp="deployment.metadata.creationTimestamp"></relative-timestamp></div>
142+
<div>Status: {{deployment.metadata.annotations.deploymentStatus}}</div>
143+
<div>Version: {{deployment.metadata.annotations.deploymentVersion}}</div>
144+
<div>Replicas: {{deployment.spec.replicas}}</div>
145+
<pod-template ng-init="podTemplate = deployment.spec.template"></pod-template>
146+
</div>
20147
</div>
148+
21149
</div>
22150
</project-page>
23151
</div>

pkg/assets/bindata.go

Lines changed: 129 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16037,10 +16037,15 @@ type:"warning",
1603716037
details:"The active filters are hiding all deployments."
1603816038
};
1603916039
}
16040-
a.deployments = {}, a.podTemplates = {}, a.unfilteredDeployments = {}, a.imageStreams = {}, a.imagesByDockerReference = {}, a.imageStreamImageRefByDockerReference = {}, a.builds = {}, a.labelSuggestions = {}, a.alerts = a.alerts || {}, a.emptyMessage = "Loading...";
16040+
a.deployments = {}, a.unfilteredDeployments = {}, a.deploymentConfigs = {}, a.deploymentsByDeploymentConfig = {}, a.podTemplates = {}, a.imageStreams = {}, a.imagesByDockerReference = {}, a.imageStreamImageRefByDockerReference = {}, a.builds = {}, a.labelSuggestions = {}, a.alerts = a.alerts || {}, a.emptyMessage = "Loading...";
1604116041
var i = [];
1604216042
i.push(b.watch("replicationcontrollers", a, function(b) {
16043-
a.unfilteredDeployments = b.by("metadata.name"), d.addLabelSuggestionsFromResources(a.unfilteredDeployments, a.labelSuggestions), d.setLabelSuggestions(a.labelSuggestions), a.deployments = d.getLabelSelector().select(a.unfilteredDeployments), g(), f.fetchReferencedImageStreamImages(a.podTemplates, a.imagesByDockerReference, a.imageStreamImageRefByDockerReference, a), a.emptyMessage = "No deployments to show", h(), e.log("deployments (subscribe)", a.deployments);
16043+
a.unfilteredDeployments = b.by("metadata.name"), d.addLabelSuggestionsFromResources(a.unfilteredDeployments, a.labelSuggestions), d.setLabelSuggestions(a.labelSuggestions), a.deployments = d.getLabelSelector().select(a.unfilteredDeployments), g(), f.fetchReferencedImageStreamImages(a.podTemplates, a.imagesByDockerReference, a.imageStreamImageRefByDockerReference, a), a.emptyMessage = "No deployments to show", h(), a.deploymentsByDeploymentConfig = {}, angular.forEach(a.deployments, function(b, c) {
16044+
var d = "";
16045+
b.metadata.annotations && (d = b.metadata.annotations.deploymentConfig || ""), a.deploymentsByDeploymentConfig[d] = a.deploymentsByDeploymentConfig[d] || {}, a.deploymentsByDeploymentConfig[d][c] = b;
16046+
}), e.log("deployments (subscribe)", a.deployments);
16047+
})), i.push(b.watch("deploymentConfigs", a, function(b) {
16048+
a.deploymentConfigs = b.by("metadata.name"), e.log("deploymentConfigs (subscribe)", a.deploymentConfigs);
1604416049
})), i.push(b.watch("imageStreams", a, function(b) {
1604516050
a.imageStreams = b.by("metadata.name"), f.buildDockerRefMapForImageStreams(a.imageStreams, a.imageStreamImageRefByDockerReference), f.fetchReferencedImageStreamImages(a.podTemplates, a.imagesByDockerReference, a.imageStreamImageRefByDockerReference, a), e.log("imageStreams (subscribe)", a.imageStreams);
1604616051
})), i.push(b.watch("builds", a, function(b) {
@@ -63875,7 +63880,127 @@ var _views_deployments_html = []byte(`<div ng-controller="ProjectController" cla
6387563880
<em>{{emptyMessage}}</em>
6387663881
</div>
6387763882
</div>
63878-
<div style="margin-bottom: 10px" ng-repeat="deployment in deployments">
63883+
<div class="tile" ng-repeat="(deploymentConfigName, deploymentConfig) in deploymentConfigs track by (deploymentConfig | uid)">
63884+
<div>
63885+
<h2>{{deploymentConfigName}}</h2>
63886+
<dl class="dl-horizontal left indent">
63887+
<div>
63888+
<dt>Created:
63889+
<dd><relative-timestamp timestamp="deploymentConfig.metadata.creationTimestamp"></relative-timestamp>
63890+
</div>
63891+
<div>
63892+
<dt>Labels:<dd ng-if="!deploymentConfig.metadata.labels">none
63893+
<dd ng-repeat="(labelKey, labelValue) in deploymentConfig.metadata.labels">{{labelKey}}={{labelValue}}<span ng-show="!$last">, </span>
63894+
</div>
63895+
<div>
63896+
<dt>Latest Version:
63897+
<dd>{{deploymentConfig.latestVersion}}
63898+
</div>
63899+
<div>
63900+
<dt>Strategy:
63901+
<dd>{{deploymentConfig.template.strategy.type}}
63902+
</div>
63903+
<div>
63904+
<h3>Template:</h3>
63905+
<dl class="dl-horizontal left indent">
63906+
<dt>Selectors:<dd ng-if="!deploymentConfig.template.controllerTemplate.replicaSelector">none
63907+
<dd ng-repeat="(selectorLabel, selectorValue) in deploymentConfig.template.controllerTemplate.replicaSelector">{{selectorLabel}}={{selectorValue}}<span ng-show="!$last">, </span>
63908+
<dt>Replicas:
63909+
<dd>
63910+
{{deploymentConfig.template.controllerTemplate.replicas}}
63911+
63912+
</dl>
63913+
</div>
63914+
<div>
63915+
<h3>Triggers:</h3>
63916+
<dl class="dl-horizontal left indent">
63917+
<dt>Manual:
63918+
<dd>
63919+
<span>
63920+
<button class="btn btn-primary" ng-click="" ng-disabled="">Start Deployment</button>
63921+
<span>
63922+
</span></span>
63923+
</dl>
63924+
<dl class="dl-horizontal left indent">
63925+
<dt>Manual (CLI):
63926+
<a href="{{'start-deployment' | helpLink}}" target="_blank">
63927+
<span class="learn-more-block">Learn more <i class="fa fa-external-link"> </i></span>
63928+
</a>
63929+
63930+
<dd>
63931+
<code>osc deploy {{deploymentConfigName}} --latest -n {{project.metadata.name}}</code>
63932+
<copy-to-clipboard-button clipboard-text="'osc deploy ' + deploymentConfigName + ' --latest -n ' + project.metadata.name"></copy-to-clipboard-button>
63933+
63934+
</dl>
63935+
<dl class="dl-horizontal left indent">
63936+
<div ng-repeat="trigger in deploymentConfig.triggers">
63937+
<span ng-switch="trigger.type">
63938+
<span ng-switch-default>{{trigger.type}}</span>
63939+
<span ng-switch-when="ImageChange">
63940+
<div ng-switch="deploymentConfig.template.strategy.type">
63941+
<div ng-switch-when="Recreate">
63942+
<dl class="dl-horizontal" ng-if="trigger.imageChangeParams.from">
63943+
<dt>
63944+
New image for:
63945+
63946+
<dd>
63947+
Image stream {{trigger.imageChangeParams.from | imageRepoReference : trigger.imageChangeParams.from.kind : trigger.imageChangeParams.tag}}
63948+
63949+
</dl>
63950+
</div>
63951+
</div>
63952+
</span>
63953+
<span ng-switch-when="ConfigChange">
63954+
<dt>Change of:
63955+
<dd>Config
63956+
</span>
63957+
</span>
63958+
</div>
63959+
</dl>
63960+
</div>
63961+
<div class="well" style="margin-bottom: 10px" ng-repeat="deployment in deploymentsByDeploymentConfig[deploymentConfigName] | orderObjectsByDate : true">
63962+
<h3>
63963+
Deployment #{{deployment.metadata.annotations.deploymentVersion}}
63964+
<span ng-if="deployment.metadata.annotations.deploymentVersion == deploymentConfig.latestVersion">(latest)</span>
63965+
</h3>
63966+
<div>Name: {{deployment.metadata.name}}</div>
63967+
<div>Created: <relative-timestamp timestamp="deployment.metadata.creationTimestamp"></relative-timestamp></div>
63968+
<div>
63969+
<span>Status: {{deployment.metadata.annotations.deploymentStatus}}</span>
63970+
<span ng-switch="deployment.metadata.annotations.deploymentStatus" class="hide-ng-leave">
63971+
<span ng-switch-when="Running"> for <duration-until-now timestamp="deployment.metadata.creationTimestamp"></duration-until-now></span>
63972+
<span ng-switch-when="New"> for <duration-until-now timestamp="deployment.metadata.creationTimestamp"></duration-until-now></span>
63973+
<span ng-switch-when="Pending"> for <duration-until-now timestamp="deployment.metadata.creationTimestamp"></duration-until-now></span>
63974+
</span>
63975+
<span ng-switch="deployment.metadata.annotations.deploymentStatus" class="hide-ng-leave">
63976+
<span style="margin-left: 5px" ng-switch-default class="fa fa-refresh fa-spin" aria-hidden="true"></span>
63977+
<span ng-switch-when="Complete" class="fa fa-check text-success" aria-hidden="true"></span>
63978+
<span ng-switch-when="Failed" class="fa fa-times text-danger" aria-hidden="true"></span>
63979+
</span>
63980+
</div>
63981+
<div>
63982+
Labels: <span ng-if="!deployment.metadata.labels">none</span>
63983+
<span ng-repeat="(labelKey, labelValue) in deployment.metadata.labels">{{labelKey}}={{labelValue}}<span ng-show="!$last">, </span></span>
63984+
</div>
63985+
<div>
63986+
Selectors: <span ng-if="!deployment.spec.selector">none</span>
63987+
<span ng-repeat="(labelKey, labelValue) in deployment.spec.selector">{{labelKey}}={{labelValue}}<span ng-show="!$last">, </span></span>
63988+
</div>
63989+
<div>Replicas: {{deployment.spec.replicas}}</div>
63990+
<pod-template ng-init="podTemplate = deployment.spec.template"></pod-template>
63991+
</div>
63992+
</dl></div>
63993+
</div>
63994+
63995+
<div class="tile" ng-repeat="(deploymentConfigName, deployments) in deploymentsByDeploymentConfig" ng-if="!deploymentConfigs[deploymentConfigName]">
63996+
<h2 ng-if="deploymentConfigName != ''">
63997+
{{deploymentConfigName}}
63998+
<span class="pficon-layered" data-toggle="tooltip" data-placement="right" title="This deployment config no longer exists" style="cursor: help">
63999+
<span class="pficon pficon-warning-triangle"></span>
64000+
<span class="pficon pficon-warning-exclamation"></span>
64001+
</span>
64002+
</h2>
64003+
<div style="margin-bottom: 10px" ng-repeat="deployment in deployments track by (deployment | uid) | orderObjectsByDate : true">
6387964004
<h3>{{deployment.metadata.annotations.deploymentConfig}} <span class="small">({{deployment.metadata.name}})</span></h3>
6388064005
<div>Created: <relative-timestamp timestamp="deployment.metadata.creationTimestamp"></relative-timestamp></div>
6388164006
<div>Status: {{deployment.metadata.annotations.deploymentStatus}}</div>
@@ -63884,6 +64009,7 @@ var _views_deployments_html = []byte(`<div ng-controller="ProjectController" cla
6388464009
<pod-template ng-init="podTemplate = deployment.spec.template"></pod-template>
6388564010
</div>
6388664011
</div>
64012+
</div>
6388764013
</project-page>
6388864014
</div>`)
6388964015

0 commit comments

Comments
 (0)