mirror of https://github.com/rancher/ui.git
Multiple categories for catalog
This commit is contained in:
parent
55eff3e0b1
commit
76c3193ab3
|
|
@ -21,7 +21,7 @@
|
|||
<small><strong>{{t 'newCatalog.catalog'}}</strong> <span class="text-capitalize">{{templateResource.catalogId}}</span></small>
|
||||
</div>
|
||||
<div>
|
||||
<small><strong>{{t 'newCatalog.category'}}</strong> {{templateResource.category}}</small>
|
||||
<small><strong>{{t 'newCatalog.category'}}</strong> {{join-array templateResource.categoryArray}}</small>
|
||||
</div>
|
||||
{{#if (eq templateResource.certifiedType 'rancher')}}
|
||||
<small><strong>{{t 'newCatalog.support'}} </strong>{{t 'newCatalog.official'}}</small>
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
},
|
||||
});
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue