Skip to content

Commit 39361a1

Browse files
author
OpenShift Bot
authored
Merge pull request #2054 from jeff-phillips-18/browse
Merged by openshift-bot
2 parents 9476f92 + b35c0df commit 39361a1

File tree

2 files changed

+46
-58
lines changed

2 files changed

+46
-58
lines changed

app/scripts/directives/processTemplateDialog.js

+4-13
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@
166166
Catalog.getProjectCatalogItems(ctrl.templateProjectName, false, true).then( _.spread(function(catalogServiceItems, errorMessage) {
167167
ctrl.catalogItems = catalogServiceItems;
168168
ctrl.totalCount = ctrl.catalogItems.length;
169-
filterItems();
169+
170+
// Clear previous filters
171+
filterChange();
170172

171173
if (errorMessage) {
172174
NotificationsService.addNotification(
@@ -248,23 +250,12 @@
248250
ctrl.filteredItems = filterForKeywords(filter.value, ctrl.filteredItems);
249251
});
250252
}
253+
ctrl.filterConfig.resultsCount = ctrl.filteredItems.length;
251254

252255
// Deselect the currently selected template if it was filtered out
253256
if (!_.includes(ctrl.filteredItems, ctrl.selectedTemplate)) {
254257
ctrl.templateSelected();
255258
}
256-
257-
updateFilterControls();
258-
}
259-
260-
function updateFilterControls() {
261-
ctrl.filterConfig.resultsCount = ctrl.filteredItems.length;
262-
263-
if (ctrl.totalCount <= 1) {
264-
$('.filter-pf.filter-fields input').attr('disabled', '');
265-
} else {
266-
$('.filter-pf.filter-fields input').removeAttr("disabled");
267-
}
268259
}
269260

270261
var updateProjects = function() {

dist/scripts/scripts.js

+42-45
Original file line numberDiff line numberDiff line change
@@ -12677,14 +12677,14 @@ templateUrl: "views/directives/process-template.html"
1267712677
angular.module("openshiftConsole").component("processTemplateDialog", {
1267812678
controller: [ "$scope", "$filter", "Catalog", "DataService", "KeywordService", "NotificationsService", "ProjectsService", "RecentlyViewedProjectsService", function(e, t, n, a, r, o, i, s) {
1267912679
function c() {
12680-
var e = _.get(y, "template.metadata.annotations.iconClass", "fa fa-clone");
12680+
var e = _.get(v, "template.metadata.annotations.iconClass", "fa fa-clone");
1268112681
return -1 !== e.indexOf("icon-") ? "font-icon " + e : e;
1268212682
}
1268312683
function l() {
12684-
y.steps || (y.steps = [ y.selectStep, y.configStep, y.resultsStep ]);
12684+
v.steps || (v.steps = [ v.selectStep, v.configStep, v.resultsStep ]);
1268512685
}
1268612686
function u() {
12687-
v && (v(), v = void 0);
12687+
h && (h(), h = void 0);
1268812688
}
1268912689
function d() {
1269012690
e.$broadcast("instantiateTemplate");
@@ -12693,67 +12693,64 @@ function m(e, t) {
1269312693
return r.filterForKeywords(t, [ "name", "tags" ], r.generateKeywords(e));
1269412694
}
1269512695
function p(e) {
12696-
y.filterConfig.appliedFilters = e, f();
12696+
v.filterConfig.appliedFilters = e, f();
1269712697
}
1269812698
function f() {
12699-
y.filteredItems = y.catalogItems, y.filterConfig.appliedFilters && y.filterConfig.appliedFilters.length > 0 && _.each(y.filterConfig.appliedFilters, function(e) {
12700-
y.filteredItems = m(e.value, y.filteredItems);
12701-
}), _.includes(y.filteredItems, y.selectedTemplate) || y.templateSelected(), g();
12699+
v.filteredItems = v.catalogItems, v.filterConfig.appliedFilters && v.filterConfig.appliedFilters.length > 0 && _.each(v.filterConfig.appliedFilters, function(e) {
12700+
v.filteredItems = m(e.value, v.filteredItems);
12701+
}), v.filterConfig.resultsCount = v.filteredItems.length, _.includes(v.filteredItems, v.selectedTemplate) || v.templateSelected();
1270212702
}
1270312703
function g() {
12704-
y.filterConfig.resultsCount = y.filteredItems.length, y.totalCount <= 1 ? $(".filter-pf.filter-fields input").attr("disabled", "") : $(".filter-pf.filter-fields input").removeAttr("disabled");
12705-
}
12706-
function h() {
12707-
y.unfilteredProjects || i.list().then(function(e) {
12708-
y.unfilteredProjects = _.toArray(e.by("metadata.name"));
12704+
v.unfilteredProjects || i.list().then(function(e) {
12705+
v.unfilteredProjects = _.toArray(e.by("metadata.name"));
1270912706
}, function() {
12710-
y.unfilteredProjects = [];
12707+
v.unfilteredProjects = [];
1271112708
}).finally(function() {
12712-
b();
12709+
y();
1271312710
});
1271412711
}
12715-
var v, y = this;
12716-
y.selectStep = {
12712+
var h, v = this;
12713+
v.selectStep = {
1271712714
id: "projectTemplates",
1271812715
label: "Selection",
1271912716
view: "views/directives/process-template-dialog/process-template-select.html",
12720-
hidden: !0 !== y.useProjectTemplate,
12717+
hidden: !0 !== v.useProjectTemplate,
1272112718
allowed: !0,
1272212719
valid: !1,
1272312720
onShow: function() {
12724-
y.selectStep.selected = !0, y.configStep.selected = !1, y.resultsStep.selected = !1, y.nextTitle = "Next >", u(), h();
12721+
v.selectStep.selected = !0, v.configStep.selected = !1, v.resultsStep.selected = !1, v.nextTitle = "Next >", u(), g();
1272512722
}
12726-
}, y.configStep = {
12723+
}, v.configStep = {
1272712724
id: "configuration",
1272812725
label: "Configuration",
1272912726
view: "views/directives/process-template-dialog/process-template-config.html",
1273012727
valid: !1,
1273112728
allowed: !0,
1273212729
onShow: function() {
12733-
y.selectStep.selected = !1, y.configStep.selected = !0, y.resultsStep.selected = !1, y.nextTitle = "Create", y.resultsStep.allowed = y.configStep.valid, v = e.$watch("$ctrl.form.$valid", function(e) {
12734-
y.configStep.valid = e && y.selectedProject, y.resultsStep.allowed = e;
12730+
v.selectStep.selected = !1, v.configStep.selected = !0, v.resultsStep.selected = !1, v.nextTitle = "Create", v.resultsStep.allowed = v.configStep.valid, h = e.$watch("$ctrl.form.$valid", function(e) {
12731+
v.configStep.valid = e && v.selectedProject, v.resultsStep.allowed = e;
1273512732
});
1273612733
}
12737-
}, y.resultsStep = {
12734+
}, v.resultsStep = {
1273812735
id: "results",
1273912736
label: "Results",
1274012737
view: "views/directives/process-template-dialog/process-template-results.html",
1274112738
valid: !0,
1274212739
allowed: !1,
1274312740
prevEnabled: !1,
1274412741
onShow: function() {
12745-
y.selectStep.selected = !1, y.configStep.selected = !1, y.resultsStep.selected = !0, y.nextTitle = "Close", u(), y.wizardDone = !0;
12742+
v.selectStep.selected = !1, v.configStep.selected = !1, v.resultsStep.selected = !0, v.nextTitle = "Close", u(), v.wizardDone = !0;
1274612743
}
12747-
}, y.$onInit = function() {
12748-
y.loginBaseUrl = a.openshiftAPIBaseUrl(), y.preSelectedProject = y.selectedProject = y.project, h(), y.projectEmptyState = {
12744+
}, v.$onInit = function() {
12745+
v.loginBaseUrl = a.openshiftAPIBaseUrl(), v.preSelectedProject = v.selectedProject = v.project, g(), v.projectEmptyState = {
1274912746
icon: "pficon pficon-info",
1275012747
title: "No Project Selected",
1275112748
info: "Please select a project from the dropdown to load Templates from that project."
12752-
}, y.templatesEmptyState = {
12749+
}, v.templatesEmptyState = {
1275312750
icon: "pficon pficon-info",
1275412751
title: "No Templates",
1275512752
info: "The selected project has no templates available to import."
12756-
}, y.filterConfig = {
12753+
}, v.filterConfig = {
1275712754
fields: [ {
1275812755
id: "keyword",
1275912756
title: "Keyword",
@@ -12768,32 +12765,32 @@ resultsCount: 0,
1276812765
appliedFilters: [],
1276912766
onFilterChange: p
1277012767
};
12771-
}, y.$onChanges = function(e) {
12772-
e.template && y.template && (l(), y.iconClass = c()), e.useProjectTemplate && l();
12768+
}, v.$onChanges = function(e) {
12769+
e.template && v.template && (l(), v.iconClass = c()), e.useProjectTemplate && l();
1277312770
}, e.$on("templateInstantiated", function(e, t) {
12774-
y.selectedProject = t.project, y.currentStep = y.resultsStep.label;
12775-
}), y.$onDestroy = function() {
12771+
v.selectedProject = t.project, v.currentStep = v.resultsStep.label;
12772+
}), v.$onDestroy = function() {
1277612773
u();
12777-
}, y.next = function(e) {
12778-
return e.stepId === y.configStep.id ? (d(), !1) : e.stepId !== y.resultsStep.id || (y.close(), !1);
12779-
}, y.close = function() {
12780-
var e = y.onDialogClosed();
12774+
}, v.next = function(e) {
12775+
return e.stepId === v.configStep.id ? (d(), !1) : e.stepId !== v.resultsStep.id || (v.close(), !1);
12776+
}, v.close = function() {
12777+
var e = v.onDialogClosed();
1278112778
_.isFunction(e) && e();
12782-
}, y.onProjectSelected = function(t) {
12783-
y.selectedProject = t, y.configStep.valid = e.$ctrl.form.$valid && y.selectedProject;
12784-
}, y.templateSelected = function(e) {
12785-
y.selectedTemplate = e, y.template = _.get(e, "resource"), y.selectStep.valid = !!e;
12786-
}, y.templateProjectChange = function() {
12787-
y.templateProjectName = _.get(y.templateProject, "metadata.name"), y.catalogItems = {}, y.templateSelected(), n.getProjectCatalogItems(y.templateProjectName, !1, !0).then(_.spread(function(e, t) {
12788-
y.catalogItems = e, y.totalCount = y.catalogItems.length, f(), t && o.addNotification({
12779+
}, v.onProjectSelected = function(t) {
12780+
v.selectedProject = t, v.configStep.valid = e.$ctrl.form.$valid && v.selectedProject;
12781+
}, v.templateSelected = function(e) {
12782+
v.selectedTemplate = e, v.template = _.get(e, "resource"), v.selectStep.valid = !!e;
12783+
}, v.templateProjectChange = function() {
12784+
v.templateProjectName = _.get(v.templateProject, "metadata.name"), v.catalogItems = {}, v.templateSelected(), n.getProjectCatalogItems(v.templateProjectName, !1, !0).then(_.spread(function(e, t) {
12785+
v.catalogItems = e, v.totalCount = v.catalogItems.length, p(), t && o.addNotification({
1278912786
type: "error",
1279012787
message: t
1279112788
});
1279212789
}));
1279312790
};
12794-
var b = function() {
12795-
var e = _.reject(y.unfilteredProjects, "metadata.deletionTimestamp"), n = _.sortBy(e, t("displayName"));
12796-
y.searchEnabled = !_.isEmpty(e), y.templateProjects = s.orderByMostRecentlyViewed(n);
12791+
var y = function() {
12792+
var e = _.reject(v.unfilteredProjects, "metadata.deletionTimestamp"), n = _.sortBy(e, t("displayName"));
12793+
v.searchEnabled = !_.isEmpty(e), v.templateProjects = s.orderByMostRecentlyViewed(n);
1279712794
};
1279812795
} ],
1279912796
controllerAs: "$ctrl",

0 commit comments

Comments
 (0)