Mercurial > gemma
annotate client/src/components/usermanagement/Usermanagement.vue @ 5510:b7792e8d5c62 deactivate-users
Client: Improve users-table layout
* Make editing/reactivating of users more recognizable by adding a reactive/edit button to the action column, that behaves according to the user's status(active,inactive).
* Disable clicking the other cells for editing user.
author | Fadi Abbud <fadi.abbud@intevation.de> |
---|---|
date | Wed, 29 Sep 2021 17:10:42 +0200 |
parents | 36cbf14b878a |
children | 84d01a536bec |
rev | line source |
---|---|
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 <template> |
2322
a25b4988eb0c
client: fixed usermanagement styles
Markus Kottlaender <markus@intevation.de>
parents:
2320
diff
changeset
|
2 <div class="main d-flex flex-row" style="position: relative;"> |
2919
6c5364ff0abb
client: removed a lot of unnecessary closing tags
Markus Kottlaender <markus@intevation.de>
parents:
2899
diff
changeset
|
3 <Spacer /> |
2534
bb5286acfee2
client: reduced spacings between and inside boxes and more compact main menu
Markus Kottlaender <markus@intevation.de>
parents:
2503
diff
changeset
|
4 <div class="d-flex content py-2"> |
2322
a25b4988eb0c
client: fixed usermanagement styles
Markus Kottlaender <markus@intevation.de>
parents:
2320
diff
changeset
|
5 <div :class="userlistStyle"> |
a25b4988eb0c
client: fixed usermanagement styles
Markus Kottlaender <markus@intevation.de>
parents:
2320
diff
changeset
|
6 <div class="card shadow-xs"> |
5509
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
7 <UIBoxHeader |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
8 icon="users-cog" |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
9 :title="usersLabel" |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
10 :checkBox="checkboxObject" |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
11 /> |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
12 <UITableHeader |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
13 :columns="[ |
2782
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
14 { id: 'role', title: `${roleForColumLabel}`, class: 'col-1' }, |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
15 { id: 'user', title: `${usernameLabel}`, class: 'col-4' }, |
5367
1695e17c5a83
Adds schedualbility for reports as an import.
Thomas Junk <thomas.junk@intevation.de>
parents:
5359
diff
changeset
|
16 { id: 'country', title: `${countryLabel}`, class: 'col-1' }, |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
17 { id: 'email', title: `${emailLabel}`, class: 'col-3' }, |
5368
a3ec478882ef
fix sorting of report receivers
Thomas Junk <thomas.junk@intevation.de>
parents:
5367
diff
changeset
|
18 { id: 'reports', title: `${reportsLabel}`, class: 'col-1' } |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
19 ]" |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
20 /> |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
21 <UITableBody |
5509
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
22 :data=" |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
23 usersForTable |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
24 | sortTable(sortColumn, sortDirection, page, pageSize) |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
25 " |
2880
c40540889b53
client: code cleanup, slight style improvements
Markus Kottlaender <markus@intevation.de>
parents:
2874
diff
changeset
|
26 :isActive="item => item === currentUser" |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
27 maxHeight="47rem" |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
28 > |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
29 <template v-slot:row="{ item: user }"> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
30 <div |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
31 class="table-cell center col-1" |
5506
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
32 :style="{ opacity: user.active ? '1' : '0.7' }" |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
33 > |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
34 <font-awesome-icon |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
35 v-tooltip="roleLabel(user.role)" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
36 :icon="roleIcon(user.role)" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
37 class="fa-lg" |
2919
6c5364ff0abb
client: removed a lot of unnecessary closing tags
Markus Kottlaender <markus@intevation.de>
parents:
2899
diff
changeset
|
38 /> |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
39 </div> |
5506
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
40 <div |
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
41 class="table-cell col-4" |
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
42 :style="{ opacity: user.active ? '1' : '0.7' }" |
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
43 > |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
44 {{ user.user }} |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
45 </div> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
46 <div |
5506
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
47 :style="{ opacity: user.active ? '1' : '0.7' }" |
5367
1695e17c5a83
Adds schedualbility for reports as an import.
Thomas Junk <thomas.junk@intevation.de>
parents:
5359
diff
changeset
|
48 class="table-cell center col-1" |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
49 > |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
50 {{ user.country }} |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
51 </div> |
5506
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
52 <div |
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
53 class="table-cell col-3" |
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
54 :style="{ opacity: user.active ? '1' : '0.7' }" |
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
55 > |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
56 {{ user.email }} |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
57 </div> |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
58 <div class="table-cell center col-1"> |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
59 <toggle-button |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
60 :value="user.reports" |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
61 v-model="user.reports" |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
62 class="pt-1" |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
63 :sync="true" |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
64 :speed="100" |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
65 @change="toggleReport(user)" |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
66 v-tooltip="receivesReportLabel" |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
67 :width="40" |
5506
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
68 :disabled="!user.active" |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
69 :height="20" |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
70 /> |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
71 </div> |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
72 <div class="table-cell col text-right justify-content-end"> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
73 <button |
5510
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
74 @click="selectUser(user.user)" |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
75 class="btn btn-xs btn-dark mr-1" |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
76 v-tooltip="getEditLabel(user.active)" |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
77 > |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
78 <font-awesome-icon |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
79 v-if="user.active" |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
80 icon="pencil-alt" |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
81 fixed-width |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
82 /> |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
83 <font-awesome-icon v-else icon="undo" fixed-width /> |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
84 </button> |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
85 <button |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
86 @click="sendTestMail(user.user)" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
87 class="btn btn-xs btn-dark mr-1" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
88 v-tooltip="sendMailLabel" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
89 v-if="user.email" |
5506
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
90 :disabled="!user.active" |
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
91 :style="{ cursor: user.active ? 'pointer' : 'default' }" |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
92 > |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
93 <font-awesome-icon icon="paper-plane" fixed-width /> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
94 </button> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
95 <button |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
96 @click="deleteUser(user.user)" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
97 class="btn btn-xs btn-dark" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
98 v-tooltip="deleteUserLabel" |
5506
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
99 :style="{ cursor: user.active ? 'pointer' : 'default' }" |
90506606a7ef
Client: Distinguish deactivated users in the table
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5368
diff
changeset
|
100 :disabled="!user.active" |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
101 > |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
102 <font-awesome-icon icon="trash" fixed-width /> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
103 </button> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
104 </div> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
105 </template> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
106 </UITableBody> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
107 <div class="p-3 border-top d-flex justify-content-between"> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
108 <div></div> |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
109 <div> |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
110 <button |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
111 @click="prevPage" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
112 v-if="this.page !== 1" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
113 class="mr-2 btn btn-sm btn-light align-self-center" |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
114 > |
2919
6c5364ff0abb
client: removed a lot of unnecessary closing tags
Markus Kottlaender <markus@intevation.de>
parents:
2899
diff
changeset
|
115 <font-awesome-icon icon="angle-left" /> |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
116 </button> |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
117 {{ this.page }} / {{ this.pages }} |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
118 <button |
2874
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
119 @click="nextPage" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
120 v-if="this.page !== this.pages" |
b9a6abef9f1c
client: more unified table layout
Markus Kottlaender <markus@intevation.de>
parents:
2782
diff
changeset
|
121 class="ml-2 btn btn-sm btn-light align-self-center" |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
122 > |
2919
6c5364ff0abb
client: removed a lot of unnecessary closing tags
Markus Kottlaender <markus@intevation.de>
parents:
2899
diff
changeset
|
123 <font-awesome-icon icon="angle-right" /> |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
124 </button> |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
125 </div> |
2322
a25b4988eb0c
client: fixed usermanagement styles
Markus Kottlaender <markus@intevation.de>
parents:
2320
diff
changeset
|
126 <button @click="addUser" class="btn btn-info addbutton shadow-sm"> |
a25b4988eb0c
client: fixed usermanagement styles
Markus Kottlaender <markus@intevation.de>
parents:
2320
diff
changeset
|
127 <translate>Add User</translate> |
a25b4988eb0c
client: fixed usermanagement styles
Markus Kottlaender <markus@intevation.de>
parents:
2320
diff
changeset
|
128 </button> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
129 </div> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
130 </div> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
131 </div> |
5351
4b367f7e39b4
Added messaging from overview to details.
Thomas Junk <thomas.junk@intevation.de>
parents:
5350
diff
changeset
|
132 <Userdetail :reportToggled="reportToggled" v-if="isUserDetailsVisible" /> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
133 </div> |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
134 </div> |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
135 </template> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
136 |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
137 <style lang="sass" scoped> |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
138 .content |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
139 width: 100% |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
140 |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
141 .userdetails |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
142 width: 50% |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
143 |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
144 .main |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
145 height: 100% |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
146 |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
147 .icon |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
148 font-size: large |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
149 |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
150 .userlist |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
151 min-width: 520px |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
152 height: 100% |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
153 |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
154 .userlistsmall |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
155 width: 100% |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
156 |
2463
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
157 .userlistextended |
8cc3cd1b27f2
client: usermanagement: implemented new table component
Markus Kottlaender <markus@intevation.de>
parents:
2387
diff
changeset
|
158 width: 100% |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
159 </style> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
160 |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
161 <script> |
1362
ca33ad696594
remove the first empyty lines
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1361
diff
changeset
|
162 /* This is Free Software under GNU Affero General Public License v >= 3.0 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
163 * without warranty, see README.md and license for details. |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
164 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
165 * SPDX-License-Identifier: AGPL-3.0-or-later |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
166 * License-Filename: LICENSES/AGPL-3.0.txt |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
167 * |
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
168 * Copyright (C) 2018 by via donau |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
169 * – Österreichische Wasserstraßen-Gesellschaft mbH |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
170 * Software engineering by Intevation GmbH |
1361
ea3a89a1813a
remove trailing whitespace, add headers for Makefile, add the missed authors
Fadi Abbud <fadi.abbud@intevation.de>
parents:
1299
diff
changeset
|
171 * |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
172 * Author(s): |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
173 * Thomas Junk <thomas.junk@intevation.de> |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
174 */ |
1613
f2d24dceecc7
refac: cleanup import paths
Thomas Junk <thomas.junk@intevation.de>
parents:
1606
diff
changeset
|
175 import store from "@/store"; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
176 import { mapGetters, mapState } from "vuex"; |
2985
1b8bb4f89227
client: removed .js and .vue extention from imports
Markus Kottlaender <markus@intevation.de>
parents:
2919
diff
changeset
|
177 import { displayError, displayInfo } from "@/lib/errors"; |
2320
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
178 import { HTTP } from "@/lib/http"; |
2738
add2d47c2567
client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents:
2640
diff
changeset
|
179 import { sortTable } from "@/lib/mixins"; |
1674
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
180 |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
181 export default { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
182 name: "userview", |
2738
add2d47c2567
client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents:
2640
diff
changeset
|
183 mixins: [sortTable], |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
184 data() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
185 return { |
5351
4b367f7e39b4
Added messaging from overview to details.
Thomas Junk <thomas.junk@intevation.de>
parents:
5350
diff
changeset
|
186 sortColumn: "user", // overriding the sortTable mixin's empty default value |
5509
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
187 reportToggled: false, |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
188 usersForTable: [], |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
189 areSomeUsersHidden: false |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
190 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
191 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
192 components: { |
1669
16fb9667ddf8
refac: use dynamic imports for components
Thomas Junk <thomas.junk@intevation.de>
parents:
1613
diff
changeset
|
193 Userdetail: () => import("./Userdetail"), |
16fb9667ddf8
refac: use dynamic imports for components
Thomas Junk <thomas.junk@intevation.de>
parents:
1613
diff
changeset
|
194 Spacer: () => import("@/components/Spacer") |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
195 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
196 computed: { |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
197 ...mapGetters("usermanagement", ["isUserDetailsVisible", "users"]), |
1455
33dda08d67be
unified layout for adminsection
Thomas Junk <thomas.junk@intevation.de>
parents:
1448
diff
changeset
|
198 ...mapState("application", ["showSidebar"]), |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
199 ...mapState("usermanagement", ["currentUser"]), |
2760
c6fba10926cc
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2739
diff
changeset
|
200 usersLabel() { |
c6fba10926cc
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2739
diff
changeset
|
201 return this.$gettext("Users"); |
c6fba10926cc
client:correct a set of strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2739
diff
changeset
|
202 }, |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
203 reportsLabel() { |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
204 return this.$gettext("DQL Report"); |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
205 }, |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
206 receivesReportLabel() { |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
207 return this.$gettext("User receives Data Quality Report"); |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
208 }, |
2595
dda4cec8e67b
client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2534
diff
changeset
|
209 sendMailLabel() { |
dda4cec8e67b
client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2534
diff
changeset
|
210 return this.$gettext("Send testmail"); |
dda4cec8e67b
client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2534
diff
changeset
|
211 }, |
dda4cec8e67b
client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2534
diff
changeset
|
212 deleteUserLabel() { |
dda4cec8e67b
client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2534
diff
changeset
|
213 return this.$gettext("Delete user"); |
dda4cec8e67b
client:translations: correct some strings marking
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2534
diff
changeset
|
214 }, |
2782
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
215 roleForColumLabel() { |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
216 return this.$gettext("Role"); |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
217 }, |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
218 usernameLabel() { |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
219 return this.$gettext("Username"); |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
220 }, |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
221 countryLabel() { |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
222 return this.$gettext("Country"); |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
223 }, |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
224 emailLabel() { |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
225 return this.$gettext("Email"); |
615b0a9b8098
Client: correct strings marking for translations
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2760
diff
changeset
|
226 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
227 pages() { |
5509
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
228 return Math.ceil(this.usersForTable.length / this.pageSize); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
229 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
230 tableStyle() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
231 return { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
232 table: true, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
233 "table-hover": true, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
234 "table-sm": this.isUserDetailsVisible, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
235 fadeIn: true, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
236 animated: true |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
237 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
238 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
239 userlistStyle() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
240 return [ |
2534
bb5286acfee2
client: reduced spacings between and inside boxes and more compact main menu
Markus Kottlaender <markus@intevation.de>
parents:
2503
diff
changeset
|
241 "userlist mr-2", |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
242 { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
243 userlistsmall: this.isUserDetailsVisible, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
244 userlistextended: !this.isUserDetailsVisible |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
245 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
246 ]; |
5509
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
247 }, |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
248 checkboxObject() { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
249 // Hide checkbox in case there are no deactivated users |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
250 if (this.users.some(u => !u.active)) { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
251 return { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
252 value: this.areSomeUsersHidden, |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
253 label: "Hide inactive users", |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
254 callback: () => { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
255 this.changeDisplayingState(); |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
256 } |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
257 }; |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
258 } else { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
259 return undefined; |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
260 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
261 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
262 }, |
5509
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
263 watch: { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
264 users() { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
265 this.filterUsers(); |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
266 } |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
267 }, |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
268 mounted() { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
269 this.usersForTable = this.users; |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
270 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
271 methods: { |
5510
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
272 getEditLabel(active) { |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
273 if (active) return this.$gettext("Edit user"); |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
274 return this.$gettext("Reactivate user"); |
b7792e8d5c62
Client: Improve users-table layout
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5509
diff
changeset
|
275 }, |
5509
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
276 changeDisplayingState() { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
277 this.areSomeUsersHidden = !this.areSomeUsersHidden; |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
278 this.filterUsers(); |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
279 }, |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
280 filterUsers() { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
281 if (this.areSomeUsersHidden) { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
282 this.usersForTable = this.users.filter(u => u.active); |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
283 } else { |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
284 this.usersForTable = this.users; |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
285 } |
36cbf14b878a
Client: Add ability to list only active users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5507
diff
changeset
|
286 }, |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
287 toggleReport(user) { |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
288 HTTP.patch( |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
289 `/users/${user.user}`, |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
290 { |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
291 reports: user.reports |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
292 }, |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
293 { |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
294 headers: { |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
295 "X-Gemma-Auth": localStorage.getItem("token"), |
5350
59db9836e29a
fixed mimetype in toggleReport
Thomas Junk <thomas.junk@intevation.de>
parents:
5348
diff
changeset
|
296 "Content-type": "application/json; charset=UTF-8" |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
297 } |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
298 } |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
299 ) |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
300 .then(() => { |
5367
1695e17c5a83
Adds schedualbility for reports as an import.
Thomas Junk <thomas.junk@intevation.de>
parents:
5359
diff
changeset
|
301 if (this.currentUser && this.currentUser.user === user.user) { |
5351
4b367f7e39b4
Added messaging from overview to details.
Thomas Junk <thomas.junk@intevation.de>
parents:
5350
diff
changeset
|
302 this.reportToggled = !this.reportToggled; |
4b367f7e39b4
Added messaging from overview to details.
Thomas Junk <thomas.junk@intevation.de>
parents:
5350
diff
changeset
|
303 } |
5348
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
304 }) |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
305 .catch(error => { |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
306 let message = "Backend not reachable"; |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
307 if (error.response) { |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
308 const { status, data } = error.response; |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
309 message = `${status}: ${data.message || data}`; |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
310 } |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
311 displayError({ |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
312 title: this.$gettext("Backend Error"), |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
313 message: message |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
314 }); |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
315 user.reports = !user.reports; |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
316 }); |
45b03e8ca47e
Toggles in user overview and in details section as well established
Thomas Junk <thomas.junk@intevation.de>
parents:
4869
diff
changeset
|
317 }, |
2320
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
318 sendTestMail(user) { |
4632
2e47b32a389d
client: encode strings in url paths
Fadi Abbud <fadi.abbud@intevation.de>
parents:
2985
diff
changeset
|
319 HTTP.get("/testmail/" + encodeURIComponent(user), { |
2320
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
320 headers: { |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
321 "X-Gemma-Auth": localStorage.getItem("token"), |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
322 "Content-type": "text/xml; charset=UTF-8" |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
323 } |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
324 }) |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
325 .then(() => { |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
326 displayInfo({ |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
327 message: this.$gettext("Testmail sent") |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
328 }); |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
329 }) |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
330 .catch(error => { |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
331 this.loginFailed = true; |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
332 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
333 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
334 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
335 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
336 } |
2320
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
337 displayError({ |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
338 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
339 message: message |
2320
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
340 }); |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
341 }); |
f2c67ebeaabb
moved test mail button to table
Markus Kottlaender <markus@intevation.de>
parents:
2290
diff
changeset
|
342 }, |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
343 nextPage() { |
2738
add2d47c2567
client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents:
2640
diff
changeset
|
344 if (this.page < this.pages) { |
add2d47c2567
client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents:
2640
diff
changeset
|
345 this.page += 1; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
346 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
347 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
348 prevPage() { |
2738
add2d47c2567
client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents:
2640
diff
changeset
|
349 if (this.page > 0) { |
add2d47c2567
client: tables: implemented simple default sorting
Markus Kottlaender <markus@intevation.de>
parents:
2640
diff
changeset
|
350 this.page -= 1; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
351 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
352 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
353 deleteUser(name) { |
2384
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
354 this.$store.commit("application/popup", { |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
355 icon: "trash", |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
356 title: this.$gettext("Delete User"), |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
357 content: |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
358 this.$gettext( |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
359 "Do you really want to delete the following user account:" |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
360 ) + |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
361 `<br> |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
362 <b>${name}</b>`, |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
363 confirm: { |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
364 label: this.$gettext("Delete"), |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
365 icon: "trash", |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
366 callback: () => { |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
367 this.$store |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
368 .dispatch("usermanagement/deleteUser", { name }) |
5507
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
369 .then(response => { |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
370 displayInfo({ |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
371 message: |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
372 name + |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
373 // Exclude whitespaces from the string passed to "gettext" function |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
374 " " + |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
375 this.$gettext("user account") + |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
376 " " + |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
377 response.data.action + |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
378 " " + |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
379 this.$gettext("successfully") |
279900b28b1b
Client: Notify user by successfully deleting/deactivating users
Fadi Abbud <fadi.abbud@intevation.de>
parents:
5506
diff
changeset
|
380 }); |
2384
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
381 this.$store |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
382 .dispatch("usermanagement/loadUsers") |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
383 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
384 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
385 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
386 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
387 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
388 } |
2384
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
389 displayError({ |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
390 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
391 message: message |
2384
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
392 }); |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
393 }); |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
394 }) |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
395 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
396 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
397 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
398 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
399 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
400 } |
2384
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
401 displayError({ |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
402 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
403 message: message |
2384
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
404 }); |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
405 }); |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
406 } |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
407 }, |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
408 cancel: { |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
409 label: this.$gettext("Cancel"), |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
410 icon: "times" |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
411 } |
c06b001dc26b
client: improved popup implementation
Markus Kottlaender <markus@intevation.de>
parents:
2330
diff
changeset
|
412 }); |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
413 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
414 addUser() { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
415 this.$store.commit("usermanagement/clearCurrentUser"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
416 this.$store.commit("usermanagement/setUserDetailsVisible"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
417 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
418 selectUser(name) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
419 const user = this.$store.getters["usermanagement/getUserByName"](name); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
420 this.$store.commit("usermanagement/setCurrentUser", user); |
1299
2738a6ae9ad8
fontawesome 4 -> 5
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
421 }, |
2738a6ae9ad8
fontawesome 4 -> 5
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
422 roleIcon(role) { |
2738a6ae9ad8
fontawesome 4 -> 5
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
423 if (role === "sys_admin") return "star"; |
2738a6ae9ad8
fontawesome 4 -> 5
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
424 if (role === "waterway_admin") return ["fab", "adn"]; |
2738a6ae9ad8
fontawesome 4 -> 5
Markus Kottlaender <markus@intevation.de>
parents:
1272
diff
changeset
|
425 return "user"; |
1674
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
426 }, |
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
427 roleLabel(role) { |
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
428 const labels = { |
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
429 sys_admin: this.$gettext("System-Administrator"), |
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
430 waterway_admin: this.$gettext("Waterway Admin"), |
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
431 waterway_user: this.$gettext("Waterway User") |
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
432 }; |
54f7493e5d36
fix: Tooltips are working again
Thomas Junk <thomas.junk@intevation.de>
parents:
1669
diff
changeset
|
433 return labels[role]; |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
434 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
435 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
436 beforeRouteEnter(to, from, next) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
437 store |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
438 .dispatch("usermanagement/loadUsers") |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
439 .then(next) |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
440 .catch(error => { |
4869
6b054b91d9b2
backend not reachable as error message etd. Login adjusted
Thomas Junk <thomas.junk@intevation.de>
parents:
4868
diff
changeset
|
441 let message = "Backend not reachable"; |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
442 if (error.response) { |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
443 const { status, data } = error.response; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
444 message = `${status}: ${data.message || data}`; |
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
445 } |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
446 displayError({ |
1460 | 447 title: this.$gettext("Backend Error"), |
4868
008bc1ae8897
exception handling
Thomas Junk <thomas.junk@intevation.de>
parents:
4632
diff
changeset
|
448 message: message |
1272
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
449 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
450 }); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
451 }, |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
452 beforeRouteLeave(to, from, next) { |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
453 store.commit("usermanagement/clearCurrentUser"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
454 store.commit("usermanagement/setUserDetailsInvisible"); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
455 next(); |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
456 } |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
457 }; |
bc55ffaeb639
cleaned up client/src directory
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
458 </script> |