The four roles the daemon reads always show and cannot be deleted; clearing one unsets it, and custom workflow roles can still be added. Provider class is a select of the SDK's classes, the provider name is a heading rather than an input, and a key read from the environment shows as one line with Set reference instead of an 'unset / unset' reference.
52 lines
1.9 KiB
Vue
52 lines
1.9 KiB
Vue
<script setup lang="ts">
|
|
import { ref } from "vue";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import { Input } from "@/components/ui/input";
|
|
import { SecretReference } from "@/components/ui/secret-reference";
|
|
|
|
/** Where a secret lives. Archie resolves it; the value never reaches the UI. */
|
|
interface SecretRef {
|
|
engine: string;
|
|
key: string;
|
|
}
|
|
|
|
// resolved stays unset until something actually resolves the reference: a
|
|
// filled-in engine and key says nothing about whether the secret exists.
|
|
// fallback names where the key comes from when no reference is set (a
|
|
// provider's environment variable).
|
|
withDefaults(
|
|
defineProps<{ resolved?: boolean; disabled?: boolean; idPrefix: string; fallback?: string }>(),
|
|
{ resolved: undefined, fallback: undefined },
|
|
);
|
|
const model = defineModel<SecretRef>({ required: true });
|
|
const editing = ref(false);
|
|
</script>
|
|
|
|
<template>
|
|
<div v-if="!editing && !model.engine && !model.key" class="flex h-9 items-center gap-3 text-sm">
|
|
<span class="min-w-0 truncate" :class="fallback ? 'font-mono text-xs text-fg-muted' : 'text-fg-subtle'">{{ fallback ?? "Not set" }}</span>
|
|
<Button variant="outline" size="sm" :disabled="disabled" @click="editing = true">Set reference</Button>
|
|
</div>
|
|
<div v-else-if="!editing">
|
|
<SecretReference
|
|
:engine="model.engine || 'unset'"
|
|
:secret-key="model.key || 'unset'"
|
|
:resolved="resolved"
|
|
:disabled="disabled"
|
|
@change="editing = true"
|
|
/>
|
|
</div>
|
|
<div v-else class="flex flex-wrap items-end gap-2">
|
|
<label class="grid gap-1 text-xs text-fg-subtle">
|
|
Engine
|
|
<Input :id="`${idPrefix}-engine`" v-model="model.engine" class="w-28 font-mono" />
|
|
</label>
|
|
<label class="grid min-w-48 flex-1 gap-1 text-xs text-fg-subtle">
|
|
Key
|
|
<Input :id="`${idPrefix}-key`" v-model="model.key" class="font-mono" />
|
|
</label>
|
|
<Button variant="ghost" size="sm" @click="editing = false">Done</Button>
|
|
</div>
|
|
</template>
|