Fix missing roles when pagetype was null

rancher/rancher#12379
This commit is contained in:
Westly Wright 2018-04-02 15:57:52 -07:00
parent 4e1ff8c9b8
commit 8ac490e90d
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
3 changed files with 14 additions and 9 deletions

View File

@ -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);
// }

View File

@ -50,7 +50,7 @@
creator=model.me
editing=notView
expanded=expanded
isNew=isNew
isNew=newCluster
memberConfig=memberConfig
primaryResource=cluster
registerHook=(action "registerHook")

View File

@ -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;
}),
});