Skip to content

Commit

Permalink
Merge pull request #2399 from jeff-phillips-18/templates
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Inform the user when no projects to select templates from

Also disables the project selection dropdown where there is but one project.

fixes #2396
  • Loading branch information
openshift-merge-robot authored Oct 31, 2017
2 parents e865849 + ea89e15 commit b066a73
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
13 changes: 12 additions & 1 deletion app/scripts/directives/processTemplateDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<div class="order-service-config">
<div class="config-top">
<div class="select-project-for-template">
<div ng-if="$ctrl.numTemplateProjects" class="select-project-for-template">
<h2>Select from Project</h2>
<label ng-if="$ctrl.numTemplateProjects === 1">{{$ctrl.templateProject | displayName}}</label>
<ui-select
ng-if="$ctrl.numTemplateProjects > 1"
name="selectProject"
ng-model="$ctrl.templateProject"
ng-change="$ctrl.templateProjectChange()"
Expand All @@ -19,7 +21,8 @@ <h2>Select from Project</h2>
</ui-select-choices>
</ui-select>
</div>
<pf-empty-state ng-if="!$ctrl.templateProject" config="$ctrl.projectEmptyState"></pf-empty-state>
<pf-empty-state ng-if="!$ctrl.numTemplateProjects" config="$ctrl.noProjectsEmptyState"></pf-empty-state>
<pf-empty-state ng-if="!$ctrl.templateProject && $ctrl.numTemplateProjects" config="$ctrl.projectEmptyState"></pf-empty-state>
<pf-empty-state ng-if="$ctrl.templateProject && !$ctrl.catalogItems.length" config="$ctrl.templatesEmptyState"></pf-empty-state>
<div class="services-view">
<div ng-if="$ctrl.templateProject && $ctrl.catalogItems.length" class="services-items">
Expand Down
9 changes: 6 additions & 3 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -13244,9 +13244,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."
Expand Down Expand Up @@ -13292,7 +13295,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",
Expand Down
8 changes: 5 additions & 3 deletions dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -9066,9 +9066,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
$templateCache.put('views/directives/process-template-dialog/process-template-select.html',
"<div class=\"order-service-config\">\n" +
"<div class=\"config-top\">\n" +
"<div class=\"select-project-for-template\">\n" +
"<div ng-if=\"$ctrl.numTemplateProjects\" class=\"select-project-for-template\">\n" +
"<h2>Select from Project</h2>\n" +
"<ui-select name=\"selectProject\" ng-model=\"$ctrl.templateProject\" ng-change=\"$ctrl.templateProjectChange()\" search-enabled=\"$ctrl.searchEnabled\">\n" +
"<label ng-if=\"$ctrl.numTemplateProjects === 1\">{{$ctrl.templateProject | displayName}}</label>\n" +
"<ui-select ng-if=\"$ctrl.numTemplateProjects > 1\" name=\"selectProject\" ng-model=\"$ctrl.templateProject\" ng-change=\"$ctrl.templateProjectChange()\" search-enabled=\"$ctrl.searchEnabled\">\n" +
"<ui-select-match placeholder=\"Select a Project\">\n" +
"{{$select.selected | displayName}}\n" +
"</ui-select-match>\n" +
Expand All @@ -9081,7 +9082,8 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"</ui-select-choices>\n" +
"</ui-select>\n" +
"</div>\n" +
"<pf-empty-state ng-if=\"!$ctrl.templateProject\" config=\"$ctrl.projectEmptyState\"></pf-empty-state>\n" +
"<pf-empty-state ng-if=\"!$ctrl.numTemplateProjects\" config=\"$ctrl.noProjectsEmptyState\"></pf-empty-state>\n" +
"<pf-empty-state ng-if=\"!$ctrl.templateProject && $ctrl.numTemplateProjects\" config=\"$ctrl.projectEmptyState\"></pf-empty-state>\n" +
"<pf-empty-state ng-if=\"$ctrl.templateProject && !$ctrl.catalogItems.length\" config=\"$ctrl.templatesEmptyState\"></pf-empty-state>\n" +
"<div class=\"services-view\">\n" +
"<div ng-if=\"$ctrl.templateProject && $ctrl.catalogItems.length\" class=\"services-items\">\n" +
Expand Down

0 comments on commit b066a73

Please sign in to comment.