Skip to content

Commit ea89e15

Browse files
Inform the user when no projects to select templates from
1 parent 9b48a7b commit ea89e15

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

app/scripts/directives/processTemplateDialog.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,14 @@
9696
ctrl.noProjectsCantCreate = true;
9797
});
9898

99+
ctrl.noProjectsEmptyState = {
100+
title: 'No Available Projects',
101+
info: 'There are no projects available from which to load templates.'
102+
};
103+
99104
ctrl.projectEmptyState = {
100105
title: 'No Project Selected',
101-
info: 'Please select a project from the dropdown to load Templates from that project.'
106+
info: 'Please select a project from the dropdown to load templates from that project.'
102107
};
103108

104109
ctrl.templatesEmptyState = {
@@ -326,6 +331,12 @@
326331
ctrl.searchEnabled = !_.isEmpty(filteredProjects);
327332

328333
ctrl.templateProjects = RecentlyViewedProjectsService.orderByMostRecentlyViewed(projects);
334+
ctrl.numTemplateProjects = _.size(ctrl.templateProjects);
335+
336+
if (ctrl.numTemplateProjects === 1) {
337+
ctrl.templateProject = _.head(ctrl.templateProjects);
338+
ctrl.templateProjectChange();
339+
}
329340
};
330341

331342
function listProjects() {

app/views/directives/process-template-dialog/process-template-select.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<div class="order-service-config">
22
<div class="config-top">
3-
<div class="select-project-for-template">
3+
<div ng-if="$ctrl.numTemplateProjects" class="select-project-for-template">
44
<h2>Select from Project</h2>
5+
<label ng-if="$ctrl.numTemplateProjects === 1">{{$ctrl.templateProject | displayName}}</label>
56
<ui-select
7+
ng-if="$ctrl.numTemplateProjects > 1"
68
name="selectProject"
79
ng-model="$ctrl.templateProject"
810
ng-change="$ctrl.templateProjectChange()"
@@ -19,7 +21,8 @@ <h2>Select from Project</h2>
1921
</ui-select-choices>
2022
</ui-select>
2123
</div>
22-
<pf-empty-state ng-if="!$ctrl.templateProject" config="$ctrl.projectEmptyState"></pf-empty-state>
24+
<pf-empty-state ng-if="!$ctrl.numTemplateProjects" config="$ctrl.noProjectsEmptyState"></pf-empty-state>
25+
<pf-empty-state ng-if="!$ctrl.templateProject && $ctrl.numTemplateProjects" config="$ctrl.projectEmptyState"></pf-empty-state>
2326
<pf-empty-state ng-if="$ctrl.templateProject && !$ctrl.catalogItems.length" config="$ctrl.templatesEmptyState"></pf-empty-state>
2427
<div class="services-view">
2528
<div ng-if="$ctrl.templateProject && $ctrl.catalogItems.length" class="services-items">

dist/scripts/scripts.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -13248,9 +13248,12 @@ b.infoStep.selected = !1, b.selectStep.selected = !1, b.configStep.selected = !1
1324813248
}, b.$onInit = function() {
1324913249
b.loginBaseUrl = r.openshiftAPIBaseUrl(), b.preSelectedProject = b.selectedProject = b.project, b.project && (b.templateProject = b.project, b.templateProjectChange()), h(), b.noProjectsCantCreate = !1, e.$on("no-projects-cannot-create", function() {
1325013250
b.noProjectsCantCreate = !0;
13251-
}), b.projectEmptyState = {
13251+
}), b.noProjectsEmptyState = {
13252+
title: "No Available Projects",
13253+
info: "There are no projects available from which to load templates."
13254+
}, b.projectEmptyState = {
1325213255
title: "No Project Selected",
13253-
info: "Please select a project from the dropdown to load Templates from that project."
13256+
info: "Please select a project from the dropdown to load templates from that project."
1325413257
}, b.templatesEmptyState = {
1325513258
title: "No Templates",
1325613259
info: "The selected project has no templates available to import."
@@ -13296,7 +13299,7 @@ return c.isRecentlyViewed(e.metadata.uid) ? "Recently Viewed" : "Other Projects"
1329613299
};
1329713300
var w = function() {
1329813301
var e = _.reject(b.unfilteredProjects, "metadata.deletionTimestamp"), n = _.sortBy(e, t("displayName"));
13299-
b.searchEnabled = !_.isEmpty(e), b.templateProjects = c.orderByMostRecentlyViewed(n);
13302+
b.searchEnabled = !_.isEmpty(e), b.templateProjects = c.orderByMostRecentlyViewed(n), b.numTemplateProjects = _.size(b.templateProjects), 1 === b.numTemplateProjects && (b.templateProject = _.head(b.templateProjects), b.templateProjectChange());
1330013303
};
1330113304
} ],
1330213305
controllerAs: "$ctrl",

dist/scripts/templates.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -9066,9 +9066,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
90669066
$templateCache.put('views/directives/process-template-dialog/process-template-select.html',
90679067
"<div class=\"order-service-config\">\n" +
90689068
"<div class=\"config-top\">\n" +
9069-
"<div class=\"select-project-for-template\">\n" +
9069+
"<div ng-if=\"$ctrl.numTemplateProjects\" class=\"select-project-for-template\">\n" +
90709070
"<h2>Select from Project</h2>\n" +
9071-
"<ui-select name=\"selectProject\" ng-model=\"$ctrl.templateProject\" ng-change=\"$ctrl.templateProjectChange()\" search-enabled=\"$ctrl.searchEnabled\">\n" +
9071+
"<label ng-if=\"$ctrl.numTemplateProjects === 1\">{{$ctrl.templateProject | displayName}}</label>\n" +
9072+
"<ui-select ng-if=\"$ctrl.numTemplateProjects > 1\" name=\"selectProject\" ng-model=\"$ctrl.templateProject\" ng-change=\"$ctrl.templateProjectChange()\" search-enabled=\"$ctrl.searchEnabled\">\n" +
90729073
"<ui-select-match placeholder=\"Select a Project\">\n" +
90739074
"{{$select.selected | displayName}}\n" +
90749075
"</ui-select-match>\n" +
@@ -9081,7 +9082,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
90819082
"</ui-select-choices>\n" +
90829083
"</ui-select>\n" +
90839084
"</div>\n" +
9084-
"<pf-empty-state ng-if=\"!$ctrl.templateProject\" config=\"$ctrl.projectEmptyState\"></pf-empty-state>\n" +
9085+
"<pf-empty-state ng-if=\"!$ctrl.numTemplateProjects\" config=\"$ctrl.noProjectsEmptyState\"></pf-empty-state>\n" +
9086+
"<pf-empty-state ng-if=\"!$ctrl.templateProject && $ctrl.numTemplateProjects\" config=\"$ctrl.projectEmptyState\"></pf-empty-state>\n" +
90859087
"<pf-empty-state ng-if=\"$ctrl.templateProject && !$ctrl.catalogItems.length\" config=\"$ctrl.templatesEmptyState\"></pf-empty-state>\n" +
90869088
"<div class=\"services-view\">\n" +
90879089
"<div ng-if=\"$ctrl.templateProject && $ctrl.catalogItems.length\" class=\"services-items\">\n" +

0 commit comments

Comments
 (0)