Mercurial > gemma
annotate client/src/views/Users.vue @ 406:40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Basic features for adding, changing, deleting users established
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 15 Aug 2018 15:14:23 +0200 |
parents | cb233a5a2ecd |
children | a9440a4826aa |
rev | line source |
---|---|
278
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 <div class="main d-flex"> |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 <Sidebar v-bind:isOverlay="false"></Sidebar> |
379
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
4 <div class="d-flex content flex-column"> |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
5 <div> |
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
6 <h1>User Management</h1> |
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
7 </div> |
379
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
8 <div class="d-flex flex-row"> |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
9 <div :class="userlistStyle"> |
379
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
10 <div class="card"> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
11 <div class="card-header text-white bg-info mb-3"> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
12 users |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
13 </div> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
14 <div class="card-body"> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
15 <table class="table table-hover"> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
16 <thead> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
17 <tr> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
18 <th scope="col">Username</th> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
19 <th scope="col">Country</th> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
20 <th scope="col">Email</th> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
21 <th scope="col">Role</th> |
400
cb233a5a2ecd
fix: Fixed country validation on submit
Thomas Junk <thomas.junk@intevation.de>
parents:
389
diff
changeset
|
22 <th scope="col"></th> |
379
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
23 </tr> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
24 </thead> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
25 <tbody> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
26 <tr v-for="user in users" :key="user.user" @click="selectUser(user.user)"> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
27 <td>{{ user.user }}</td> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
28 <td>{{ user.country }}</td> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
29 <td>{{ user.email}}</td> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
30 <td>{{ user.role }}</td> |
400
cb233a5a2ecd
fix: Fixed country validation on submit
Thomas Junk <thomas.junk@intevation.de>
parents:
389
diff
changeset
|
31 <td><i @click="deleteUser(user.user)" class="fa fa-trash-o"></i></td> |
379
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
32 </tr> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
33 </tbody> |
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
34 </table> |
293
85b653d4380c
style: Table is now rendered as a card.
Thomas Junk <thomas.junk@intevation.de>
parents:
290
diff
changeset
|
35 </div> |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
36 <div class="adduser"> |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
37 <button @click="addUser" class="btn btn-info pull-right">Add User</button> |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
38 </div> |
375
112527683ee9
Backed out changeset 2c58906649be
Thomas Junk <thomas.junk@intevation.de>
parents:
373
diff
changeset
|
39 </div> |
293
85b653d4380c
style: Table is now rendered as a card.
Thomas Junk <thomas.junk@intevation.de>
parents:
290
diff
changeset
|
40 </div> |
379
0a9aaf21f69f
feat: usermanagement
Thomas Junk <thomas.junk@intevation.de>
parents:
376
diff
changeset
|
41 <Userdetail v-if="isUserDetailsVisible"></Userdetail> |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
42 </div> |
278
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
43 </div> |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
44 </div> |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
45 </template> |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
46 |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
47 <style lang="scss"> |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
48 @import "../assets/application.scss"; |
278
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
49 .main { |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
50 height: 100vh; |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 } |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
53 .content { |
293
85b653d4380c
style: Table is now rendered as a card.
Thomas Junk <thomas.junk@intevation.de>
parents:
290
diff
changeset
|
54 margin-top: $large-offset; |
85b653d4380c
style: Table is now rendered as a card.
Thomas Junk <thomas.junk@intevation.de>
parents:
290
diff
changeset
|
55 margin-left: auto; |
85b653d4380c
style: Table is now rendered as a card.
Thomas Junk <thomas.junk@intevation.de>
parents:
290
diff
changeset
|
56 margin-right: auto; |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
57 } |
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
58 |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
59 .adduser { |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
60 margin-right: $offset; |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
61 padding-bottom: $offset; |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
62 } |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
63 |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
64 .userlist { |
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
65 margin-top: $large-offset; |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
66 margin-right: $offset; |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
67 height: 100%; |
278
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 } |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
69 |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
70 .userlistsmall { |
400
cb233a5a2ecd
fix: Fixed country validation on submit
Thomas Junk <thomas.junk@intevation.de>
parents:
389
diff
changeset
|
71 width: 35vw; |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
72 } |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
73 |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
74 .userlistextended { |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
75 width: 70vw; |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
76 } |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
77 |
293
85b653d4380c
style: Table is now rendered as a card.
Thomas Junk <thomas.junk@intevation.de>
parents:
290
diff
changeset
|
78 .shadow { |
85b653d4380c
style: Table is now rendered as a card.
Thomas Junk <thomas.junk@intevation.de>
parents:
290
diff
changeset
|
79 box-shadow: $basic-shadow-light !important; |
85b653d4380c
style: Table is now rendered as a card.
Thomas Junk <thomas.junk@intevation.de>
parents:
290
diff
changeset
|
80 } |
294
c57b0b230452
style: Remove bootstrap standard lines
Thomas Junk <thomas.junk@intevation.de>
parents:
293
diff
changeset
|
81 |
c57b0b230452
style: Remove bootstrap standard lines
Thomas Junk <thomas.junk@intevation.de>
parents:
293
diff
changeset
|
82 .table th, |
c57b0b230452
style: Remove bootstrap standard lines
Thomas Junk <thomas.junk@intevation.de>
parents:
293
diff
changeset
|
83 td { |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
84 font-size: 0.9rem; |
294
c57b0b230452
style: Remove bootstrap standard lines
Thomas Junk <thomas.junk@intevation.de>
parents:
293
diff
changeset
|
85 border-top: 0px !important; |
c57b0b230452
style: Remove bootstrap standard lines
Thomas Junk <thomas.junk@intevation.de>
parents:
293
diff
changeset
|
86 } |
300
af29878be602
feat: User table selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
299
diff
changeset
|
87 |
af29878be602
feat: User table selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
299
diff
changeset
|
88 .table td { |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
89 font-size: 0.9rem; |
300
af29878be602
feat: User table selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
299
diff
changeset
|
90 cursor: pointer; |
af29878be602
feat: User table selectable
Thomas Junk <thomas.junk@intevation.de>
parents:
299
diff
changeset
|
91 } |
278
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
92 </style> |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 <script> |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
95 import Sidebar from "../components/Sidebar"; |
356
dc8052b60485
feat: User detail card added
Thomas Junk <thomas.junk@intevation.de>
parents:
300
diff
changeset
|
96 import Userdetail from "../components/Userdetail"; |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
97 import store from "../store"; |
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
98 import { mapGetters } from "vuex"; |
295
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
294
diff
changeset
|
99 import app from "../main"; |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
100 |
278
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 export default { |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
102 name: "userview", |
375
112527683ee9
Backed out changeset 2c58906649be
Thomas Junk <thomas.junk@intevation.de>
parents:
373
diff
changeset
|
103 data() { |
376
e42f42eb9353
refactor: Userdetails refactored to card model
Thomas Junk <thomas.junk@intevation.de>
parents:
375
diff
changeset
|
104 return {}; |
375
112527683ee9
Backed out changeset 2c58906649be
Thomas Junk <thomas.junk@intevation.de>
parents:
373
diff
changeset
|
105 }, |
278
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 components: { |
356
dc8052b60485
feat: User detail card added
Thomas Junk <thomas.junk@intevation.de>
parents:
300
diff
changeset
|
107 Sidebar, |
dc8052b60485
feat: User detail card added
Thomas Junk <thomas.junk@intevation.de>
parents:
300
diff
changeset
|
108 Userdetail |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
109 }, |
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
110 computed: { |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
111 ...mapGetters("usermanagement", ["users", "isUserDetailsVisible"]), |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
112 userlistStyle() { |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
113 return { |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
114 userlist: true, |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
115 shadow: true, |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
116 userlistsmall: this.isUserDetailsVisible, |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
117 userlistextended: !this.isUserDetailsVisible |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
118 }; |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
119 } |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
120 }, |
375
112527683ee9
Backed out changeset 2c58906649be
Thomas Junk <thomas.junk@intevation.de>
parents:
373
diff
changeset
|
121 methods: { |
400
cb233a5a2ecd
fix: Fixed country validation on submit
Thomas Junk <thomas.junk@intevation.de>
parents:
389
diff
changeset
|
122 deleteUser(name) { |
406
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
123 this.$store |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
124 .dispatch("usermanagement/deleteUser", { name: name }) |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
125 .then(() => { |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
126 this.submitted = false; |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
127 this.$store.dispatch("usermanagement/loadUsers").catch(error => { |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
128 const { status, data } = error.response; |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
129 app.$toast.error({ |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
130 title: "Backend Error", |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
131 message: `${status}: ${data.message}` |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
132 }); |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
133 }); |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
134 }) |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
135 .catch(error => { |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
136 const { status, data } = error.response; |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
137 app.$toast.error({ |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
138 title: "Backend Error", |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
139 message: `${status}: ${data.message}` |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
140 }); |
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
141 }); |
400
cb233a5a2ecd
fix: Fixed country validation on submit
Thomas Junk <thomas.junk@intevation.de>
parents:
389
diff
changeset
|
142 }, |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
143 addUser() { |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
144 this.$store.commit("usermanagement/clearCurrentUser"); |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
145 this.$store.commit("usermanagement/setUserDetailsVisible"); |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
146 }, |
375
112527683ee9
Backed out changeset 2c58906649be
Thomas Junk <thomas.junk@intevation.de>
parents:
373
diff
changeset
|
147 selectUser(name) { |
112527683ee9
Backed out changeset 2c58906649be
Thomas Junk <thomas.junk@intevation.de>
parents:
373
diff
changeset
|
148 const user = this.$store.getters["usermanagement/getUserByName"](name); |
376
e42f42eb9353
refactor: Userdetails refactored to card model
Thomas Junk <thomas.junk@intevation.de>
parents:
375
diff
changeset
|
149 this.$store.commit("usermanagement/setCurrentUser", user); |
375
112527683ee9
Backed out changeset 2c58906649be
Thomas Junk <thomas.junk@intevation.de>
parents:
373
diff
changeset
|
150 } |
112527683ee9
Backed out changeset 2c58906649be
Thomas Junk <thomas.junk@intevation.de>
parents:
373
diff
changeset
|
151 }, |
289
aee175e3f82c
feat: Listing of users on management page
Thomas Junk <thomas.junk@intevation.de>
parents:
278
diff
changeset
|
152 beforeRouteEnter(to, from, next) { |
295
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
294
diff
changeset
|
153 store |
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
294
diff
changeset
|
154 .dispatch("usermanagement/loadUsers") |
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
294
diff
changeset
|
155 .then(next) |
299
6b4df87a7ccc
refactor: console.log removed. Backend error while fetching users.
Thomas Junk <thomas.junk@intevation.de>
parents:
295
diff
changeset
|
156 .catch(error => { |
6b4df87a7ccc
refactor: console.log removed. Backend error while fetching users.
Thomas Junk <thomas.junk@intevation.de>
parents:
295
diff
changeset
|
157 const { status, data } = error.response; |
295
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
294
diff
changeset
|
158 app.$toast.error({ |
373
7e7e978d1cac
Backed out changeset 1a2ef18e464d
Thomas Junk <thomas.junk@intevation.de>
parents:
366
diff
changeset
|
159 title: "Backend Error", |
406
40e7ab3df32c
feat: Basic CRUD for usermanagement etd
Thomas Junk <thomas.junk@intevation.de>
parents:
400
diff
changeset
|
160 message: `${status}: ${data.message}` |
295
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
294
diff
changeset
|
161 }); |
22deb76dff2c
feat: Added vue2-toastr
Thomas Junk <thomas.junk@intevation.de>
parents:
294
diff
changeset
|
162 }); |
389
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
163 }, |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
164 beforeRouteLeave(to, from, next) { |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
165 store.commit("usermanagement/clearCurrentUser"); |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
166 store.commit("usermanagement/setUserDetailsInvisible"); |
e7d5383bc358
feat: Primitive validation and error messages
Thomas Junk <thomas.junk@intevation.de>
parents:
379
diff
changeset
|
167 next(); |
278
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
168 } |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
169 }; |
9c1dfadb53aa
feat: usermanagement - route established and secured
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
170 </script> |