Files
archie/ui/src/org/OrgShell.vue
T
sam 714b132c53 fix(ui): trim view captions and empty-state copy in org, accounts, curators and skills
Drop captions that restated headings, cut the duplicate Policies card title,
use the Select component for account roles, let org agent actions wrap on
phone width, and use em-free placeholders.
2026-10-18 15:02:00 +11:00

67 lines
2.3 KiB
Vue

<script setup lang="ts">
import { storeToRefs } from "pinia";
import { computed, onMounted, ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
import NewOrgDialog from "./NewOrgDialog.vue";
import { useOrgStore } from "@/stores/org";
/**
* The Organisation area's frame: the org every section below is about, and the
* switcher an instance admin uses to point it elsewhere.
*/
const orgStore = useOrgStore();
const { homeOrg, instanceAdmin, org, orgs } = storeToRefs(orgStore);
const error = ref("");
// Policies and models act on the caller's own org server-side, so an instance
// admin looking at another org is sent back rather than editing the wrong one.
const OWN_ORG_ONLY = ["/org/policies", "/org/models", "/org/connections", "/org/repositories"];
const away = computed(() => !!org.value && org.value.id !== homeOrg.value);
const route = useRoute();
const router = useRouter();
watch([away, () => route.path], ([isAway]) => {
if (isAway && OWN_ORG_ONLY.includes(route.path)) void router.replace("/org");
});
onMounted(async () => {
try {
await orgStore.loadOrg();
} catch (cause) {
error.value = String((cause as Error).message || cause);
}
});
</script>
<template>
<div>
<!-- The org is named once: the switcher for an instance admin, a plain
label for everyone else. -->
<div v-if="instanceAdmin" class="mb-4 flex flex-wrap items-center gap-2">
<Select :model-value="org?.id" @update:model-value="(id) => orgStore.viewOrg(String(id))">
<SelectTrigger class="w-72" aria-label="Organisation">
<SelectValue placeholder="Organisation" />
</SelectTrigger>
<SelectContent>
<SelectItem v-for="o in orgs" :key="o.id" :value="o.id">{{ o.name }}</SelectItem>
</SelectContent>
</Select>
<NewOrgDialog />
</div>
<p v-else-if="org" class="mb-4 text-lg font-semibold tracking-[-0.01em]">{{ org.name }}</p>
<p v-if="error" role="alert" class="mb-4 text-sm text-danger">{{ error }}</p>
<!-- The sections need the org id, so they wait for the one read; keying on
it remounts the open section when an instance admin switches org. -->
<RouterView v-if="org" :key="org.id" />
</div>
</template>