From ea89e15be731f28e55e7814cfe1d72d69d15d64e Mon Sep 17 00:00:00 2001 From: Jeffrey Phillips Date: Tue, 31 Oct 2017 11:49:35 -0400 Subject: [PATCH] Inform the user when no projects to select templates from --- app/scripts/directives/processTemplateDialog.js | 13 ++++++++++++- .../process-template-select.html | 7 +++++-- dist/scripts/scripts.js | 9 ++++++--- dist/scripts/templates.js | 8 +++++--- 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/app/scripts/directives/processTemplateDialog.js b/app/scripts/directives/processTemplateDialog.js index 1c9137d21e..3a923b2447 100644 --- a/app/scripts/directives/processTemplateDialog.js +++ b/app/scripts/directives/processTemplateDialog.js @@ -96,9 +96,14 @@ ctrl.noProjectsCantCreate = true; }); + ctrl.noProjectsEmptyState = { + title: 'No Available Projects', + info: 'There are no projects available from which to load templates.' + }; + ctrl.projectEmptyState = { title: 'No Project Selected', - info: 'Please select a project from the dropdown to load Templates from that project.' + info: 'Please select a project from the dropdown to load templates from that project.' }; ctrl.templatesEmptyState = { @@ -326,6 +331,12 @@ ctrl.searchEnabled = !_.isEmpty(filteredProjects); ctrl.templateProjects = RecentlyViewedProjectsService.orderByMostRecentlyViewed(projects); + ctrl.numTemplateProjects = _.size(ctrl.templateProjects); + + if (ctrl.numTemplateProjects === 1) { + ctrl.templateProject = _.head(ctrl.templateProjects); + ctrl.templateProjectChange(); + } }; function listProjects() { diff --git a/app/views/directives/process-template-dialog/process-template-select.html b/app/views/directives/process-template-dialog/process-template-select.html index de961f0eb1..88cb11fa51 100644 --- a/app/views/directives/process-template-dialog/process-template-select.html +++ b/app/views/directives/process-template-dialog/process-template-select.html @@ -1,8 +1,10 @@
-
+

Select from Project

+ Select from Project
- + +
diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index 03a37df93f..304fcfc2df 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -13248,9 +13248,12 @@ b.infoStep.selected = !1, b.selectStep.selected = !1, b.configStep.selected = !1 }, b.$onInit = function() { 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() { b.noProjectsCantCreate = !0; -}), b.projectEmptyState = { +}), b.noProjectsEmptyState = { +title: "No Available Projects", +info: "There are no projects available from which to load templates." +}, b.projectEmptyState = { title: "No Project Selected", -info: "Please select a project from the dropdown to load Templates from that project." +info: "Please select a project from the dropdown to load templates from that project." }, b.templatesEmptyState = { title: "No Templates", info: "The selected project has no templates available to import." @@ -13296,7 +13299,7 @@ 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")); -b.searchEnabled = !_.isEmpty(e), b.templateProjects = c.orderByMostRecentlyViewed(n); +b.searchEnabled = !_.isEmpty(e), b.templateProjects = c.orderByMostRecentlyViewed(n), b.numTemplateProjects = _.size(b.templateProjects), 1 === b.numTemplateProjects && (b.templateProject = _.head(b.templateProjects), b.templateProjectChange()); }; } ], controllerAs: "$ctrl", diff --git a/dist/scripts/templates.js b/dist/scripts/templates.js index 5485a88953..b2608d691b 100644 --- a/dist/scripts/templates.js +++ b/dist/scripts/templates.js @@ -9066,9 +9066,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( $templateCache.put('views/directives/process-template-dialog/process-template-select.html', "
\n" + "
\n" + - "
\n" + + "
\n" + "

Select from Project

\n" + - "\n" + + "\n" + + " 1\" name=\"selectProject\" ng-model=\"$ctrl.templateProject\" ng-change=\"$ctrl.templateProjectChange()\" search-enabled=\"$ctrl.searchEnabled\">\n" + "\n" + "{{$select.selected | displayName}}\n" + "\n" + @@ -9081,7 +9082,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "\n" + "\n" + "
\n" + - "\n" + + "\n" + + "\n" + "\n" + "
\n" + "
\n" +