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

Add 'Select from Project' wizard to allow project templatesto be imported #1966

Merged
merged 1 commit into from
Sep 6, 2017

Conversation

jeff-phillips-18
Copy link
Member

@jeff-phillips-18 jeff-phillips-18 commented Aug 25, 2017

https://trello.com/c/NFhQawHD

Requires openshift/origin-web-catalog#394

image

image

image

image

cc @openshift/team-ux-review

Copy link
Member

@rhamilto rhamilto left a 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.

Copy link

@cshinn cshinn left a 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

@beanh66 beanh66 self-requested a review August 25, 2017 17:27
Copy link
Member

@beanh66 beanh66 left a comment

Choose a reason for hiding this comment

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

var ctrl = this;
var validityWatcher;
var projectListWatcher;
var MAX_PROJECTS_TO_WATCH = 250;
Copy link
Contributor

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 😄

Copy link
Member Author

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,
Copy link
Contributor

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?

Copy link
Member Author

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

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

Copy link
Member Author

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

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.

Copy link
Member Author

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);
});
}

Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

@jeff-phillips-18
Copy link
Member Author

I've updated the less to fix the spacing issue for the horizontal rule

@jeff-phillips-18
Copy link
Member Author

image

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.

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

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

Copy link
Member Author

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

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed the watch.

@jeff-phillips-18
Copy link
Member Author

@spadgett Updated to not pull the image streams into the selection list. This dialog will only handle the templates at this point.

@openshift-bot openshift-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 29, 2017
@benjaminapetersen
Copy link
Contributor

How does it look with lots of templates & images? If you give that user access to openshift namespace & can see a huge list?

Asking because it is a little awkward feeling with just one item, but I bet it looks better when there is more.

@jeff-phillips-18
Copy link
Member Author

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

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

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

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?

@openshift-bot openshift-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 5, 2017
@jeff-phillips-18 jeff-phillips-18 changed the title [WIP] Add 'Select from Project' wizard to allow project templates/images to be imported Add 'Select from Project' wizard to allow project templates/images to be imported Sep 6, 2017
@jeff-phillips-18
Copy link
Member Author

Removed WIP status, ready for final reviews.


var updateProjects = function() {
var filteredProjects = _.reject(ctrl.unfilteredProjects, 'metadata.deletionTimestamp');
var projects = _.sortBy(filteredProjects, $filter('displayName'));
Copy link
Contributor

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.

@spadgett
Copy link
Member

spadgett commented Sep 6, 2017

[merge]

@spadgett spadgett changed the title Add 'Select from Project' wizard to allow project templates/images to be imported Add 'Select from Project' wizard to allow project templatesto be imported Sep 6, 2017
@openshift-bot
Copy link

Evaluated for origin web console merge up to 197c465

@openshift-bot
Copy link

openshift-bot commented Sep 6, 2017

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)

@openshift-bot openshift-bot merged commit 73c7420 into openshift:master Sep 6, 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.

None yet

8 participants