Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inform the user when no projects to select templates from #2399

Merged
merged 1 commit into from
Oct 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -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."
Expand Down Expand Up @@ -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",
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