Fixup user admin page

This commit is contained in:
Nassim Jahnke 2023-03-25 10:16:32 +01:00
parent 79f1619841
commit 9ba2bdb584
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
3 changed files with 30 additions and 30 deletions

View File

@ -1,3 +1,4 @@
DROP VIEW IF EXISTS pinned_versions;
CREATE OR REPLACE VIEW pinned_versions AS
SELECT *
FROM (SELECT DISTINCT ON (version_id) version_id,
@ -40,6 +41,7 @@ CREATE OR REPLACE VIEW pinned_versions AS
ORDER BY pv.created_at DESC)) AS pvs) AS t
ORDER BY t.created_at DESC;
DROP VIEW IF EXISTS pinned_projects;
CREATE OR REPLACE VIEW pinned_projects AS
SELECT DISTINCT ON (project_id) project_id,
user_id,

View File

@ -86,39 +86,34 @@ useHead(useSeo(i18n.t("userAdmin.title") + " " + route.params.user, null, route,
</Link>
</PageTitle>
<div class="flex lt-md:flex-col mb-2 gap-2">
<Card class="basis-full md:basis-8/12">
<Card class="basis-full">
<template #header>{{ i18n.t("userAdmin.roles") }}</template>
<div class="space-x-1">
<Tag v-for="roleId in user?.roles" :key="roleId" :color="{ background: getRole(roleId).color }" :name="getRole(roleId).title" />
</div>
<div class="flex mt-2">
<div class="flex mt-2 items-center">
<div class="flex-grow">
<InputSelect v-model="selectedRole" :values="useBackendData.globalRoles.filter((role) => role.assignable)" item-text="title" item-value="value" />
</div>
<div>
<Button size="medium" :disabled="!selectedRole || user?.roles.some((r) => getRole(r).value === selectedRole)" @click="processRole(true)">
{{ i18n.t("general.add") }}
</Button>
</div>
<div class="ml-2">
<Button size="medium" :disabled="!selectedRole || !user?.roles.some((r) => getRole(r).value === selectedRole)" @click="processRole(false)">
{{ i18n.t("general.delete") }}
</Button>
<InputSelect
v-model="selectedRole"
:values="useBackendData.globalRoles.filter((r) => r.value !== 'Organization')"
item-text="title"
item-value="value"
/>
</div>
<Button size="medium" :disabled="!selectedRole || user?.roles.some((r) => getRole(r).value === selectedRole)" class="ml-1" @click="processRole(true)">
{{ i18n.t("general.add") }}
</Button>
<Button
size="medium"
:disabled="!selectedRole || !user?.roles.some((r) => getRole(r).value === selectedRole)"
@click="processRole(false)"
class="ml-1"
>
{{ i18n.t("general.delete") }}
</Button>
</div>
</Card>
<Card class="basis-full md:basis-4/12">
<template #header>{{ i18n.t("userAdmin.sidebar") }}</template>
<ul>
<li>
<Link :href="_authUrl">{{ i18n.t("userAdmin.hangarAuth") }}</Link>
</li>
<li>
<Link :href="_forumUserUrl">{{ i18n.t("userAdmin.forum") }}</Link>
</li>
</ul>
</Card>
</div>
<Card md="mb-2">
@ -139,7 +134,8 @@ useHead(useSeo(i18n.t("userAdmin.title") + " " + route.params.user, null, route,
{{ getRole(orgs[item.name].roleId).title }}
</template>
<template #item_accepted="{ item }">
<InputCheckbox v-model="orgs[item.name].accepted" :disabled="true" />
<IconMdiCheck v-if="orgs[item.name].accepted" class="text-green" />
<IconMdiClose v-else class="text-red" />
</template>
</SortableTable>
</Card>
@ -157,12 +153,13 @@ useHead(useSeo(i18n.t("userAdmin.title") + " " + route.params.user, null, route,
{{ item.namespace.owner }}
</Link>
</template>
<template #item_role="{ item }">
<!-- todo add role -->
&lt;{{ item.name }}'s role&gt;
</template>
<!-- todo -->
<!--<template #item_role="{ item }">
{{ item.name }}
</template>-->
<template #item_accepted="{ item }">
<InputCheckbox :model-value="item.visibility === 'public'" :disabled="true" />
<IconMdiCheck v-if="item.visibility === 'public'" class="text-green" />
<IconMdiClose v-else class="text-red" />
</template>
</SortableTable>
</Card>

View File

@ -14,6 +14,7 @@ declare module "@vue/runtime-core" {
IconMdiAlertBox: typeof import("~icons/mdi/alert-box")["default"];
IconMdiAlertDecagram: typeof import("~icons/mdi/alert-decagram")["default"];
IconMdiAlertOutline: typeof import("~icons/mdi/alert-outline")["default"];
IconMdiAlphaX: typeof import("~icons/mdi/alpha-x")["default"];
IconMdiBell: typeof import("~icons/mdi/bell")["default"];
IconMdiBellOutline: typeof import("~icons/mdi/bell-outline")["default"];
IconMdiBookshelf: typeof import("~icons/mdi/bookshelf")["default"];