refs #6033 feat(VnLog): can use accountDescriptor
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d43b70c971
commit
eb0e6dd985
|
@ -28,7 +28,7 @@
|
|||
<vn-avatar
|
||||
ng-class="::{system: !userLog.user}"
|
||||
val="{{::userLog.user ? userLog.user.nickname : $ctrl.$t('System')}}"
|
||||
ng-click="$ctrl.showWorkerDescriptor($event, userLog)">
|
||||
ng-click="$ctrl.showDescriptor($event, userLog)">
|
||||
<img
|
||||
ng-if="::userLog.user.image"
|
||||
ng-src="/api/Images/user/160x160/{{::userLog.userFk}}/download?access_token={{::$ctrl.vnToken.token}}">
|
||||
|
@ -260,3 +260,6 @@
|
|||
<vn-worker-descriptor-popover
|
||||
vn-id="worker-descriptor">
|
||||
</vn-worker-descriptor-popover>
|
||||
<vn-account-descriptor-popover
|
||||
vn-id="account-descriptor">
|
||||
</vn-account-descriptor-popover>
|
||||
|
|
|
@ -362,7 +362,10 @@ export default class Controller extends Section {
|
|||
}
|
||||
}
|
||||
|
||||
showWorkerDescriptor(event, userLog) {
|
||||
showDescriptor(event, userLog) {
|
||||
if (this.$state.current.name.split('.')[0] == 'account')
|
||||
return this.$.accountDescriptor.show(event.target, userLog.userFk);
|
||||
|
||||
if (userLog.user?.worker)
|
||||
this.$.workerDescriptor.show(event.target, userLog.userFk);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<slot-descriptor>
|
||||
<vn-user-descriptor>
|
||||
</vn-user-descriptor>
|
||||
</slot-descriptor>
|
|
@ -0,0 +1,9 @@
|
|||
import ngModule from '../module';
|
||||
import DescriptorPopover from 'salix/components/descriptor-popover';
|
||||
|
||||
class Controller extends DescriptorPopover {}
|
||||
|
||||
ngModule.vnComponent('vnAccountDescriptorPopover', {
|
||||
slotTemplate: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
|
@ -24,6 +24,28 @@ class Controller extends Descriptor {
|
|||
.then(res => this.hasAccount = res.data.exists);
|
||||
}
|
||||
|
||||
loadData() {
|
||||
const filter = {
|
||||
where: {id: this.$params.id},
|
||||
include: {
|
||||
relation: 'role',
|
||||
scope: {
|
||||
fields: ['id', 'name']
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return Promise.all([
|
||||
this.$http.get(`VnUsers/preview`, {filter})
|
||||
.then(res => {
|
||||
const [user] = res.data;
|
||||
this.user = user;
|
||||
}),
|
||||
this.$http.get(`Accounts/${this.$params.id}/exists`)
|
||||
.then(res => this.hasAccount = res.data.exists)
|
||||
]);
|
||||
}
|
||||
|
||||
onDelete() {
|
||||
return this.$http.delete(`VnUsers/${this.id}`)
|
||||
.then(() => this.$state.go('account.index'))
|
||||
|
|
|
@ -9,6 +9,7 @@ import './acl';
|
|||
import './summary';
|
||||
import './card';
|
||||
import './descriptor';
|
||||
import './descriptor-popover';
|
||||
import './search-panel';
|
||||
import './create';
|
||||
import './basic-data';
|
||||
|
|
Loading…
Reference in New Issue