catalog fixes

rancher/rancher#10529
This commit is contained in:
Westly Wright 2018-02-06 13:55:54 -07:00
parent db69e0d6e3
commit 24f4548ad0
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
3 changed files with 22 additions and 25 deletions

View File

@ -13,7 +13,6 @@ export default Route.extend({
const catalog = get(this, 'catalog');
return this.get('globalStore').find('app').then((apps) => {
debugger;
let deps = [];
apps.forEach((stack) => {

View File

@ -59,18 +59,15 @@ export default Component.extend({
let out = {};
let templates = this.get('catalog.templateCache');
let base = this.get('catalog.templateBase');
// let plusInfra = this.get('scope.currentProject.clusterOwner') === true;
let plusInfra = this.get('scope.currentProject.clusterOwner') === true;
templates.forEach((tpl) => {
if (base === tpl.get('templateBase') || (tpl.get('templateBase') === 'kubernetes')) {
// TODO 2.0 does a kubernetes template need a category?
if (base === tpl.get('templateBase') || (plusInfra && tpl.get('templateBase') === 'infra') || (tpl.get('templateBase') === 'kubernetes')) {
if (tpl.categories) {
tpl.categories.forEach((ctgy) => {
categories.push(ctgy);
});
} else {
// TODO 2.0 does a kubernetes template need a category?
tpl.set('categories', ['uncategorized']);
categories.push('uncategorized');
}
}
});
@ -109,7 +106,7 @@ export default Component.extend({
return this.get('globalStore').all('catalog').map((obj) => {
return {
catalogId: get(obj, 'id'),
label: get(obj,'displayName'),
label: get(obj,'name'),
};
});
}),
@ -119,7 +116,7 @@ export default Component.extend({
let result = [];
let base = this.get('catalog.templateBase');
let catalog = this.get('model.catalog').filter((item) => {
if (item.templateBase === base || item.templateBase === 'kubernetes' || item.templateBase === '') {
if (item.templateBase === base || item.templateBase === 'kubernetes' || item.templateBase === 'infra') {
return true;
}
return false;

View File

@ -5,7 +5,9 @@
</div>
<div class="right-buttons">
<button type="button" class="btn bg-primary icon-btn" disabled={{eq updating 'yes'}} {{action "update"}}>
{{!-- <button type="button" class="btn bg-primary icon-btn" disabled={{eq updating 'yes'}} {{action "update"}}> --}}
{{!-- currently no refresh button --}}
<button type="button" class="btn bg-primary icon-btn" disabled={{eq updating 'no'}} {{action "update"}}>
{{#if (eq updating "yes")}}
<span class="darken"><i class="icon icon-spinner icon-spin"></i></span>
{{else}}
@ -40,9 +42,14 @@
<div class="dropdown filter-group">
<button type="button" class="btn bg-default btn-md dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="text-align: left;"><i class="icon icon-chevron-down pull-right"></i><span class="text-capitalize">{{catalogId}}</span></button>
<ul class="dropdown-menu dropdown-menu-right">
<li class="text-capitalize {{if (eq catalogId 'all') 'active'}}">
<a href="#" {{action (action filterAction)}}>
{{t 'generic.all'}}
</a>
</li>
{{#each filters as |opt|}}
<li class="text-capitalize {{if (eq catalogId opt.queryParams.catalogId) 'active'}}">
<a href="#" {{action (action filterAction opt.queryParams.catalogId )}}>
<li class="{{if (eq catalogId opt.catalogId) 'active'}}">
<a href="#" {{action (action filterAction opt.catalogId )}}>
<i class="{{opt.icon}}"></i>
{{#if opt.localizedLabel}}
{{t opt.localizedLabel}}
@ -59,15 +66,9 @@
</div>
<ul class="container-categories list-unstyled">
<li class=" {{if (eq category 'all') 'active' ''}}">
{{#if preFetchCategory}}
<a href="#" {{action (action categoryAction 'all' catalogId)}} class="btn has-label bg-default btn-md">
<span class="btn-label">{{totalCategories}}</span><span class="clip">{{t 'generic.all'}}</span>
</a>
{{else}}
<a href="#" {{action (action categoryAction 'all' catalogId)}} class="btn has-label bg-default btn-md">
<span class="btn-label">{{totalCategories}}</span><span class="clip">{{t 'generic.all'}}</span>
</a>
{{/if}}
<a href="#" {{action (action categoryAction 'all' catalogId)}} class="btn has-label bg-default btn-md">
<span class="btn-label">{{totalCategories}}</span><span class="clip">{{t 'generic.all'}}</span>
</a>
</li>
{{#each-in categoryWithCounts as |norm cat|}}
<li class=" {{if (eq cat.name category) 'active' ''}}">
@ -85,14 +86,14 @@
<h3>
{{#if (eq catalogItem.templateBase 'infra')}}
{{#if catalogItem.exists}}
<a href="#" {{action (action launch catalogItem.id true) allowedKeys="meta ctrl"}}>{{catalogItem.name}}</a>
<a href="#" {{action (action launch catalogItem.id true) allowedKeys="meta ctrl"}}>{{catalogItem.displayName}}</a>
{{else if catalogItem.supported}}
<a href="#" {{action (action launch catalogItem.id )}}>{{catalogItem.name}}</a>
<a href="#" {{action (action launch catalogItem.id )}}>{{catalogItem.displayName}}</a>
{{else}}
<a href="#" {{action (action launch catalogItem.id true ) allowedKeys="meta ctrl"}}>{{catalogItem.name}}</a>
<a href="#" {{action (action launch catalogItem.id true ) allowedKeys="meta ctrl"}}>{{catalogItem.displayName}}</a>
{{/if}}
{{else}}
<a href="#" {{action (action launch catalogItem.id )}}>{{catalogItem.name}}</a>
<a href="#" {{action (action launch catalogItem.id )}}>{{catalogItem.displayName}}</a>
{{/if}}
</h3>
<div class="mt-10 description">{{catalogItem.description}}</div>