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 ChildHook from 'shared/mixins/child-hook';
|
||||||
import { alias } from '@ember/object/computed';
|
import { alias } from '@ember/object/computed';
|
||||||
import layout from './template';
|
import layout from './template';
|
||||||
|
import { isEmpty } from '@ember/utils';
|
||||||
|
|
||||||
const MEMBER_CONFIG = {
|
const MEMBER_CONFIG = {
|
||||||
type: 'clusterRoleTemplateBinding',
|
type: 'clusterRoleTemplateBinding',
|
||||||
|
|
@ -23,6 +24,7 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
||||||
step: 1,
|
step: 1,
|
||||||
initialProvider: null,
|
initialProvider: null,
|
||||||
memberConfig: MEMBER_CONFIG,
|
memberConfig: MEMBER_CONFIG,
|
||||||
|
newCluster: false,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
|
|
@ -33,6 +35,9 @@ export default Component.extend(ViewNewEdit, ChildHook, {
|
||||||
set(this, 'provider', initialProvider);
|
set(this, 'provider', initialProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isEmpty(get(this, 'cluster.id')) ){
|
||||||
|
set(this, 'newCluster', true);
|
||||||
|
}
|
||||||
// if ( get(this, 'cluster.id') && initialProvider ){
|
// if ( get(this, 'cluster.id') && initialProvider ){
|
||||||
// set(this,'step', 2);
|
// set(this,'step', 2);
|
||||||
// }
|
// }
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
creator=model.me
|
creator=model.me
|
||||||
editing=notView
|
editing=notView
|
||||||
expanded=expanded
|
expanded=expanded
|
||||||
isNew=isNew
|
isNew=newCluster
|
||||||
memberConfig=memberConfig
|
memberConfig=memberConfig
|
||||||
primaryResource=cluster
|
primaryResource=cluster
|
||||||
registerHook=(action "registerHook")
|
registerHook=(action "registerHook")
|
||||||
|
|
|
||||||
|
|
@ -170,6 +170,13 @@ export default Component.extend({
|
||||||
|
|
||||||
choices: computed('roles.[]', 'pageType', function() {
|
choices: computed('roles.[]', 'pageType', function() {
|
||||||
let pt = get(this, 'pageType');
|
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) {
|
if (pt) {
|
||||||
let customRoles = get(this, 'customRoles').map( r => {
|
let customRoles = get(this, 'customRoles').map( r => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -177,16 +184,9 @@ export default Component.extend({
|
||||||
value: r.id
|
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);
|
neuRoles = neuRoles.concat(customRoles);
|
||||||
return neuRoles;
|
return neuRoles;
|
||||||
}
|
}
|
||||||
return [];
|
return neuRoles;
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue