Mercurial > gemma
annotate client/src/views/Usermanagement.vue @ 583:a27c405ec1a8
added missing vue files
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Fri, 07 Sep 2018 08:40:21 +0200 |
parents | |
children |
rev | line source |
---|---|
583
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
1 <template> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
2 <div class="main d-flex flex-column"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
3 <div class="d-flex content flex-column"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
4 <div class="d-flex flex-row"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
5 <div :class="userlistStyle"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
6 <div class="card"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
7 <div class="card-header shadow-sm text-white bg-info mb-3"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
8 Users |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
9 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
10 <div class="card-body"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
11 <table id="datatable" :class="tableStyle"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
12 <thead> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
13 <tr> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
14 <th scope="col" @click="sortBy('user')"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
15 <span>Username |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
16 <i v-if="sortCriterion=='user'" class="fa fa-angle-down"></i> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
17 </span> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
18 </th> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
19 <th scope="col" @click="sortBy('country')"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
20 <span>Country |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
21 <i v-if="sortCriterion=='country'" class="fa fa-angle-down"></i> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
22 </span> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
23 </th> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
24 <th scope="col" @click="sortBy('email')"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
25 <span>Email |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
26 <i v-if="sortCriterion=='email'" class="fa fa-angle-down"></i> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
27 </span> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
28 </th> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
29 <th scope="col" @click="sortBy('role')"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
30 <span>Role |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
31 <i v-if="sortCriterion=='role'" class="fa fa-angle-down"></i> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
32 </span> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
33 </th> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
34 <th scope="col"></th> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
35 </tr> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
36 </thead> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
37 <tbody> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
38 <tr v-for="user in users" :key="user.user" @click="selectUser(user.user)"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
39 <td>{{ user.user }}</td> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
40 <td>{{ user.country }}</td> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
41 <td>{{ user.email}}</td> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
42 <td> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
43 <i v-tooltip="user.roleLabel" :class="{ |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
44 fa:true, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
45 icon:true, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
46 'fa-user':user.role==='waterway_user', |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
47 'fa-star':user.role=='sys_admin', |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
48 'fa-adn':user.role==='waterway_admin'}"></i> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
49 </td> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
50 <td> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
51 <i @click="deleteUser(user.user)" class="icon fa fa-trash-o"></i> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
52 </td> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
53 </tr> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
54 </tbody> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
55 </table> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
56 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
57 <div class="d-flex flex-row pagination"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
58 <i @click=" prevPage " v-if="this.currentPage!=1 " class="backwards btn btn-sm btn-light align-self-center pages fa fa-caret-left "></i> {{this.currentPage}} / {{this.pages}} |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
59 <i @click="nextPage " class="forwards btn btn-sm btn-light align-self-center pages fa fa-caret-right "></i> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
60 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
61 <div class="adduser "> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
62 <button @click="addUser " class="btn btn-info pull-right shadow-sm ">Add User</button> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
63 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
64 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
65 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
66 <Userdetail v-if="isUserDetailsVisible "></Userdetail> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
67 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
68 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
69 </div> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
70 </template> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
71 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
72 <style lang="scss"> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
73 @import "../assets/application.scss"; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
74 @import "../assets/tooltip.scss"; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
75 .main { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
76 height: 100vh; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
77 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
78 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
79 .backwards { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
80 margin-right: 0.5rem; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
81 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
82 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
83 .forwards { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
84 margin-left: 0.5rem; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
85 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
86 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
87 .content { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
88 margin-top: $large-offset; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
89 margin-left: auto; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
90 margin-right: auto; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
91 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
92 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
93 .adduser { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
94 margin-right: $offset; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
95 padding-bottom: $offset; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
96 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
97 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
98 .icon { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
99 font-size: large; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
100 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
101 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
102 .userlist { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
103 margin-top: $topbarheight; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
104 margin-right: $offset; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
105 min-width: 520px; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
106 height: 100%; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
107 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
108 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
109 .pagination { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
110 margin-left: auto; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
111 margin-right: auto; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
112 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
113 .userlistsmall { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
114 width: 30vw; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
115 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
116 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
117 .userlistextended { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
118 width: 70vw; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
119 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
120 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
121 .table { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
122 width: 90% !important; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
123 margin: auto; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
124 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
125 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
126 .table th, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
127 .pages { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
128 cursor: pointer; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
129 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
130 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
131 .table th, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
132 td { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
133 font-size: 0.9rem; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
134 border-top: 0px !important; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
135 text-align: left; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
136 padding: 0.5rem !important; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
137 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
138 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
139 .table td { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
140 font-size: 0.9rem; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
141 cursor: pointer; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
142 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
143 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
144 tr span { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
145 display: flex; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
146 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
147 </style> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
148 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
149 <script> |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
150 import Userdetail from "../components/Userdetail"; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
151 import store from "../store"; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
152 import { mapGetters } from "vuex"; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
153 import { displayError } from "../lib/errors.js"; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
154 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
155 export default { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
156 name: "userview", |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
157 data() { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
158 return { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
159 sortCriterion: "user", |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
160 pageSize: 10, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
161 currentPage: 1 |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
162 }; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
163 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
164 components: { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
165 Userdetail |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
166 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
167 computed: { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
168 ...mapGetters("usermanagement", ["isUserDetailsVisible"]), |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
169 ...mapGetters("application", ["sidebarCollapsed"]), |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
170 users() { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
171 let users = [...this.$store.getters["usermanagement/users"]]; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
172 users.sort((a, b) => { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
173 if ( |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
174 a[this.sortCriterion].toLowerCase() < |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
175 b[this.sortCriterion].toLowerCase() |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
176 ) |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
177 return -1; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
178 if ( |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
179 a[this.sortCriterion].toLowerCase() > |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
180 b[this.sortCriterion].toLowerCase() |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
181 ) |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
182 return 1; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
183 return 0; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
184 }); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
185 const start = (this.currentPage - 1) * this.pageSize; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
186 return users.slice(start, start + this.pageSize); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
187 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
188 pages() { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
189 let users = [...this.$store.getters["usermanagement/users"]]; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
190 return Math.ceil(users.length / this.pageSize); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
191 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
192 tableStyle() { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
193 return { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
194 table: true, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
195 "table-hover": true, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
196 "table-sm": this.isUserDetailsVisible, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
197 fadeIn: true, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
198 animated: true |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
199 }; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
200 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
201 userlistStyle() { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
202 return { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
203 userlist: true, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
204 shadow: true, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
205 userlistsmall: this.isUserDetailsVisible, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
206 userlistextended: !this.isUserDetailsVisible |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
207 }; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
208 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
209 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
210 methods: { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
211 tween() {}, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
212 nextPage() { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
213 if (this.currentPage < this.pages) { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
214 document.querySelector("#datatable").classList.add("fadeOut"); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
215 setTimeout(() => { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
216 document.querySelector("#datatable").classList.remove("fadeOut"); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
217 this.currentPage += 1; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
218 }, 10); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
219 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
220 return; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
221 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
222 prevPage() { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
223 if (this.currentPage > 0) { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
224 document.querySelector("#datatable").classList.add("fadeOut"); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
225 setTimeout(() => { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
226 document.querySelector("#datatable").classList.remove("fadeOut"); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
227 this.currentPage -= 1; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
228 }, 10); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
229 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
230 return; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
231 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
232 sortBy(criterion) { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
233 this.sortCriterion = criterion; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
234 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
235 deleteUser(name) { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
236 this.$store |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
237 .dispatch("usermanagement/deleteUser", { name: name }) |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
238 .then(() => { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
239 this.submitted = false; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
240 this.$store.dispatch("usermanagement/loadUsers").catch(error => { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
241 const { status, data } = error.response; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
242 displayError({ |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
243 title: "Backend Error", |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
244 message: `${status}: ${data.message || data}` |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
245 }); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
246 }); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
247 }) |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
248 .catch(error => { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
249 const { status, data } = error.response; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
250 displayError({ |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
251 title: "Backend Error", |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
252 message: `${status}: ${data.message || data}` |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
253 }); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
254 }); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
255 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
256 addUser() { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
257 this.$store.commit("usermanagement/clearCurrentUser"); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
258 this.$store.commit("usermanagement/setUserDetailsVisible"); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
259 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
260 selectUser(name) { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
261 const user = this.$store.getters["usermanagement/getUserByName"](name); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
262 this.$store.commit("usermanagement/setCurrentUser", user); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
263 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
264 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
265 beforeRouteEnter(to, from, next) { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
266 store |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
267 .dispatch("usermanagement/loadUsers") |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
268 .then(next) |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
269 .catch(error => { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
270 const { status, data } = error.response; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
271 displayError({ |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
272 title: "Backend Error", |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
273 message: `${status}: ${data}` |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
274 }); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
275 }); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
276 }, |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
277 beforeRouteLeave(to, from, next) { |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
278 store.commit("usermanagement/clearCurrentUser"); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
279 store.commit("usermanagement/setUserDetailsInvisible"); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
280 next(); |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
281 } |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
282 }; |
a27c405ec1a8
added missing vue files
Thomas Junk <thomas.junk@intevation.de>
parents:
diff
changeset
|
283 </script> |