Fix issue when loading the accounts page initially

rancher/rancher#8422
This commit is contained in:
Westly Wright 2017-05-11 09:49:24 -07:00
parent f61a9498cb
commit 62d4b7a6a0
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
3 changed files with 33 additions and 9 deletions

View File

@ -1,11 +1,16 @@
import Ember from 'ember';
export default Ember.Component.extend({
classNames: ['box'],
access: Ember.inject.service(),
account: Ember.computed.alias('access.identity'),
classNames: ['box'],
access: Ember.inject.service(),
modalService: Ember.inject.service('modal'),
account: null,
didReceiveAttrs() {
this._super(...arguments);
this.set('account', this.get('access.identity'));
},
actions: {
editPassword() {
this.get('account').send('edit');

View File

@ -0,0 +1,18 @@
import C from 'ui/utils/constants';
export function initialize(instance) {
var access = instance.lookup('service:access');
var userStore = instance.lookup('service:user-store');
var session = instance.lookup('service:session');
var idnt = session.get(C.SESSION.IDENTITY) || {};
idnt.type = 'identity';
access.set('identity', userStore.createRecord(idnt));
}
export default {
name: 'identity',
after: ['user-store'],
initialize: initialize
};

View File

@ -23,11 +23,12 @@ export default Ember.Service.extend({
admin: null,
// The identity from the session isn't an actual identity model...
identity: function() {
var obj = this.get('session.'+C.SESSION.IDENTITY) || {};
obj.type = 'identity';
return this.get('userStore').createRecord(obj);
}.property('session.'+C.SESSION.IDENTITY),
// identity: function() {
// var obj = this.get('session.'+C.SESSION.IDENTITY) || {};
// obj.type = 'identity';
// return this.get('userStore').createRecord(obj);
// }.property('session.'+C.SESSION.IDENTITY),
identity: null,
testAuth() {
// make a call to api base because it is authenticated