Skip to content

Commit

Permalink
initial commit for #146
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongundel committed Dec 11, 2024
1 parent 1becfe3 commit 50e92df
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 27 deletions.
8 changes: 8 additions & 0 deletions arches_lingo/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ class Meta:
fields = "__all__"


class SchemeLabelSerializer(ArchesModelSerializer):
class Meta:
model = ResourceInstance
graph_slug = "scheme"
nodegroups = ["label"]
fields = "__all__"


class TextualWorkRdmSystemSerializer(ArchesModelSerializer):
class Meta:
model = ResourceInstance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import { onBeforeUpdate, onUpdated, ref } from "vue";
import { useGettext } from "vue3-gettext";
import Button from "primevue/button";
Expand All @@ -7,9 +8,9 @@ import TabList from "primevue/tablist";
import Tab from "primevue/tab";
import TabPanels from "primevue/tabpanels";
import TabPanel from "primevue/tabpanel";
import SchemeNamespace from "../report/SchemeNamespace.vue";
import { onBeforeUpdate, onUpdated, ref } from "vue";
import SchemeStandard from "../report/SchemeStandard.vue";
import SchemeNamespace from "@/arches_lingo/components/scheme/report/SchemeNamespace.vue";
import SchemeStandard from "@/arches_lingo/components/scheme/report/SchemeStandard.vue";
import SchemeLabel from "@/arches_lingo/components/scheme/report/SchemeLabel.vue";
type sectionTypes = typeof SchemeNamespace;
const { $gettext } = useGettext();
Expand All @@ -20,6 +21,11 @@ const props = defineProps<{
}>();
const childRefs = ref<Array<sectionTypes>>([]);
const schemeComponents = [
{
component: SchemeLabel,
id: "label",
editorTabName: $gettext("Scheme Label"),
},
{
component: SchemeNamespace,
id: "namespace",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ import SchemeReportSection from "@/arches_lingo/components/scheme/report/SchemeS
import { ref } from "vue";
import DataTable from "primevue/datatable";
import Column from "primevue/column";
import { VIEW, EDIT } from "@/arches_lingo/constants.ts";
import type { DataComponentMode } from "@/arches_lingo/types";
//todo: replace dummy data with actual data
const labels = ref([
{
code: "1",
Expand All @@ -25,30 +29,55 @@ const labels = ref([
},
]);
const { $gettext } = useGettext();
defineProps<{
mode?: DataComponentMode;
}>();
defineExpose({ save, getSectionValue });
async function getSectionValue() {
// todo: this function is for both of us, I'll implement it tomorrow (you should be able to work on the UI for the form and widgets with dummy data for now).
// This is the current value of the label nodegroup that will be passed
// via prop to both components. Note - per ticket #146 I will probably be genericizing the label viewer component for use by other nodegroups.
// you will likely need to do the same. You will need to emit an update event from your component(s) and have a ref to that here, then actually
// save that value with the save function below.
}
async function save() {
// todo for Johnathan. This function will save the values of the form back to arches.
}
// async function update() {
// // todo for Johnathan. This function will handle the update emit when the user changes values in your form - you store those values in this section.
// }
</script>

<template>
<SchemeReportSection :title-text="$gettext('Scheme Labels')">
<DataTable
:value="labels"
table-style="min-width: 50rem"
>
<Column
field="code"
header="Code"
></Column>
<Column
field="name"
header="Name"
></Column>
<Column
field="category"
header="Category"
></Column>
<Column
field="quantity"
header="Quantity"
></Column>
</DataTable>
</SchemeReportSection>
<div v-if="!mode || mode === VIEW">
<SchemeReportSection :title-text="$gettext('Scheme Labels')">
<DataTable
:value="labels"
table-style="min-width: 50rem"
>
<Column
field="code"
header="Code"
></Column>
<Column
field="name"
header="Name"
></Column>
<Column
field="category"
header="Category"
></Column>
<Column
field="quantity"
header="Quantity"
></Column>
</DataTable>
</SchemeReportSection>
</div>
<div v-if="mode === EDIT"><!-- todo for Johnathan-->abc</div>
</template>
3 changes: 3 additions & 0 deletions arches_lingo/src/arches_lingo/pages/SchemePage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { ref } from "vue";
import Splitter from "primevue/splitter";
import SplitterPanel from "primevue/splitterpanel";
import SchemeLabel from "@/arches_lingo/components/scheme/report/SchemeLabel.vue";
import SchemeLicense from "@/arches_lingo/components/scheme/report/SchemeLicense.vue";
import SchemeNote from "@/arches_lingo/components/scheme/report/SchemeNote.vue";
import SchemeNamespace from "@/arches_lingo/components/scheme/report/SchemeNamespace.vue";
Expand All @@ -13,6 +14,7 @@ const editorVisible = ref(false);
const sectionVisible = ref(true);
const editorTab = ref<string>();
type sectionTypes =
| typeof SchemeLabel
| typeof SchemeNamespace
| typeof SchemeLicense
| typeof SchemeStandard
Expand Down Expand Up @@ -47,6 +49,7 @@ const onUpdated = () => {
};
const components = [
{ component: SchemeLabel, id: "label", props: {} },
{ component: SchemeNote, id: "note", props: {} },
{ component: SchemeAuthority, id: "authority", props: {} },
{ component: SchemeStandard, id: "standard", props: {} },
Expand Down
2 changes: 1 addition & 1 deletion arches_lingo/src/arches_lingo/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const routes = [
component: () => import("@/arches_lingo/pages/SchemePage.vue"),
meta: {
shouldShowNavigation: true,
shouldShowHierarchy: true,
shouldShowHierarchy: false,
requiresAuthentication: true,
},
},
Expand Down
5 changes: 5 additions & 0 deletions arches_lingo/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
SchemeCreationView.as_view(),
name="api-scheme-creation",
),
path(
"api/scheme/<uuid:pk>/label",
SchemeCreationView.as_view(),
name="api-scheme-creation",
),
path(
"api/textual-work",
TextualWorkRdmSystemSerializerView.as_view(),
Expand Down

0 comments on commit 50e92df

Please sign in to comment.