mirror of https://github.com/rancher/ui.git
refactor global resource memeber access
pass the access types down rather that own the access types and manipulate rancher/rancher#18938
This commit is contained in:
parent
25e54fae82
commit
ff1d1e56c4
|
|
@ -26,6 +26,7 @@ export default Controller.extend(ViewNewEdit, {
|
|||
scope: service(),
|
||||
|
||||
queryParams: ['id'],
|
||||
memberAccessTypes: ['owner'],
|
||||
|
||||
id: null,
|
||||
errros: null,
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@
|
|||
expand=(action expandFn)
|
||||
}}
|
||||
{{form-members-global-access
|
||||
excludeMember=true
|
||||
optionsForAccessType=memberAccessTypes
|
||||
readOnly=false
|
||||
resource=model.globaldns
|
||||
addAuthorizedPrincipal=(action "addAuthorizedPrincipal")
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ export default Controller.extend(ViewNewEdit, {
|
|||
globalStore: service(),
|
||||
|
||||
queryParams: ['id', 'activeProvider'],
|
||||
memberAccessTypes: ['owner', 'read-only'],
|
||||
id: null,
|
||||
|
||||
activeProvider: 'route53',
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
expand=(action expandFn)
|
||||
}}
|
||||
{{form-members-global-access
|
||||
excludeMember=true
|
||||
optionsForAccessType=memberAccessTypes
|
||||
readOnly=false
|
||||
resource=model
|
||||
addAuthorizedPrincipal=(action "addAuthorizedPrincipal")
|
||||
|
|
|
|||
|
|
@ -22,18 +22,18 @@ const MEMBERS_HEADERS = [
|
|||
];
|
||||
|
||||
export default Component.extend({
|
||||
globalStore: service(),
|
||||
globalStore: service(),
|
||||
|
||||
layout,
|
||||
|
||||
membersHeaders: MEMBERS_HEADERS,
|
||||
sortBy: '',
|
||||
descending: false,
|
||||
excludeMember: false,
|
||||
resource: null,
|
||||
gotError: null,
|
||||
removeMember: null,
|
||||
optionsForAccessType: null,
|
||||
membersHeaders: MEMBERS_HEADERS,
|
||||
sortBy: '',
|
||||
descending: false,
|
||||
excludeMember: false,
|
||||
resource: null,
|
||||
gotError: null,
|
||||
removeMember: null,
|
||||
optionsForAccessType: null,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
|
|
@ -69,13 +69,8 @@ export default Component.extend({
|
|||
},
|
||||
|
||||
initOptionsForMembersAccessType() {
|
||||
let accessTypes = this.globalStore.getById('schema', 'member').optionsFor('accessType') || [];
|
||||
let accessTypes = this.optionsForAccessType || this.globalStore.getById('schema', 'member').optionsFor('accessType');
|
||||
|
||||
if (this.excludeMember) {
|
||||
accessTypes = accessTypes.without('member');
|
||||
}
|
||||
set(this, 'optionsForAccessType', accessTypes);
|
||||
|
||||
return;
|
||||
return set(this, 'optionsForAccessType', accessTypes);
|
||||
},
|
||||
});
|
||||
|
|
|
|||
|
|
@ -30,21 +30,25 @@
|
|||
{{member.displayType}}
|
||||
</td>
|
||||
<td data-title="{{dt.accessType}}:">
|
||||
<select
|
||||
class="form-control"
|
||||
onchange={{action (mut member.accessType) value="target.value"}}
|
||||
>
|
||||
{{#unless (eq member.accessType "")}}
|
||||
<option value="" selected=true>
|
||||
{{t "formMembersGlobalAccess.table.prompt"}}
|
||||
</option>
|
||||
{{/unless}}
|
||||
{{#each optionsForAccessType as |choice|}}
|
||||
<option value="{{choice}}" selected={{eq choice member.accessType}}>
|
||||
{{choice}}
|
||||
</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
{{#if (gt optionsForAccessType.length 1)}}
|
||||
<select
|
||||
class="form-control"
|
||||
onchange={{action (mut member.accessType) value="target.value"}}
|
||||
>
|
||||
{{#unless (eq member.accessType "")}}
|
||||
<option value="" selected=true>
|
||||
{{t "formMembersGlobalAccess.table.prompt"}}
|
||||
</option>
|
||||
{{/unless}}
|
||||
{{#each optionsForAccessType as |choice|}}
|
||||
<option value="{{choice}}" selected={{eq choice member.accessType}}>
|
||||
{{choice}}
|
||||
</option>
|
||||
{{/each}}
|
||||
</select>
|
||||
{{else}}
|
||||
{{member.accessType}}
|
||||
{{/if}}
|
||||
</td>
|
||||
<td data-title="{{t "generic.actions"}}:" class="actions">
|
||||
<div class="p-5">
|
||||
|
|
|
|||
Loading…
Reference in New Issue