Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev/8.0.x' into 11396_nodegrou…
Browse files Browse the repository at this point in the history
…p_graphid_fk

merges latest from dev/8.0.x into branch
  • Loading branch information
whatisgalen committed Aug 23, 2024
2 parents 9bf43f3 + e8166aa commit 70eee7a
Show file tree
Hide file tree
Showing 129 changed files with 9,050 additions and 2,916 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ source =
arches/

omit =
*/__init__.py
*/celery.py
*/hosts.py
*/models/migrations/*
Expand Down
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
6d519d00e752448362b880b73c3641a562ee9ee3
eea27d316c5ff975556e15ccd4c11d7c393dd95c
8de09526329685ee4d80c816c3475a66b19d46e9
e3d8197d5a7d1f03ed125fe2f47d4fbef0913404
9740c846eda0cc067f49d7abffdcb1a93fe3e0a9
eff6710e8b44faef5a628b0ea1373cd99cb47e9e
# Reformatting of 7.6 features under dev (2024)
9740c846eda0cc067f49d7abffdcb1a93fe3e0a9
# Format with black on dev/8.0.x (2024)
e218a8ab828fae79aaeaa4895e4c30c0ce8c96f1
# Relevant subset of git log --grep black
9b7e30d4499cb02dec6d17c7c99f9a7087fcdd47
b959f1139a1d789e6c116d43d8be7daa0baa6075
Expand Down
2 changes: 1 addition & 1 deletion arches/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
pass

# VERSION[3] options = "alpha", "beta", "rc", or "final"
VERSION = (7, 6, 0, "alpha", 10)
VERSION = (8, 0, 0, "alpha", 0)

__version__ = get_version(VERSION)
2 changes: 2 additions & 0 deletions arches/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class GuardedAdmin(GuardedModelAdmin):
models.Widget,
models.UserProfile,
models.GraphModel,
models.ResourceInstanceLifecycle,
models.ResourceInstanceLifecycleState,
models.SearchComponent,
models.IIIFManifest,
models.GroupMapSettings,
Expand Down
2 changes: 1 addition & 1 deletion arches/app/etl_modules/base_data_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def get_graphs(self, request):
GraphModel.objects.all()
.exclude(pk=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID)
.exclude(isresource=False)
.exclude(publication_id__isnull=True)
.exclude(source_identifier__isnull=False)
.order_by(graph_name_i18n)
)
return {"success": True, "data": graphs}
Expand Down
3 changes: 2 additions & 1 deletion arches/app/etl_modules/import_single_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def get_graphs(self, request):
GraphModel.objects.all()
.exclude(pk=settings.SYSTEM_SETTINGS_RESOURCE_MODEL_ID)
.exclude(isresource=False)
.exclude(publication_id__isnull=True)
.exclude(is_active=False)
.exclude(source_identifier__isnull=False)
.order_by(graph_name_i18n)
)
return {"success": True, "data": graphs}
Expand Down
2 changes: 1 addition & 1 deletion arches/app/etl_modules/jsonld_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_graph_tree_from_slug(slug):

@lru_cache(maxsize=1)
def graph_id_from_slug(slug):
return GraphModel.objects.get(slug=slug).pk
return GraphModel.objects.get(slug=slug, source_identifier=None).pk


@cache
Expand Down
53 changes: 48 additions & 5 deletions arches/app/media/css/arches.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
@import url(node_modules/bootstrap-colorpicker/dist/css/bootstrap-colorpicker.min.css);
@import url(nifty.css);
@import url(node_modules/font-awesome/css/font-awesome.min.css);
@import url(node_modules/primeicons/primeicons.css);
@import url(node_modules/ionicons/css/ionicons.min.css);
@import url(node_modules/lt-themify-icons/themify-icons.css);
@import url(node_modules/chosen-js/chosen.css);
Expand Down Expand Up @@ -3394,6 +3395,16 @@ ul.nav.nav-tabs.nav-justified {
min-width: 468px;
}

.graph-active-switch-container {
display: flex;
align-items: center;
}
.graph-active-switch-container .toggle-container {
padding: 0 !important;
height: 20px;
width: 40px;
}

.function-node-alert {
display: inline-block;
background: #A2EAE2;
Expand Down Expand Up @@ -3596,7 +3607,7 @@ div.dropdown-menu.open {
right: 0;
bottom: 0;
left: 0;
z-index: 999;
z-index: 9999;
transition: all 0.3s;
cursor: pointer;
}
Expand All @@ -3607,6 +3618,7 @@ div.dropdown-menu.open {
margin: 15% auto;
max-width: 600px;
padding: 18px;
z-index: 9999;
border: 1px solid #ddd;
border-radius: 5px;
width: 70%;
Expand Down Expand Up @@ -4017,7 +4029,7 @@ div.dropdown-menu.open {
}

.resource-grid-main-container.active {
background: #f6f6f6;
background: #f8f8f8;
}

.resource-grid-icon {
Expand Down Expand Up @@ -4059,9 +4071,10 @@ div.dropdown-menu.open {

.resource-grid-item .resource-grid-tools-container {
flex-direction: column;
margin: 15px;
padding: 15px;
display: flex;
width: 76px;
justify-content: flex-end;
align-items: center;
}

.report-image-grid .resource-grid-item:last-of-type .resource-grid-tools-container .btn-group .manage-menu {
Expand Down Expand Up @@ -4266,6 +4279,7 @@ div.dropdown-menu.open {

.edit-menu-item {
height: 60px;
padding-right: 20px;
border-left: 3px solid #ebeef0;
border-bottom: 1px solid #ddd;
background: #fff;
Expand Down Expand Up @@ -4334,6 +4348,30 @@ div.dropdown-menu.open {
z-index: 10;
}

.publication {
cursor: pointer;
justify-content: left;
min-height: 60px;
display: grid;
grid-auto-flow: column;
align-items: center;
border-bottom: 1px solid #ddd;
padding: 0 8px;
}

.publication:hover {
background-color: #fff;
border-left: 1px solid #ddd;
border-right: 1px solid #ddd;
}

.active-publication {
justify-content: left;
background-color: #fff;
border-left: 1px solid #ddd;
border-right: 1px solid #ddd;
}

.graph-list-header {
position: sticky;
top: 0px;
Expand Down Expand Up @@ -6415,10 +6453,11 @@ ul div .card-tree-list span .card-tree-list-item .card-tree-list-icon {
}

.resource-status-label {
display: flex;
font-size: 1.1rem;
float: right;
color: #555;
margin-top: 3px;
margin-top: 5px;
}

.list-filter {
Expand Down Expand Up @@ -10365,6 +10404,10 @@ a.filter-tools:hover {
height: 100%;
}

.editor-report .resource-report-abstract-container .resource-component-abstract {
height: calc(100vh - 150px);
}

.editor-report .rp-report-section {
border-bottom: none;
padding-bottom: 0;
Expand Down
5 changes: 5 additions & 0 deletions arches/app/media/js/models/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ define([
return AbstractModel.prototype.save.call(this, function(request, status, self) {
if (status === 'success') {
this._card(JSON.stringify(this.toJSON()));

// adds event to trigger dirty state in graph-designer
document.dispatchEvent(
new Event('cardSave')
);
}
if (typeof callback === 'function') {
callback(request, status, self);
Expand Down
5 changes: 5 additions & 0 deletions arches/app/media/js/models/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ define([
});
parentNode.childNodes.remove(node);
parentNode.selected(true);

// adds event to trigger dirty state in graph-designer
document.dispatchEvent(
new Event('deleteNode')
);
}else{
this.trigger('error', response, 'deleteNode');
}
Expand Down
10 changes: 10 additions & 0 deletions arches/app/media/js/models/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ define([
self.slug = ko.observable(null);
self.alias = ko.observable(null);
self.hasCustomAlias = ko.observable(false);
self.sourceIdentifierId = ko.observable(null);
self.nodeGroupId = ko.observable('');
var datatype = ko.observable('');
self.datatype = ko.computed({
Expand Down Expand Up @@ -184,6 +185,7 @@ define([
config: config,
issearchable: self.issearchable,
isrequired: self.isrequired,
is_immutable: self.is_immutable,
fieldname: self.fieldname,
exportable: self.exportable,
alias: self.alias,
Expand Down Expand Up @@ -267,13 +269,15 @@ define([
self.exportable(source.exportable);
self.alias(source.alias);
self.hasCustomAlias(source.hascustomalias);
self.sourceIdentifierId(source.source_identifier_id);

if (source.config) {
self.setupConfig(source.config);
}

self.nodeid = source.nodeid;
self.istopnode = source.istopnode;
self.is_immutable = source.is_immutable;
self.sourceBranchPublicationId = source.sourcebranchpublication_id;

self.set('id', self.nodeid);
Expand Down Expand Up @@ -324,6 +328,12 @@ define([
this._node(this.json());
}
};

// adds event to trigger dirty state in graph-designer
// need to execute before save to avoid issues with graph caching
document.dispatchEvent(
new Event('nodeSave')
);
return this._doRequest({
type: method,
url: this._getURL(method),
Expand Down
8 changes: 8 additions & 0 deletions arches/app/media/js/viewmodels/card-component.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ define([
});
}

self.cardIdentifier = ko.computed(function() {
return self.card.model.attributes.source_identifier_id ? self.card.model.attributes.source_identifier_id : self.card.model.nodegroup_id();
});

self.widgetNodeIdentifier = function(widget) {
return ko.unwrap(widget.node.sourceIdentifierId) ? ko.unwrap(widget.node.sourceIdentifierId) : widget.node.id;
};

self.dirty = ko.computed(function() {
if (!ko.unwrap(self.tiles)) {
return true;
Expand Down
7 changes: 6 additions & 1 deletion arches/app/media/js/viewmodels/graph-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ define([
self.relatable_resources = ko.computed(function() {
return _.each(self.resource_data(), function(resource) {
resource.isRelatable = ko.observable(resource.is_relatable);
});
}).filter(resource => !resource.graph.source_identifier_id);
});

self.designerViewModel = params.designerViewModel;
Expand All @@ -26,6 +26,7 @@ define([
self.graph.root.name(val);
self.rootnode.name(val);
});

self.graph.root.datatype.subscribe(function(val){
self.rootnode.datatype(val);
});
Expand Down Expand Up @@ -94,6 +95,10 @@ define([
.done(function(response) {
self.jsonCache(self.jsonData());
self.rootnode._node(JSON.stringify(self.rootnode));

if (params.onSave && typeof params.onSave === 'function') {
params.onSave();
}
})
.fail(function(response) {
self.designerViewModel.alert(new JsonErrorAlertViewModel('ep-alert-red', response.responseJSON));
Expand Down
6 changes: 6 additions & 0 deletions arches/app/media/js/viewmodels/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ define([
self[key] = obs;

var forwardSubscription = self[key].subscribe(function(val) {
if (params.hasOwnProperty('graphDesignerHasDirtyWidget')) {
if (val || val === 0) {
params.graphDesignerHasDirtyWidget(true);
}
}

var configObj = self.config();
configObj[key] = val;
self.config(configObj);
Expand Down
2 changes: 1 addition & 1 deletion arches/app/media/js/views/base-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ define([
return graph.isresource;
});
});
options.viewModel.createableResources = ko.observableArray(data.createableResources);
options.viewModel.createableResources = ko.observableArray(data.createableResources.filter(currentGraph => currentGraph.source_identifier_id === null));
options.viewModel.userCanReadResources = data.userCanReadResources;
options.viewModel.userCanEditResources = data.userCanEditResources;

Expand Down
10 changes: 1 addition & 9 deletions arches/app/media/js/views/components/datatypes/concept.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ define([
});
} else {
this.conceptCollections = ko.observableArray([]);
this.isEditable = true;
if (params.graph) {
var cards = _.filter(params.graph.get('cards')(), function(card){return card.nodegroup_id === params.nodeGroupId();});
if (cards.length) {
this.isEditable = cards[0].is_editable;
}
} else if (params.widget) {
this.isEditable = params.widget.card.get('is_editable');
}
this.topConcept = params.config.rdmCollection;
this.initialTopConcept = this.topConcept();
if (arches.conceptCollections.length === 0) {
Expand All @@ -62,6 +53,7 @@ define([
'id': null
});
self.topConcept(self.initialTopConcept);
params._node(JSON.stringify(params)) // prevents dirty state trigger on Graph Designer concept node load
}).fail(function(error){
console.log(error);
});
Expand Down
11 changes: 0 additions & 11 deletions arches/app/media/js/views/components/datatypes/domain-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,6 @@ define([
});

} else {
this.isEditable = true;

if (params.graph) {
var cards = _.filter(params.graph.get('cards')(), function(card){return card.nodegroup_id === params.nodeGroupId();});
if (cards.length) {
this.isEditable = cards[0].is_editable;
}
} else if (params.widget) {
this.isEditable = params.widget.card.get('is_editable');
}

this.options = params.config.options;
params.config.options().map(option => {
option.text = ko.observable(ko.unwrap(option.text));
Expand Down
7 changes: 0 additions & 7 deletions arches/app/media/js/views/components/datatypes/node-value.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ define([
};
updateProperties();
this.config.nodeid.subscribe(updateProperties);
this.isEditable = true;
if (params.graph) {
this.propertyName = ko.computed(function() {
var propertyId = self.config.property();
Expand All @@ -81,12 +80,6 @@ define([
});
return relatedNode ? relatedNode.name() : '';
});
var cards = _.filter(params.graph.get('cards')(), function(card){return card.nodegroup_id === params.nodeGroupId();});
if (cards.length) {
this.isEditable = cards[0].is_editable;
}
} else if (params.widget) {
this.isEditable = params.widget.card.get('is_editable');
}
} else {
var filter = params.filterValue();
Expand Down
Loading

0 comments on commit 70eee7a

Please sign in to comment.