arden scrape safety telemetry and polish run state UX
This commit is contained in:
parent
110e246a1c
commit
d7404abf18
33 changed files with 2074 additions and 96 deletions
|
|
@ -3,7 +3,9 @@ import { computed } from "vue";
|
|||
import { useRouter } from "vue-router";
|
||||
|
||||
import RunStatusBadge from "@/components/patterns/RunStatusBadge.vue";
|
||||
import ScrapeSafetyBadge from "@/components/patterns/ScrapeSafetyBadge.vue";
|
||||
import AppButton from "@/components/ui/AppButton.vue";
|
||||
import { formatCooldownCountdown } from "@/features/safety";
|
||||
import { useAuthStore } from "@/stores/auth";
|
||||
import { useRunStatusStore } from "@/stores/run_status";
|
||||
import { useUserSettingsStore } from "@/stores/user_settings";
|
||||
|
|
@ -31,21 +33,34 @@ const links = computed(() => {
|
|||
return userSettings.isPageVisible(item.id);
|
||||
});
|
||||
});
|
||||
const navRunStatus = computed(() => {
|
||||
const navSafetyText = computed(() => {
|
||||
if (!userSettings.manualRunAllowed) {
|
||||
return "Manual checks disabled";
|
||||
}
|
||||
if (runStatus.safetyState.cooldown_active) {
|
||||
return `Cooldown: ${formatCooldownCountdown(runStatus.safetyState.cooldown_remaining_seconds)}`;
|
||||
}
|
||||
return "Safety ready";
|
||||
});
|
||||
const navRunStateStatus = computed(() => {
|
||||
if (runStatus.isSubmitting && !runStatus.isLikelyRunning) {
|
||||
return "starting";
|
||||
}
|
||||
if (runStatus.isLikelyRunning) {
|
||||
return "running";
|
||||
}
|
||||
return "idle";
|
||||
});
|
||||
const navRunText = computed(() => {
|
||||
const label = navRunStatus.value
|
||||
.replaceAll("_", " ")
|
||||
.split(" ")
|
||||
const navRunStateLabel = computed(() =>
|
||||
navRunStateStatus.value
|
||||
.split("_")
|
||||
.filter((segment) => segment.length > 0)
|
||||
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
||||
.join(" ");
|
||||
return `State: ${label}`;
|
||||
});
|
||||
.join(" "),
|
||||
);
|
||||
const showSafetyRow = computed(
|
||||
() => runStatus.safetyState.cooldown_active || !userSettings.manualRunAllowed,
|
||||
);
|
||||
|
||||
async function onLogout(): Promise<void> {
|
||||
await auth.logout();
|
||||
|
|
@ -71,12 +86,18 @@ async function onLogout(): Promise<void> {
|
|||
</nav>
|
||||
|
||||
<div class="mt-auto grid gap-2 border-t border-stroke-subtle pt-3">
|
||||
<div
|
||||
v-if="auth.isAdmin"
|
||||
class="flex items-center justify-between gap-2 rounded-lg border border-stroke-default bg-surface-card-muted px-2.5 py-2 text-xs text-secondary"
|
||||
>
|
||||
<span class="truncate">{{ navRunText }}</span>
|
||||
<RunStatusBadge :status="navRunStatus" />
|
||||
<div class="grid gap-1 rounded-lg border border-stroke-default bg-surface-card-muted px-2.5 py-2 text-xs text-secondary">
|
||||
<div class="flex items-center justify-between gap-2">
|
||||
<span class="truncate">State: {{ navRunStateLabel }}</span>
|
||||
<RunStatusBadge :status="navRunStateStatus" />
|
||||
</div>
|
||||
<div
|
||||
v-if="showSafetyRow"
|
||||
class="flex items-center justify-between gap-2 border-t border-stroke-subtle pt-1"
|
||||
>
|
||||
<span class="truncate">{{ navSafetyText }}</span>
|
||||
<ScrapeSafetyBadge :state="runStatus.safetyState" />
|
||||
</div>
|
||||
</div>
|
||||
<AppButton variant="ghost" class="w-full justify-start" @click="onLogout">Logout</AppButton>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue