Skip to content

Commit

Permalink
Stub out label viewer #147
Browse files Browse the repository at this point in the history
  • Loading branch information
johnatawnclementawn committed Dec 31, 2024
1 parent f459ca5 commit 1d451fd
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 13 deletions.
65 changes: 65 additions & 0 deletions arches_lingo/src/arches_lingo/components/generic/LabelEditor.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<script setup lang="ts">
import { defineProps, ref } from "vue";
import NonLocalizedString from "@/arches_lingo/components/generic/NonLocalizedString.vue";
// import ResourceInstanceRelationships from "@/arches_lingo/components/generic/ResourceInstanceRelationships.vue";
import { EDIT } from "@/arches_lingo/constants.ts";
import type { AppellativeStatus } from "@/arches_lingo/types.ts";
const props = withDefaults(
defineProps<{
value?: AppellativeStatus;
}>(),
{
value: () => ({}) as AppellativeStatus,
},
);
const appellative_status = ref(props.value);
function onUpdate(newValue: string) {
// handle the update
console.log("Update new value here!" + newValue);
}
</script>

<template>
<!-- Label: string -->
<label for="">{{ $gettext("Label") }}</label>
<NonLocalizedString
:value="
appellative_status?.appellative_status_ascribed_name_content ?? ''
"
:mode="EDIT"
@update="onUpdate"
/>
<!-- Label Language: reference datatype -->
<label for="">{{ $gettext("Label Language") }}</label>

<!-- Label Type: reference datatype -->
<label for="">{{ $gettext("Label Type") }}</label>

<!-- Label Status: reference datatype -->
<label for="">{{ $gettext("Label Status") }}</label>

<!-- Label Status Metatype: reference datatype -->
<label for="">{{ $gettext("Label Metatype") }}</label>

<!-- Label Temporal Validity Start: date -->
<label for="">{{ $gettext("Label Temporal Validity Start") }}</label>

<!-- Label Temporal Validity End: date -->
<label for="">{{ $gettext("Label Temporal Validity End") }}</label>

<!-- Contributor: resource instance -->
<label for="">{{ $gettext("Contributor") }}</label>

<!-- Sources: resource instance -->
<label for="">{{ $gettext("Sources") }}</label>

<!-- Warrant Type: reference datatype -->
<label for="">{{ $gettext("Warrant Type") }}</label>
</template>
12 changes: 6 additions & 6 deletions arches_lingo/src/arches_lingo/components/generic/LabelViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Button from "primevue/button";
import ConfirmDialog from "primevue/confirmdialog";
import { useConfirm } from "primevue/useconfirm";
import ControlledListItem from "@/arches_lingo/components/generic/ControlledListItem.vue";
import ResourceInstanceRelationships from "@/arches_lingo/components/generic/ResourceInstanceRelationships.vue";
import ReferenceDatatypeViewer from "@/arches_lingo/components/generic/reference-datatype/ReferenceDatatypeViewer.vue";
import ResourceInstanceRelationshipsViewer from "@/arches_lingo/components/generic/resource-instance-relationships/ResourceInstanceRelationshipsViewer.vue";
import type { AppellativeStatus } from "@/arches_lingo/types";
Expand Down Expand Up @@ -73,13 +73,13 @@ function confirmDelete(tileId: string) {
sortable
>
<template #body="slotProps">
<ControlledListItem
<ReferenceDatatypeViewer
:value="
(slotProps.data as AppellativeStatus)
.appellative_status_ascribed_relation
"
>
</ControlledListItem>
</ReferenceDatatypeViewer>
</template>
</Column>
<Column
Expand All @@ -88,13 +88,13 @@ function confirmDelete(tileId: string) {
sortable
>
<template #body="slotProps">
<ControlledListItem
<ReferenceDatatypeViewer
:value="
(slotProps.data as AppellativeStatus)
.appellative_status_ascribed_name_language
"
>
</ControlledListItem>
</ReferenceDatatypeViewer>
</template>
</Column>
<Column>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@
import { useGettext } from "vue3-gettext";
import { onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import { useToast } from "primevue/usetoast";
import { VIEW, EDIT, OPEN_EDITOR } from "@/arches_lingo/constants.ts";
import { deleteSchemeLabelTile, fetchSchemeLabel } from "@/arches_lingo/api.ts";
import LabelViewer from "@/arches_lingo/components/generic/LabelViewer.vue";
import LabelEditor from "@/arches_lingo/components/generic/LabelEditor.vue";
import SchemeReportSection from "@/arches_lingo/components/scheme/report/SchemeSection.vue";
import { VIEW, EDIT, OPEN_EDITOR, ERROR } from "@/arches_lingo/constants.ts";
import type {
DataComponentMode,
SchemeInstance,
} from "@/arches_lingo/types.ts";
import { deleteSchemeLabelTile, fetchSchemeLabel } from "@/arches_lingo/api.ts";
import SchemeReportSection from "@/arches_lingo/components/scheme/report/SchemeSection.vue";
import LabelViewer from "@/arches_lingo/components/generic/LabelViewer.vue";
import { useToast } from "primevue/usetoast";
const schemeInstance = ref<SchemeInstance>();
const { $gettext } = useGettext();
const toast = useToast();
const route = useRoute();
Expand All @@ -22,12 +23,16 @@ withDefaults(
defineProps<{
mode?: DataComponentMode;
tileId?: string | null;
args?: Array<object>;
// todo for Johnathan - if obj empty, create new tile
// if obj has values, load those values into the form
}>(),
{
mode: VIEW,
tileId: null, // editor arg specifying what tile to operate on.
},
);
const schemeInstance = ref<SchemeInstance>();
defineExpose({ save, getSectionValue });
Expand Down Expand Up @@ -112,7 +117,14 @@ async function save() {
></LabelViewer>
</SchemeReportSection>
</div>
<div v-if="mode === EDIT"><!-- todo for Johnathan-->abc</div>
<div v-if="mode === EDIT">
<div
v-for="appellative_status in schemeInstance?.appellative_status"
:key="appellative_status.tileid"
>
<LabelEditor :value="appellative_status"></LabelEditor>
</div>
</div>
</template>
<style scoped>
:deep(.drawer) {
Expand Down

0 comments on commit 1d451fd

Please sign in to comment.