mirror of https://github.com/rancher/ui.git
parent
4e1ff8c9b8
commit
8ac490e90d
|
|
@ -5,6 +5,7 @@ import ViewNewEdit from 'shared/mixins/view-new-edit';
|
|||
import ChildHook from 'shared/mixins/child-hook';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import layout from './template';
|
||||
import { isEmpty } from '@ember/utils';
|
||||
|
||||
const MEMBER_CONFIG = {
|
||||
type: 'clusterRoleTemplateBinding',
|
||||
|
|
@ -23,6 +24,7 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
step: 1,
|
||||
initialProvider: null,
|
||||
memberConfig: MEMBER_CONFIG,
|
||||
newCluster: false,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
|
@ -33,6 +35,9 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
|||
set(this, 'provider', initialProvider);
|
||||
}
|
||||
|
||||
if ( isEmpty(get(this, 'cluster.id')) ){
|
||||
set(this, 'newCluster', true);
|
||||
}
|
||||
// if ( get(this, 'cluster.id') && initialProvider ){
|
||||
// set(this,'step', 2);
|
||||
// }
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
creator=model.me
|
||||
editing=notView
|
||||
expanded=expanded
|
||||
isNew=isNew
|
||||
isNew=newCluster
|
||||
memberConfig=memberConfig
|
||||
primaryResource=cluster
|
||||
registerHook=(action "registerHook")
|
||||
|
|
|
|||
|
|
@ -170,6 +170,13 @@ export default Component.extend({
|
|||
|
||||
choices: computed('roles.[]', 'pageType', function() {
|
||||
let pt = get(this, 'pageType');
|
||||
let neuRoles = BASIC_ROLES.map((r) => {
|
||||
return {
|
||||
label: r.label,
|
||||
value: r.value.indexOf('custom') >= 0 ? 'custom' : `${pt}-${r.value}`
|
||||
};
|
||||
|
||||
});
|
||||
if (pt) {
|
||||
let customRoles = get(this, 'customRoles').map( r => {
|
||||
return {
|
||||
|
|
@ -177,16 +184,9 @@ export default Component.extend({
|
|||
value: r.id
|
||||
}
|
||||
});
|
||||
let neuRoles = BASIC_ROLES.map((r) => {
|
||||
return {
|
||||
label: r.label,
|
||||
value: r.value.indexOf('custom') >= 0 ? 'custom' : `${pt}-${r.value}`
|
||||
};
|
||||
|
||||
});
|
||||
neuRoles = neuRoles.concat(customRoles);
|
||||
return neuRoles;
|
||||
}
|
||||
return [];
|
||||
return neuRoles;
|
||||
}),
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue