Skip to content

Commit 07576fe

Browse files
committed
feat: prefix objects with shortidentifier if it is available
1 parent f1854ba commit 07576fe

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/components/CollectionItem.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<script setup lang="ts">
22
const { field, routePath } = defineProps<{
3-
field: { id: string; name: string };
3+
field: { id: string; name: string; identifiers?: { shortIdentifier: string } };
44
routePath: string;
55
}>();
66
77
const id = field.id;
88
const link = `/${routePath}?id=${encodeURIComponent(id)}`;
9+
const label = field.identifiers?.shortIdentifier
10+
? `${field.identifiers.shortIdentifier} - ${field.name || field.id}`
11+
: field.name || field.id;
912
</script>
1013

1114
<template>
1215
<p>
1316
<el-link type="primary">
1417
<router-link :to="link">
15-
{{ field.name || field.id }}
18+
{{ label }}
1619
</router-link>
1720
</el-link>
1821
</p>

src/services/api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ type BaseEntityType = {
3333
id: string;
3434
name: string;
3535
description?: string;
36+
identifiers?: {
37+
collectionIdentifier: string;
38+
itemIdentifier: string;
39+
shortIdentifier: string;
40+
};
3641
memberOf?: {
3742
id: string;
3843
name?: string;

src/views/ObjectView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fetchdata();
330330
<ul class="mt-4 space">
331331
<li v-for="d of membersFiltered" :key="d.id">
332332
<p v-if="d.id === route.query.id" class="font-bold">
333-
{{ d.name || d.id }}
333+
{{ d.identifiers?.shortIdentifier ? `${d.identifiers.shortIdentifier} - ${d.name || d.id}` : d.name || d.id }}
334334
</p>
335335
<CollectionItem v-else :field="d" routePath="object" />
336336
</li>

0 commit comments

Comments
 (0)