Add Alibaba App Hub in catalog list

This commit is contained in:
loganhz 2019-09-24 11:19:07 +08:00
parent 804ace7031
commit cc7d1bb477
4 changed files with 29 additions and 13 deletions

View File

@ -21,7 +21,7 @@ const Catalog = Resource.extend({
canClone: computed('actions.clone', function() {
const name = get(this, 'name');
const catalogNames = get(C, 'CATALOG');
const builtIn = [get(catalogNames, 'LIBRARY_KEY'), get(catalogNames, 'HELM_STABLE_KEY'), get(catalogNames, 'HELM_INCUBATOR_KEY')];
const builtIn = [get(catalogNames, 'LIBRARY_KEY'), get(catalogNames, 'ALIBABA_APP_HUB_KEY'), get(catalogNames, 'HELM_STABLE_KEY'), get(catalogNames, 'HELM_INCUBATOR_KEY')];
return !builtIn.includes(name);
}),

View File

@ -176,7 +176,7 @@ export default Component.extend({
if ( name === C.CATALOG.LIBRARY_KEY ) {
priority = 1;
} else if ( [C.CATALOG.HELM_STABLE_KEY, C.CATALOG.HELM_INCUBATOR_KEY].includes(name) ) {
} else if ( [C.CATALOG.HELM_STABLE_KEY, C.CATALOG.HELM_INCUBATOR_KEY, C.CATALOG.ALIBABA_APP_HUB_KEY].includes(name) ) {
priority = 2;
}

View File

@ -64,6 +64,10 @@ export default Component.extend({
return get(this, 'catalogs').findBy('name', C.CATALOG.HELM_INCUBATOR_KEY)
}),
alibabaAppHub: computed('catalogs.@each.{name}', function() {
return get(this, 'catalogs').findBy('name', C.CATALOG.ALIBABA_APP_HUB_KEY)
}),
rows: computed('catalogs.@each.{id,name,url}', function() {
const out = get(this, 'catalogs').slice();
@ -97,6 +101,16 @@ export default Component.extend({
kind: 'helm',
}));
}
if ( !this.alibabaAppHub ) {
out.push(get(this, 'globalStore').createRecord({
type: 'catalog',
name: C.CATALOG.ALIBABA_APP_HUB_KEY,
url: C.CATALOG.ALIBABA_APP_HUB_VALUE,
branch: C.CATALOG.DEFAULT_BRANCH,
kind: 'helm',
}));
}
}
return out;

View File

@ -8,17 +8,19 @@ const KIND_NOT_ORCHESTRATION = 'cattle';
var C = {
CATALOG: {
LIBRARY_KEY: 'library',
LIBRARY_VALUE: 'https://git.rancher.io/charts',
SYSTEM_LIBRARY_KEY: 'system-library',
SYSTEM_LIBRARY_VALUE: 'https://git.rancher.io/system-charts',
HELM_STABLE_KEY: 'helm',
HELM_STABLE_VALUE: 'https://kubernetes-charts.storage.googleapis.com/',
HELM_INCUBATOR_KEY: 'helm-incubator',
HELM_INCUBATOR_VALUE: 'https://kubernetes-charts-incubator.storage.googleapis.com/',
DEFAULT_BRANCH: 'master',
LIBRARY_BRANCH: 'v2.0-development', // @TODO-2.0 '${RELEASE}',
COMMUNITY_BRANCH: 'v2.0-development', // @TODO-2.0 '${RELEASE}',
LIBRARY_KEY: 'library',
LIBRARY_VALUE: 'https://git.rancher.io/charts',
SYSTEM_LIBRARY_KEY: 'system-library',
SYSTEM_LIBRARY_VALUE: 'https://git.rancher.io/system-charts',
HELM_STABLE_KEY: 'helm',
HELM_STABLE_VALUE: 'https://kubernetes-charts.storage.googleapis.com/',
HELM_INCUBATOR_KEY: 'helm-incubator',
HELM_INCUBATOR_VALUE: 'https://kubernetes-charts-incubator.storage.googleapis.com/',
ALIBABA_APP_HUB_KEY: 'alibaba-app-hub',
ALIBABA_APP_HUB_VALUE: 'https://apphub.aliyuncs.com',
DEFAULT_BRANCH: 'master',
LIBRARY_BRANCH: 'v2.0-development', // @TODO-2.0 '${RELEASE}',
COMMUNITY_BRANCH: 'v2.0-development', // @TODO-2.0 '${RELEASE}',
},
COOKIE: {