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 grouping to Select from Project #2336

Merged
merged 1 commit into from
Oct 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/scripts/directives/processTemplateDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@
}));
};

// TODO: Update the select-project component in the origin-web-catalog to optionally
// disable creating new projects, so we can reuse it.
ctrl.groupChoicesBy = function (item) {
if (RecentlyViewedProjectsService.isRecentlyViewed(item.metadata.uid)) {
return "Recently Viewed";
}
return "Other Projects";
};

function getIconClass() {
var iconClass = _.get(ctrl, 'template.metadata.annotations.iconClass', 'fa fa-clone');
return (iconClass.indexOf('icon-') !== -1) ? 'font-icon ' + iconClass : iconClass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ <h2>Select from Project</h2>
<ui-select-match placeholder="Select a Project">
{{$select.selected | displayName}}
</ui-select-match>
<ui-select-choices repeat="project in $ctrl.templateProjects | searchProjects : $select.search track by (project | uid)">
<ui-select-choices repeat="project in $ctrl.templateProjects | searchProjects : $select.search track by (project | uid)" group-by="$ctrl.groupChoicesBy">
<span ng-bind-html="project | displayName | highlightKeywords : $select.search"></span>
<span ng-if="project | displayName : true" class="small text-muted">
<span ng-if="project.metadata.name">&ndash;</span>
Expand Down
2 changes: 2 additions & 0 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13274,6 +13274,8 @@ type: "error",
message: t
});
}));
}, b.groupChoicesBy = function(e) {
return c.isRecentlyViewed(e.metadata.uid) ? "Recently Viewed" : "Other Projects";
};
var w = function() {
var e = _.reject(b.unfilteredProjects, "metadata.deletionTimestamp"), n = _.sortBy(e, t("displayName"));
Expand Down
2 changes: 1 addition & 1 deletion dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -9041,7 +9041,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<ui-select-match placeholder=\"Select a Project\">\n" +
"{{$select.selected | displayName}}\n" +
"</ui-select-match>\n" +
"<ui-select-choices repeat=\"project in $ctrl.templateProjects | searchProjects : $select.search track by (project | uid)\">\n" +
"<ui-select-choices repeat=\"project in $ctrl.templateProjects | searchProjects : $select.search track by (project | uid)\" group-by=\"$ctrl.groupChoicesBy\">\n" +
"<span ng-bind-html=\"project | displayName | highlightKeywords : $select.search\"></span>\n" +
"<span ng-if=\"project | displayName : true\" class=\"small text-muted\">\n" +
"<span ng-if=\"project.metadata.name\">&ndash;</span>\n" +
Expand Down