diff --git a/app/components/new-catalog/template.hbs b/app/components/new-catalog/template.hbs
index ac96bb091..a735c38e3 100644
--- a/app/components/new-catalog/template.hbs
+++ b/app/components/new-catalog/template.hbs
@@ -21,7 +21,7 @@
{{t 'newCatalog.catalog'}} {{templateResource.catalogId}}
- {{t 'newCatalog.category'}} {{templateResource.category}}
+ {{t 'newCatalog.category'}} {{join-array templateResource.categoryArray}}
{{#if (eq templateResource.certifiedType 'rancher')}}
{{t 'newCatalog.support'}} {{t 'newCatalog.official'}}
diff --git a/app/helpers/join-array.js b/app/helpers/join-array.js
new file mode 100644
index 000000000..28715a3b4
--- /dev/null
+++ b/app/helpers/join-array.js
@@ -0,0 +1,8 @@
+import Ember from 'ember';
+
+export default Ember.Helper.extend({
+ compute(params, options) {
+ let separator = options.separator || ', ';
+ return params[0].join(separator);
+ },
+});
diff --git a/app/models/template.js b/app/models/template.js
index 60a1bfe1e..25b39befd 100644
--- a/app/models/template.js
+++ b/app/models/template.js
@@ -62,9 +62,27 @@ export default Resource.extend({
return list.length === 0 || list.includes(orch);
},
+ categoryArray: function() {
+ let out = this.get('categories');
+ if ( !out || !out.length ) {
+ let single = this.get('category');
+ if ( single ) {
+ out = [single];
+ } else {
+ out = [];
+ }
+ }
+
+ return out;
+ }.property('category','categories.[]'),
+
+ categoryLowerArray: function() {
+ return this.get('categoryArray').map(x => (x||'').toLowerCase());
+ }.property('categoryArray.[]'),
+
supported: function() {
let orch = this.get('projects.current.orchestration')||'cattle';
- if ( (this.get('category')||'').toLowerCase() === 'orchestration' ) {
+ if ( this.get('categoryLowerArray').includes('orchestration') ) {
return orch === 'cattle';
} else {
return this.supportsOrchestration(orch);
diff --git a/app/services/catalog.js b/app/services/catalog.js
index 9a6c318db..a0bed6cac 100644
--- a/app/services/catalog.js
+++ b/app/services/catalog.js
@@ -115,11 +115,13 @@ export default Ember.Service.extend({
bases.push(C.EXTERNAL_ID.KIND_INFRA);
}
- let categories = uniqKeys(data, 'category');
+ let categories = [];
+ data.forEach((obj) => { categories.pushObjects(obj.get('categoryArray')); });
+ categories = uniqKeys(categories);
categories.unshift('all');
data = data.filter((tpl) => {
- if ( category !== 'all' && (tpl.get('category')||'').toLowerCase() !== category ) {
+ if ( category !== 'all' && !tpl.get('categoryLowerArray').includes(category) ) {
return false;
}
diff --git a/app/utils/constants.js b/app/utils/constants.js
index 4c36b7eca..28e6cfc29 100644
--- a/app/utils/constants.js
+++ b/app/utils/constants.js
@@ -108,6 +108,7 @@ var C = {
CSRF: 'X-Api-Csrf',
NO_CHALLENGE: 'X-Api-No-Challenge',
NO_CHALLENGE_VALUE: 'true',
+ PROJECT_ID: 'X-Api-Project-Id',
RANCHER_VERSION: 'X-Rancher-Version',
},