Skip to content

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

Merged
merged 1 commit into from
Jul 21, 2017

Conversation

cdcabrera
Copy link
Contributor

@cdcabrera cdcabrera commented Jul 13, 2017

Implementation of label filter for Kubernetes deployment history tab.

Closes #1817

test-kb3-jul-13-2017 15-27-17

@cdcabrera
Copy link
Contributor Author

cdcabrera commented Jul 13, 2017

@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

@spadgett
Copy link
Member

spadgett commented Jul 14, 2017

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.

.run(function($rootScope, LabelFilter){
// assume we always want filterState persisted, pages that dont can turn it off
LabelFilter.persistFilterState(true);
$rootScope.$on('$routeChangeSuccess', function() {
LabelFilter.readPersistedState();
});
})

@@ -21,11 +21,15 @@ angular.module('openshiftConsole')
OwnerReferencesService,
Logger,
ProjectsService,
StorageService) {
StorageService,
LabelFilter) {
Copy link
Member

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;
Copy link
Member

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)) {
Copy link
Member

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)) {
  // ...
}

Copy link
Contributor Author

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"] = {
Copy link
Member

@spadgett spadgett Jul 14, 2017

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."
Copy link
Member

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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$scope.$evalAsync(function() { ... });

Copy link
Contributor Author

@cdcabrera cdcabrera Jul 14, 2017

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?

@@ -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">
Copy link
Member

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)">

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gotcha

<tbody ng-if="(replicaSetsForDeployment | hashSize) == 0">
<tr><td colspan="4"><em>{{emptyMessage}}</em></td></tr>
</tbody>
<tbody ng-if="(replicaSetsForDeployment | hashSize) > 0">
Copy link
Member

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">

@cdcabrera cdcabrera force-pushed the issue-labelfilter branch from bbb61aa to 8116db3 Compare July 14, 2017 02:42
Copy link
Member

@spadgett spadgett left a 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);
Copy link
Member

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?

@cdcabrera cdcabrera force-pushed the issue-labelfilter branch from 8116db3 to 2f3b018 Compare July 14, 2017 14:56
@cdcabrera
Copy link
Contributor Author

The implementation of updateFilterWarning and two additional lines involving addLabelSuggestionsFromResources and setLabelSuggestions fixed the refresh issue for Kubernetes deployments. Additional review over the deployment config and I'm unable to recreate the refresh issue there. Looks like we can avoid declaring another issue

There is however a different refresh issue involving just the alerts directive on the Kubernetes deployments deployment.html, ever 3rd refresh and it double jumps. Any ideas?

@spadgett
Copy link
Member

There is however a different refresh issue involving just the alerts directive on the Kubernetes deployments deployment.html, ever 3rd refresh and it double jumps. Any ideas?

I'm not clear on what happens. Do you have a screenshot or gif?

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @cdcabrera

@spadgett
Copy link
Member

Approved for 3.7

@cdcabrera
Copy link
Contributor Author

Refresh jump...

refresh-jul-14-2017 11-16-27

@spadgett
Copy link
Member

@cdcabrera OK I see. Let's open a separate P3 issue

@spadgett
Copy link
Member

spadgett commented Jul 19, 2017

We should hold this PR until #1836 and then rebase to pick up the new styles.

@sg00dwin
Copy link
Member

sg00dwin commented Jul 19, 2017

@cdcabrera
fyi - in #1836 the class table-filter-wrapper was replaced with

https://github.com/sg00dwin/origin-web-console/blob/ddf4e78a77c0347c342ad1af577d8c2d1b09da36/app/views/browse/build-config.html#L178-L184

So that the filter input is wide.

@spadgett
Copy link
Member

@cdcabrera FYI should be able to rebase now to pick up @sg00dwin's change

@cdcabrera cdcabrera force-pushed the issue-labelfilter branch from 7510a3f to f8fa1aa Compare July 19, 2017 20:46
@cdcabrera cdcabrera requested a review from sg00dwin July 19, 2017 20:47
@cdcabrera
Copy link
Contributor Author

cdcabrera commented Jul 19, 2017

@@ -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">
Copy link
Member

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.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 20, 2017
@cdcabrera cdcabrera force-pushed the issue-labelfilter branch 2 times, most recently from 4cfded4 to 1361fdb Compare July 20, 2017 21:30
@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 20, 2017
Implementation of label filter for Kubernetes deployment
history tab
@cdcabrera cdcabrera force-pushed the issue-labelfilter branch from 1361fdb to 5bbf8ab Compare July 21, 2017 13:59
@cdcabrera
Copy link
Contributor Author

[test]

@spadgett
Copy link
Member

Error: Timed out waiting for the WebDriver server at http://172.18.5.25:33526/wd/hub

Flake #1684

@cdcabrera
Copy link
Contributor Author

[test]

@openshift-bot
Copy link

Evaluated for origin web console test up to 5bbf8ab

@openshift-bot
Copy link

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)

@spadgett
Copy link
Member

[merge][severity: bug]

@openshift-bot
Copy link

Evaluated for origin web console merge up to 5bbf8ab

@openshift-bot
Copy link

openshift-bot commented Jul 21, 2017

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)

@spadgett spadgett changed the title [WIP] Label Filter for Kubernetes Deployment History Tab Label Filter for Kubernetes Deployment History Tab Jul 21, 2017
@openshift-bot openshift-bot merged commit ab5f706 into openshift:master Jul 21, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants