Compare commits
14 Commits
v1.0.0-alp
...
main
Author | SHA1 | Date |
---|---|---|
|
3f4f8a5fd4 | |
|
668458e5e9 | |
|
e99d123156 | |
|
cf82684ce4 | |
|
d6da01eeda | |
|
ed5bd72771 | |
|
94c45fe3f4 | |
|
036b97f8e4 | |
|
775da10b3b | |
|
25be3947a6 | |
|
0241e2cdeb | |
|
ca2a1ae387 | |
|
9ff8e61c85 | |
|
2e6c08e431 |
|
@ -0,0 +1,3 @@
|
||||||
|
yarn-error.log
|
||||||
|
.woodpecker/
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
pipeline:
|
||||||
|
deploy:
|
||||||
|
when:
|
||||||
|
event: tag
|
||||||
|
tag: v*
|
||||||
|
image: node:lts-alpine
|
||||||
|
commands:
|
||||||
|
- echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > .npmrc
|
||||||
|
- yarn publish --non-interactive
|
||||||
|
secrets: [ node_auth_token ]
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- lint
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
pipeline:
|
||||||
|
lint:
|
||||||
|
when:
|
||||||
|
branch: [main, develop]
|
||||||
|
image: node:lts-alpine
|
||||||
|
commands:
|
||||||
|
- yarn install
|
||||||
|
- yarn lint
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# Flaschengeist `users` fontend-plugin
|
# Flaschengeist `users` fontend-plugin
|
||||||
|

|
||||||
|
|
||||||
This package provides the [Flaschengeist](https://flaschengeist.dev/Flaschengeist/flaschengeist) frontend for the users plugin (user management, account settings etc).
|
This package provides the [Flaschengeist](https://flaschengeist.dev/Flaschengeist/flaschengeist) frontend for the users plugin (user management, account settings etc).
|
||||||
|
|
||||||
|
|
24
package.json
24
package.json
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"version": "1.0.0-alpha.3",
|
"version": "1.1.0",
|
||||||
"name": "@flaschengeist/users",
|
"name": "@flaschengeist/users",
|
||||||
"author": "Ferdinand Thiessen <rpm@fthiessen.de>",
|
"author": "Ferdinand Thiessen <rpm@fthiessen.de>",
|
||||||
"homepage": "https://flaschengeist.dev/Flaschengeist",
|
"homepage": "https://flaschengeist.dev/Flaschengeist",
|
||||||
|
@ -18,23 +18,23 @@
|
||||||
"lint": "eslint --ext .js,.ts,.vue ./src"
|
"lint": "eslint --ext .js,.ts,.vue ./src"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@flaschengeist/api": "^1.0.0-alpha.7",
|
"@flaschengeist/api": "^1.0.0",
|
||||||
"@flaschengeist/types": "^1.0.0-alpha.10",
|
"@flaschengeist/types": "^1.0.0",
|
||||||
"@quasar/app": "^3.2.4",
|
"@quasar/app-webpack": "^3.7.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.5.0",
|
"@typescript-eslint/eslint-plugin": "^5.8.0",
|
||||||
"@typescript-eslint/parser": "^5.5.0",
|
"@typescript-eslint/parser": "^5.8.0",
|
||||||
"axios": "^0.24.0",
|
"axios": "^0.24.0",
|
||||||
"eslint": "^8.4.0",
|
"eslint": "^8.5.0",
|
||||||
"eslint-config-prettier": "^8.3.0",
|
"eslint-config-prettier": "^8.3.0",
|
||||||
"eslint-plugin-prettier": "^4.0.0",
|
"eslint-plugin-prettier": "^4.0.0",
|
||||||
"eslint-plugin-vue": "^8.1.1",
|
"eslint-plugin-vue": "^8.2.0",
|
||||||
"pinia": "^2.0.6",
|
"pinia": "^2.0.8",
|
||||||
"prettier": "^2.5.1",
|
"prettier": "^2.5.1",
|
||||||
"quasar": "^2.3.3",
|
"quasar": "^2.11.10",
|
||||||
"typescript": "^4.5.2"
|
"typescript": "^4.5.4"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@flaschengeist/api": "^1.0.0-alpha.7"
|
"@flaschengeist/api": "^1.0.0"
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"singleQuote": true,
|
"singleQuote": true,
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
<template>
|
||||||
|
<q-card>
|
||||||
|
<q-card-section class="text-h6"> Einstellungen Benutzer </q-card-section>
|
||||||
|
<q-card-section>
|
||||||
|
<q-select
|
||||||
|
v-model="displayNameMode"
|
||||||
|
:options="options"
|
||||||
|
label="Anzeige des Namens"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
input-debounce="0"
|
||||||
|
filled
|
||||||
|
/>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent, onBeforeMount, computed } from 'vue';
|
||||||
|
import { useUserStore } from '@flaschengeist/api';
|
||||||
|
import { DisplayNameMode } from '../models';
|
||||||
|
export default defineComponent({
|
||||||
|
name: 'SettingWidget',
|
||||||
|
setup() {
|
||||||
|
const store = useUserStore();
|
||||||
|
onBeforeMount(() => {
|
||||||
|
void store.getDisplayNameModeSetting(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
const displayNameMode = computed({
|
||||||
|
get: () => store.userSettings.display_name || DisplayNameMode.DISPLAYNAME,
|
||||||
|
set: (val) => {
|
||||||
|
console.log('set', val);
|
||||||
|
void store.setDisplayNameModeSetting(val);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const options = [
|
||||||
|
{
|
||||||
|
label: 'Anzeigename',
|
||||||
|
value: DisplayNameMode.DISPLAYNAME,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Vorname',
|
||||||
|
value: DisplayNameMode.FIRSTNAME,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Nachname',
|
||||||
|
value: DisplayNameMode.LASTNAME,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Vor- und Nachname',
|
||||||
|
value: DisplayNameMode.FIRSTNAME_LASTNAME,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Nachname, Vorname',
|
||||||
|
value: DisplayNameMode.LASTNAME_FIRSTNAME,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
return {
|
||||||
|
displayNameMode,
|
||||||
|
options,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -4,15 +4,19 @@
|
||||||
filled
|
filled
|
||||||
:label="label"
|
:label="label"
|
||||||
:options="users"
|
:options="users"
|
||||||
option-label="display_name"
|
:option-label="showName"
|
||||||
option-value="userid"
|
option-value="userid"
|
||||||
map-options
|
map-options
|
||||||
|
use-input
|
||||||
|
input-debounce="0"
|
||||||
|
@filter="filterFn"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { computed, defineComponent, PropType, onBeforeMount } from 'vue';
|
import { computed, defineComponent, PropType, onBeforeMount, ref } from 'vue';
|
||||||
import { useUserStore } from '@flaschengeist/api';
|
import { useUserStore } from '@flaschengeist/api';
|
||||||
|
import { DisplayNameMode } from '../models';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'UserSelector',
|
name: 'UserSelector',
|
||||||
|
@ -26,17 +30,64 @@ export default defineComponent({
|
||||||
|
|
||||||
onBeforeMount(() => {
|
onBeforeMount(() => {
|
||||||
void userStore.getUsers(false);
|
void userStore.getUsers(false);
|
||||||
|
void userStore.getDisplayNameModeSetting(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
const users = computed(() => userStore.users);
|
const users = computed(() =>
|
||||||
|
userStore.users.filter((user) => {
|
||||||
|
let names = filter.value.toLowerCase().split(' ');
|
||||||
|
if (names.length < 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (names.length === 1) {
|
||||||
|
let name = names[0];
|
||||||
|
return (
|
||||||
|
user.lastname.toLowerCase().includes(name) ||
|
||||||
|
user.firstname.toLowerCase().includes(name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (names.length === 2) {
|
||||||
|
let name1 = names[0];
|
||||||
|
let name2 = names[1];
|
||||||
|
return (
|
||||||
|
(user.lastname.toLowerCase().includes(name1) &&
|
||||||
|
user.firstname.toLowerCase().includes(name2)) ||
|
||||||
|
(user.lastname.toLowerCase().includes(name2) &&
|
||||||
|
user.firstname.toLowerCase().includes(name1))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const filter = ref<string>('');
|
||||||
|
const filterFn = (val: string, update: () => void) => {
|
||||||
|
filter.value = val;
|
||||||
|
update();
|
||||||
|
};
|
||||||
const selected = computed({
|
const selected = computed({
|
||||||
get: () => props.modelValue,
|
get: () => props.modelValue,
|
||||||
set: (value: FG.User | undefined) => (value ? emit('update:modelValue', value) : undefined),
|
set: (value: FG.User | undefined) => (value ? emit('update:modelValue', value) : undefined),
|
||||||
});
|
});
|
||||||
|
function showName(user: FG.User) {
|
||||||
|
switch (userStore.userSettings.display_name) {
|
||||||
|
case DisplayNameMode.DISPLAYNAME:
|
||||||
|
return user.display_name;
|
||||||
|
case DisplayNameMode.FIRSTNAME:
|
||||||
|
return user.firstname;
|
||||||
|
case DisplayNameMode.LASTNAME:
|
||||||
|
return user.lastname;
|
||||||
|
case DisplayNameMode.FIRSTNAME_LASTNAME:
|
||||||
|
return `${user.firstname} ${user.lastname}`;
|
||||||
|
case DisplayNameMode.LASTNAME_FIRSTNAME:
|
||||||
|
return `${user.lastname}, ${user.firstname}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
selected,
|
selected,
|
||||||
users,
|
users,
|
||||||
|
filterFn,
|
||||||
|
showName,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,11 @@
|
||||||
<div class="col">Plattform:</div>
|
<div class="col">Plattform:</div>
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<q-icon :name="getPlatformIcon(modelValue.platform)" size="24px" />
|
<q-icon :name="getPlatformIcon(modelValue.platform)" size="24px" />
|
||||||
<q-icon v-if="!modelValue.browser" :name="getOS(modelValue.platform)" size="24px" />
|
<q-icon
|
||||||
|
v-if="getOS(modelValue.platform)"
|
||||||
|
:name="getOS(modelValue.platform)"
|
||||||
|
size="24px"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -78,38 +82,46 @@ export default defineComponent({
|
||||||
const options = ref(['Minuten', 'Stunden', 'Tage']);
|
const options = ref(['Minuten', 'Stunden', 'Tage']);
|
||||||
const option = ref<string>(options.value[0]);
|
const option = ref<string>(options.value[0]);
|
||||||
const lifetime = ref(0);
|
const lifetime = ref(0);
|
||||||
function getBrowserIcon(browser: string) {
|
function getBrowserIcon(br: string) {
|
||||||
console.log('browser', browser);
|
const browser = br.toLowerCase();
|
||||||
return browser == 'firefox'
|
return browser.includes('firefox')
|
||||||
? 'mdi-firefox'
|
? 'mdi-firefox'
|
||||||
: browser == 'chrome'
|
: browser.includes('chrome')
|
||||||
? 'mdi-google-chrome'
|
? 'mdi-google-chrome'
|
||||||
: browser == 'safari'
|
: browser.includes('safari')
|
||||||
? 'mdi-apple-safari'
|
? 'mdi-apple-safari'
|
||||||
|
: browser.includes('edge')
|
||||||
|
? 'mdi-microsoft-edge'
|
||||||
|
: browser.includes('opera')
|
||||||
|
? 'mdi-opera'
|
||||||
|
: browser.includes('ie')
|
||||||
|
? 'mdi-internet-explorer'
|
||||||
: 'mdi-help';
|
: 'mdi-help';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlatformIcon(platform: string) {
|
function getPlatformIcon(pl: string) {
|
||||||
|
const platform = pl.toLowerCase();
|
||||||
console.log('platform', platform);
|
console.log('platform', platform);
|
||||||
return platform == 'linux'
|
return platform.includes('linux')
|
||||||
? 'mdi-linux'
|
? 'mdi-linux'
|
||||||
: platform == 'windows'
|
: platform.includes('windows')
|
||||||
? 'mdi-microsoft-windows'
|
? 'mdi-microsoft-windows'
|
||||||
: platform == 'macos'
|
: platform.includes('mac')
|
||||||
? 'mdi-apple'
|
? 'mdi-apple'
|
||||||
: platform == 'iphone'
|
: platform.includes('ios')
|
||||||
? 'mdi-cellphone'
|
? 'mdi-cellphone'
|
||||||
: platform == 'android'
|
: platform.includes('android')
|
||||||
? 'mdi-cellphone'
|
? 'mdi-cellphone'
|
||||||
: 'mdi-help';
|
: 'mdi-help';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOS(platform: string) {
|
function getOS(pl: string) {
|
||||||
return platform == 'iphone'
|
const platform = pl.toLowerCase();
|
||||||
|
return platform.includes('ios')
|
||||||
? 'mdi-apple'
|
? 'mdi-apple'
|
||||||
: platform == 'android'
|
: platform.includes('android')
|
||||||
? 'mdi-android'
|
? 'mdi-android'
|
||||||
: 'mdi-help';
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function deleteSession(token: string) {
|
async function deleteSession(token: string) {
|
||||||
|
|
10
src/index.ts
10
src/index.ts
|
@ -1,6 +1,7 @@
|
||||||
import { FG_Plugin } from '@flaschengeist/types';
|
import { FG_Plugin } from '@flaschengeist/types';
|
||||||
import { defineAsyncComponent } from 'vue';
|
import { defineAsyncComponent } from 'vue';
|
||||||
import routes from './routes';
|
import routes from './routes';
|
||||||
|
import { DisplayNameMode } from './models';
|
||||||
|
|
||||||
const plugin: FG_Plugin.Plugin = {
|
const plugin: FG_Plugin.Plugin = {
|
||||||
id: 'users',
|
id: 'users',
|
||||||
|
@ -16,6 +17,15 @@ const plugin: FG_Plugin.Plugin = {
|
||||||
widget: defineAsyncComponent(() => import('./components/Widget.vue')),
|
widget: defineAsyncComponent(() => import('./components/Widget.vue')),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
settingWidgets: [
|
||||||
|
{
|
||||||
|
priority: 1,
|
||||||
|
name: 'userSettings',
|
||||||
|
permissions: [],
|
||||||
|
widget: defineAsyncComponent(() => import('./components/SettingWidget.vue')),
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
export default plugin;
|
export default plugin;
|
||||||
|
export { DisplayNameMode };
|
||||||
|
|
|
@ -12,3 +12,12 @@ export interface LoginResponse {
|
||||||
export interface CurrentUserResponse extends FG.User {
|
export interface CurrentUserResponse extends FG.User {
|
||||||
permissions: FG.Permission[];
|
permissions: FG.Permission[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum DisplayNameMode {
|
||||||
|
FIRSTNAME = 'firstname',
|
||||||
|
LASTNAME = 'lastname',
|
||||||
|
FULLNAME = 'fullname',
|
||||||
|
DISPLAYNAME = 'display_name',
|
||||||
|
FIRSTNAME_LASTNAME = 'firstname_lastname',
|
||||||
|
LASTNAME_FIRSTNAME = 'lastname_firstname',
|
||||||
|
}
|
||||||
|
|
|
@ -45,18 +45,24 @@
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Screen } from 'quasar';
|
import { Screen } from 'quasar';
|
||||||
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
|
import { onBeforeMount, watch } from 'vue';
|
||||||
import { PERMISSIONS } from '../permissions';
|
import { PERMISSIONS } from '../permissions';
|
||||||
import NewUser from '../components/NewUser.vue';
|
import NewUser from '../components/NewUser.vue';
|
||||||
import { hasPermission } from '@flaschengeist/api';
|
import { hasPermission } from '@flaschengeist/api';
|
||||||
import { computed, defineComponent, ref } from 'vue';
|
import { computed, defineComponent, ref } from 'vue';
|
||||||
import UpdateUser from '../components/UpdateUser.vue';
|
import UpdateUser from '../components/UpdateUser.vue';
|
||||||
import RoleSettings from '../components/settings/RoleSettings.vue';
|
import RoleSettings from '../components/settings/RoleSettings.vue';
|
||||||
|
import { useUserStore } from '@flaschengeist/api';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'AdminSettings',
|
name: 'AdminSettings',
|
||||||
components: { RoleSettings, UpdateUser, NewUser },
|
components: { RoleSettings, UpdateUser, NewUser },
|
||||||
setup() {
|
setup() {
|
||||||
const canEditRoles = computed(() => hasPermission(PERMISSIONS.ROLES_EDIT));
|
const canEditRoles = computed(() => hasPermission(PERMISSIONS.ROLES_EDIT));
|
||||||
|
const route = useRoute();
|
||||||
|
const router = useRouter();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
interface Tab {
|
interface Tab {
|
||||||
name: string;
|
name: string;
|
||||||
|
@ -74,6 +80,17 @@ export default defineComponent({
|
||||||
{ name: 'roles', label: 'Rollen', permissions: [PERMISSIONS.ROLES_EDIT] },
|
{ name: 'roles', label: 'Rollen', permissions: [PERMISSIONS.ROLES_EDIT] },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
onBeforeMount(async () => {
|
||||||
|
if (
|
||||||
|
route.query.keys?.length === 0 ||
|
||||||
|
!tabs.some((value) => value.name == route.query.q_tab)
|
||||||
|
) {
|
||||||
|
await router.replace({ query: { q_tab: 'user' } });
|
||||||
|
}
|
||||||
|
tab.value = route.query.q_tab as string;
|
||||||
|
void userStore.getUsers(true);
|
||||||
|
});
|
||||||
|
|
||||||
const _tabs = computed(() =>
|
const _tabs = computed(() =>
|
||||||
tabs.filter((tab) => {
|
tabs.filter((tab) => {
|
||||||
return tab.permissions.every((permission) => hasPermission(permission));
|
return tab.permissions.every((permission) => hasPermission(permission));
|
||||||
|
@ -93,6 +110,10 @@ export default defineComponent({
|
||||||
|
|
||||||
const tab = ref<string>('user');
|
const tab = ref<string>('user');
|
||||||
|
|
||||||
|
watch(tab, async (val) => {
|
||||||
|
await router.replace({ query: { q_tab: val } });
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
canEditRoles,
|
canEditRoles,
|
||||||
showDrawer,
|
showDrawer,
|
||||||
|
|
|
@ -0,0 +1,153 @@
|
||||||
|
<template>
|
||||||
|
<q-page>
|
||||||
|
<q-table
|
||||||
|
:columns="cols"
|
||||||
|
:rows="users"
|
||||||
|
:filter="filter"
|
||||||
|
:grid="grid"
|
||||||
|
:pagination="initialPagination"
|
||||||
|
>
|
||||||
|
<template v-slot:body-cell-avatar="props">
|
||||||
|
<q-td :key="props.key" :props="props">
|
||||||
|
<user-avatar v-model="props.row" />
|
||||||
|
</q-td>
|
||||||
|
</template>
|
||||||
|
<template v-slot:top-right="props">
|
||||||
|
<q-input v-model="filter" filled dense debounce="300" placeholder="Suche">
|
||||||
|
<template v-slot:append>
|
||||||
|
<q-icon name="mdi-magnify" />
|
||||||
|
</template>
|
||||||
|
</q-input>
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
round
|
||||||
|
dense
|
||||||
|
:icon="grid ? 'mdi-land-rows-horizontal' : 'mdi-card-account-details'"
|
||||||
|
@click="grid = !grid"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
<template v-slot:item="props">
|
||||||
|
<div class="q-pa-xs col-xs-12 col-sm-6 col-md-4">
|
||||||
|
<q-card bordered>
|
||||||
|
<div class="row justify-center">
|
||||||
|
<q-img :src="avatarURL(props.row.userid)">
|
||||||
|
<template #error>
|
||||||
|
<div
|
||||||
|
class="row fit justify-center items-center"
|
||||||
|
style="background-color: transparent"
|
||||||
|
>
|
||||||
|
<img src="no-image.svg" style="object-fit: contain; height: 100%" />
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</q-img>
|
||||||
|
</div>
|
||||||
|
<q-card-section>
|
||||||
|
<div class="text-h6">{{ props.row.firstname }} {{ props.row.lastname }}</div>
|
||||||
|
<div class="text-caption">{{ props.row.display_name }}</div>
|
||||||
|
</q-card-section>
|
||||||
|
<q-card-section>
|
||||||
|
<div class="row items-center">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
icon="mdi-email"
|
||||||
|
:href="'mailto:' + props.row.mail"
|
||||||
|
class="q-mr-xs"
|
||||||
|
no-caps
|
||||||
|
/>
|
||||||
|
<div class="text-caption">{{ props.row.mail }}</div>
|
||||||
|
</div>
|
||||||
|
<div class="row items-center">
|
||||||
|
<q-btn
|
||||||
|
flat
|
||||||
|
dense
|
||||||
|
icon="mdi-calendar"
|
||||||
|
class="q-mr-xs"
|
||||||
|
no-caps
|
||||||
|
v-if="props.row.birthday"
|
||||||
|
/>
|
||||||
|
<div class="text-caption" v-if="props.row.birthday">
|
||||||
|
{{ props.row.birthday.toLocaleDateString() }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</q-card-section>
|
||||||
|
</q-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</q-table>
|
||||||
|
</q-page>
|
||||||
|
</template>
|
||||||
|
<script lang="ts">
|
||||||
|
import { defineComponent, onBeforeMount, computed, ref } from 'vue';
|
||||||
|
import { useUserStore, avatarURL } from '@flaschengeist/api';
|
||||||
|
import { UserAvatar } from '@flaschengeist/api/components';
|
||||||
|
|
||||||
|
const cols = [
|
||||||
|
{
|
||||||
|
name: 'avatar',
|
||||||
|
label: 'Profilbild',
|
||||||
|
sortable: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'firstName',
|
||||||
|
label: 'Vorname',
|
||||||
|
field: 'firstname',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'lastName',
|
||||||
|
label: 'Nachname',
|
||||||
|
field: 'lastname',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'displayName',
|
||||||
|
label: 'Anzeigename',
|
||||||
|
field: 'display_name',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'mail',
|
||||||
|
label: 'E-Mail',
|
||||||
|
field: 'mail',
|
||||||
|
sortable: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'birthday',
|
||||||
|
label: 'Geburtstag',
|
||||||
|
field: 'birthday',
|
||||||
|
sortable: true,
|
||||||
|
format: (val: Date | undefined) => {
|
||||||
|
return val?.toLocaleDateString();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
export default defineComponent({
|
||||||
|
components: { UserAvatar },
|
||||||
|
setup() {
|
||||||
|
const userStore = useUserStore();
|
||||||
|
onBeforeMount(() => {
|
||||||
|
void userStore.getUsers(true);
|
||||||
|
});
|
||||||
|
const filter = ref('');
|
||||||
|
|
||||||
|
const users = computed(() => userStore.users);
|
||||||
|
const grid = ref(false);
|
||||||
|
return {
|
||||||
|
users,
|
||||||
|
cols,
|
||||||
|
filter,
|
||||||
|
grid,
|
||||||
|
avatarURL,
|
||||||
|
initialPagination: {
|
||||||
|
sortBy: 'lastName',
|
||||||
|
descending: false,
|
||||||
|
page: 1,
|
||||||
|
rowsPerPage: 0,
|
||||||
|
// rowsNumber: xx if getting data from a server
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -7,6 +7,9 @@
|
||||||
</q-card-section>
|
</q-card-section>
|
||||||
<MainUserSettings :user="currentUser" @update:user="updateUser" />
|
<MainUserSettings :user="currentUser" @update:user="updateUser" />
|
||||||
</q-card>
|
</q-card>
|
||||||
|
<div v-for="(item, index) in widgets" :key="index" class="full-height col-12">
|
||||||
|
<component :is="item.widget" />
|
||||||
|
</div>
|
||||||
<div class="col-12 text-left text-h6">Aktive Sessions:</div>
|
<div class="col-12 text-left text-h6">Aktive Sessions:</div>
|
||||||
<user-session
|
<user-session
|
||||||
v-for="(session, index) in sessions"
|
v-for="(session, index) in sessions"
|
||||||
|
@ -14,15 +17,17 @@
|
||||||
v-model="sessions[index]"
|
v-model="sessions[index]"
|
||||||
@delete="removeSession(session)"
|
@delete="removeSession(session)"
|
||||||
/>
|
/>
|
||||||
|
<q-btn label="List Widgets" @click="listWidgets" />
|
||||||
</q-page>
|
</q-page>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { useMainStore, useUserStore, useSessionStore } from '@flaschengeist/api';
|
import { useMainStore, useUserStore, useSessionStore, hasPermissions } from '@flaschengeist/api';
|
||||||
import MainUserSettings from '../components/settings/MainUserSettings.vue';
|
import MainUserSettings from '../components/settings/MainUserSettings.vue';
|
||||||
import { defineComponent, onBeforeMount, ref } from 'vue';
|
import { defineComponent, onBeforeMount, ref, computed, inject } from 'vue';
|
||||||
import UserSession from '../components/settings/UserSession.vue';
|
import UserSession from '../components/settings/UserSession.vue';
|
||||||
|
import { FG_Plugin } from '@flaschengeist/types';
|
||||||
import { Notify } from 'quasar';
|
import { Notify } from 'quasar';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -47,17 +52,29 @@ export default defineComponent({
|
||||||
progress: true,
|
progress: true,
|
||||||
actions: [{ icon: 'mdi-close', color: 'white' }],
|
actions: [{ icon: 'mdi-close', color: 'white' }],
|
||||||
});
|
});
|
||||||
|
console.log(widgets);
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeSession(s: FG.Session) {
|
function removeSession(s: FG.Session) {
|
||||||
sessions.value = sessions.value.filter((ss) => ss.token !== s.token);
|
sessions.value = sessions.value.filter((ss) => ss.token !== s.token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const flaschengeist = inject<FG_Plugin.Flaschengeist>('flaschengeist');
|
||||||
|
const widgets = computed(() =>
|
||||||
|
flaschengeist?.settingWidgets.filter((widget) => hasPermissions(widget.permissions))
|
||||||
|
);
|
||||||
|
|
||||||
|
function listWidgets() {
|
||||||
|
console.log(widgets);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
currentUser,
|
currentUser,
|
||||||
sessions,
|
sessions,
|
||||||
updateUser,
|
updateUser,
|
||||||
removeSession,
|
removeSession,
|
||||||
|
widgets,
|
||||||
|
listWidgets,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,16 @@ const mainRoutes: FG_Plugin.MenuRoute[] = [
|
||||||
permissions: ['user'],
|
permissions: ['user'],
|
||||||
route: { path: 'user', name: 'user', redirect: { name: 'user-settings' } },
|
route: { path: 'user', name: 'user', redirect: { name: 'user-settings' } },
|
||||||
children: [
|
children: [
|
||||||
|
{
|
||||||
|
title: 'Mitglieder',
|
||||||
|
icon: 'mdi-account-multiple',
|
||||||
|
shortcut: true,
|
||||||
|
route: {
|
||||||
|
path: 'members',
|
||||||
|
name: 'user-members',
|
||||||
|
component: () => import('../pages/Members.vue'),
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Einstellungen',
|
title: 'Einstellungen',
|
||||||
icon: 'mdi-account-edit',
|
icon: 'mdi-account-edit',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"extends": "@quasar/app/tsconfig-preset",
|
"extends": "@quasar/app-webpack/tsconfig-preset",
|
||||||
"target": "esnext",
|
"target": "esnext",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
|
|
Loading…
Reference in New Issue