feat: display error messages on settings
parent
5e6f14b5dc
commit
603203848a
|
@ -215,6 +215,7 @@
|
||||||
"settingsUpdated": "Settings updated!",
|
"settingsUpdated": "Settings updated!",
|
||||||
"shareDuration": "Share Duration",
|
"shareDuration": "Share Duration",
|
||||||
"shareManagement": "Share Management",
|
"shareManagement": "Share Management",
|
||||||
|
"shareDeleted": "Share deleted!",
|
||||||
"singleClick": "Use single clicks to open files and directories",
|
"singleClick": "Use single clicks to open files and directories",
|
||||||
"themes": {
|
"themes": {
|
||||||
"dark": "Dark",
|
"dark": "Dark",
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="row" v-if="!loading">
|
<errors v-if="error" :errorCode="error.message" />
|
||||||
|
<div class="row" v-else-if="!loading">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<form class="card" @submit.prevent="save">
|
<form class="card" @submit.prevent="save">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
|
@ -172,10 +173,11 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapMutations } from "vuex";
|
import { mapState, mapMutations } from "vuex";
|
||||||
import { settings as api } from "@/api";
|
import { settings as api } from "@/api";
|
||||||
|
import { enableExec } from "@/utils/constants";
|
||||||
import UserForm from "@/components/settings/UserForm";
|
import UserForm from "@/components/settings/UserForm";
|
||||||
import Rules from "@/components/settings/Rules";
|
import Rules from "@/components/settings/Rules";
|
||||||
import Themes from "@/components/settings/Themes";
|
import Themes from "@/components/settings/Themes";
|
||||||
import { enableExec } from "@/utils/constants";
|
import Errors from "@/views/Errors";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "settings",
|
name: "settings",
|
||||||
|
@ -183,9 +185,11 @@ export default {
|
||||||
Themes,
|
Themes,
|
||||||
UserForm,
|
UserForm,
|
||||||
Rules,
|
Rules,
|
||||||
|
Errors,
|
||||||
},
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
error: null,
|
||||||
originalSettings: null,
|
originalSettings: null,
|
||||||
settings: null,
|
settings: null,
|
||||||
};
|
};
|
||||||
|
@ -212,10 +216,10 @@ export default {
|
||||||
|
|
||||||
this.originalSettings = original;
|
this.originalSettings = original;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
|
|
||||||
this.setLoading(false);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$showError(e);
|
this.error = e;
|
||||||
|
} finally {
|
||||||
|
this.setLoading(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="row" v-if="!loading">
|
<errors v-if="error" :errorCode="error.message" />
|
||||||
|
<div class="row" v-else-if="!loading">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
<h2>{{ $t("settings.shareManagement") }}</h2>
|
<h2>{{ $t("settings.shareManagement") }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="card-content full">
|
<div class="card-content full" v-if="links.length > 0">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{{ $t("settings.path") }}</th>
|
<th>{{ $t("settings.path") }}</th>
|
||||||
|
@ -52,6 +53,10 @@
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
<h2 class="message" v-else>
|
||||||
|
<i class="material-icons">sentiment_dissatisfied</i>
|
||||||
|
<span>{{ $t("files.lonely") }}</span>
|
||||||
|
</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,16 +64,21 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { share as api, users } from "@/api";
|
import { share as api, users } from "@/api";
|
||||||
import moment from "moment";
|
|
||||||
import { baseURL } from "@/utils/constants";
|
import { baseURL } from "@/utils/constants";
|
||||||
import Clipboard from "clipboard";
|
|
||||||
import { mapState, mapMutations } from "vuex";
|
import { mapState, mapMutations } from "vuex";
|
||||||
|
import moment from "moment";
|
||||||
|
import Clipboard from "clipboard";
|
||||||
|
import Errors from "@/views/Errors";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "shares",
|
name: "shares",
|
||||||
|
components: {
|
||||||
|
Errors,
|
||||||
|
},
|
||||||
computed: mapState(["user", "loading"]),
|
computed: mapState(["user", "loading"]),
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
error: null,
|
||||||
links: [],
|
links: [],
|
||||||
clip: null,
|
clip: null,
|
||||||
};
|
};
|
||||||
|
@ -88,10 +98,10 @@ export default {
|
||||||
: "";
|
: "";
|
||||||
}
|
}
|
||||||
this.links = links;
|
this.links = links;
|
||||||
|
|
||||||
this.setLoading(false);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$showError(e);
|
this.error = e;
|
||||||
|
} finally {
|
||||||
|
this.setLoading(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -113,8 +123,13 @@ export default {
|
||||||
confirm: () => {
|
confirm: () => {
|
||||||
this.$store.commit("closeHovers");
|
this.$store.commit("closeHovers");
|
||||||
|
|
||||||
api.remove(link.hash);
|
try {
|
||||||
this.links = this.links.filter((item) => item.hash !== link.hash);
|
api.remove(link.hash);
|
||||||
|
this.links = this.links.filter((item) => item.hash !== link.hash);
|
||||||
|
this.$showSuccess(this.$t("settings.shareDeleted"));
|
||||||
|
} catch (e) {
|
||||||
|
this.$showError(e);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="row" v-if="!loading">
|
<errors v-if="error" :errorCode="error.message" />
|
||||||
|
<div class="row" v-else-if="!loading">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<form @submit="save" class="card">
|
<form @submit="save" class="card">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
|
@ -58,15 +59,18 @@
|
||||||
import { mapState, mapMutations } from "vuex";
|
import { mapState, mapMutations } from "vuex";
|
||||||
import { users as api, settings } from "@/api";
|
import { users as api, settings } from "@/api";
|
||||||
import UserForm from "@/components/settings/UserForm";
|
import UserForm from "@/components/settings/UserForm";
|
||||||
|
import Errors from "@/views/Errors";
|
||||||
import deepClone from "lodash.clonedeep";
|
import deepClone from "lodash.clonedeep";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "user",
|
name: "user",
|
||||||
components: {
|
components: {
|
||||||
UserForm,
|
UserForm,
|
||||||
|
Errors,
|
||||||
},
|
},
|
||||||
data: () => {
|
data: () => {
|
||||||
return {
|
return {
|
||||||
|
error: null,
|
||||||
originalUser: null,
|
originalUser: null,
|
||||||
user: {},
|
user: {},
|
||||||
};
|
};
|
||||||
|
@ -107,10 +111,10 @@ export default {
|
||||||
const id = this.$route.params.pathMatch;
|
const id = this.$route.params.pathMatch;
|
||||||
this.user = { ...(await api.get(id)) };
|
this.user = { ...(await api.get(id)) };
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setLoading(false);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$router.push({ path: "/settings/users/new" });
|
this.error = e;
|
||||||
|
} finally {
|
||||||
|
this.setLoading(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
deletePrompt() {
|
deletePrompt() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="row" v-if="!loading">
|
<errors v-if="error" :errorCode="error.message" />
|
||||||
|
<div class="row" v-else-if="!loading">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-title">
|
<div class="card-title">
|
||||||
|
@ -43,11 +44,16 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapState, mapMutations } from "vuex";
|
import { mapState, mapMutations } from "vuex";
|
||||||
import { users as api } from "@/api";
|
import { users as api } from "@/api";
|
||||||
|
import Errors from "@/views/Errors";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "users",
|
name: "users",
|
||||||
|
components: {
|
||||||
|
Errors,
|
||||||
|
},
|
||||||
data: function () {
|
data: function () {
|
||||||
return {
|
return {
|
||||||
|
error: null,
|
||||||
users: [],
|
users: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@ -56,9 +62,10 @@ export default {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.users = await api.getAll();
|
this.users = await api.getAll();
|
||||||
this.setLoading(false);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.$showError(e);
|
this.error = e;
|
||||||
|
} finally {
|
||||||
|
this.setLoading(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
Loading…
Reference in New Issue