owltide/components/TableUsers.vue
Hornwitser d006be251c Create a per-user admin page to inspect users
Add page to allow admins to inspect all of the details stored on the
server of a user account.  For now this is just the UserDetails, but
in the future this is planned to be expanded to also show sessions
and logs.
2025-09-06 15:16:02 +02:00

67 lines
1.3 KiB
Vue

<!--
SPDX-FileCopyrightText: © 2025 Hornwitser <code@hornwitser.no>
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<table>
<thead>
<tr>
<th>Id</th>
<th>Name</th>
<th>Type</th>
<th>Last Update</th>
<th></th>
</tr>
</thead>
<tbody>
<tr v-for="user in usersStore.users.values()">
<td>{{ user.id }}</td>
<td>
<NuxtLink :to="`/admin/users/${user.id}`">
<template v-if="user.name">
{{ user.name }}
</template>
<i v-else>(empty)</i>
</NuxtLink>
</td>
<td>
<select
v-if='user.type !== "anonymous"'
v-model="user.type"
>
<option value="regular">Regular</option>
<option value="crew">Crew</option>
<option value="admin">Admin</option>
</select>
<template v-else>
{{ user.type }}
</template>
</td>
<td>
{{ user.updatedAt.toFormat("yyyy-LL-dd HH:mm") }}
</td>
<td>
<button
v-if="user.isModified()"
type="button"
@click="usersStore.saveUser(user);"
>Save</button>
<button
v-if="user.isModified()"
type="button"
@click="user.discard()"
>Discard</button>
</td>
</tr>
</tbody>
</table>
</template>
<script lang="ts" setup>
useEventSource();
const usersStore = useUsersStore();
</script>
<style>
</style>