Big changes
This commit is contained in:
parent
4240ad38e2
commit
e3f0d63fec
99 changed files with 8804 additions and 1731 deletions
|
|
@ -1,316 +0,0 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
|
||||
import AppPage from "@/components/layout/AppPage.vue";
|
||||
import AsyncStateGate from "@/components/patterns/AsyncStateGate.vue";
|
||||
import RequestStateAlerts from "@/components/patterns/RequestStateAlerts.vue";
|
||||
import AppButton from "@/components/ui/AppButton.vue";
|
||||
import AppCard from "@/components/ui/AppCard.vue";
|
||||
import AppCheckbox from "@/components/ui/AppCheckbox.vue";
|
||||
import AppHelpHint from "@/components/ui/AppHelpHint.vue";
|
||||
import AppInput from "@/components/ui/AppInput.vue";
|
||||
import AppModal from "@/components/ui/AppModal.vue";
|
||||
import AppTable from "@/components/ui/AppTable.vue";
|
||||
import {
|
||||
createAdminUser,
|
||||
listAdminUsers,
|
||||
resetAdminUserPassword,
|
||||
setAdminUserActive,
|
||||
type AdminUser,
|
||||
} from "@/features/admin_users";
|
||||
import { ApiRequestError } from "@/lib/api/errors";
|
||||
|
||||
const loading = ref(true);
|
||||
const creating = ref(false);
|
||||
const togglingUserId = ref<number | null>(null);
|
||||
const resettingPassword = ref(false);
|
||||
const activeUserId = ref<number | null>(null);
|
||||
const users = ref<AdminUser[]>([]);
|
||||
|
||||
const email = ref("");
|
||||
const password = ref("");
|
||||
const createIsAdmin = ref(false);
|
||||
const resetPassword = ref("");
|
||||
|
||||
const errorMessage = ref<string | null>(null);
|
||||
const errorRequestId = ref<string | null>(null);
|
||||
const successMessage = ref<string | null>(null);
|
||||
|
||||
const activeUser = computed(() => users.value.find((item) => item.id === activeUserId.value) ?? null);
|
||||
|
||||
function formatDate(value: string): string {
|
||||
const asDate = new Date(value);
|
||||
if (Number.isNaN(asDate.getTime())) {
|
||||
return value;
|
||||
}
|
||||
return asDate.toLocaleString();
|
||||
}
|
||||
|
||||
function userRoleLabel(user: AdminUser): string {
|
||||
return user.is_admin ? "Admin" : "User";
|
||||
}
|
||||
|
||||
function statusDotClass(user: AdminUser): string {
|
||||
return user.is_active
|
||||
? "bg-success-500 ring-success-200"
|
||||
: "bg-ink-muted/70 ring-stroke-default";
|
||||
}
|
||||
|
||||
function openUserModal(user: AdminUser): void {
|
||||
activeUserId.value = user.id;
|
||||
resetPassword.value = "";
|
||||
}
|
||||
|
||||
function closeUserModal(): void {
|
||||
activeUserId.value = null;
|
||||
resetPassword.value = "";
|
||||
}
|
||||
|
||||
async function loadUsers(): Promise<void> {
|
||||
loading.value = true;
|
||||
errorMessage.value = null;
|
||||
errorRequestId.value = null;
|
||||
|
||||
try {
|
||||
users.value = await listAdminUsers();
|
||||
if (activeUserId.value !== null && !users.value.some((item) => item.id === activeUserId.value)) {
|
||||
closeUserModal();
|
||||
}
|
||||
} catch (error) {
|
||||
users.value = [];
|
||||
if (error instanceof ApiRequestError) {
|
||||
errorMessage.value = error.message;
|
||||
errorRequestId.value = error.requestId;
|
||||
} else {
|
||||
errorMessage.value = "Unable to load users.";
|
||||
}
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function onCreateUser(): Promise<void> {
|
||||
creating.value = true;
|
||||
successMessage.value = null;
|
||||
errorMessage.value = null;
|
||||
errorRequestId.value = null;
|
||||
|
||||
try {
|
||||
if (!email.value.trim() || !password.value) {
|
||||
throw new Error("Email and password are required.");
|
||||
}
|
||||
|
||||
const created = await createAdminUser({
|
||||
email: email.value.trim(),
|
||||
password: password.value,
|
||||
is_admin: createIsAdmin.value,
|
||||
});
|
||||
|
||||
email.value = "";
|
||||
password.value = "";
|
||||
createIsAdmin.value = false;
|
||||
successMessage.value = `User created: ${created.email}`;
|
||||
await loadUsers();
|
||||
} catch (error) {
|
||||
if (error instanceof ApiRequestError) {
|
||||
errorMessage.value = error.message;
|
||||
errorRequestId.value = error.requestId;
|
||||
} else if (error instanceof Error) {
|
||||
errorMessage.value = error.message;
|
||||
} else {
|
||||
errorMessage.value = "Unable to create user.";
|
||||
}
|
||||
} finally {
|
||||
creating.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
async function onToggleUser(user: AdminUser): Promise<void> {
|
||||
togglingUserId.value = user.id;
|
||||
successMessage.value = null;
|
||||
|
||||
try {
|
||||
const updated = await setAdminUserActive(user.id, !user.is_active);
|
||||
successMessage.value = `${updated.email} is now ${updated.is_active ? "active" : "inactive"}.`;
|
||||
await loadUsers();
|
||||
} catch (error) {
|
||||
if (error instanceof ApiRequestError) {
|
||||
errorMessage.value = error.message;
|
||||
errorRequestId.value = error.requestId;
|
||||
} else {
|
||||
errorMessage.value = "Unable to update user.";
|
||||
}
|
||||
} finally {
|
||||
togglingUserId.value = null;
|
||||
}
|
||||
}
|
||||
|
||||
async function onResetPassword(): Promise<void> {
|
||||
const user = activeUser.value;
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
|
||||
resettingPassword.value = true;
|
||||
successMessage.value = null;
|
||||
errorMessage.value = null;
|
||||
errorRequestId.value = null;
|
||||
|
||||
try {
|
||||
const candidate = resetPassword.value.trim();
|
||||
if (candidate.length < 12) {
|
||||
throw new Error("New password must be at least 12 characters.");
|
||||
}
|
||||
|
||||
const result = await resetAdminUserPassword(user.id, candidate);
|
||||
successMessage.value = result.message || `Password reset for ${user.email}.`;
|
||||
resetPassword.value = "";
|
||||
} catch (error) {
|
||||
if (error instanceof ApiRequestError) {
|
||||
errorMessage.value = error.message;
|
||||
errorRequestId.value = error.requestId;
|
||||
} else if (error instanceof Error) {
|
||||
errorMessage.value = error.message;
|
||||
} else {
|
||||
errorMessage.value = "Unable to reset password.";
|
||||
}
|
||||
} finally {
|
||||
resettingPassword.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void loadUsers();
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppPage title="Admin Users" subtitle="Create and manage user access for this instance.">
|
||||
<RequestStateAlerts
|
||||
:success-message="successMessage"
|
||||
:error-message="errorMessage"
|
||||
:error-request-id="errorRequestId"
|
||||
error-title="User management request failed"
|
||||
@dismiss-success="successMessage = null"
|
||||
/>
|
||||
|
||||
<section class="grid gap-4 lg:grid-cols-2">
|
||||
<AppCard class="space-y-4">
|
||||
<div class="flex items-center gap-1">
|
||||
<h2 class="text-lg font-semibold text-ink-primary">Create User</h2>
|
||||
<AppHelpHint text="Create local accounts for this Scholarr instance and optionally grant admin rights." />
|
||||
</div>
|
||||
<form class="grid gap-3" @submit.prevent="onCreateUser">
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span>Email</span>
|
||||
<AppInput id="admin-user-email" v-model="email" type="email" autocomplete="off" />
|
||||
</label>
|
||||
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span>Password</span>
|
||||
<AppInput id="admin-user-password" v-model="password" type="password" autocomplete="new-password" />
|
||||
</label>
|
||||
|
||||
<AppCheckbox id="admin-user-is-admin" v-model="createIsAdmin" label="Grant admin privileges" />
|
||||
|
||||
<AppButton type="submit" :disabled="creating">
|
||||
{{ creating ? "Creating..." : "Create user" }}
|
||||
</AppButton>
|
||||
</form>
|
||||
</AppCard>
|
||||
|
||||
<AppCard class="space-y-4">
|
||||
<div class="flex items-center gap-1">
|
||||
<h2 class="text-lg font-semibold text-ink-primary">Users</h2>
|
||||
<AppHelpHint text="Review account roles and active status. Inactive users cannot sign in." />
|
||||
</div>
|
||||
<AsyncStateGate
|
||||
:loading="loading"
|
||||
:loading-lines="5"
|
||||
:empty="users.length === 0"
|
||||
:show-empty="!errorMessage"
|
||||
empty-title="No users available"
|
||||
empty-body="Create an account to begin assigning access."
|
||||
>
|
||||
<AppTable label="Admin users table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Email</th>
|
||||
<th scope="col">Role</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr v-for="user in users" :key="user.id">
|
||||
<td>
|
||||
<button
|
||||
type="button"
|
||||
class="group inline-flex items-center gap-2 rounded-md px-1 py-0.5 text-left text-ink-primary transition hover:bg-surface-card-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-focus-offset"
|
||||
@click="openUserModal(user)"
|
||||
>
|
||||
<span
|
||||
:class="statusDotClass(user)"
|
||||
class="h-2.5 w-2.5 rounded-full ring-2"
|
||||
:aria-label="user.is_active ? 'Active user' : 'Inactive user'"
|
||||
/>
|
||||
<span class="underline-offset-2 group-hover:underline">{{ user.email }}</span>
|
||||
</button>
|
||||
</td>
|
||||
<td>{{ userRoleLabel(user) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</AppTable>
|
||||
<p class="text-xs text-secondary">Status dot: green is active, gray is inactive. Click an email to manage.</p>
|
||||
</AsyncStateGate>
|
||||
</AppCard>
|
||||
</section>
|
||||
|
||||
<AppModal :open="activeUser !== null" title="User settings" @close="closeUserModal">
|
||||
<div v-if="activeUser" class="grid gap-4">
|
||||
<div class="space-y-1">
|
||||
<div class="flex items-center gap-2">
|
||||
<span
|
||||
:class="statusDotClass(activeUser)"
|
||||
class="h-2.5 w-2.5 rounded-full ring-2"
|
||||
:aria-label="activeUser.is_active ? 'Active user' : 'Inactive user'"
|
||||
/>
|
||||
<p class="truncate text-sm font-semibold text-ink-primary">{{ activeUser.email }}</p>
|
||||
</div>
|
||||
<p class="text-sm text-secondary">Role: {{ userRoleLabel(activeUser) }}</p>
|
||||
<p class="text-xs text-secondary">Last updated: {{ formatDate(activeUser.updated_at) }}</p>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-2 border-t border-stroke-default pt-3">
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary" for="admin-user-reset-password">
|
||||
<span>Reset password</span>
|
||||
<AppInput
|
||||
id="admin-user-reset-password"
|
||||
v-model="resetPassword"
|
||||
type="password"
|
||||
autocomplete="new-password"
|
||||
placeholder="Minimum 12 characters"
|
||||
:disabled="resettingPassword"
|
||||
/>
|
||||
</label>
|
||||
<div class="flex flex-wrap justify-end gap-2">
|
||||
<AppButton variant="secondary" :disabled="resettingPassword" @click="onResetPassword">
|
||||
{{ resettingPassword ? "Resetting..." : "Reset password" }}
|
||||
</AppButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center justify-between gap-2 border-t border-stroke-default pt-3">
|
||||
<AppButton
|
||||
variant="secondary"
|
||||
:disabled="togglingUserId === activeUser.id"
|
||||
@click="onToggleUser(activeUser)"
|
||||
>
|
||||
{{ activeUser.is_active ? "Deactivate user" : "Activate user" }}
|
||||
</AppButton>
|
||||
<AppButton variant="ghost" :disabled="togglingUserId === activeUser.id || resettingPassword" @click="closeUserModal">
|
||||
Close
|
||||
</AppButton>
|
||||
</div>
|
||||
</div>
|
||||
</AppModal>
|
||||
</AppPage>
|
||||
</template>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
|
||||
import { fetchDashboardSnapshot, type DashboardSnapshot } from "@/features/dashboard";
|
||||
import { ApiRequestError } from "@/lib/api/errors";
|
||||
|
|
@ -14,7 +14,7 @@ import AppCard from "@/components/ui/AppCard.vue";
|
|||
import AppEmptyState from "@/components/ui/AppEmptyState.vue";
|
||||
import AppHelpHint from "@/components/ui/AppHelpHint.vue";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { RUN_STATUS_POLL_INTERVAL_MS, useRunStatusStore } from "@/stores/run_status";
|
||||
import { useRunStatusStore } from "@/stores/run_status";
|
||||
import { useUserSettingsStore } from "@/stores/user_settings";
|
||||
|
||||
const loading = ref(true);
|
||||
|
|
@ -26,7 +26,6 @@ const refreshingAfterCompletion = ref(false);
|
|||
const auth = useAuthStore();
|
||||
const runStatus = useRunStatusStore();
|
||||
const userSettings = useUserSettingsStore();
|
||||
let latestRunSyncTimer: ReturnType<typeof setInterval> | null = null;
|
||||
|
||||
const isStartBlocked = computed(
|
||||
() =>
|
||||
|
|
@ -135,23 +134,6 @@ function shouldRefreshAfterRunChange(
|
|||
return previousRun.status === "running";
|
||||
}
|
||||
|
||||
function startLatestRunSyncLoop(): void {
|
||||
if (latestRunSyncTimer !== null) {
|
||||
return;
|
||||
}
|
||||
latestRunSyncTimer = setInterval(() => {
|
||||
void runStatus.syncLatest();
|
||||
}, RUN_STATUS_POLL_INTERVAL_MS);
|
||||
}
|
||||
|
||||
function stopLatestRunSyncLoop(): void {
|
||||
if (latestRunSyncTimer === null) {
|
||||
return;
|
||||
}
|
||||
clearInterval(latestRunSyncTimer);
|
||||
latestRunSyncTimer = null;
|
||||
}
|
||||
|
||||
async function loadSnapshot(): Promise<void> {
|
||||
loading.value = true;
|
||||
errorMessage.value = null;
|
||||
|
|
@ -207,11 +189,6 @@ async function onTriggerRun(): Promise<void> {
|
|||
onMounted(() => {
|
||||
void loadSnapshot();
|
||||
void runStatus.syncLatest();
|
||||
startLatestRunSyncLoop();
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
stopLatestRunSyncLoop();
|
||||
});
|
||||
|
||||
watch(
|
||||
|
|
@ -266,7 +243,12 @@ watch(
|
|||
</div>
|
||||
<p class="text-sm text-secondary">Newest papers found while checking your tracked scholar profiles.</p>
|
||||
</div>
|
||||
<RouterLink to="/publications" class="link-inline text-sm">Open full publications view</RouterLink>
|
||||
<RouterLink
|
||||
to="/publications"
|
||||
class="inline-flex min-h-10 items-center justify-center rounded-lg border border-action-secondary-border bg-action-secondary-bg px-3 py-2 text-sm font-semibold text-action-secondary-text shadow-sm transition hover:border-action-secondary-hover-border hover:bg-action-secondary-hover-bg hover:text-action-secondary-hover-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-focus-offset"
|
||||
>
|
||||
view all
|
||||
</RouterLink>
|
||||
</div>
|
||||
|
||||
<AppEmptyState
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ import { computed, ref } from "vue";
|
|||
import { useRouter } from "vue-router";
|
||||
|
||||
import AppAlert from "@/components/ui/AppAlert.vue";
|
||||
import AppBrandMark from "@/components/ui/AppBrandMark.vue";
|
||||
import AppButton from "@/components/ui/AppButton.vue";
|
||||
import AppCard from "@/components/ui/AppCard.vue";
|
||||
import AppInput from "@/components/ui/AppInput.vue";
|
||||
import AppThemePicker from "@/components/ui/AppThemePicker.vue";
|
||||
import { ApiRequestError } from "@/lib/api/errors";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
|
||||
|
|
@ -54,46 +56,22 @@ async function onSubmit(): Promise<void> {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<div class="relative h-[100dvh] max-h-[100dvh] overflow-y-auto overflow-x-hidden bg-surface-app">
|
||||
<div class="pointer-events-none absolute inset-0">
|
||||
<div class="absolute -top-20 left-[-8rem] h-72 w-72 rounded-full bg-brand-300/30 blur-3xl" />
|
||||
<div class="absolute bottom-[-7rem] right-[-6rem] h-80 w-80 rounded-full bg-success-300/25 blur-3xl" />
|
||||
<div class="absolute left-1/3 top-1/3 h-52 w-52 rounded-full bg-warning-300/20 blur-3xl" />
|
||||
<div class="relative h-[100dvh] max-h-[100dvh] overflow-hidden bg-surface-app">
|
||||
<div class="absolute right-4 top-4 z-10 sm:right-6 sm:top-6">
|
||||
<AppThemePicker compact id-prefix="login-theme" />
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="relative mx-auto grid min-h-full w-full max-w-6xl items-center gap-8 px-4 py-6 sm:px-6 lg:grid-cols-[minmax(0,1fr)_26rem] lg:px-8"
|
||||
>
|
||||
<section class="hidden space-y-5 lg:block">
|
||||
<p class="inline-flex items-center rounded-full border border-stroke-strong bg-surface-card/70 px-3 py-1 text-xs font-medium uppercase tracking-[0.12em] text-ink-muted">
|
||||
Scholarr Control Center
|
||||
</p>
|
||||
<h1 class="max-w-xl font-display text-4xl font-semibold tracking-tight text-ink-primary">
|
||||
Scholar tracking with reliable operational controls.
|
||||
</h1>
|
||||
<p class="max-w-xl text-base leading-relaxed text-ink-muted">
|
||||
Use your account to review ingestion runs, publication changes, and continuation queue diagnostics from a
|
||||
single workspace.
|
||||
</p>
|
||||
<ul class="grid max-w-xl gap-2 text-sm text-ink-muted">
|
||||
<li class="rounded-lg border border-stroke-default bg-surface-card/60 px-3 py-2">
|
||||
Session-based authentication with CSRF enforcement.
|
||||
</li>
|
||||
<li class="rounded-lg border border-stroke-default bg-surface-card/60 px-3 py-2">
|
||||
Run and queue diagnostics are available for support workflows.
|
||||
</li>
|
||||
<li class="rounded-lg border border-stroke-default bg-surface-card/60 px-3 py-2">
|
||||
Theme-aware interface with light and dark mode support.
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<div class="pointer-events-none absolute inset-0">
|
||||
<div class="absolute -top-28 right-[-8rem] h-72 w-72 rounded-full bg-brand-300/25 blur-3xl" />
|
||||
<div class="absolute bottom-[-8rem] left-[-7rem] h-80 w-80 rounded-full bg-info-300/20 blur-3xl" />
|
||||
</div>
|
||||
|
||||
<AppCard class="w-full max-w-md justify-self-end space-y-6 border-stroke-default/80 bg-surface-card/90 backdrop-blur">
|
||||
<div class="space-y-2">
|
||||
<h1 class="font-display text-3xl font-semibold tracking-tight text-ink-primary">Sign In</h1>
|
||||
<p class="text-sm text-secondary">
|
||||
Sign in to access scholar tracking, publication updates, and run diagnostics.
|
||||
</p>
|
||||
<div class="relative mx-auto grid h-full w-full max-w-md items-center px-4 py-8 sm:px-6">
|
||||
<AppCard class="space-y-6 border-stroke-default/80 bg-surface-card/90 p-6 backdrop-blur sm:p-7">
|
||||
<div class="grid justify-items-center gap-2 text-center">
|
||||
<AppBrandMark size="xl" />
|
||||
<p class="font-display text-2xl font-semibold tracking-tight text-ink-primary">scholarr</p>
|
||||
<h1 class="text-sm font-medium uppercase tracking-[0.12em] text-ink-secondary">Sign in</h1>
|
||||
</div>
|
||||
|
||||
<AppAlert v-if="errorMessage" tone="danger">
|
||||
|
|
@ -106,7 +84,7 @@ async function onSubmit(): Promise<void> {
|
|||
<form class="grid gap-4" @submit.prevent="onSubmit">
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span>Email</span>
|
||||
<AppInput id="login-email" v-model="email" type="email" autocomplete="email" />
|
||||
<AppInput id="login-email" v-model="email" type="email" autocomplete="email" autofocus />
|
||||
</label>
|
||||
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
|
|
@ -123,6 +101,10 @@ async function onSubmit(): Promise<void> {
|
|||
{{ pending ? "Signing in..." : "Sign in" }}
|
||||
</AppButton>
|
||||
</form>
|
||||
|
||||
<p class="text-center text-xs text-secondary">
|
||||
Use your assigned account credentials.
|
||||
</p>
|
||||
</AppCard>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -6,10 +6,10 @@ import AppPage from "@/components/layout/AppPage.vue";
|
|||
import AsyncStateGate from "@/components/patterns/AsyncStateGate.vue";
|
||||
import RequestStateAlerts from "@/components/patterns/RequestStateAlerts.vue";
|
||||
import RunStatusBadge from "@/components/patterns/RunStatusBadge.vue";
|
||||
import AppButton from "@/components/ui/AppButton.vue";
|
||||
import AppCard from "@/components/ui/AppCard.vue";
|
||||
import AppEmptyState from "@/components/ui/AppEmptyState.vue";
|
||||
import AppHelpHint from "@/components/ui/AppHelpHint.vue";
|
||||
import AppRefreshButton from "@/components/ui/AppRefreshButton.vue";
|
||||
import AppTable from "@/components/ui/AppTable.vue";
|
||||
import { getRunDetail, type RunDetail } from "@/features/runs";
|
||||
import { ApiRequestError } from "@/lib/api/errors";
|
||||
|
|
@ -108,9 +108,13 @@ onMounted(() => {
|
|||
</div>
|
||||
<p class="text-sm text-secondary">Refresh this run detail view after queue/run updates.</p>
|
||||
</div>
|
||||
<AppButton variant="secondary" @click="loadDetail" :disabled="loading">
|
||||
{{ loading ? "Refreshing..." : "Refresh" }}
|
||||
</AppButton>
|
||||
<AppRefreshButton
|
||||
variant="secondary"
|
||||
:loading="loading"
|
||||
title="Refresh run detail"
|
||||
loading-title="Refreshing run detail"
|
||||
@click="loadDetail"
|
||||
/>
|
||||
</div>
|
||||
</AppCard>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import AppButton from "@/components/ui/AppButton.vue";
|
|||
import AppCard from "@/components/ui/AppCard.vue";
|
||||
import AppEmptyState from "@/components/ui/AppEmptyState.vue";
|
||||
import AppHelpHint from "@/components/ui/AppHelpHint.vue";
|
||||
import AppRefreshButton from "@/components/ui/AppRefreshButton.vue";
|
||||
import AppTable from "@/components/ui/AppTable.vue";
|
||||
import {
|
||||
clearQueueItem,
|
||||
|
|
@ -210,9 +211,13 @@ onMounted(() => {
|
|||
<AppButton :disabled="isStartBlocked" :title="startCheckDisabledReason || undefined" @click="onTriggerManualRun">
|
||||
{{ runButtonLabel }}
|
||||
</AppButton>
|
||||
<AppButton variant="secondary" :disabled="loading" @click="loadData">
|
||||
{{ loading ? "Refreshing..." : "Refresh" }}
|
||||
</AppButton>
|
||||
<AppRefreshButton
|
||||
variant="secondary"
|
||||
:loading="loading"
|
||||
title="Refresh runs and queue"
|
||||
loading-title="Refreshing runs and queue"
|
||||
@click="loadData"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
v-if="runStatus.isLikelyRunning"
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import AppEmptyState from "@/components/ui/AppEmptyState.vue";
|
|||
import AppHelpHint from "@/components/ui/AppHelpHint.vue";
|
||||
import AppInput from "@/components/ui/AppInput.vue";
|
||||
import AppModal from "@/components/ui/AppModal.vue";
|
||||
import AppRefreshButton from "@/components/ui/AppRefreshButton.vue";
|
||||
import AppSelect from "@/components/ui/AppSelect.vue";
|
||||
import AppTable from "@/components/ui/AppTable.vue";
|
||||
import {
|
||||
|
|
@ -812,9 +813,14 @@ onMounted(() => {
|
|||
<AppButton variant="secondary" :disabled="loading || importingData" @click="onOpenImportPicker">
|
||||
{{ importingData ? "Importing..." : "Import" }}
|
||||
</AppButton>
|
||||
<AppButton variant="secondary" :disabled="loading || saving" @click="loadScholars">
|
||||
{{ loading ? "Refreshing..." : "Refresh" }}
|
||||
</AppButton>
|
||||
<AppRefreshButton
|
||||
variant="secondary"
|
||||
:disabled="saving"
|
||||
:loading="loading"
|
||||
title="Refresh scholars"
|
||||
loading-title="Refreshing scholars"
|
||||
@click="loadScholars"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<input
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<script setup lang="ts">
|
||||
import { computed, onMounted, ref } from "vue";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import AppPage from "@/components/layout/AppPage.vue";
|
||||
import AsyncStateGate from "@/components/patterns/AsyncStateGate.vue";
|
||||
|
|
@ -9,7 +10,8 @@ import AppCard from "@/components/ui/AppCard.vue";
|
|||
import AppCheckbox from "@/components/ui/AppCheckbox.vue";
|
||||
import AppHelpHint from "@/components/ui/AppHelpHint.vue";
|
||||
import AppInput from "@/components/ui/AppInput.vue";
|
||||
import AppModal from "@/components/ui/AppModal.vue";
|
||||
import AppTabs, { type AppTabItem } from "@/components/ui/AppTabs.vue";
|
||||
import SettingsAdminPanel from "@/features/settings/SettingsAdminPanel.vue";
|
||||
import {
|
||||
changePassword,
|
||||
fetchSettings,
|
||||
|
|
@ -22,65 +24,18 @@ import { useAuthStore } from "@/stores/auth";
|
|||
import { useRunStatusStore } from "@/stores/run_status";
|
||||
import { normalizeUserNavVisiblePages, useUserSettingsStore } from "@/stores/user_settings";
|
||||
|
||||
interface NavPageOption {
|
||||
id: string;
|
||||
label: string;
|
||||
description: string;
|
||||
required: boolean;
|
||||
adminOnly?: boolean;
|
||||
}
|
||||
|
||||
const NAV_PAGE_OPTIONS: NavPageOption[] = [
|
||||
{
|
||||
id: "dashboard",
|
||||
label: "Dashboard",
|
||||
description: "Overview and latest publication updates.",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: "scholars",
|
||||
label: "Scholars",
|
||||
description: "Tracked scholar profiles and profile management.",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: "publications",
|
||||
label: "Publications",
|
||||
description: "Review and search discovered publication records.",
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
id: "settings",
|
||||
label: "Settings",
|
||||
description: "Configuration and account controls.",
|
||||
required: true,
|
||||
},
|
||||
{
|
||||
id: "style-guide",
|
||||
label: "Style Guide",
|
||||
description: "Admin-only visual reference for theme and component tokens.",
|
||||
required: false,
|
||||
adminOnly: true,
|
||||
},
|
||||
{
|
||||
id: "runs",
|
||||
label: "Runs",
|
||||
description: "Admin-only diagnostics and queue operations.",
|
||||
required: false,
|
||||
adminOnly: true,
|
||||
},
|
||||
{
|
||||
id: "users",
|
||||
label: "Users",
|
||||
description: "Admin-only user management.",
|
||||
required: false,
|
||||
adminOnly: true,
|
||||
},
|
||||
];
|
||||
const TAB_CHECKING = "checking";
|
||||
const TAB_ACCOUNT = "account";
|
||||
const TAB_ADMIN_USERS = "admin-users";
|
||||
const TAB_ADMIN_INTEGRITY = "admin-integrity";
|
||||
const TAB_ADMIN_REPAIRS = "admin-repairs";
|
||||
const TAB_ADMIN_PDF = "admin-pdf";
|
||||
|
||||
const auth = useAuthStore();
|
||||
const userSettings = useUserSettingsStore();
|
||||
const runStatus = useRunStatusStore();
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const loading = ref(true);
|
||||
const saving = ref(false);
|
||||
|
|
@ -98,55 +53,82 @@ const confirmPassword = ref("");
|
|||
const errorMessage = ref<string | null>(null);
|
||||
const errorRequestId = ref<string | null>(null);
|
||||
const successMessage = ref<string | null>(null);
|
||||
const showIngestionModal = ref(false);
|
||||
const showPasswordModal = ref(false);
|
||||
const showNavigationModal = ref(false);
|
||||
|
||||
const minCheckIntervalMinutes = ref(15);
|
||||
const minRequestDelaySeconds = ref(2);
|
||||
const automationAllowed = ref(true);
|
||||
const manualRunAllowed = ref(true);
|
||||
const blockedFailureThreshold = ref(1);
|
||||
const networkFailureThreshold = ref(2);
|
||||
const cooldownBlockedSeconds = ref(1800);
|
||||
const cooldownNetworkSeconds = ref(900);
|
||||
|
||||
const visibleNavOptions = computed(() =>
|
||||
NAV_PAGE_OPTIONS.filter((option) => !option.adminOnly || auth.isAdmin),
|
||||
);
|
||||
const visibleNavLabels = computed(() =>
|
||||
visibleNavOptions.value
|
||||
.filter((option) => navVisiblePages.value.includes(option.id))
|
||||
.map((option) => option.label),
|
||||
);
|
||||
const activeTab = ref(TAB_CHECKING);
|
||||
|
||||
const tabItems = computed<AppTabItem[]>(() => {
|
||||
const tabs: AppTabItem[] = [
|
||||
{ id: TAB_CHECKING, label: "Checking" },
|
||||
{ id: TAB_ACCOUNT, label: "Account" },
|
||||
];
|
||||
if (auth.isAdmin) {
|
||||
tabs.push(
|
||||
{ id: TAB_ADMIN_USERS, label: "Users" },
|
||||
{ id: TAB_ADMIN_INTEGRITY, label: "Integrity" },
|
||||
{ id: TAB_ADMIN_REPAIRS, label: "Repairs" },
|
||||
{ id: TAB_ADMIN_PDF, label: "PDF Queue" },
|
||||
);
|
||||
}
|
||||
return tabs;
|
||||
});
|
||||
|
||||
const activeAdminSection = computed<"users" | "integrity" | "repairs" | "pdf" | null>(() => {
|
||||
if (activeTab.value === TAB_ADMIN_USERS) {
|
||||
return "users";
|
||||
}
|
||||
if (activeTab.value === TAB_ADMIN_INTEGRITY) {
|
||||
return "integrity";
|
||||
}
|
||||
if (activeTab.value === TAB_ADMIN_REPAIRS) {
|
||||
return "repairs";
|
||||
}
|
||||
if (activeTab.value === TAB_ADMIN_PDF) {
|
||||
return "pdf";
|
||||
}
|
||||
return null;
|
||||
});
|
||||
|
||||
function isKnownTab(tabId: string): boolean {
|
||||
return tabItems.value.some((item) => item.id === tabId);
|
||||
}
|
||||
|
||||
async function syncRouteTab(candidate: string): Promise<void> {
|
||||
const fallback = tabItems.value[0]?.id || TAB_CHECKING;
|
||||
const nextTab = isKnownTab(candidate) ? candidate : fallback;
|
||||
activeTab.value = nextTab;
|
||||
|
||||
const currentQueryTab = typeof route.query.tab === "string" ? route.query.tab : "";
|
||||
if (currentQueryTab === nextTab) {
|
||||
return;
|
||||
}
|
||||
|
||||
await router.replace({ query: { ...route.query, tab: nextTab } });
|
||||
}
|
||||
|
||||
function hydrateSettings(settings: UserSettings): void {
|
||||
const parsedMinRunInterval = Number(settings.policy?.min_run_interval_minutes);
|
||||
minCheckIntervalMinutes.value = Number.isFinite(parsedMinRunInterval)
|
||||
? Math.max(15, parsedMinRunInterval)
|
||||
: 15;
|
||||
|
||||
const parsedMinRequestDelay = Number(settings.policy?.min_request_delay_seconds);
|
||||
minRequestDelaySeconds.value = Number.isFinite(parsedMinRequestDelay)
|
||||
? Math.max(2, parsedMinRequestDelay)
|
||||
: 2;
|
||||
|
||||
automationAllowed.value = Boolean(settings.policy?.automation_allowed ?? true);
|
||||
manualRunAllowed.value = Boolean(settings.policy?.manual_run_allowed ?? true);
|
||||
blockedFailureThreshold.value = Number.isFinite(settings.policy?.blocked_failure_threshold)
|
||||
? Math.max(1, settings.policy.blocked_failure_threshold)
|
||||
: 1;
|
||||
networkFailureThreshold.value = Number.isFinite(settings.policy?.network_failure_threshold)
|
||||
? Math.max(1, settings.policy.network_failure_threshold)
|
||||
: 2;
|
||||
cooldownBlockedSeconds.value = Number.isFinite(settings.policy?.cooldown_blocked_seconds)
|
||||
? Math.max(60, settings.policy.cooldown_blocked_seconds)
|
||||
: 1800;
|
||||
cooldownNetworkSeconds.value = Number.isFinite(settings.policy?.cooldown_network_seconds)
|
||||
? Math.max(60, settings.policy.cooldown_network_seconds)
|
||||
: 900;
|
||||
|
||||
autoRunEnabled.value = Boolean(settings.auto_run_enabled) && automationAllowed.value;
|
||||
runIntervalMinutes.value = String(settings.run_interval_minutes);
|
||||
requestDelaySeconds.value = String(settings.request_delay_seconds);
|
||||
navVisiblePages.value = normalizeUserNavVisiblePages(settings.nav_visible_pages);
|
||||
|
||||
userSettings.applySettings(settings);
|
||||
runStatus.setSafetyState(settings.safety_state);
|
||||
}
|
||||
|
|
@ -162,31 +144,10 @@ function parseBoundedInteger(value: string, label: string, minimum: number): num
|
|||
return parsed;
|
||||
}
|
||||
|
||||
function isNavPageVisible(pageId: string): boolean {
|
||||
return navVisiblePages.value.includes(pageId);
|
||||
}
|
||||
|
||||
function onToggleNavPage(page: NavPageOption, event: Event): void {
|
||||
const input = event.target as HTMLInputElement;
|
||||
if (page.required && !input.checked) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (input.checked) {
|
||||
navVisiblePages.value = normalizeUserNavVisiblePages([...navVisiblePages.value, page.id]);
|
||||
return;
|
||||
}
|
||||
|
||||
navVisiblePages.value = normalizeUserNavVisiblePages(
|
||||
navVisiblePages.value.filter((pageId) => pageId !== page.id),
|
||||
);
|
||||
}
|
||||
|
||||
async function loadSettings(): Promise<void> {
|
||||
loading.value = true;
|
||||
errorMessage.value = null;
|
||||
errorRequestId.value = null;
|
||||
|
||||
try {
|
||||
const settings = await fetchSettings();
|
||||
hydrateSettings(settings);
|
||||
|
|
@ -227,8 +188,6 @@ async function onSaveSettings(): Promise<void> {
|
|||
const saved = await updateSettings(payload);
|
||||
hydrateSettings(saved);
|
||||
successMessage.value = "Settings updated.";
|
||||
showIngestionModal.value = false;
|
||||
showNavigationModal.value = false;
|
||||
} catch (error) {
|
||||
if (error instanceof ApiRequestError) {
|
||||
errorMessage.value = error.message;
|
||||
|
|
@ -264,7 +223,6 @@ async function onChangePassword(): Promise<void> {
|
|||
newPassword.value = "";
|
||||
confirmPassword.value = "";
|
||||
successMessage.value = response.message;
|
||||
showPasswordModal.value = false;
|
||||
} catch (error) {
|
||||
if (error instanceof ApiRequestError) {
|
||||
errorMessage.value = error.message;
|
||||
|
|
@ -279,16 +237,35 @@ async function onChangePassword(): Promise<void> {
|
|||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
void loadSettings();
|
||||
async function onSelectTab(tabId: string): Promise<void> {
|
||||
await syncRouteTab(tabId);
|
||||
}
|
||||
|
||||
watch(
|
||||
() => route.query.tab,
|
||||
async (value) => {
|
||||
const requestedTab = typeof value === "string" ? value : TAB_CHECKING;
|
||||
await syncRouteTab(requestedTab);
|
||||
},
|
||||
);
|
||||
|
||||
watch(
|
||||
() => auth.isAdmin,
|
||||
async () => {
|
||||
const requestedTab = typeof route.query.tab === "string" ? route.query.tab : TAB_CHECKING;
|
||||
await syncRouteTab(requestedTab);
|
||||
},
|
||||
);
|
||||
|
||||
onMounted(async () => {
|
||||
await loadSettings();
|
||||
const requestedTab = typeof route.query.tab === "string" ? route.query.tab : TAB_CHECKING;
|
||||
await syncRouteTab(requestedTab);
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AppPage
|
||||
title="Settings"
|
||||
subtitle="Control how often Scholarr checks profiles and how cautiously it sends requests."
|
||||
>
|
||||
<AppPage title="Settings" subtitle="Configuration and account controls in one place.">
|
||||
<RequestStateAlerts
|
||||
:success-message="successMessage"
|
||||
success-title="Saved"
|
||||
|
|
@ -298,189 +275,91 @@ onMounted(() => {
|
|||
@dismiss-success="successMessage = null"
|
||||
/>
|
||||
|
||||
<AsyncStateGate :loading="loading" :loading-lines="7" :show-empty="false">
|
||||
<section class="grid gap-4 xl:grid-cols-3">
|
||||
<AppCard class="flex h-full flex-col gap-4">
|
||||
<div class="flex items-center gap-1">
|
||||
<h2 class="text-lg font-semibold text-ink-primary">Automatic Checking</h2>
|
||||
<AppHelpHint text="Controls when Scholarr runs automatic profile checks and how cautiously it scrapes." />
|
||||
</div>
|
||||
<p class="text-sm text-secondary">
|
||||
Configure the background checker that looks for new publications on your tracked profiles.
|
||||
</p>
|
||||
<AppButton variant="secondary" class="mt-auto self-start" @click="showIngestionModal = true">
|
||||
Edit checking rules
|
||||
</AppButton>
|
||||
</AppCard>
|
||||
<AsyncStateGate :loading="loading" :loading-lines="8" :show-empty="false">
|
||||
<AppCard class="grid gap-4">
|
||||
<AppTabs :model-value="activeTab" :items="tabItems" aria-label="Settings sections" @update:model-value="onSelectTab" />
|
||||
|
||||
<AppCard class="flex h-full flex-col gap-4">
|
||||
<section v-if="activeTab === TAB_CHECKING" class="grid gap-4">
|
||||
<div class="flex items-center gap-1">
|
||||
<h2 class="text-lg font-semibold text-ink-primary">Automatic Checking</h2>
|
||||
<AppHelpHint text="Controls when Scholarr runs automatic profile checks and how cautiously it scrapes." />
|
||||
</div>
|
||||
<p class="text-sm text-secondary">Configure background checks and request pacing for ingestion.</p>
|
||||
|
||||
<div class="grid gap-3 md:grid-cols-2 md:items-start">
|
||||
<div class="grid gap-2 rounded-lg border border-stroke-default bg-surface-card-muted p-3 md:col-span-2">
|
||||
<AppCheckbox
|
||||
id="auto-run-enabled"
|
||||
v-model="autoRunEnabled"
|
||||
:disabled="!automationAllowed"
|
||||
label="Enable automatic background checks"
|
||||
/>
|
||||
<p class="text-xs text-secondary">
|
||||
Automatic checks are {{ automationAllowed ? "enabled by policy." : "disabled by server safety policy." }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span class="inline-flex items-center gap-1">
|
||||
Check interval (minutes)
|
||||
<AppHelpHint text="Minimum is controlled by server policy." />
|
||||
</span>
|
||||
<AppInput v-model="runIntervalMinutes" inputmode="numeric" />
|
||||
<span class="text-xs text-secondary">Minimum: {{ minCheckIntervalMinutes }}</span>
|
||||
</label>
|
||||
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span class="inline-flex items-center gap-1">
|
||||
Delay between requests (seconds)
|
||||
<AppHelpHint text="Minimum is controlled by safety policy to reduce blocks." />
|
||||
</span>
|
||||
<AppInput v-model="requestDelaySeconds" inputmode="numeric" />
|
||||
<span class="text-xs text-secondary">Minimum: {{ minRequestDelaySeconds }}</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-3 text-xs text-secondary">
|
||||
<span>Automation allowed: {{ automationAllowed ? "yes" : "no" }}</span>
|
||||
<span>Manual runs allowed: {{ manualRunAllowed ? "yes" : "no" }}</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<AppButton :disabled="saving" @click="onSaveSettings">
|
||||
{{ saving ? "Saving..." : "Save checking settings" }}
|
||||
</AppButton>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section v-if="activeTab === TAB_ACCOUNT" class="grid gap-4">
|
||||
<div class="flex items-center gap-1">
|
||||
<h2 class="text-lg font-semibold text-ink-primary">Account Access</h2>
|
||||
<AppHelpHint text="Manage credentials for your current signed-in account on this instance." />
|
||||
</div>
|
||||
<p class="text-sm text-secondary">
|
||||
Change your sign-in password from a focused view. This does not affect other users.
|
||||
</p>
|
||||
<AppButton variant="secondary" class="mt-auto self-start" @click="showPasswordModal = true">
|
||||
Change password
|
||||
</AppButton>
|
||||
</AppCard>
|
||||
<p class="text-sm text-secondary">Change your sign-in password directly from this tab.</p>
|
||||
<form class="grid gap-3 rounded-lg border border-stroke-default bg-surface-card-muted p-3" @submit.prevent="onChangePassword">
|
||||
<label class="grid gap-1 text-sm font-medium text-ink-secondary">
|
||||
<span>Current password</span>
|
||||
<AppInput v-model="currentPassword" type="password" autocomplete="current-password" />
|
||||
</label>
|
||||
<label class="grid gap-1 text-sm font-medium text-ink-secondary">
|
||||
<span>New password</span>
|
||||
<AppInput v-model="newPassword" type="password" autocomplete="new-password" />
|
||||
</label>
|
||||
<label class="grid gap-1 text-sm font-medium text-ink-secondary">
|
||||
<span>Confirm new password</span>
|
||||
<AppInput v-model="confirmPassword" type="password" autocomplete="new-password" />
|
||||
</label>
|
||||
<div class="flex gap-2">
|
||||
<AppButton type="submit" :disabled="updatingPassword">
|
||||
{{ updatingPassword ? "Updating..." : "Update password" }}
|
||||
</AppButton>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<AppCard class="flex h-full flex-col gap-4">
|
||||
<div class="flex items-center gap-1">
|
||||
<h2 class="text-lg font-semibold text-ink-primary">Navigation</h2>
|
||||
<AppHelpHint text="Choose which pages appear in the left sidebar. Dashboard, Scholars, and Settings are always visible." />
|
||||
</div>
|
||||
<p class="text-sm text-secondary">
|
||||
Visible now: {{ visibleNavLabels.length > 0 ? visibleNavLabels.join(", ") : "none" }}.
|
||||
</p>
|
||||
<AppButton variant="secondary" class="mt-auto self-start" @click="showNavigationModal = true">
|
||||
Customize sidebar pages
|
||||
</AppButton>
|
||||
</AppCard>
|
||||
</section>
|
||||
<SettingsAdminPanel v-if="activeAdminSection" :section="activeAdminSection" />
|
||||
</AppCard>
|
||||
</AsyncStateGate>
|
||||
|
||||
<AppModal
|
||||
:open="showIngestionModal"
|
||||
title="Automatic Checking Settings"
|
||||
@close="showIngestionModal = false"
|
||||
>
|
||||
<form class="grid gap-3" @submit.prevent="onSaveSettings">
|
||||
<AppCheckbox
|
||||
id="auto-run-enabled"
|
||||
v-model="autoRunEnabled"
|
||||
:disabled="!automationAllowed"
|
||||
label="Enable automatic background checks"
|
||||
/>
|
||||
<p v-if="!automationAllowed" class="text-xs text-secondary">
|
||||
Automatic checks are disabled by server safety policy.
|
||||
</p>
|
||||
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span class="inline-flex items-center gap-1">
|
||||
Check interval (minutes)
|
||||
<AppHelpHint text="How often Scholarr starts a background update check." />
|
||||
</span>
|
||||
<AppInput id="run-interval" v-model="runIntervalMinutes" type="number" :min="minCheckIntervalMinutes" />
|
||||
<span class="text-xs text-secondary">Minimum: {{ minCheckIntervalMinutes }} minutes.</span>
|
||||
</label>
|
||||
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span class="inline-flex items-center gap-1">
|
||||
Delay between requests (seconds)
|
||||
<AppHelpHint text="Pause between profile requests during a check. Higher values are slower but safer." />
|
||||
</span>
|
||||
<AppInput
|
||||
id="request-delay"
|
||||
v-model="requestDelaySeconds"
|
||||
type="number"
|
||||
:min="minRequestDelaySeconds"
|
||||
/>
|
||||
<span class="text-xs text-secondary">Minimum: {{ minRequestDelaySeconds }} seconds.</span>
|
||||
</label>
|
||||
|
||||
<div class="grid gap-1 rounded-lg border border-stroke-default bg-surface-card-muted px-3 py-2 text-xs text-secondary">
|
||||
<p class="font-medium text-ink-primary">Server-enforced scrape safety policy</p>
|
||||
<p>Blocked failures trigger cooldown at {{ blockedFailureThreshold }} failures.</p>
|
||||
<p>Network failures trigger cooldown at {{ networkFailureThreshold }} failures.</p>
|
||||
<p>Blocked cooldown: {{ cooldownBlockedSeconds }}s. Network cooldown: {{ cooldownNetworkSeconds }}s.</p>
|
||||
</div>
|
||||
|
||||
<div class="mt-2 flex flex-wrap justify-end gap-2">
|
||||
<AppButton
|
||||
variant="ghost"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
@click="showIngestionModal = false"
|
||||
>
|
||||
Cancel
|
||||
</AppButton>
|
||||
<AppButton type="submit" :disabled="saving">
|
||||
{{ saving ? "Saving..." : "Save settings" }}
|
||||
</AppButton>
|
||||
</div>
|
||||
</form>
|
||||
</AppModal>
|
||||
|
||||
<AppModal :open="showPasswordModal" title="Change Sign-in Password" @close="showPasswordModal = false">
|
||||
<form class="grid gap-3" @submit.prevent="onChangePassword">
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span>Current password</span>
|
||||
<AppInput v-model="currentPassword" type="password" autocomplete="current-password" />
|
||||
</label>
|
||||
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span>New password</span>
|
||||
<AppInput v-model="newPassword" type="password" autocomplete="new-password" />
|
||||
</label>
|
||||
|
||||
<label class="grid gap-2 text-sm font-medium text-ink-secondary">
|
||||
<span>Confirm new password</span>
|
||||
<AppInput v-model="confirmPassword" type="password" autocomplete="new-password" />
|
||||
</label>
|
||||
|
||||
<div class="mt-2 flex flex-wrap justify-end gap-2">
|
||||
<AppButton
|
||||
variant="ghost"
|
||||
type="button"
|
||||
:disabled="updatingPassword"
|
||||
@click="showPasswordModal = false"
|
||||
>
|
||||
Cancel
|
||||
</AppButton>
|
||||
<AppButton type="submit" :disabled="updatingPassword">
|
||||
{{ updatingPassword ? "Updating..." : "Change password" }}
|
||||
</AppButton>
|
||||
</div>
|
||||
</form>
|
||||
</AppModal>
|
||||
|
||||
<AppModal :open="showNavigationModal" title="Sidebar Page Visibility" @close="showNavigationModal = false">
|
||||
<form class="grid gap-3" @submit.prevent="onSaveSettings">
|
||||
<p class="text-sm text-secondary">
|
||||
Turn optional pages on or off in the sidebar for your account.
|
||||
</p>
|
||||
|
||||
<ul class="grid gap-2">
|
||||
<li
|
||||
v-for="option in visibleNavOptions"
|
||||
:key="option.id"
|
||||
class="rounded-lg border border-stroke-default bg-surface-card-muted/70 px-3 py-2"
|
||||
>
|
||||
<label class="flex items-start gap-3">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="mt-0.5 h-4 w-4 rounded border-stroke-interactive bg-surface-input text-brand-600 focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 focus-visible:ring-offset-focus-offset"
|
||||
:checked="isNavPageVisible(option.id)"
|
||||
:disabled="saving || option.required"
|
||||
@change="onToggleNavPage(option, $event)"
|
||||
/>
|
||||
<span class="grid gap-0.5">
|
||||
<span class="text-sm font-medium text-ink-primary">
|
||||
{{ option.label }}
|
||||
<span v-if="option.required" class="ml-1 text-xs text-ink-muted">(required)</span>
|
||||
</span>
|
||||
<span class="text-xs text-secondary">{{ option.description }}</span>
|
||||
</span>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="mt-2 flex flex-wrap justify-end gap-2">
|
||||
<AppButton
|
||||
variant="ghost"
|
||||
type="button"
|
||||
:disabled="saving"
|
||||
@click="showNavigationModal = false"
|
||||
>
|
||||
Cancel
|
||||
</AppButton>
|
||||
<AppButton type="submit" :disabled="saving">
|
||||
{{ saving ? "Saving..." : "Save sidebar settings" }}
|
||||
</AppButton>
|
||||
</div>
|
||||
</form>
|
||||
</AppModal>
|
||||
</AppPage>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue