-
Notifications
You must be signed in to change notification settings - Fork 231
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
Add 'Select from Project' wizard to allow project templatesto be imported #1966
Conversation
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.
Code changes look ok to me.
I find the spacing between the project picker and the horizontal rule to be a bit tight and uneven.
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 good! I agree with @rhamilto, it doesn't seem like the spacing on the left and right sides of the h.rule are the same
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 @jeff-phillips-18!
var ctrl = this; | ||
var validityWatcher; | ||
var projectListWatcher; | ||
var MAX_PROJECTS_TO_WATCH = 250; |
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.
Interested in this constant, wondering if it should be configurable via constants.js?
Curious if we will actually be watching 250 projects at one time. Thats a lot of watches 😄
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 followed the lead from https://github.com/openshift/origin-web-console/blob/master/app/scripts/controllers/projects.js#L22
We should probably define a constant somewhere. I will add a comment for now.
id: 'projectTemplates', | ||
label: 'Selection', | ||
view: 'views/directives/process-template-dialog/process-template-select.html', | ||
hidden: ctrl.useProjectTemplate !== true, |
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.
ctrl.useProjectTemplate !== true
vs !ctrl.useProjectTemplate
? Non-boolean options possible?
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.
It's a passed in parameter, I am defaulting to false unless explicitly set to true.
return KeywordService.filterForKeywords(items, ['name', 'tags'], KeywordService.generateKeywords(searchText)); | ||
} | ||
|
||
function filterChange (filters) { |
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.
Tiny nit: some inconsistent parens spacing in this file function filterChange (filters)
vs function filterItems()
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.
Fixed
} | ||
|
||
function updateFilterControls() { | ||
$timeout(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.
Always have to ask if $
is needed/should be used or if an "angular native" way can be achieved via template bindings.
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've removed the $timeout as it doesn't appear to be necessary.
ctrl.filteredItems = filterForKeywords(filter.value, ctrl.filteredItems); | ||
}); | ||
} | ||
|
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.
Curious if order of flow here matters, since what is inside updateFilterControls()
is wrapped in $timeout
...ie, could this call be the last line in this fn since its contexts will execute later?
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.
Adjusted, not sure what you were getting at but the timeout was unnecessary.
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.
Great! I just have a tendency to pause and ask a question when I see $timeout
, they are good at hiding bugs. Wasn't sure about your code here, but figured I'd mention just in case.
977c3aa
to
01ac42f
Compare
I've updated the less to fix the spacing issue for the horizontal rule |
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.
What happens when I click a builder image. It looks like we're only handling templates?
Templates are probably the 80% case, although we would need to hide image streams if we don't handle builder images in this dialog.
ctrl.projectEmptyState = { | ||
icon: 'pficon pficon-info', | ||
title: 'No Project Selected', | ||
info: 'Please select a project from the dropdown to load Templates and Images from that project' |
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.
nit: we try to use punctuation at the end of sentences in the console when possible
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.
OK, fixed.
updateProjectData(projectData); | ||
|
||
if (!ProjectsService.isProjectListIncomplete() && _.size(ctrl.unfilteredProjects) <= MAX_PROJECTS_TO_WATCH) { | ||
projectListWatcher = ProjectsService.watch($scope, updateProjectData); |
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 not sure it's worth a watch here. I'd probably just list projects to populate the dropdown. This is consistent with what we do in other project selects in the console.
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.
Removed the watch.
01ac42f
to
67ab911
Compare
@spadgett Updated to not pull the image streams into the selection list. This dialog will only handle the templates at this point. |
How does it look with lots of templates & images? If you give that user access to Asking because it is a little awkward feeling with just one item, but I bet it looks better when there is more. |
@benjaminapetersen I can add a bunch of fake templates if you'd like to see. |
ctrl.templatesEmptyState = { | ||
icon: 'pficon pficon-info', | ||
title: 'No Templates or Images', | ||
info: 'The selected project has no templates or images available to import.' |
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'll want to remove "images" from these messages if there are only templates. Maybe
"The selected project has no templates available to instantiate."
(When we add images back, we'll want to say specifically "builder images.")
ctrl.projectEmptyState = { | ||
icon: 'pficon pficon-info', | ||
title: 'No Project Selected', | ||
info: 'Please select a project from the dropdown to load Templates and Images from that project.' |
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.
'Please select a project from the dropdown to load templates from that project.'
// prevents applying an empty keyword filter | ||
// TODO: can remove the following line of code after angular-patternfly issue is fixed: | ||
// https://github.com/patternfly/angular-patternfly/issues/509 | ||
filters = _.filter(filters, 'value'); |
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 think this can be removed now?
67ab911
to
6ea5a84
Compare
6ea5a84
to
bf55372
Compare
Removed WIP status, ready for final reviews. |
bf55372
to
197c465
Compare
|
||
var updateProjects = function() { | ||
var filteredProjects = _.reject(ctrl.unfilteredProjects, 'metadata.deletionTimestamp'); | ||
var projects = _.sortBy(filteredProjects, $filter('displayName')); |
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.
Hi, this _.sortBy(...)
is unnecessary as RecentlyViewedProjectsService.orderByMostRecentlyViewed(projects)
handles a case insensitive sort of displayName.
[merge] |
Evaluated for origin web console merge up to 197c465 |
Origin Web Console Merge Results: SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_request_origin_web_console/124/) (Base Commit: 2d2e297) (PR Branch Commit: 197c465) |
https://trello.com/c/NFhQawHD
Requires openshift/origin-web-catalog#394
cc @openshift/team-ux-review