Skip to content
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

BZ1221441 - show unique project name in projects dropdown and project… #4704

Merged
merged 1 commit into from Sep 21, 2015

Conversation

rafabene
Copy link
Contributor

@rafabene
Copy link
Contributor Author

It needs a review from @jwforres @spadgett and @fabianofranz

@fabianofranz
Copy link
Member

Thanks for the PR @rafabene. You need to run hack/build-assets.sh to update bindata.go, then add it to your commit. After it's done we will run the tests suite on top of this.

Also make sure the spec tests are passing with hack/test-assets.sh. Check the assets docs for more info about it.

@@ -53,11 +53,16 @@ angular.module('openshiftConsole')

sortedProjects = $filter('orderByDisplayName')(projects);

options = _.map(sortedProjects, function(item) {
options = _.map(sortedProjects, function(item, index) {
Copy link
Contributor

Choose a reason for hiding this comment

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

That's a lot of calls to the display name filter. Probably faster (and easier to follow) to build a hash of displayNames:count first, then just check against that when building the options. Also, don't show in parens if the display name and project name are the same

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To avoid duplicate code in the directive and in the controller. I'm thinking to build a service for that. What do you think about this proposal ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Service seems heavyweight. Filter that takes the item and the list (e.g. uniqueDisplayName(item,items)) would be much cleaner, though it would have to calculate all display names every time

Copy link
Contributor

Choose a reason for hiding this comment

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

What about a filter that takes a set of items and returns a map of name:uniqueDisplayName. That lets you calculate once and share code

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. I'll use the approach of a filter. What about updating the displayName filter ? I think it's preferable over the creation of a new one.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer a second filter that makes use of the displayName filter

@rafabene
Copy link
Contributor Author

This is my proposal #2 for review of @jwforres @spadgett and @fabianofranz

@@ -94,6 +94,29 @@ angular.module('openshiftConsole')
return null;
};
})
.filter('displayUniqueName', function(displayNameFilter, annotationFilter){
Copy link
Contributor

Choose a reason for hiding this comment

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

uniqueDisplayName

Copy link
Member

Choose a reason for hiding this comment

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

drop annotationFilter since you aren't using it

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/5056/)

@rafabene
Copy link
Contributor Author

Thanks for the tip on JS semantics. The code is much more clear now.

@rafabene
Copy link
Contributor Author

[test]

@rafabene
Copy link
Contributor Author

I was not able to understand why there are 2 failing checks.

@fabianofranz
Copy link
Member

@rafabene It's saying that bindata.go is not up-to-date with the actual assets. You might need to run hack/build-assets.sh again and add it to the commit.

@liggitt
Copy link
Contributor

liggitt commented Sep 18, 2015

Make sure you clean assets and install assets to pick up dependency updates

@rafabene
Copy link
Contributor Author

[test]

@fabianofranz
Copy link
Member

[test] again

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 39386a9

@jwforres
Copy link
Member

[merge]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/3356/) (Image: devenv-fedora_2374)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 39386a9

openshift-bot pushed a commit that referenced this pull request Sep 21, 2015
@openshift-bot openshift-bot merged commit 3fbd1af into openshift:master Sep 21, 2015
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.

None yet

5 participants