@@ -15,16 +15,21 @@ angular.module('openshiftConsole')
15
15
DeploymentsService ,
16
16
HPAService ,
17
17
ImageStreamResolver ,
18
+ LabelFilter ,
19
+ Logger ,
18
20
ModalsService ,
19
21
Navigate ,
20
22
OwnerReferencesService ,
21
- Logger ,
22
23
ProjectsService ,
23
24
StorageService ) {
24
25
var imageStreamImageRefByDockerReference = { } ; // lets us determine if a particular container's docker image reference belongs to an imageStream
25
26
26
27
$scope . projectName = $routeParams . project ;
27
28
$scope . name = $routeParams . deployment ;
29
+ $scope . replicaSetsForDeployment = { } ;
30
+ $scope . unfilteredReplicaSetsForDeployment = { } ;
31
+ $scope . labelSuggestions = { } ;
32
+ $scope . emptyMessage = "Loading..." ;
28
33
$scope . forms = { } ;
29
34
$scope . alerts = { } ;
30
35
$scope . imagesByDockerReference = { } ;
@@ -91,10 +96,18 @@ angular.module('openshiftConsole')
91
96
group : 'extensions' ,
92
97
resource : 'replicasets'
93
98
} , context , function ( replicaSetData ) {
99
+ $scope . emptyMessage = "No deployments to show" ;
100
+
94
101
var replicaSets = replicaSetData . by ( 'metadata.name' ) ;
95
102
replicaSets = OwnerReferencesService . filterForController ( replicaSets , deployment ) ;
96
103
$scope . inProgressDeployment = _ . chain ( replicaSets ) . filter ( 'status.replicas' ) . size ( ) > 1 ;
97
- $scope . replicaSetsForDeployment = DeploymentsService . sortByRevision ( replicaSets ) ;
104
+
105
+ $scope . unfilteredReplicaSetsForDeployment = DeploymentsService . sortByRevision ( replicaSets ) ;
106
+ $scope . replicaSetsForDeployment = LabelFilter . getLabelSelector ( ) . select ( $scope . unfilteredReplicaSetsForDeployment ) ;
107
+
108
+ updateFilterWarning ( ) ;
109
+ LabelFilter . addLabelSuggestionsFromResources ( $scope . unfilteredReplicaSetsForDeployment , $scope . labelSuggestions ) ;
110
+ LabelFilter . setLabelSuggestions ( $scope . labelSuggestions ) ;
98
111
} ) ) ;
99
112
} ,
100
113
// failure
@@ -140,6 +153,25 @@ angular.module('openshiftConsole')
140
153
Logger . log ( "builds (subscribe)" , $scope . builds ) ;
141
154
} ) ) ;
142
155
156
+ function updateFilterWarning ( ) {
157
+ if ( ! LabelFilter . getLabelSelector ( ) . isEmpty ( ) && _ . isEmpty ( $scope . replicaSetsForDeployment ) && ! _ . isEmpty ( $scope . unfilteredReplicaSetsForDeployment ) ) {
158
+ $scope . alerts [ "filter-hiding-all" ] = {
159
+ type : "warning" ,
160
+ details : "The active filters are hiding all rollout history."
161
+ } ;
162
+ }
163
+ else {
164
+ delete $scope . alerts [ "filter-hiding-all" ] ;
165
+ }
166
+ }
167
+
168
+ LabelFilter . onActiveFiltersChanged ( function ( labelSelector ) {
169
+ $scope . $evalAsync ( function ( ) {
170
+ $scope . replicaSetsForDeployment = labelSelector . select ( $scope . unfilteredReplicaSetsForDeployment ) ;
171
+ updateFilterWarning ( ) ;
172
+ } ) ;
173
+ } ) ;
174
+
143
175
$scope . scale = function ( replicas ) {
144
176
var showScalingError = function ( result ) {
145
177
$scope . alerts = $scope . alerts || { } ;
0 commit comments