From 031515b58fc85bf6d36ed50db00bb71bb71e0a1e Mon Sep 17 00:00:00 2001 From: Johnathan Clementi Date: Thu, 2 Jan 2025 12:02:10 -0500 Subject: [PATCH] Use refdt widget in label editor #147 --- .../components/generic/LabelEditor.vue | 57 ++++++++++++++++--- .../ReferenceDatatypeEditor.vue | 4 +- arches_lingo/src/arches_lingo/constants.ts | 5 ++ arches_lingo/src/arches_lingo/types.ts | 1 + 4 files changed, 56 insertions(+), 11 deletions(-) diff --git a/arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue b/arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue index d94a0e1e..1aeeb118 100644 --- a/arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue +++ b/arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue @@ -6,7 +6,14 @@ import NonLocalizedString from "@/arches_lingo/components/generic/NonLocalizedSt import ReferenceDatatype from "@/arches_lingo/components/generic/ReferenceDatatype.vue"; // import ResourceInstanceRelationships from "@/arches_lingo/components/generic/ResourceInstanceRelationships.vue"; -import { EDIT, LANGUAGE_CONTROLLED_LIST } from "@/arches_lingo/constants.ts"; +import { + EDIT, + LANGUAGE_CONTROLLED_LIST, + LABEL_CONTROLLED_LIST, + STATUSES_CONTROLLED_LIST, + METATYPES_CONTROLLED_LIST, + EVENT_TYPES_CONTROLLED_LIST, +} from "@/arches_lingo/constants.ts"; import type { AppellativeStatus, @@ -25,8 +32,7 @@ const props = withDefaults( const appellative_status = ref(props.value); function onUpdate(newValue: string) { - // handle the update - console.log("Update new value here!" + newValue); + console.log(newValue); } async function getOptions(listId: string): Promise { @@ -42,10 +48,17 @@ async function getOptions(listId: string): Promise { } const languageOptions = ref([]); +const typeOptions = ref([]); +const statusOptions = ref([]); +const metatypeOptions = ref([]); +const eventTypeOptions = ref([]); onMounted(async () => { - const lang_opts = await getOptions(LANGUAGE_CONTROLLED_LIST); - languageOptions.value = lang_opts; + languageOptions.value = await getOptions(LANGUAGE_CONTROLLED_LIST); + typeOptions.value = await getOptions(LABEL_CONTROLLED_LIST); + statusOptions.value = await getOptions(STATUSES_CONTROLLED_LIST); + metatypeOptions.value = await getOptions(METATYPES_CONTROLLED_LIST); + eventTypeOptions.value = await getOptions(EVENT_TYPES_CONTROLLED_LIST); }); @@ -64,18 +77,37 @@ onMounted(async () => { - + - + - + @@ -90,4 +122,11 @@ onMounted(async () => { + diff --git a/arches_lingo/src/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeEditor.vue b/arches_lingo/src/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeEditor.vue index 66c55b75..c2e9738f 100644 --- a/arches_lingo/src/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeEditor.vue +++ b/arches_lingo/src/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeEditor.vue @@ -24,9 +24,9 @@ const props = withDefaults( const emit = defineEmits(["update"]); const uriRef = ref( - props?.value.length === 1 && !props.multiValue + props?.value && !props.multiValue ? props?.value[0].uri - : props?.value.map((item) => item.uri), + : props?.value?.map((item) => item.uri) || [], ); const val = computed({ get() { diff --git a/arches_lingo/src/arches_lingo/constants.ts b/arches_lingo/src/arches_lingo/constants.ts index 031f468d..703954f8 100644 --- a/arches_lingo/src/arches_lingo/constants.ts +++ b/arches_lingo/src/arches_lingo/constants.ts @@ -32,3 +32,8 @@ export const ENGLISH = { }; export const LANGUAGE_CONTROLLED_LIST = "55ce793b-a51a-4b25-811d-d08ea797f8c3"; +export const LABEL_CONTROLLED_LIST = "deb847fc-f4c3-4e82-be19-04641579f129"; +export const STATUSES_CONTROLLED_LIST = "2cc0e054-ef9b-41ae-8e86-e0c3b4e7ca00"; +export const METATYPES_CONTROLLED_LIST = "ef69e772-de53-45fe-98d4-bf3e7b10eb57"; +export const EVENT_TYPES_CONTROLLED_LIST = + "6eaa2c6f-af83-464c-9200-051c4cfe7e8e"; diff --git a/arches_lingo/src/arches_lingo/types.ts b/arches_lingo/src/arches_lingo/types.ts index f7d6456d..7dadfaba 100644 --- a/arches_lingo/src/arches_lingo/types.ts +++ b/arches_lingo/src/arches_lingo/types.ts @@ -117,6 +117,7 @@ export interface AppellativeStatus { appellative_status_status?: ControlledListItem[]; appellative_status_data_assignment_object_used: ResourceInstanceReference[]; appellative_status_data_assignment_actor: ResourceInstanceReference[]; + appellative_status_data_assignment_type: ControlledListItem[]; } export interface SchemeStatement {