Skip to content

Commit

Permalink
Use refdt widget in label editor #147
Browse files Browse the repository at this point in the history
  • Loading branch information
johnatawnclementawn committed Jan 2, 2025
1 parent 36ab544 commit 010ff8d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 11 deletions.
57 changes: 48 additions & 9 deletions arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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<ControlledListItem[]> {
Expand All @@ -42,10 +48,17 @@ async function getOptions(listId: string): Promise<ControlledListItem[]> {
}
const languageOptions = ref<ControlledListItem[]>([]);
const typeOptions = ref<ControlledListItem[]>([]);
const statusOptions = ref<ControlledListItem[]>([]);
const metatypeOptions = ref<ControlledListItem[]>([]);
const eventTypeOptions = ref<ControlledListItem[]>([]);
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);
});
</script>

Expand All @@ -64,18 +77,37 @@ onMounted(async () => {
<ReferenceDatatype
:value="appellative_status?.appellative_status_ascribed_name_language"
:mode="EDIT"
:multivalue="false"
:multi-value="false"
:options="languageOptions"
@update="onUpdate"
/>
<!-- Label Type: reference datatype -->
<label for="">{{ $gettext("Label Type") }}</label>

<ReferenceDatatype
:value="appellative_status?.appellative_status_ascribed_relation"
:mode="EDIT"
:multi-value="false"
:options="typeOptions"
@update="onUpdate"
/>
<!-- Label Status: reference datatype -->
<label for="">{{ $gettext("Label Status") }}</label>

<ReferenceDatatype
:value="appellative_status?.appellative_status_status"
:mode="EDIT"
:multi-value="false"
:options="statusOptions"
@update="onUpdate"
/>
<!-- Label Status Metatype: reference datatype -->
<label for="">{{ $gettext("Label Metatype") }}</label>

<ReferenceDatatype
:value="appellative_status?.appellative_status_status_metatype"
:mode="EDIT"
:multi-value="false"
:options="metatypeOptions"
@update="onUpdate"
/>
<!-- Label Temporal Validity Start: date -->
<label for="">{{ $gettext("Label Temporal Validity Start") }}</label>

Expand All @@ -90,4 +122,11 @@ onMounted(async () => {

<!-- Warrant Type: reference datatype -->
<label for="">{{ $gettext("Warrant Type") }}</label>
<ReferenceDatatype
:value="appellative_status?.appellative_status_data_assignment_type"
:mode="EDIT"
:multi-value="false"
:options="eventTypeOptions"
@update="onUpdate"
/>
</template>
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
5 changes: 5 additions & 0 deletions arches_lingo/src/arches_lingo/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,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";
1 change: 1 addition & 0 deletions arches_lingo/src/arches_lingo/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,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 SchemeInstance {
Expand Down

0 comments on commit 010ff8d

Please sign in to comment.