prettier all files

This commit is contained in:
Tim Gröger 2021-01-27 08:16:44 +01:00
parent 91200f277c
commit 693b6a11d3
18 changed files with 126 additions and 198 deletions

View File

@ -9,6 +9,6 @@ export default defineComponent({
name: 'EmptyParent', name: 'EmptyParent',
setup() { setup() {
return {}; return {};
}, }
}); });
</script> </script>

View File

@ -49,18 +49,14 @@ export default defineComponent({
if (props.title.includes('loadFromStore')) { if (props.title.includes('loadFromStore')) {
const startIndex = props.title.indexOf('(') + 1; const startIndex = props.title.indexOf('(') + 1;
const endIndex = props.title.indexOf(')'); const endIndex = props.title.indexOf(')');
const substring = props.title const substring = props.title.substring(startIndex, endIndex).replace(/"/g, '');
.substring(startIndex, endIndex)
.replace(/"/g, '');
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
return <string>root.$store.getters[substring]; return <string>root.$store.getters[substring];
} }
return props.title; return props.title;
}); });
const isGranted = computed(() => const isGranted = computed(() => hasPermissions(props.permissions || [], root.$store));
hasPermissions(props.permissions || [], root.$store)
);
return { realTitle: title, isGranted }; return { realTitle: title, isGranted };
} }

View File

@ -22,9 +22,7 @@ export default defineComponent({
} }
}, },
setup(props, { root }) { setup(props, { root }) {
const isGranted = computed(() => const isGranted = computed(() => hasPermissions(props.permissions || [], root.$store));
hasPermissions(props.permissions || [], root.$store)
);
return { isGranted }; return { isGranted };
} }
}); });

View File

@ -49,18 +49,18 @@ export default defineComponent({
name: 'IsoDateInput', name: 'IsoDateInput',
props: { props: {
value: { value: {
required: true, required: true
}, },
label: {}, label: {},
readonly: { readonly: {
default: false, default: false
}, },
type: { type: {
default: 'date', default: 'date',
validator: function(value: string) { validator: function(value: string) {
return ['date', 'time', 'datetime'].indexOf(value) !== -1; return ['date', 'time', 'datetime'].indexOf(value) !== -1;
}, }
}, }
}, },
setup(props: Props, { emit }: { emit: any }) { setup(props: Props, { emit }: { emit: any }) {
function getDateTime() { function getDateTime() {
@ -183,8 +183,8 @@ export default defineComponent({
rules, rules,
timeChanged, timeChanged,
placeholder, placeholder,
dateTimeChanged, dateTimeChanged
}; };
}, }
}); });
</script> </script>

View File

@ -112,23 +112,23 @@ const links = [
name: 'about', name: 'about',
title: 'Über Flaschengeist', title: 'Über Flaschengeist',
link: 'about', link: 'about',
icon: 'mdi-information', icon: 'mdi-information'
}, }
]; ];
const shortcuts = [ const shortcuts = [
{ {
link: 'about', link: 'about',
icon: 'mdi-information', icon: 'mdi-information'
}, },
{ {
link: 'user', link: 'user',
icon: 'mdi-account', icon: 'mdi-account'
}, },
{ {
link: 'user-plugin1', link: 'user-plugin1',
icon: 'mdi-account-plus', icon: 'mdi-account-plus'
}, }
]; ];
declare module 'vue/types/vue' { declare module 'vue/types/vue' {
@ -146,7 +146,7 @@ export default defineComponent({
const leftDrawerOpen = ref( const leftDrawerOpen = ref(
computed({ computed({
get: () => (leftDrawer.value || Screen.gt.sm ? true : false), get: () => (leftDrawer.value || Screen.gt.sm ? true : false),
set: (val: boolean) => (leftDrawer.value = val), set: (val: boolean) => (leftDrawer.value = val)
}) })
); );
const leftDrawerMini = ref(false); const leftDrawerMini = ref(false);
@ -177,11 +177,9 @@ export default defineComponent({
function logout() { function logout() {
Loading.show({ message: 'Session wird abgemeldet' }); Loading.show({ message: 'Session wird abgemeldet' });
(<Store<StateInterface>>ctx.root.$store) (<Store<StateInterface>>ctx.root.$store).dispatch('session/logout').finally(() => {
.dispatch('session/logout') Loading.hide();
.finally(() => { });
Loading.hide();
});
} }
return { return {
@ -191,8 +189,8 @@ export default defineComponent({
links, links,
pluginChildLinks, pluginChildLinks,
shortcuts, shortcuts,
logout, logout
}; };
}, }
}); });
</script> </script>

View File

@ -49,6 +49,6 @@ import ShortCutLink from 'components/navigation/ShortCutLink.vue';
export default defineComponent({ export default defineComponent({
name: 'OutLayout', name: 'OutLayout',
components: { ShortCutLink }, components: { ShortCutLink }
}); });
</script> </script>

View File

@ -4,11 +4,7 @@
style="grid-auto-rows: 1fr;" style="grid-auto-rows: 1fr;"
class="fit row justify-around items-start q-col-gutter-sm" class="fit row justify-around items-start q-col-gutter-sm"
> >
<div <div v-for="(item, index) in widgets" :key="index" class="col-4 full-height col-sm-6 col-xs-12">
v-for="(item, index) in widgets"
:key="index"
class="col-4 full-height col-sm-6 col-xs-12"
>
<component v-bind:is="item" /> <component v-bind:is="item" />
</div> </div>
</q-page> </q-page>
@ -25,15 +21,14 @@ export default defineComponent({
const widgets = ref<Array<AsyncComponentPromise>>([]); const widgets = ref<Array<AsyncComponentPromise>>([]);
onMounted(() => { onMounted(() => {
root.$flaschengeistPlugins.widgets.forEach((widget) => { root.$flaschengeistPlugins.widgets.forEach(widget => {
if (hasPermissions(widget.permissions, root.$store)) if (hasPermissions(widget.permissions, root.$store)) widgets.value.push(widget.widget);
widgets.value.push(widget.widget);
}); });
}); });
return { return {
widgets, widgets
}; };
}, }
}); });
</script> </script>

View File

@ -12,14 +12,16 @@
fill="white" fill="white"
> >
<g> <g>
<circle <circle cx="87.493" cy="25.907" r="25.907" />
cx="87.493" <path
cy="25.907" d="m194.386,209.531l-42.802-36.895c-1.825-1.573-4.001-2.683-6.345-3.237l-72.533-17.136 47.755,.703v-34.439l-46.525-26.18 50.36,14.829c4.016,1.182 8.356,0.276 11.564-2.414l38.264-32.093c1.1-0.923 2.001-1.994 2.698-3.161 2.656-4.442 2.36-10.26-1.154-14.449-4.437-5.29-12.32-5.981-17.61-1.544l-33.127,27.785-45.605-13.428 41.402,1.292 16.027-13.442-6.021-2.955-3.631,3.945-18.134,2.86h-37.216c-9.665,0-17.501,7.835-17.501,17.501v90.395l.029-.024c0.252,6.569 4.819,12.433 11.527,14.019l68.966,16.292 40.024,34.501c2.834,2.442 6.318,3.639 9.787,3.639 4.213,0 8.402-1.765 11.368-5.206 5.41-6.278 4.708-15.75-1.567-21.158z"
r="25.907" />
<path
d="m233.888,50.21l-43.49-21.349c-2.17-1.065-4.545-1.612-6.94-1.612-0.861,0-1.724,0.071-2.581,0.213l-13.243,2.2-24.213-11.886c-6.197-3.043-13.688-0.485-16.728,5.713-3.042,6.197-0.484,13.687 5.713,16.729l14.402,7.069 3.539-2.969c4.405-3.694 9.994-5.729 15.738-5.729 7.266,0 14.11,3.192 18.777,8.756 6.702,7.991 7.61,19.371 2.258,28.32-0.529,0.884-1.127,1.717-1.759,2.523l28.035,13.762c0.916,0.45 1.914,0.664 2.967,0.664 5.79,0 13.263-6.495 18.05-16.247 5.66-11.524 5.424-23.236-0.525-26.157z"
/>
<path
d="m102.363,202.426l2.531,6.9-13.835,65.324c-1.716,8.105 3.463,16.065 11.567,17.782 1.048,0.222 2.092,0.328 3.122,0.328 6.936-0.001 13.165-4.839 14.66-11.896l14.265-67.357-5.513-4.752-26.797-6.329z"
/> />
<path d="m194.386,209.531l-42.802-36.895c-1.825-1.573-4.001-2.683-6.345-3.237l-72.533-17.136 47.755,.703v-34.439l-46.525-26.18 50.36,14.829c4.016,1.182 8.356,0.276 11.564-2.414l38.264-32.093c1.1-0.923 2.001-1.994 2.698-3.161 2.656-4.442 2.36-10.26-1.154-14.449-4.437-5.29-12.32-5.981-17.61-1.544l-33.127,27.785-45.605-13.428 41.402,1.292 16.027-13.442-6.021-2.955-3.631,3.945-18.134,2.86h-37.216c-9.665,0-17.501,7.835-17.501,17.501v90.395l.029-.024c0.252,6.569 4.819,12.433 11.527,14.019l68.966,16.292 40.024,34.501c2.834,2.442 6.318,3.639 9.787,3.639 4.213,0 8.402-1.765 11.368-5.206 5.41-6.278 4.708-15.75-1.567-21.158z" />
<path d="m233.888,50.21l-43.49-21.349c-2.17-1.065-4.545-1.612-6.94-1.612-0.861,0-1.724,0.071-2.581,0.213l-13.243,2.2-24.213-11.886c-6.197-3.043-13.688-0.485-16.728,5.713-3.042,6.197-0.484,13.687 5.713,16.729l14.402,7.069 3.539-2.969c4.405-3.694 9.994-5.729 15.738-5.729 7.266,0 14.11,3.192 18.777,8.756 6.702,7.991 7.61,19.371 2.258,28.32-0.529,0.884-1.127,1.717-1.759,2.523l28.035,13.762c0.916,0.45 1.914,0.664 2.967,0.664 5.79,0 13.263-6.495 18.05-16.247 5.66-11.524 5.424-23.236-0.525-26.157z" />
<path d="m102.363,202.426l2.531,6.9-13.835,65.324c-1.716,8.105 3.463,16.065 11.567,17.782 1.048,0.222 2.092,0.328 3.122,0.328 6.936-0.001 13.165-4.839 14.66-11.896l14.265-67.357-5.513-4.752-26.797-6.329z" />
</g> </g>
</svg> </svg>
</div> </div>
@ -27,7 +29,8 @@
Der Admin is über's Kabel gestolpert! Der Admin is über's Kabel gestolpert!
</div> </div>
<div> <div>
Aktuell kann der Backend Server nicht erreicht werden, wir versuchen es in {{reload}} Sekunden erneut. Aktuell kann der Backend Server nicht erreicht werden, wir versuchen es in
{{ reload }} Sekunden erneut.
</div> </div>
</div> </div>
</div> </div>
@ -49,6 +52,6 @@ export default defineComponent({
}, 1000); }, 1000);
onUnmounted(() => clearInterval(ival)); onUnmounted(() => clearInterval(ival));
return { reload }; return { reload };
}, }
}); });
</script> </script>

View File

@ -2,12 +2,26 @@
<div class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center"> <div class="fullscreen bg-blue text-white text-center q-pa-md flex flex-center">
<div> <div>
<div> <div>
<svg style="max-width: 400px;" version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 292.761 292.761" xmlns:xlink="http://www.w3.org/1999/xlink" enable-background="new 0 0 292.761 292.761" fill="white"> <svg
style="max-width: 400px;"
version="1.1"
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 292.761 292.761"
xmlns:xlink="http://www.w3.org/1999/xlink"
enable-background="new 0 0 292.761 292.761"
fill="white"
>
<g> <g>
<circle cx="87.493" cy="25.907" r="25.907"/> <circle cx="87.493" cy="25.907" r="25.907" />
<path d="m194.386,209.531l-42.802-36.895c-1.825-1.573-4.001-2.683-6.345-3.237l-72.533-17.136 47.755,.703v-34.439l-46.525-26.18 50.36,14.829c4.016,1.182 8.356,0.276 11.564-2.414l38.264-32.093c1.1-0.923 2.001-1.994 2.698-3.161 2.656-4.442 2.36-10.26-1.154-14.449-4.437-5.29-12.32-5.981-17.61-1.544l-33.127,27.785-45.605-13.428 41.402,1.292 16.027-13.442-6.021-2.955-3.631,3.945-18.134,2.86h-37.216c-9.665,0-17.501,7.835-17.501,17.501v90.395l.029-.024c0.252,6.569 4.819,12.433 11.527,14.019l68.966,16.292 40.024,34.501c2.834,2.442 6.318,3.639 9.787,3.639 4.213,0 8.402-1.765 11.368-5.206 5.41-6.278 4.708-15.75-1.567-21.158z"/> <path
<path d="m233.888,50.21l-43.49-21.349c-2.17-1.065-4.545-1.612-6.94-1.612-0.861,0-1.724,0.071-2.581,0.213l-13.243,2.2-24.213-11.886c-6.197-3.043-13.688-0.485-16.728,5.713-3.042,6.197-0.484,13.687 5.713,16.729l14.402,7.069 3.539-2.969c4.405-3.694 9.994-5.729 15.738-5.729 7.266,0 14.11,3.192 18.777,8.756 6.702,7.991 7.61,19.371 2.258,28.32-0.529,0.884-1.127,1.717-1.759,2.523l28.035,13.762c0.916,0.45 1.914,0.664 2.967,0.664 5.79,0 13.263-6.495 18.05-16.247 5.66-11.524 5.424-23.236-0.525-26.157z"/> d="m194.386,209.531l-42.802-36.895c-1.825-1.573-4.001-2.683-6.345-3.237l-72.533-17.136 47.755,.703v-34.439l-46.525-26.18 50.36,14.829c4.016,1.182 8.356,0.276 11.564-2.414l38.264-32.093c1.1-0.923 2.001-1.994 2.698-3.161 2.656-4.442 2.36-10.26-1.154-14.449-4.437-5.29-12.32-5.981-17.61-1.544l-33.127,27.785-45.605-13.428 41.402,1.292 16.027-13.442-6.021-2.955-3.631,3.945-18.134,2.86h-37.216c-9.665,0-17.501,7.835-17.501,17.501v90.395l.029-.024c0.252,6.569 4.819,12.433 11.527,14.019l68.966,16.292 40.024,34.501c2.834,2.442 6.318,3.639 9.787,3.639 4.213,0 8.402-1.765 11.368-5.206 5.41-6.278 4.708-15.75-1.567-21.158z"
<path d="m102.363,202.426l2.531,6.9-13.835,65.324c-1.716,8.105 3.463,16.065 11.567,17.782 1.048,0.222 2.092,0.328 3.122,0.328 6.936-0.001 13.165-4.839 14.66-11.896l14.265-67.357-5.513-4.752-26.797-6.329z"/> />
<path
d="m233.888,50.21l-43.49-21.349c-2.17-1.065-4.545-1.612-6.94-1.612-0.861,0-1.724,0.071-2.581,0.213l-13.243,2.2-24.213-11.886c-6.197-3.043-13.688-0.485-16.728,5.713-3.042,6.197-0.484,13.687 5.713,16.729l14.402,7.069 3.539-2.969c4.405-3.694 9.994-5.729 15.738-5.729 7.266,0 14.11,3.192 18.777,8.756 6.702,7.991 7.61,19.371 2.258,28.32-0.529,0.884-1.127,1.717-1.759,2.523l28.035,13.762c0.916,0.45 1.914,0.664 2.967,0.664 5.79,0 13.263-6.495 18.05-16.247 5.66-11.524 5.424-23.236-0.525-26.157z"
/>
<path
d="m102.363,202.426l2.531,6.9-13.835,65.324c-1.716,8.105 3.463,16.065 11.567,17.782 1.048,0.222 2.092,0.328 3.122,0.328 6.936-0.001 13.165-4.839 14.66-11.896l14.265-67.357-5.513-4.752-26.797-6.329z"
/>
</g> </g>
</svg> </svg>
</div> </div>
@ -15,20 +29,19 @@
Der Admin war betrunken!! Der Admin war betrunken!!
</div> </div>
<div> <div>
Einige Plugins konnten nicht geladen werden.<br />Sollte diese Seite jemals auftauchen, kontaktiere einen nüchternen Admin. Einige Plugins konnten nicht geladen werden.<br />Sollte diese Seite jemals auftauchen,
kontaktiere einen nüchternen Admin.
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import {defineComponent} from '@vue/composition-api'; import { defineComponent } from '@vue/composition-api';
export default defineComponent({ export default defineComponent({
name: 'PluginError.vue' name: 'PluginError.vue'
}) });
</script> </script>
<style scoped> <style scoped></style>
</style>

View File

@ -6,7 +6,7 @@
> >
<div class="fit row justify-center content-center items-center"> <div class="fit row justify-center content-center items-center">
<q-img <q-img
:src="$q.dark.isActive? 'logo.svg' : 'logo-dark.svg'" :src="$q.dark.isActive ? 'logo.svg' : 'logo-dark.svg'"
class="col-12 q-ma-md" class="col-12 q-ma-md"
style="min-width: 200px; max-width: 400px" style="min-width: 200px; max-width: 400px"
/> />
@ -17,16 +17,14 @@
</div> </div>
</div> </div>
<div class="col-12 text-center q-ma-sm" style="max-width: 600px;"> <div class="col-12 text-center q-ma-sm" style="max-width: 600px;">
Flaschengeist ist ein dynamischen Managementsystem für Studentenclubs. Flaschengeist ist ein dynamischen Managementsystem für Studentenclubs. Es ermöglicht unter
Es ermöglicht unter anderem die Mitgliederverwaltung, Dienstverwaltung, anderem die Mitgliederverwaltung, Dienstverwaltung, Arbeitsgruppenverwaltung und vieles
Arbeitsgruppenverwaltung und vieles meher. Es kann fast alles ermöglich meher. Es kann fast alles ermöglich werden, wenn ein Plugin dafür geschrieben wird. Jeder
werden, wenn ein Plugin dafür geschrieben wird. Jeder Club hat die Club hat die Möglichkeit sein eigenes Flaschengeist zu hosten. Ziel ist später
Möglichkeit sein eigenes Flaschengeist zu hosten. Ziel ist später
Clubübergreifend dezentralisiert miteinander zu arbeiten. Clubübergreifend dezentralisiert miteinander zu arbeiten.
</div> </div>
<q-separator />
<q-separator/>
<div class="col-12 text-h6 q-pa-sm" v-if="$route.name == 'about'"> <div class="col-12 text-h6 q-pa-sm" v-if="$route.name == 'about'">
Geladene Plugins: Geladene Plugins:
</div> </div>
@ -44,14 +42,12 @@
</q-chip> </q-chip>
</q-chip> </q-chip>
</div> </div>
<q-separator/> <q-separator />
<div class="col-12 text-h6 q-pa-sm"> <div class="col-12 text-h6 q-pa-sm">
Entwickler: Entwickler:
</div> </div>
<div <div class="fit row inline wrap justify-around items-start content-start">
class="fit row inline wrap justify-around items-start content-start"
>
<developer <developer
v-for="(developer, index) in developers" v-for="(developer, index) in developers"
:key="'dev' + index" :key="'dev' + index"
@ -69,7 +65,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import {defineComponent} from '@vue/composition-api'; import { defineComponent } from '@vue/composition-api';
import Developer from 'components/about/Developer.vue'; import Developer from 'components/about/Developer.vue';
const developers = [ const developers = [
@ -105,9 +101,9 @@ const developers = [
]; ];
export default defineComponent({ export default defineComponent({
// name: 'PageName' // name: 'PageName'
components: {Developer}, components: { Developer },
setup() { setup() {
return {developers}; return { developers };
} }
}); });
</script> </script>

View File

@ -3,10 +3,7 @@
<q-page padding v-if="checkMain"> <q-page padding v-if="checkMain">
<q-card> <q-card>
<q-card-section> <q-card-section>
<q-list <q-list v-for="(mainRoute, index) in mainRoutes" :key="'mainRoute' + index">
v-for="(mainRoute, index) in mainRoutes"
:key="'mainRoute' + index"
>
<essential-link <essential-link
v-for="(route, index2) in mainRoute.children" v-for="(route, index2) in mainRoute.children"
:key="'route' + index2" :key="'route' + index2"

View File

@ -5,16 +5,10 @@
Benutzereinstellungen Benutzereinstellungen
</div> </div>
<div class="col-xs-12 col-sm-6 q-pa-sm"> <div class="col-xs-12 col-sm-6 q-pa-sm">
<UserSelector <UserSelector :user="user" @update:user="userUpdated" />
:user="user"
@update:user="userUpdated"
/>
</div> </div>
</q-card-section> </q-card-section>
<MainUserSettings <MainUserSettings :user="user" @update:user="updateUser" />
:user="user"
@update:user="updateUser"
/>
</q-card> </q-card>
</template> </template>
@ -39,7 +33,7 @@ export default defineComponent({
}; };
function updateUser(value: FG.User) { function updateUser(value: FG.User) {
store.dispatch('user/updateUser', value).catch((error) => { store.dispatch('user/updateUser', value).catch(error => {
console.warn(error); console.warn(error);
}); });
} }
@ -47,9 +41,9 @@ export default defineComponent({
return { return {
user, user,
userUpdated, userUpdated,
updateUser, updateUser
}; };
}, }
}); });
</script> </script>

View File

@ -9,12 +9,16 @@
</div> </div>
</div> </div>
<div class="col-8"> <div class="col-8">
<span class="text-h6">Hallo {{ name }}</span><br /> <span class="text-h6">Hallo {{ name }}</span
><br />
<span v-if="hasBirthday">Herzlichen Glückwunsch zum Geburtstag!<br /></span> <span v-if="hasBirthday">Herzlichen Glückwunsch zum Geburtstag!<br /></span>
<span v-if="birthday.length > 0">Heute <span v-if="birthday.length === 1">hat </span><span v-else>haben </span><span <span v-if="birthday.length > 0"
v-for="(user, index) in birthday" >Heute <span v-if="birthday.length === 1">hat </span><span v-else>haben </span
v-bind:key="index" ><span v-for="(user, index) in birthday" v-bind:key="index"
>{{user.display_name}}<span v-if="index < (birthday.length-1)">, </span></span> Geburtstag.</span> >{{ user.display_name }}<span v-if="index < birthday.length - 1">, </span></span
>
Geburtstag.</span
>
<span v-else>Heute stehen keine Geburtstage an</span> <span v-else>Heute stehen keine Geburtstage an</span>
</div> </div>
</q-card-section> </q-card-section>
@ -22,12 +26,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { import { computed, defineComponent, onMounted, ref } from '@vue/composition-api';
computed,
defineComponent,
onMounted,
ref,
} from '@vue/composition-api';
import { Store } from 'vuex'; import { Store } from 'vuex';
import { StateInterface } from 'src/store'; import { StateInterface } from 'src/store';
@ -57,10 +56,10 @@ export default defineComponent({
const birthday = computed(() => const birthday = computed(() =>
store.state.user.users store.state.user.users
.filter(userHasBirthday) .filter(userHasBirthday)
.filter((user) => user.userid !== store.state.user.currentUser?.userid) .filter(user => user.userid !== store.state.user.currentUser?.userid)
); );
return { avatarLink, name, hasBirthday, birthday }; return { avatarLink, name, hasBirthday, birthday };
}, }
}); });
</script> </script>

View File

@ -2,9 +2,7 @@
<div> <div>
<q-card class="col-12"> <q-card class="col-12">
<q-form @submit="save" @reset="reset"> <q-form @submit="save" @reset="reset">
<q-card-section <q-card-section class="fit row justify-start content-center items-center">
class="fit row justify-start content-center items-center"
>
<span class="col-xs-12 col-sm-6 text-center text-h6"> <span class="col-xs-12 col-sm-6 text-center text-h6">
Rollen und Berechtigungen Rollen und Berechtigungen
</span> </span>
@ -26,17 +24,9 @@
/> />
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-section <q-card-section v-if="role" class="fit row justify-start content-center items-center">
v-if="role"
class="fit row justify-start content-center items-center"
>
<q-scroll-area style="height: 20em; width: 100%"> <q-scroll-area style="height: 20em; width: 100%">
<q-input <q-input filled v-model="newRoleName" label="neuer Name" v-if="role.id != -1" />
filled
v-model="newRoleName"
label="neuer Name"
v-if="role.id != -1"
/>
<q-option-group <q-option-group
:value="role.permissions" :value="role.permissions"
@input="updatePermissions" @input="updatePermissions"
@ -57,12 +47,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { import { computed, defineComponent, ref, onBeforeMount } from '@vue/composition-api';
computed,
defineComponent,
ref,
onBeforeMount,
} from '@vue/composition-api';
import { Store } from 'vuex'; import { Store } from 'vuex';
import { StateInterface } from 'src/store'; import { StateInterface } from 'src/store';
@ -72,10 +57,10 @@ export default defineComponent({
const store = <Store<StateInterface>>root.$store; const store = <Store<StateInterface>>root.$store;
onBeforeMount(() => { onBeforeMount(() => {
store.dispatch('user/getRoles').catch((error) => { store.dispatch('user/getRoles').catch(error => {
console.warn(error); console.warn(error);
}); });
store.dispatch('user/getPermissions').catch((error) => { store.dispatch('user/getPermissions').catch(error => {
console.warn(error); console.warn(error);
}); });
}); });
@ -83,20 +68,17 @@ export default defineComponent({
const role = ref<FG.Role | null>(null); const role = ref<FG.Role | null>(null);
const roles = computed(() => store.state.user.roles); const roles = computed(() => store.state.user.roles);
const permissions = computed(() => const permissions = computed(() =>
store.state.user.permissions.map((perm) => { store.state.user.permissions.map(perm => {
return { return {
value: perm, value: perm,
label: perm, label: perm
}; };
}) })
); );
const newRoleName = ref<string>(''); const newRoleName = ref<string>('');
function createRole( function createRole(name: string, done: (arg0: string, arg1: string) => void): void {
name: string,
done: (arg0: string, arg1: string) => void
): void {
role.value = { name: name, permissions: [], id: -1 }; role.value = { name: name, permissions: [], id: -1 };
done(name, 'add-unique'); done(name, 'add-unique');
} }
@ -116,19 +98,17 @@ export default defineComponent({
role.value = { role.value = {
id: rl.id, id: rl.id,
name: rl.name, name: rl.name,
permissions: Array.from(rl.permissions), permissions: Array.from(rl.permissions)
}; };
} }
function save() { function save() {
if (role.value) { if (role.value) {
if (role.value.id === -1) if (role.value.id === -1)
void store void store.dispatch('user/newRole', role.value).then((createdRole: FG.Role) => {
.dispatch('user/newRole', role.value) console.log(createdRole);
.then((createdRole: FG.Role) => { role.value = createdRole;
console.log(createdRole); });
role.value = createdRole;
});
else { else {
if (newRoleName.value !== '') role.value.name = newRoleName.value; if (newRoleName.value !== '') role.value.name = newRoleName.value;
console.log(role.value); console.log(role.value);
@ -139,9 +119,7 @@ export default defineComponent({
function reset() { function reset() {
if (role.value && role.value.id !== -1) { if (role.value && role.value.id !== -1) {
const original = roles.value.find( const original = roles.value.find(value => value.name === role.value?.name);
(value) => value.name === role.value?.name
);
if (original) updateRole(original); if (original) updateRole(original);
} else { } else {
role.value = null; role.value = null;
@ -156,7 +134,7 @@ export default defineComponent({
store store
.dispatch('user/deleteRole', role.value) .dispatch('user/deleteRole', role.value)
.then(() => (role.value = null)) .then(() => (role.value = null))
.catch((error) => console.warn(error)); .catch(error => console.warn(error));
} }
} }
} }
@ -172,8 +150,8 @@ export default defineComponent({
reset, reset,
removeRole, removeRole,
remove, remove,
newRoleName, newRoleName
}; };
}, }
}); });
</script> </script>

View File

@ -21,19 +21,11 @@
Lebenszeit: Lebenszeit:
{{ session.lifetime }} {{ session.lifetime }}
</div> </div>
<div class="col-xs-12 col-sm-6"> <div class="col-xs-12 col-sm-6">Läuft aus: {{ session.expires | dateTime(true) }}</div>
Läuft aus: {{ session.expires | dateTime(true) }}
</div>
</div> </div>
</q-card-section> </q-card-section>
<q-card-actions align="right"> <q-card-actions align="right">
<q-btn <q-btn flat round dense icon="mdi-delete" @click="deleteSession(session.token)" />
flat
round
dense
icon="mdi-delete"
@click="deleteSession(session.token)"
/>
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</template> </template>

View File

@ -1,9 +1,6 @@
<template> <template>
<div> <div>
<q-tabs <q-tabs v-model="tab" v-if="$q.screen.gt.sm">
v-model="tab"
v-if="$q.screen.gt.sm"
>
<q-tab <q-tab
v-for="(tabindex, index) in tabs" v-for="(tabindex, index) in tabs"
:key="'tab' + index" :key="'tab' + index"
@ -11,23 +8,10 @@
:label="tabindex.label" :label="tabindex.label"
/> />
</q-tabs> </q-tabs>
<div <div class="fit row justify-end" v-else>
class="fit row justify-end" <q-btn flat round icon="mdi-menu" @click="showDrawer = !showDrawer" />
v-else
>
<q-btn
flat
round
icon="mdi-menu"
@click="showDrawer = !showDrawer"
/>
</div> </div>
<q-drawer <q-drawer side="right" v-model="showDrawer" @click="showDrawer = !showDrawer" behavior="mobile">
side="right"
v-model="showDrawer"
@click="showDrawer = !showDrawer"
behavior="mobile"
>
<q-list v-model="tab"> <q-list v-model="tab">
<q-item <q-item
v-for="(tabindex, index) in tabs" v-for="(tabindex, index) in tabs"
@ -40,10 +24,7 @@
</q-item> </q-item>
</q-list> </q-list>
</q-drawer> </q-drawer>
<q-page <q-page padding class="fit row justify-center content-start items-start q-gutter-sm">
padding
class="fit row justify-center content-start items-start q-gutter-sm"
>
<q-tab-panels <q-tab-panels
v-model="tab" v-model="tab"
style="background-color: transparent;" style="background-color: transparent;"
@ -81,9 +62,7 @@ export default defineComponent({
setup(_, { root }) { setup(_, { root }) {
const store = <Store<StateInterface>>root.$store; const store = <Store<StateInterface>>root.$store;
const canEditRoles = computed(() => const canEditRoles = computed(() => hasPermission(PERMISSIONS.ROLES_EDIT, store));
hasPermission(PERMISSIONS.ROLES_EDIT, store)
);
interface Tab { interface Tab {
name: string; name: string;
@ -93,7 +72,7 @@ export default defineComponent({
const tabs: Tab[] = [ const tabs: Tab[] = [
{ name: 'user', label: 'Mitglieder' }, { name: 'user', label: 'Mitglieder' },
{ name: 'newUser', label: 'Neues Mitglied' }, { name: 'newUser', label: 'Neues Mitglied' },
{ name: 'roles', label: 'Rollen' }, { name: 'roles', label: 'Rollen' }
]; ];
const drawer = ref<boolean>(false); const drawer = ref<boolean>(false);
@ -104,7 +83,7 @@ export default defineComponent({
}, },
set: (val: boolean) => { set: (val: boolean) => {
drawer.value = val; drawer.value = val;
}, }
}); });
const tab = ref<string>('user'); const tab = ref<string>('user');
@ -113,8 +92,8 @@ export default defineComponent({
canEditRoles, canEditRoles,
showDrawer, showDrawer,
tab, tab,
tabs, tabs
}; };
}, }
}); });
</script> </script>

View File

@ -3,10 +3,7 @@
<q-page padding v-if="checkMain"> <q-page padding v-if="checkMain">
<q-card> <q-card>
<q-card-section> <q-card-section>
<q-list <q-list v-for="(mainRoute, index) in mainRoutes" :key="'mainRoute' + index">
v-for="(mainRoute, index) in mainRoutes"
:key="'mainRoute' + index"
>
<essential-link <essential-link
v-for="(route, index2) in mainRoute.children" v-for="(route, index2) in mainRoute.children"
:key="'route' + index2" :key="'route' + index2"

View File

@ -14,12 +14,7 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { import { computed, defineComponent, onBeforeMount, ref } from '@vue/composition-api';
computed,
defineComponent,
onBeforeMount,
ref
} from '@vue/composition-api';
import Sessions from '../components/settings/Sessions.vue'; import Sessions from '../components/settings/Sessions.vue';
import MainUserSettings from '../components/settings/MainUserSettings.vue'; import MainUserSettings from '../components/settings/MainUserSettings.vue';
import { Store } from 'vuex'; import { Store } from 'vuex';
@ -40,9 +35,7 @@ export default defineComponent({
const currentUser = ref(<FG.User>store.state.user.currentUser); const currentUser = ref(<FG.User>store.state.user.currentUser);
const sessions = computed(() => store.state.session.sessions); const sessions = computed(() => store.state.session.sessions);
const loading = computed( const loading = computed(() => store.state.session.loading || store.state.user.loading > 0);
() => store.state.session.loading || store.state.user.loading > 0
);
function updateUser(value: FG.User) { function updateUser(value: FG.User) {
store.dispatch('user/updateUser', value).catch(error => { store.dispatch('user/updateUser', value).catch(error => {
console.warn(error); console.warn(error);