gdns providers - allow read only + owner when adding members

rancher/rancher#18938
This commit is contained in:
Westly Wright 2019-03-21 15:56:50 -07:00
parent 7f9fda50ea
commit 25e54fae82
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
4 changed files with 25 additions and 26 deletions

View File

@ -187,7 +187,7 @@
expand=(action expandFn)
}}
{{form-members-global-access
ownerOnly=true
excludeMember=true
readOnly=false
resource=model.globaldns
addAuthorizedPrincipal=(action "addAuthorizedPrincipal")

View File

@ -54,7 +54,7 @@
expand=(action expandFn)
}}
{{form-members-global-access
ownerOnly=true
excludeMember=true
readOnly=false
resource=model
addAuthorizedPrincipal=(action "addAuthorizedPrincipal")

View File

@ -29,7 +29,7 @@ export default Component.extend({
membersHeaders: MEMBERS_HEADERS,
sortBy: '',
descending: false,
ownerOnly: false,
excludeMember: false,
resource: null,
gotError: null,
removeMember: null,
@ -38,9 +38,7 @@ export default Component.extend({
init() {
this._super(...arguments);
if (!this.ownerOnly) {
this.initOptionsForMembersAccessType();
}
this.initOptionsForMembersAccessType();
},
actions: {
@ -71,7 +69,12 @@ export default Component.extend({
},
initOptionsForMembersAccessType() {
set(this, 'optionsForAccessType', this.globalStore.getById('schema', 'member').optionsFor('accessType') || []);
let accessTypes = this.globalStore.getById('schema', 'member').optionsFor('accessType') || [];
if (this.excludeMember) {
accessTypes = accessTypes.without('member');
}
set(this, 'optionsForAccessType', accessTypes);
return;
},

View File

@ -30,25 +30,21 @@
{{member.displayType}}
</td>
<td data-title="{{dt.accessType}}:">
{{#if ownerOnly}}
{{member.accessType}}
{{else}}
<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}}
<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>
</td>
<td data-title="{{t "generic.actions"}}:" class="actions">
<div class="p-5">