Skip to content

Commit

Permalink
Merge branch 'main' into jmc/10_add_rdm_to_clm_migrator_cli
Browse files Browse the repository at this point in the history
  • Loading branch information
johnatawnclementawn committed Aug 9, 2024
2 parents 5e4cae8 + 6157b3c commit 7b94313
Show file tree
Hide file tree
Showing 39 changed files with 353 additions and 330 deletions.
16 changes: 0 additions & 16 deletions .github/actions/build-and-test-branch/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,6 @@ runs:
with:
secrets: ${{ inputs.secrets }}

- name: Checkout into feature branch
if: inputs.branch-type == 'feature'
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
path: .

- name: Checkout into target branch
if: inputs.branch-type == 'target'
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.base.ref }}
path: .

- name: Install frontend dependencies
run: |
npm install
Expand Down
28 changes: 21 additions & 7 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
workflow_dispatch:

jobs:
build_feature_branch:
build_target_branch:
runs-on: ubuntu-latest

services:
Expand All @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -33,14 +33,21 @@ jobs:
python-version: ${{ matrix.python-version }}
check-latest: true

- name: Checkout into target branch
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.base.ref }}
path: .

- name: Build and test branch
uses: ./.github/actions/build-and-test-branch
with:
secrets: ${{ toJSON(secrets) }}
project-name: 'arches_references'
branch-type: 'feature'
branch-type: 'target'

build_target_branch:
build_feature_branch:
runs-on: ubuntu-latest

services:
Expand All @@ -56,7 +63,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -67,12 +74,19 @@ jobs:
python-version: ${{ matrix.python-version }}
check-latest: true

- name: Checkout into feature branch
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
path: .

- name: Build and test branch
uses: ./.github/actions/build-and-test-branch
with:
secrets: ${{ toJSON(secrets) }}
project-name: 'arches_references'
branch-type: 'target'
branch-type: 'feature'

check_frontend_coverage:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -255,4 +269,4 @@ jobs:
exit 1
else
echo "Feature branch coverage ($feature_branch_python_coverage%) >= Target branch coverage ($target_branch_python_coverage%)."
fi
fi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ko from 'knockout';
import ControlledListManager from '@/arches-references/plugins/ControlledListManager.vue';
import ControlledListManager from '@/arches_references/plugins/ControlledListManager.vue';
import createVueApp from 'utils/create-vue-application';
import ControlledListManagerTemplate from 'templates/views/components/plugins/controlled-list-manager.htm';

Expand Down
4 changes: 0 additions & 4 deletions arches_references/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,3 @@
from settings_local import *
except ImportError as e:
pass

# returns an output that can be read by NODEJS
if __name__ == "__main__":
transmit_webpack_django_config(**locals())

This file was deleted.

10 changes: 0 additions & 10 deletions arches_references/src/arches-references/declarations.d.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import arches from "arches";
import Cookies from "js-cookie";

import { makeParentMap, makeSortOrderMap } from "@/arches-references/utils.ts";
import { makeParentMap, makeSortOrderMap } from "@/arches_references/utils.ts";

import type {
ControlledList,
ControlledListItem,
ControlledListItemImage,
ControlledListItemImageMetadata,
NewControlledListItem,
NewOrExistingControlledListItemImageMetadata,
NewValue,
Value,
NewControlledListItemImageMetadata,
NewOrExistingValue,
} from "@/arches-references/types";
} from "@/arches_references/types";

function getToken() {
const token = Cookies.get("csrftoken");
Expand Down Expand Up @@ -51,7 +52,7 @@ export const createList = async (name: string) => {
}
};

export const createItem = async (item: ControlledListItem) => {
export const createItem = async (item: NewControlledListItem) => {
const response = await fetch(arches.urls.controlled_list_item_add, {
method: "POST",
headers: { "X-CSRFToken": getToken() },
Expand Down Expand Up @@ -173,7 +174,7 @@ export const deleteItems = async (itemIds: string[]) => {
return true;
};

export const upsertValue = async (value: NewOrExistingValue) => {
export const upsertValue = async (value: Value | NewValue) => {
const url = value.id
? arches.urls.controlled_list_item_value(value.id)
: arches.urls.controlled_list_item_value_add;
Expand Down Expand Up @@ -214,7 +215,7 @@ export const deleteValue = async (value: Value) => {
};

export const upsertMetadata = async (
metadata: NewControlledListItemImageMetadata,
metadata: NewOrExistingControlledListItemImageMetadata,
) => {
const url = metadata.id
? arches.urls.controlled_list_item_image_metadata(metadata.id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@ import ProgressSpinner from "primevue/progressspinner";
import Splitter from "primevue/splitter";
import SplitterPanel from "primevue/splitterpanel";
import { LIGHT_GRAY } from "@/arches-references/theme.ts";
import { LIGHT_GRAY } from "@/arches_references/theme.ts";
import {
displayedRowKey,
selectedLanguageKey,
} from "@/arches-references/constants.ts";
import { dataIsList } from "@/arches-references/utils.ts";
import ControlledListSplash from "@/arches-references/components/misc/ControlledListSplash.vue";
import ItemEditor from "@/arches-references/components/editor/ItemEditor.vue";
import ListCharacteristics from "@/arches-references/components/editor/ListCharacteristics.vue";
import ListHeader from "@/arches-references/components/misc/ListHeader.vue";
import ListTree from "@/arches-references/components/tree/ListTree.vue";
} from "@/arches_references/constants.ts";
import { dataIsList } from "@/arches_references/utils.ts";
import ControlledListSplash from "@/arches_references/components/misc/ControlledListSplash.vue";
import ItemEditor from "@/arches_references/components/editor/ItemEditor.vue";
import ListCharacteristics from "@/arches_references/components/editor/ListCharacteristics.vue";
import ListHeader from "@/arches_references/components/misc/ListHeader.vue";
import ListTree from "@/arches_references/components/tree/ListTree.vue";
import type { Ref } from "vue";
import type { Language } from "arches/arches/app/src/arches/types";
import type { Selectable } from "@/arches-references/types";
import type { Language } from "@/arches/types";
import type { Selectable } from "@/arches_references/types";
const splash = "splash";
const displayedRow: Ref<Selectable | null> = ref(null);
function setDisplayedRow(val: Selectable | null) {
const setDisplayedRow = (val: Selectable | null) => {
displayedRow.value = val;
}
};
// @ts-expect-error vue-tsc doesn't like arbitrary properties here
provide(displayedRowKey, { displayedRow, setDisplayedRow });
const selectedLanguage: Ref<Language> = ref(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,34 @@ import { useGettext } from "vue3-gettext";
import Button from "primevue/button";
import { ARCHES_CHROME_BLUE } from "@/arches-references/theme.ts";
import { itemKey } from "@/arches-references/constants.ts";
import { ARCHES_CHROME_BLUE } from "@/arches_references/theme.ts";
import { itemKey } from "@/arches_references/constants.ts";
import { dataIsNew } from "@/arches_references/utils.ts";
import type { Ref } from "vue";
import type {
ControlledListItem,
ControlledListItemImage,
ControlledListItemImageMetadata,
LabeledChoice,
NewControlledListItemImageMetadata,
} from "@/arches-references/types";
} from "@/arches_references/types";
const { labeledChoices, image, makeMetadataEditable } = defineProps<{
labeledChoices: LabeledChoice[];
image: ControlledListItemImage;
makeMetadataEditable: (
clickedMetadata: NewControlledListItemImageMetadata,
clickedMetadata: ControlledListItemImageMetadata,
index: number,
) => void;
}>();
const item = inject(itemKey) as Ref<ControlledListItem>;
const { $gettext } = useGettext();
const newMetadata: Ref<NewControlledListItemImageMetadata> = computed(() => {
const newMetadata: Ref<ControlledListItemImageMetadata> = computed(() => {
const otherNewMetadataIds = image.metadata
.filter((metadatum) => typeof metadatum.id === "number")
.map((metadatum) => metadatum.id as number);
.filter((metadatum) => dataIsNew(metadatum))
.map((metadatum) => Number.parseInt(metadatum.id));
const maxOtherNewMetadataId = Math.max(...otherNewMetadataIds, 0);
Expand All @@ -44,7 +45,7 @@ const newMetadata: Ref<NewControlledListItemImageMetadata> = computed(() => {
) ?? labeledChoices[0];
return {
id: maxOtherNewMetadataId + 1,
id: (maxOtherNewMetadataId + 1).toString(),
metadata_type: nextMetadataType.type,
metadata_label: nextMetadataType.label,
language_id: arches.activeLanguage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@ import { useGettext } from "vue3-gettext";
import Button from "primevue/button";
import { ARCHES_CHROME_BLUE } from "@/arches-references/theme.ts";
import { ARCHES_CHROME_BLUE } from "@/arches_references/theme.ts";
import {
itemKey,
ALT_LABEL,
NOTE_CHOICES,
PREF_LABEL,
} from "@/arches-references/constants.ts";
} from "@/arches_references/constants.ts";
import { dataIsNew } from "@/arches_references/utils.ts";
import type { Ref } from "vue";
import type { Language } from "arches/arches/app/src/arches/types";
import type { Language } from "@/arches/types";
import type {
ControlledListItem,
Value,
NewValue,
ValueType,
} from "@/arches-references/types";
} from "@/arches_references/types";
const { valueType, makeNewValueEditable } = defineProps<{
valueType?: ValueType;
makeNewValueEditable: (newValue: NewValue, index: number) => void;
makeNewValueEditable: (newValue: Value, index: number) => void;
}>();
const item = inject(itemKey) as Ref<ControlledListItem>;
const { $gettext } = useGettext();
const newValue: Ref<NewValue> = computed(() => {
const newValue: Ref<Value> = computed(() => {
const otherNewValueIds = item.value.values
.filter((value: NewValue | Value) => typeof value.id === "number")
.map((value) => value.id as number);
.filter((value: Value) => dataIsNew(value))
.map((value) => Number.parseInt(value.id));
const maxOtherNewValueId = Math.max(...otherNewValueIds, 0);
Expand Down Expand Up @@ -68,7 +68,7 @@ const newValue: Ref<NewValue> = computed(() => {
}
return {
id: maxOtherNewValueId + 1,
id: (maxOtherNewValueId + 1).toString(),
valuetype_id: nextValueType ?? NOTE_CHOICES.scope,
language_id: nextLanguageCode,
value: "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
import arches from "arches";
import { computed, inject } from "vue";
import { itemKey, METADATA_CHOICES } from "@/arches-references/constants.ts";
import { bestLabel } from "@/arches-references/utils.ts";
import ImageMetadata from "@/arches-references/components/editor/ImageMetadata.vue";
import { itemKey, METADATA_CHOICES } from "@/arches_references/constants.ts";
import { bestLabel } from "@/arches_references/utils.ts";
import ImageMetadata from "@/arches_references/components/editor/ImageMetadata.vue";
import type { Ref } from "vue";
import type {
ControlledListItem,
ControlledListItemImage,
} from "@/arches-references/types";
} from "@/arches_references/types";
const item = inject(itemKey) as Ref<ControlledListItem>;
const { image } = defineProps<{ image: ControlledListItemImage }>();
Expand Down
Loading

0 comments on commit 7b94313

Please sign in to comment.