fix(ui): leave the older organisation page working without rename support

The dashboard is shared with the retired dashboard service, which reports neither a role nor a revision: the workspace form stays available there, and the rename control and name history appear only where the server serves them.

Refs #2077
This commit is contained in:
sam committed 2026-11-20 21:12:55 +11:00
1 parent 064eeab748
commit b868d450bd
2 files changed
+11 -5

No files matched your search

+7 -3
View File
@@ -47,14 +47,18 @@ const areas = computed(() => {
return allAreas.filter((area) => !hidden.includes(area.to));
});
const org = computed(() => orgStore.org);
const canRename = computed(() => org.value?.role === "owner");
// The single binary reports a revision with every org and serves the rename
// routes and their history. A server without one has neither, so the controls
// stay hidden rather than calling an endpoint it does not have.
const renamesHere = computed(() => typeof org.value?.version === "number");
const canRename = computed(() => renamesHere.value && org.value?.role === "owner");
const history = ref<OrgEvent[]>([]);
const historyLoading = ref(true);
const historyError = ref("");
async function loadHistory(): Promise<void> {
if (!org.value) return;
if (!org.value || !renamesHere.value) return;
try {
history.value = (
await api.orgHistory<{ events: OrgEvent[] }>(org.value.id)
@@ -139,7 +143,7 @@ function describeChange(event: OrgEvent): string {
</RouterLink>
</div>
<Section title="Name changes" class="mt-4">
<Section v-if="renamesHere" title="Name changes" class="mt-4">
<ReadError v-if="historyError" :message="historyError" retry-label="Retry" @retry="loadHistory" />
<p v-else-if="historyLoading" class="text-label text-fg-muted" role="status">Loading changes…</p>
<Empty v-else-if="!history.length">
+4 -2
View File
@@ -43,8 +43,10 @@ const error = ref("");
const loading = ref(true);
const busy = ref(false);
const canCreate = computed(() => org.value?.role === "owner" || org.value?.role === "admin");
const canRename = computed(() => org.value?.role === "owner");
// A server that reports no role is the older one: it still lets any member
// create a workspace and has no rename route.
const canCreate = computed(() => !org.value?.role || org.value.role === "owner" || org.value.role === "admin");
const canRename = computed(() => typeof org.value?.version === "number" && org.value.role === "owner");
async function load(): Promise<void> {
if (!org.value) return;