Skip to content

Commit

Permalink
Add grouping to Select from Project
Browse files Browse the repository at this point in the history
  • Loading branch information
jhadvig committed Oct 23, 2017
1 parent b2c1cf1 commit 755027a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/scripts/directives/processTemplateDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@
}));
};

// TODO: Make this as a reusable component since we are using similar method also in origin-web-catalog
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 755027a

Please sign in to comment.