Skip to content

Commit

Permalink
Merge pull request #2336 from jhadvig/sort
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Add grouping to Select from Project

@spadgett PTAL

Closes #2332
  • Loading branch information
openshift-merge-robot committed Oct 23, 2017
2 parents 3d44d1c + ae6972a commit 6ce98f4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
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

0 comments on commit 6ce98f4

Please sign in to comment.