Files
archie/ui/src/tasks/TaskNotes.vue
T

38 lines
1.1 KiB
Vue

<script setup lang="ts">
import { AlertTriangle } from "@lucide/vue";
import { computed } from "vue";
import { Alert, AlertDescription } from "@/components/ui/alert";
import { useTaskRun } from "./use-task-run";
/**
* Two things the page can say about its own reads, both warnings rather than
* errors: the page still works, with less than it would like.
*
* The task list is the 100 most recently updated, so a task outside it is
* normal, and saying so is what stops an operator reading the missing status
* and controls as the task having none.
*/
const props = defineProps<{ id: string }>();
const run = useTaskRun();
const note = computed(() => {
if (run.taskList === null) {
return "The task list could not be read, so the current status and operator controls are unavailable.";
}
if (Array.isArray(run.taskList) && !run.task) {
return `Task ${props.id} is not in the recent tasks list, so its status and operator controls are unavailable.`;
}
return "";
});
</script>
<template>
<Alert v-if="note" variant="warn" class="mb-4">
<AlertTriangle />
<AlertDescription>{{ note }}</AlertDescription>
</Alert>
</template>