mirror of https://github.com/rancher/ui.git
44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
import { inject as service } from '@ember/service';
|
|
import Resource from 'ember-api-store/models/resource';
|
|
import { get, computed } from '@ember/object';
|
|
|
|
var User = Resource.extend({
|
|
router: service(),
|
|
|
|
actions: {
|
|
deactivate() {
|
|
return this.doAction('deactivate');
|
|
},
|
|
|
|
activate() {
|
|
return this.doAction('activate');
|
|
},
|
|
|
|
edit: function() {
|
|
get(this, 'router').transitionTo('global-admin.accounts.edit', get(this, 'id'));
|
|
},
|
|
|
|
changePassword(password) {
|
|
this.doAction('changepassword', {newPassword: password});
|
|
}
|
|
},
|
|
|
|
availableActions: computed('actionLinks.{activate,deactivate,restore}','links.{update,remove}', function() {
|
|
let a = this.get('actionLinks');
|
|
let l = this.get('links');
|
|
|
|
return [
|
|
{ label: 'action.edit', icon: 'icon icon-edit', action: 'edit', enabled: !!l.update },
|
|
{ divider: true },
|
|
{ label: 'action.activate', icon: 'icon icon-play', action: 'activate', enabled: !!a.activate , bulkable: true},
|
|
{ label: 'action.deactivate', icon: 'icon icon-pause', action: 'deactivate', enabled: !!a.deactivate , bulkable: true},
|
|
{ divider: true },
|
|
{ label: 'action.remove', icon: 'icon icon-trash', action: 'promptDelete', enabled: !!l.remove, altAction: 'delete', bulkable: true },
|
|
{ divider: true },
|
|
{ label: 'action.viewInApi', icon: 'icon icon-external-link',action: 'goToApi', enabled: true },
|
|
];
|
|
}),
|
|
});
|
|
|
|
export default User;
|