Skip to content

Commit

Permalink
Merge branch 'dev/8.0.x' into jtw/sensitive-variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls authored Dec 19, 2024
2 parents 233f188 + 02f2d8c commit 8ed08e1
Show file tree
Hide file tree
Showing 21 changed files with 511 additions and 97 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build-and-test-branch/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:

- name: Ensure frontend configuration files exist
run: |
python manage.py check --tag=compatibility
python manage.py check
shell: bash

- name: Install Arches applications
Expand Down Expand Up @@ -74,7 +74,7 @@ runs:

- name: Check for missing migrations
run: |
python manage.py makemigrations --check --skip-checks
python manage.py makemigrations --check
shell: bash

- name: Ensure previous Python coverage data is erased
Expand Down
2 changes: 2 additions & 0 deletions arches/app/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
IntegrityCheckDescriptions = {
1005: "Nodes with ontologies found in graphs without ontologies",
1012: "Node Groups without matching nodes",
1014: "Publication missing for language",
}


@unique
class IntegrityCheck(Enum):
NODE_HAS_ONTOLOGY_GRAPH_DOES_NOT = 1005
NODELESS_NODE_GROUP = 1012
PUBLICATION_MISSING_FOR_LANGUAGE = 1014

def __str__(self):
return IntegrityCheckDescriptions[self.value]
Expand Down
4 changes: 3 additions & 1 deletion arches/app/etl_modules/branch_excel_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,9 @@ def process_worksheet(self, worksheet, cursor, node_lookup, nodegroup_lookup):
tile_value_json, passes_validation = self.create_tile_value(
cell_values, data_node_lookup, node_lookup, row_details, cursor
)
sortorder = 0
cursor.execute(
"""INSERT INTO load_staging (nodegroupid, legacyid, resourceid, tileid, parenttileid, value, loadid, nodegroup_depth, source_description, passes_validation, operation) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
"""INSERT INTO load_staging (nodegroupid, legacyid, resourceid, tileid, parenttileid, value, loadid, nodegroup_depth, source_description, passes_validation, operation, sortorder) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
(
row_details["nodegroup_id"],
legacyid,
Expand All @@ -221,6 +222,7 @@ def process_worksheet(self, worksheet, cursor, node_lookup, nodegroup_lookup):
), # source_description
passes_validation,
operation,
sortorder,
),
)
except KeyError:
Expand Down
4 changes: 2 additions & 2 deletions arches/app/etl_modules/bulk_edit_concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ def stage_data(
try:
sql = (
"""
INSERT INTO load_staging (value, tileid, nodegroupid, parenttileid, resourceid, loadid, nodegroup_depth, source_description, operation, passes_validation)
(SELECT tiledata, tileid, nodegroupid, parenttileid, resourceinstanceid, %(load_id)s, 0, 'bulk_edit', 'update', true
INSERT INTO load_staging (value, tileid, nodegroupid, parenttileid, resourceid, loadid, nodegroup_depth, source_description, operation, passes_validation, sortorder)
(SELECT tiledata, tileid, nodegroupid, parenttileid, resourceinstanceid, %(load_id)s, 0, 'bulk_edit', 'update', true, sortorder
FROM tiles
WHERE nodegroupid in (SELECT nodegroupid FROM nodes WHERE nodeid = %(node_id)s)
AND tiledata -> %(node_id)s ? %(old_id)s
Expand Down
6 changes: 4 additions & 2 deletions arches/app/etl_modules/import_single_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,9 @@ def populate_staging_table(
nodegroup_depth,
source_description,
operation,
passes_validation
) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
passes_validation,
sortorder
) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
(
nodegroup,
legacyid,
Expand All @@ -568,6 +569,7 @@ def populate_staging_table(
csv_file_name,
"insert",
passes_validation,
0,
),
)

Expand Down
6 changes: 3 additions & 3 deletions arches/app/etl_modules/tile_excel_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def run_load_task_async(self, request):

def create_tile_value(
self,
cell_values,
data_node_lookup,
node_lookup,
nodegroup_alias,
Expand Down Expand Up @@ -176,6 +175,7 @@ def process_worksheet(self, worksheet, cursor, node_lookup, nodegroup_lookup):
raise ValueError(_("All rows must have a valid resource id"))

node_values = cell_values[3:-3]
sortorder = cell_values[-3] if cell_values[-3] else 0
try:
row_count += 1
row_details = dict(zip(data_node_lookup[nodegroup_alias], node_values))
Expand All @@ -194,7 +194,6 @@ def process_worksheet(self, worksheet, cursor, node_lookup, nodegroup_lookup):
)
legacyid, resourceid = self.set_legacy_id(resourceid)
tile_value_json, passes_validation = self.create_tile_value(
cell_values,
data_node_lookup,
node_lookup,
nodegroup_alias,
Expand All @@ -214,7 +213,7 @@ def process_worksheet(self, worksheet, cursor, node_lookup, nodegroup_lookup):
if TileModel.objects.filter(pk=tileid).exists():
operation = "update"
cursor.execute(
"""INSERT INTO load_staging (nodegroupid, legacyid, resourceid, tileid, parenttileid, value, loadid, nodegroup_depth, source_description, passes_validation, operation) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
"""INSERT INTO load_staging (nodegroupid, legacyid, resourceid, tileid, parenttileid, value, loadid, nodegroup_depth, source_description, passes_validation, operation, sortorder) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)""",
(
row_details["nodegroup_id"],
legacyid,
Expand All @@ -229,6 +228,7 @@ def process_worksheet(self, worksheet, cursor, node_lookup, nodegroup_lookup):
), # source_description
passes_validation,
operation,
sortorder,
),
)
except KeyError:
Expand Down
15 changes: 13 additions & 2 deletions arches/app/media/js/utils/create-vue-application.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { createGettext } from "vue3-gettext";
import arches from 'arches';
import { DEFAULT_THEME } from "@/arches/themes/default.ts";

export default async function createVueApplication(vueComponent, themeConfiguration) {
export default async function createVueApplication(vueComponent, themeConfiguration = DEFAULT_THEME) {
/**
* This wrapper allows us to maintain a level of control inside arches-core
* over Vue apps. For instance this allows us to abstract i18n setup/config
Expand All @@ -40,8 +40,19 @@ export default async function createVueApplication(vueComponent, themeConfigurat
});

const app = createApp(vueComponent);
const darkModeClass = themeConfiguration.theme.options.darkModeSelector.substring(1);
const darkModeStorageKey = `arches.${darkModeClass}`;

app.use(PrimeVue, themeConfiguration || DEFAULT_THEME);
const darkModeToggleState = localStorage.getItem(darkModeStorageKey);
if (
darkModeToggleState === "true" ||
(darkModeToggleState === null &&
window.matchMedia("(prefers-color-scheme: dark)").matches)
) {
document.documentElement.classList.add(darkModeClass);
}

app.use(PrimeVue, themeConfiguration);
app.use(gettext);
app.use(ConfirmationService);
app.use(DialogService);
Expand Down
1 change: 1 addition & 0 deletions arches/app/models/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,7 @@ def flatten_tree(tree, node_id_list=[]):
copy_of_self.root = root_node
copy_of_self.name = root_node.name
copy_of_self.isresource = False
copy_of_self.resource_instance_lifecycle = None
copy_of_self.subtitle = ""
copy_of_self.description = ""
copy_of_self.author = ""
Expand Down
Loading

0 comments on commit 8ed08e1

Please sign in to comment.