Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<template>
<div class="mt-sm-3" v-if="userLabel !== null">
<b-button variant="primary" class="float-right" v-on:click="back()">Back</b-button>
<h5>Results for <strong>{{userLabel}}</strong>:</h5>
<b-container class="mt-sm-5">
<b-row>
<b-col class="text-left">
<h5>Is member of</h5>
<div v-if="groups.length === 0">
No groups to show
</div>
<div v-if="groups.length > 0">
<ul>
<li v-for="group in groups" v-bind:key="group.groupId">
<a href="#" v-on:click="openGroup(group.groupId)">
{{group.groupCompleteName.join(' / ')}}
</a>
</li>
</ul>
</div>
</b-col>
<b-col v-if="permissions.length > 0">
<h5>Permissions</h5>
<table class="table table-striped">
<thead>
<tr>
<th>Group</th>
<th>Permission</th>
</tr>
</thead>
<tbody>
<tr v-for="(p, rowIndex) in permissions" v-bind:key="rowIndex">
<td>
<a href="#" v-on:click="openGroup(p.groupId)">
{{p.groupCompleteName.join(' / ')}}
</a>
</td>
<td>{{p.permission}}</td>
</tr>
</tbody>
</table>
</b-col>
</b-row>
</b-container>
</div>
</template>
<script>
import {
mapState
} from 'vuex';
export default {
name: 'UserSearchResult',
computed: mapState({
userLabel: state => state.model.userSearchResults.userLabel,
groups: state => state.model.userSearchResults.groups,
permissions: state => state.model.userSearchResults.permissions
}),
methods: {
back() {
this.$store.commit('displaySearchResults');
},
openGroup(groupId) {
this.$store.commit('openGroup', groupId);
}
}
}
</script>