diff --git a/arches/app/etl_modules/base_data_editor.py b/arches/app/etl_modules/base_data_editor.py index 1ed3b90efeb..49acb51f083 100644 --- a/arches/app/etl_modules/base_data_editor.py +++ b/arches/app/etl_modules/base_data_editor.py @@ -106,15 +106,23 @@ def get_nodegroups(self, request): with connection.cursor() as cursor: cursor.execute(""" - SELECT ng.nodegroupid, c.name ->> %s card_name, n.name node_name - FROM node_groups ng, cards c, nodes n - WHERE c.nodegroupid = ng.nodegroupid - AND ng.nodegroupid = n.nodeid - AND c.graphid = %s - AND c.visible = true - ORDER BY c.name; + WITH RECURSIVE card_tree(nodegroupid, parentnodegroupid, name) AS ( + SELECT ng.nodegroupid, ng.parentnodegroupid, c.name ->> %s name + FROM node_groups ng, cards c + WHERE c.nodegroupid = ng.nodegroupid + AND c.graphid = %s + AND ng.parentnodegroupid IS null + AND c.visible = true + UNION + SELECT ng.nodegroupid, ng.parentnodegroupid, (ct.name || ' - ' || (c.name ->> %s)) name + FROM node_groups ng, cards c, card_tree ct + WHERE ng.parentnodegroupid = ct.nodegroupid + AND c.nodegroupid = ng.nodegroupid + AND c.visible = true + ) + SELECT nodegroupid, name FROM card_tree ORDER BY name """, - [settings.LANGUAGE_CODE, graphid], + [settings.LANGUAGE_CODE, graphid, settings.LANGUAGE_CODE], ) nodegroups = dictfetchall(cursor) return {"success": True, "data": nodegroups} diff --git a/arches/app/media/js/views/components/etl_modules/bulk-data-deletion.js b/arches/app/media/js/views/components/etl_modules/bulk-data-deletion.js index c52c89e883d..3f5e9051c8b 100644 --- a/arches/app/media/js/views/components/etl_modules/bulk-data-deletion.js +++ b/arches/app/media/js/views/components/etl_modules/bulk-data-deletion.js @@ -131,10 +131,7 @@ define([ self.loading(true); self.formData.append('graphid', graph); self.submit('get_nodegroups').then(function(response){ - const nodegroups = response.result.map(nodegroup => ( - { ...nodegroup, - label: `${nodegroup.card_name} (${nodegroup.node_name})` - })); + const nodegroups = response.result; self.selectedNodegroup(null); self.nodegroups(nodegroups); self.loading(false); diff --git a/arches/app/templates/views/components/etl_modules/bulk-data-deletion.htm b/arches/app/templates/views/components/etl_modules/bulk-data-deletion.htm index d0fb7e57e2c..7d5a72bab27 100644 --- a/arches/app/templates/views/components/etl_modules/bulk-data-deletion.htm +++ b/arches/app/templates/views/components/etl_modules/bulk-data-deletion.htm @@ -69,7 +69,7 @@