-
Notifications
You must be signed in to change notification settings - Fork 232
Label Filter for Kubernetes Deployment History Tab #1845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@spadgett there appears to be a side issue where hitting refresh on the deployment view causes the filter recommendations to reset, is this something known? The refresh issue appears on both deployment views for Kubernetes and Deployment config |
There's some code that's supposed to handle it. We should try to debug why it's not working. You might start by setting a breakpoint there to see if the code is running. origin-web-console/app/scripts/app.js Lines 466 to 472 in d0e24f5
|
@@ -21,11 +21,15 @@ angular.module('openshiftConsole') | |||
OwnerReferencesService, | |||
Logger, | |||
ProjectsService, | |||
StorageService) { | |||
StorageService, | |||
LabelFilter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've started to alphabetize the dependencies when possible to try and keep our sanity :) The lists can get long.
|
||
$scope.unfilteredReplicaSetsForDeployment = DeploymentsService.sortByRevision(replicaSets); | ||
$scope.replicaSetsForDeployment = LabelFilter.getLabelSelector().select($scope.unfilteredReplicaSetsForDeployment); | ||
$scope.orderedReplicaSetsForDeployment = $scope.replicaSetsForDeployment; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need both scope variables if they'll always have the same value. $scope.replicaSetsForDeployment
seems OK.
@@ -260,6 +269,28 @@ angular.module('openshiftConsole') | |||
Logger.log("builds (subscribe)", $scope.builds); | |||
})); | |||
|
|||
function updateFilterWarning() { | |||
if (!LabelFilter.getLabelSelector().isEmpty() && $.isArray($scope.replicaSetsForDeployment) && !$scope.replicaSetsForDeployment.length && !$.isEmptyObject($scope.unfilteredReplicaSetsForDeployment)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lodash makes it a little easier because you can pass an array or object to _.isEmpty
if (!LabelFilter.getLabelSelector().isEmpty() &&
_.isEmpty(scope.replicaSetsForDeployment) &&
!_.isEmpty($scope.unfilteredReplicaSetsForDeployment)) {
// ...
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure thing.
If we're looking for consistency, I could also flip the source to Lodash?
@@ -260,6 +269,28 @@ angular.module('openshiftConsole') | |||
Logger.log("builds (subscribe)", $scope.builds); | |||
})); | |||
|
|||
function updateFilterWarning() { | |||
if (!LabelFilter.getLabelSelector().isEmpty() && $.isArray($scope.replicaSetsForDeployment) && !$scope.replicaSetsForDeployment.length && !$.isEmptyObject($scope.unfilteredReplicaSetsForDeployment)) { | |||
$scope.alerts["deployments"] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure this is what we used on the other page, but I suggest a more descriptive ID like
$scope.alerts['filter-hiding-all'] = ...
if (!LabelFilter.getLabelSelector().isEmpty() && $.isArray($scope.replicaSetsForDeployment) && !$scope.replicaSetsForDeployment.length && !$.isEmptyObject($scope.unfilteredReplicaSetsForDeployment)) { | ||
$scope.alerts["deployments"] = { | ||
type: "warning", | ||
details: "The active filters are hiding all deployments." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"...hiding all rollout history."
|
||
LabelFilter.onActiveFiltersChanged(function(labelSelector) { | ||
// trigger a digest loop | ||
$scope.$apply(function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$scope.$evalAsync(function() { ... });
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure thing.
could also update the copy source on this one?
app/views/browse/deployment.html
Outdated
@@ -108,8 +110,11 @@ <h1 class="contains-actions"> | |||
<th>Created</th> | |||
</tr> | |||
</thead> | |||
<tbody> | |||
<tr ng-repeat="replicaSet in replicaSetsForDeployment"> | |||
<tbody ng-if="(replicaSetsForDeployment | hashSize) == 0"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replicaSetsForDeployment
is an array right? hashSize
won't work on arrays. The size
filter we have does, and we're trying to switch code to use it for that reason.
<tbody ng-if="!(replicaSetsForDeployment | size)">
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha
app/views/browse/deployment.html
Outdated
<tbody ng-if="(replicaSetsForDeployment | hashSize) == 0"> | ||
<tr><td colspan="4"><em>{{emptyMessage}}</em></td></tr> | ||
</tbody> | ||
<tbody ng-if="(replicaSetsForDeployment | hashSize) > 0"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
size
not hashSize
<tbody ng-if="replicaSetsForDeployment | size">
bbb61aa
to
8116db3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for the one comment. Do you mind opening a follow on issue for the filters not being saved on reload?
$scope.replicaSetsForDeployment = DeploymentsService.sortByRevision(replicaSets); | ||
|
||
$scope.unfilteredReplicaSetsForDeployment = DeploymentsService.sortByRevision(replicaSets); | ||
$scope.replicaSetsForDeployment = LabelFilter.getLabelSelector().select($scope.unfilteredReplicaSetsForDeployment); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we fix keeping filters on page reload, I think we need a call to updateFilterWarning
here?
8116db3
to
2f3b018
Compare
The implementation of There is however a different refresh issue involving just the alerts directive on the Kubernetes deployments |
I'm not clear on what happens. Do you have a screenshot or gif? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @cdcabrera
Approved for 3.7 |
@cdcabrera OK I see. Let's open a separate P3 issue |
2f3b018
to
7510a3f
Compare
We should hold this PR until #1836 and then rebase to pick up the new styles. |
@cdcabrera So that the filter input is wide. |
@cdcabrera FYI should be able to rebase now to pick up @sg00dwin's change |
7510a3f
to
f8fa1aa
Compare
app/views/browse/deployment.html
Outdated
@@ -92,7 +92,13 @@ <h1 class="contains-actions"> | |||
<uib-tabset> | |||
<uib-tab active="selectedTab.history"> | |||
<uib-tab-heading>History</uib-tab-heading> | |||
<div ng-if="replicaSetsForDeployment | hashSize"> | |||
<div class="table-filter-extension"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the indentation is off.
4cfded4
to
1361fdb
Compare
Implementation of label filter for Kubernetes deployment history tab
1361fdb
to
5bbf8ab
Compare
[test] |
Flake #1684 |
[test] |
Evaluated for origin web console test up to 5bbf8ab |
Origin Web Console Test Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_request_origin_web_console/23/) (Base Commit: 7b414b3) (PR Branch Commit: 5bbf8ab) |
[merge][severity: bug] |
Evaluated for origin web console merge up to 5bbf8ab |
Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin_web_console/44/) (Base Commit: e839e15) (PR Branch Commit: 5bbf8ab) (Extended Tests: bug) |
Implementation of label filter for Kubernetes deployment history tab.
Closes #1817