Fix avatars on access controls page (rancher/rancher#2183)

This commit is contained in:
Vincent Fiduccia 2015-10-02 16:06:32 -07:00
parent 8d56eeffde
commit 19b5826d9f
2 changed files with 12 additions and 5 deletions

View File

@ -54,6 +54,13 @@ export default Ember.Controller.extend({
return str;
}.property('originalModel.allowedIdentities.[]','wasRestricted'),
allowedActualIdentities: function() {
return this.get('model.allowedIdentities').map((obj) => {
obj.type = 'identity';
return this.get('store').createRecord(obj);
});
}.property('model.allowedIdentities.[]'),
wasShowing: false,
showingAccessControl: function() {
var show = this.get('wasShowing');
@ -61,11 +68,11 @@ export default Ember.Controller.extend({
if ( restricted )
{
if ( this.get('model.allowedIdentities.length') > 1 )
if ( this.get('allowedActualIdentities.length') > 1 )
{
show = true;
}
else if ( this.get('model.allowedIdentities.firstObject.id') !== this.get('access.identity.id') )
else if ( this.get('allowedActualIdentities.firstObject.id') !== this.get('access.identity.id') )
{
show = true;
}
@ -78,7 +85,7 @@ export default Ember.Controller.extend({
this.set('wasShowing', show);
return show;
}.property('model.allowedIdentities.@each.id','isRestricted','wasShowing'),
}.property('allowedActualIdentities.@each.id','isRestricted','wasShowing'),
destinationUrl: function() {
return window.location.origin+'/';

View File

@ -52,7 +52,7 @@
<h5>Authorized Users and Organizations</h5>
<ul class="list-unstyled gh-block-list">
{{#each model.allowedIdentities as |item|}}
{{#each allowedActualIdentities as |item|}}
<li>
{{#identity-block identity=item}}
<button class="btn-circle-x btn-sm pull-right gh-action" {{action "removeIdentity" item}}></button>
@ -60,7 +60,7 @@
</li>
{{/each}}
</ul>
{{#if (eq model.allowedIdentities.length 0)}}
{{#if (eq allowedActualIdentities.length 0)}}
<span class="text-muted">None</span>
{{/if}}
{{/if}}