Mercurial > gemma
changeset 2320:f2c67ebeaabb
moved test mail button to table
This testmail endpoints can onnly send an email to the currently configured
email for a given user. Therefore it's unintuitive behavior in the edit form
when you change the email and then click the test mail button before savingthe form
To avoid this the button was now moved to the table, where it is more clear that
the mail will be send to the current adress.
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Tue, 19 Feb 2019 08:41:31 +0100 |
parents | 478cc0d26d33 |
children | c00e3f7f5b17 |
files | client/src/components/usermanagement/Userdetail.vue client/src/components/usermanagement/Usermanagement.vue |
diffstat | 2 files changed, 57 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/usermanagement/Userdetail.vue Tue Feb 19 08:08:17 2019 +0100 +++ b/client/src/components/usermanagement/Userdetail.vue Tue Feb 19 08:41:31 2019 +0100 @@ -130,16 +130,6 @@ <translate>Submit</translate> </button> </div> - <div - v-if="currentUser.role != 'waterway_user'" - class="form-group row d-flex flex-row justify-content-start mailbutton" - > - <a @click="sendTestMail" class="btn btn-light"> - <font-awesome-icon icon="paper-plane"></font-awesome-icon> - <translate>Send testmail</translate> - </a> - <div v-if="mailsent"><translate>Mail was sent</translate></div> - </div> </form> </div> </div> @@ -188,7 +178,6 @@ * Author(s): * Thomas Junk <thomas.junk@intevation.de> */ -import { HTTP } from "@/lib/http"; import { displayError } from "@/lib/errors.js"; import { mapState } from "vuex"; @@ -231,7 +220,6 @@ }, data() { return { - mailsent: false, passwordLabel: this.$gettext("Password"), passwordReLabel: this.$gettext("Repeat Password"), passwordPlaceholder: this.$gettext("password"), @@ -285,27 +273,6 @@ } }, methods: { - sendTestMail() { - if (this.mailsent) return; - HTTP.get("/testmail/" + this.currentUser.user, { - headers: { - "X-Gemma-Auth": localStorage.getItem("token"), - "Content-type": "text/xml; charset=UTF-8" - } - }) - .then(() => { - this.mailsent = true; - }) - .catch(error => { - this.loginFailed = true; - this.submitted = false; - const { status, data } = error.response; - displayError({ - title: this.$gettext("Backend Error"), - message: `${status}: ${data.message || data}` - }); - }); - }, passwordChanged(value) { this.password = value; this.validatePassword();
--- a/client/src/components/usermanagement/Usermanagement.vue Tue Feb 19 08:08:17 2019 +0100 +++ b/client/src/components/usermanagement/Usermanagement.vue Tue Feb 19 08:41:31 2019 +0100 @@ -18,6 +18,15 @@ <table id="datatable" :class="tableStyle"> <thead> <tr> + <th scope="col" @click="sortBy('role')"> + <span + >Role + <font-awesome-icon + v-if="sortCriterion == 'role'" + icon="angle-down" + ></font-awesome-icon> + </span> + </th> <th scope="col" @click="sortBy('user')"> <span >Username @@ -45,37 +54,41 @@ ></font-awesome-icon> </span> </th> - <th scope="col" @click="sortBy('role')"> - <span - >Role - <font-awesome-icon - v-if="sortCriterion == 'role'" - icon="angle-down" - ></font-awesome-icon> - </span> - </th> <th scope="col"></th> </tr> </thead> <tbody> <tr v-for="user in users" :key="user.user"> - <td @click="selectUser(user.user)">{{ user.user }}</td> - <td @click="selectUser(user.user)">{{ user.country }}</td> - <td @click="selectUser(user.user)">{{ user.email }}</td> <td @click="selectUser(user.user)"> <font-awesome-icon v-tooltip="roleLabel(user.role)" :icon="roleIcon(user.role)" ></font-awesome-icon> </td> - <td> - <font-awesome-icon - icon="trash" + <td @click="selectUser(user.user)">{{ user.user }}</td> + <td @click="selectUser(user.user)">{{ user.country }}</td> + <td @click="selectUser(user.user)">{{ user.email }}</td> + <td class="text-right"> + <button + @click="sendTestMail(user.user)" + class="btn btn-sm btn-info mr-1" + v-tooltip="$gettext('Send testmail')" + v-if="user.email" + > + <font-awesome-icon + icon="paper-plane" + ></font-awesome-icon> + </button> + <button @click=" showDeleteUserPrompt = true; userToDelete = user.user; " - ></font-awesome-icon> + class="btn btn-sm btn-danger" + v-tooltip="$gettext('Delete user')" + > + <font-awesome-icon icon="trash" /> + </button> </td> </tr> </tbody> @@ -198,6 +211,10 @@ cursor: pointer; } +.table th:first-child { + width: 50px; +} + .table th, td { font-size: $smaller; @@ -232,7 +249,8 @@ */ import store from "@/store"; import { mapGetters, mapState } from "vuex"; -import { displayError } from "@/lib/errors.js"; +import { displayError, displayInfo } from "@/lib/errors.js"; +import { HTTP } from "@/lib/http"; import Vue from "vue"; import { VTooltip, VPopover, VClosePopover } from "v-tooltip"; @@ -300,6 +318,28 @@ } }, methods: { + sendTestMail(user) { + HTTP.get("/testmail/" + user, { + headers: { + "X-Gemma-Auth": localStorage.getItem("token"), + "Content-type": "text/xml; charset=UTF-8" + } + }) + .then(() => { + displayInfo({ + message: this.$gettext("Testmail sent") + }); + }) + .catch(error => { + this.loginFailed = true; + this.submitted = false; + const { status, data } = error.response; + displayError({ + title: this.$gettext("Backend Error"), + message: `${status}: ${data.message || data}` + }); + }); + }, tween() {}, nextPage() { if (this.currentPage < this.pages) {