fix(daemon): execute dashboard identities with scoped authority
This commit is contained in:
1 parent
6a6db5737a
commit
2181dd8a48
22 files changed
+508
-75
No files matched your search
@@ -2,7 +2,7 @@
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
|
||||
import { computed, ref } from "vue";
|
||||
import { computed, ref, onMounted } from "vue";
|
||||
import { Plus, Trash2, X } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
@@ -10,6 +10,8 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { statusKind, statusLabel, type Binding } from "@/bindings/binding-draft";
|
||||
import { api } from "@/lib/api";
|
||||
import type { Identity } from "@/stores/org";
|
||||
import { useOrgStore } from "@/stores/org";
|
||||
import BindEvent from "./BindEvent.vue";
|
||||
import { setWorkflowField, workflowField } from "./workflow-edit";
|
||||
@@ -61,8 +63,22 @@ function addSpec(key: "inputs" | "outputs", list: [string, Spec][]): void {
|
||||
// The identity a run acts as must be an agent, never a person; a workflow
|
||||
// naming none is refused when it runs.
|
||||
const identities = useOrgStore();
|
||||
identities.watchIdentities();
|
||||
const agents = computed(() => identities.identities.filter((i) => i.kind !== "user" && i.lifecycle === "active"));
|
||||
const agents = ref<Identity[]>([]);
|
||||
const identitiesLoading = ref(true);
|
||||
const identitiesError = ref("");
|
||||
async function loadAgents(): Promise<void> {
|
||||
identitiesLoading.value = true;
|
||||
identitiesError.value = "";
|
||||
agents.value = [];
|
||||
try {
|
||||
await identities.loadOrg();
|
||||
const response = await api.orgAgents<{ agents: Identity[] }>(identities.homeOrg);
|
||||
agents.value = response.agents.filter((agent) => agent.lifecycle === "active");
|
||||
} catch (cause) {
|
||||
identitiesError.value = String((cause as Error).message || cause);
|
||||
} finally { identitiesLoading.value = false; }
|
||||
}
|
||||
onMounted(loadAgents);
|
||||
|
||||
const MODES = [
|
||||
{ value: "required", label: "Repository", hint: "Clones the task's repository" },
|
||||
@@ -150,18 +166,20 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
|
||||
<div class="divide-y divide-border rounded-md border border-border">
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Identity</span>
|
||||
<Input
|
||||
<NativeSelect
|
||||
:model-value="text('identity')"
|
||||
list="workflow-identities"
|
||||
placeholder="required"
|
||||
title="Every run acts as this identity; a workflow naming none is refused."
|
||||
:class="cn('h-7 w-44 text-[13px]', !text('identity') && 'border-danger/60')"
|
||||
@change="set('identity', ($event.target as HTMLInputElement).value.trim())"
|
||||
/>
|
||||
<datalist id="workflow-identities">
|
||||
<option v-for="agent in agents" :key="agent.id" :value="agent.id">{{ agent.display_name }}</option>
|
||||
</datalist>
|
||||
aria-label="Execution identity"
|
||||
:disabled="identitiesLoading || !!identitiesError"
|
||||
:class="cn('w-44 text-[13px]', !text('identity') && 'border-danger/60')"
|
||||
@update:model-value="(value) => set('identity', String(value))"
|
||||
>
|
||||
<NativeSelectOption value="" disabled>{{ identitiesLoading ? 'Loading agents…' : 'Choose an agent' }}</NativeSelectOption>
|
||||
<NativeSelectOption v-if="text('identity') && !agents.some((agent) => agent.id === text('identity'))" :value="text('identity')" disabled>{{ text('identity') === 'root' ? 'Existing instance agent' : 'Unavailable agent' }}</NativeSelectOption>
|
||||
<NativeSelectOption v-for="agent in agents" :key="agent.id" :value="agent.id">{{ agent.display_name }}</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
</label>
|
||||
<p v-if="identitiesError" role="alert" class="px-3 py-2 text-xs text-danger">{{ identitiesError }} <Button variant="link" size="xs" @click="loadAgents">Retry</Button></p>
|
||||
<p v-else-if="!identitiesLoading && !agents.length" class="px-3 py-2 text-xs text-fg-subtle">No active agents are assigned to your organisation.</p>
|
||||
<label class="flex min-h-10 items-center gap-3 px-3 py-1.5">
|
||||
<span class="flex-1 text-[13px]">Container profile</span>
|
||||
<Input
|
||||
|
||||
Reference in new issue
Block a user