Skip to content

Commit

Permalink
Merge branch 'dev/7.5.x' into update_76_with_75_latest_20240108
Browse files Browse the repository at this point in the history
  • Loading branch information
chiatt committed Feb 8, 2024
2 parents 35eeb5c + 035965d commit bc93d4a
Show file tree
Hide file tree
Showing 19 changed files with 143 additions and 56 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Issue reports are encouraged! [Please read this article](http://polite.technolog
* [Report a Bug](https://github.com/archesproject/arches/issues/new?template=bug.md)
* [File a Feature Ticket](https://github.com/archesproject/arches/issues/new?template=feature.md)

[Version 7.5.0 release notes](https://github.com/archesproject/arches/blob/stable/7.5.0/releases/7.5.0.md)
[Version 7.5.1 release notes](https://github.com/archesproject/arches/blob/stable/7.5.0/releases/7.5.1.md)

#### Quick Install

Expand Down
12 changes: 7 additions & 5 deletions arches/app/etl_modules/base_data_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def edit_staged_data(self, cursor, graph_id, node_id, operation, language_code,
result["message"] = _("Unable to edit staged data: {}").format(str(e))
return result

def get_preview_data(self, node_id, search_url, language_code, operation, old_text, case_insensitive, whole_word):
def get_preview_data(self, node_id, search_url, language_code, operation, old_text, case_insensitive, whole_word, preview_limit):
request = HttpRequest()
request.user = self.request.user
request.method = "GET"
Expand Down Expand Up @@ -312,7 +312,7 @@ def get_preview_data(self, node_id, search_url, language_code, operation, old_te
nested_agg.add_aggregation(search_filter_agg)

se = SearchEngineFactory().create()
query = Query(se, limit=5)
query = Query(se, limit=preview_limit)

query.add_query(search_url_query)
query.add_aggregation(nested_agg)
Expand All @@ -326,7 +326,7 @@ def get_preview_data(self, node_id, search_url, language_code, operation, old_te
number_of_resources = results['hits']['total']['value']
number_of_tiles = results["aggregations"]["tile_agg"]["string_search"]["buckets"][0]["doc_count"]

return values[:5], number_of_tiles, number_of_resources
return values[:preview_limit], number_of_tiles, number_of_resources

def preview(self, request):
graph_id = request.POST.get("graph_id", None)
Expand All @@ -341,6 +341,8 @@ def preview(self, request):
also_trim = request.POST.get("also_trim", "false")
search_url = request.POST.get("search_url", None)

preview_limit = ETLModule.objects.get(pk=self.moduleid).config.get("previewLimit", 5)

try:
self.validate_inputs(request)
except MissingRequiredInputError as e:
Expand Down Expand Up @@ -374,7 +376,7 @@ def preview(self, request):

try:
first_five_values, number_of_tiles, number_of_resources = self.get_preview_data(
node_id, search_url, language_code, operation, old_text, case_insensitive, whole_word
node_id, search_url, language_code, operation, old_text, case_insensitive, whole_word, preview_limit
)
except TypeError:
return {
Expand Down Expand Up @@ -408,7 +410,7 @@ def preview(self, request):

return {
"success": True,
"data": {"value": return_list, "number_of_tiles": number_of_tiles, "number_of_resources": number_of_resources},
"data": {"value": return_list, "number_of_tiles": number_of_tiles, "number_of_resources": number_of_resources, "preview_limit": preview_limit},
}

def write(self, request):
Expand Down
17 changes: 7 additions & 10 deletions arches/app/media/css/arches.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11824,12 +11824,11 @@ a.filter-tools:hover {
}

.map-coordinate-editor {
margin-top: 15px;
margin-top: 5px;
}

.map-coordinate-editor-crs-selector {
position: fixed;
margin-top: 25px;
margin-top: 10px;
background: #fff;
padding-bottom: 8px;
border-bottom: 1px solid #ddd;
Expand All @@ -11849,8 +11848,9 @@ a.filter-tools:hover {
}

.map-coordinate-editor-list {
padding: 0 5px;
margin-top: 70px;
padding-top: 5px;
padding-left: 5px;
overflow-y: auto;
}

.map-coordinate-editor-list a:focus i {
Expand Down Expand Up @@ -11894,21 +11894,18 @@ a.filter-tools:hover {
}

.map-coordinate-editor-header {
position: fixed;
background: #fff;
padding: 6px 0;
font-size: 1.2em;
width: 370px;
margin-top: -6px;
}

.map-coordinate-editor-pair.map-coordinate-editor-new-coordinates {
padding: 0 0px 10px 4px;
padding: 5px 0px 5px 4px;
}

.map-coordinate-editor-button-container {
position: sticky;
bottom: -17px;
display: inline-flex;
background: #fff;
width: 400px;
padding: 10px 5px;
Expand Down
20 changes: 8 additions & 12 deletions arches/app/media/js/viewmodels/file-widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,16 +231,12 @@ define([
});
}, this, 'beforeChange');

this.getFileUrl = function(url){
url = ko.unwrap(url);
var httpRegex = /^https?:\/\//;
// test whether the url is external (starts with http(s), if it is just return it)
if (httpRegex.test(url)){
return url;
}else{
return (arches.urls.url_subpath + url).replace('//', '/');
}

this.getFileUrl = function(urltoclean) {
const url = ko.unwrap(urltoclean);
const httpRegex = /^https?:\/\//;
// test whether the url is fully qualified or already starts with url_subpath
return !url || httpRegex.test(url) || url.startsWith(arches.urls.url_subpath) ? url :
(arches.urls.url_subpath + url).replace('//', '/');
};

if (Array.isArray(self.value())) {
Expand Down Expand Up @@ -292,7 +288,7 @@ define([
}
if (self.filesJSON().length > 0) { self.selectedFile(self.filesJSON()[newfilePosition]); }
};

this.pageCt = ko.observable(5);
this.pageCtReached = ko.computed(function() {
return (self.filesJSON().length > self.pageCt() ? 'visible' : 'hidden');
Expand Down Expand Up @@ -399,7 +395,7 @@ define([
};

this.displayValue = ko.computed(function() {
return self.uploadedFiles().length === 1 ? ko.unwrap(self.uploadedFiles()[0].name) : self.uploadedFiles().length;
return self.uploadedFiles().length === 1 ? ko.unwrap(self.uploadedFiles()[0].name) : self.uploadedFiles().length;
});

this.reportFiles = ko.computed(function() {
Expand Down
3 changes: 2 additions & 1 deletion arches/app/media/js/viewmodels/workflow-step.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ define([

this.updateWorkflowComponentAbstractLookup = function(workflowComponentAbtractData) {
var workflowComponentAbstractLookup = self.workflowComponentAbstractLookup();
var workflowComponentAbstractId = self.id();
var workflowComponentAbstractId = null;

if (config.workflowHistory.stepdata) {
const componentIdLookup = config.workflowHistory.stepdata?.[ko.unwrap(self.name)]?.[COMPONENT_ID_LOOKUP_LABEL];
Expand Down Expand Up @@ -214,6 +214,7 @@ define([
[ko.unwrap(self.name)]: {
[key]: value,
locked: self.locked(),
stepId: self.id(),
},
},
};
Expand Down
2 changes: 1 addition & 1 deletion arches/app/media/js/viewmodels/workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ define([
var stepName = ko.unwrap(stepConfigData.name);
if (stepConfigData.workflowHistory.stepdata?.[stepName]) {
// stepdata might exist without this specific stepName if injected
stepConfigData.id = Object.values(stepConfigData.workflowHistory.stepdata[stepName].componentIdLookup)[0];
stepConfigData.id = stepConfigData.workflowHistory.stepdata[stepName].stepId;
}

stepConfigData.informationBoxDisplayed = ko.observable(self.getInformationBoxDisplayedStateFromLocalStorage(stepName));
Expand Down
13 changes: 10 additions & 3 deletions arches/app/media/js/views/components/cards/photo-gallery-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ define([
'knockout',
'knockout-mapping',
'underscore',
'arches',
'dropzone',
'uuid',
'viewmodels/card-component',
Expand All @@ -12,9 +13,9 @@ define([
'bindings/fadeVisible',
'bindings/dropzone',
'bindings/gallery',
], function(ko, koMapping, _, Dropzone, uuid, CardComponentViewModel, WorkbenchComponentViewModel, PhotoGallery, photoGalleryCardTemplate) {
], function(ko, koMapping, _, arches, Dropzone, uuid, CardComponentViewModel, WorkbenchComponentViewModel, PhotoGallery, photoGalleryCardTemplate) {
const viewModel = function(params) {

params.configKeys = ['acceptedFiles', 'maxFilesize'];
var self = this;
CardComponentViewModel.apply(this, [params]);
Expand Down Expand Up @@ -48,13 +49,19 @@ define([

this.fileListNodeId = getfileListNode();

this.cleanUrl = function(url) {
const httpRegex = /^https?:\/\//;
return !url || httpRegex.test(url) || url.startsWith(arches.urls.url_subpath) ? url :
(arches.urls.url_subpath + url).replace('//', '/');
};

this.getUrl = function(tile){
var url = '';
var name = '';
var val = ko.unwrap(tile.data[this.fileListNodeId]);
if (val && val.length == 1) {
{
url = ko.unwrap(val[0].url) || ko.unwrap(val[0].content);
url = self.cleanUrl(ko.unwrap(val[0].url)) || ko.unwrap(val[0].content);
name = ko.unwrap(val[0].name);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ define([
this.loadId = params.loadId || uuid.generate();
this.resourceids = ko.observable();
this.previewValue = ko.observable();
this.previewLimit = ko.observable();
this.showPreview = ko.observable(false);
this.searchUrl = ko.observable();
this.caseInsensitive = ko.observable();
Expand Down Expand Up @@ -204,6 +205,7 @@ define([
self.showPreview(true);
self.numberOfResources(data.result.number_of_resources);
self.numberOfTiles(data.result.number_of_tiles);
self.previewLimit(data.result.preview_limit);
}).fail(function(err) {
self.alert(
new JsonErrorAlertViewModel(
Expand Down
17 changes: 9 additions & 8 deletions arches/app/media/js/views/components/widgets/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,15 @@ define([

});

const valueLeaf = self.value?.[arches.activeLanguage]?.value || self.value;
valueLeaf?.subscribe(newValue => {
const currentLanguage = self.currentLanguage();
if(!currentLanguage) { return; }
if(JSON.stringify(currentValue) != JSON.stringify(ko.toJS(ko.unwrap(self.value)))){
self.currentText(newValue?.[currentLanguage.code]?.value || newValue);
}
});
if (ko.isObservable(self.value)) {
self.value.subscribe(newValue => {
const currentLanguage = self.currentLanguage();
if(!currentLanguage) { return; }
if(JSON.stringify(currentValue) != JSON.stringify(ko.toJS(ko.unwrap(self.value)))){
self.currentText(newValue?.[currentLanguage.code]?.value);
}
});
}

self.currentText.subscribe(newValue => {
const currentLanguage = self.currentLanguage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Migration(migrations.Migration):
'bulk-trim-editor',
'base_data_editor.py',
'BulkStringEditor',
'{"bgColor": "#2ecc71", "circleColor": "#51D88C", "show": true}',
'{"bgColor": "#2ecc71", "circleColor": "#51D88C", "show": true, "previewLimit": 5}',
'fa fa-edit',
'bulk-trim-editor'
),
Expand All @@ -39,7 +39,7 @@ class Migration(migrations.Migration):
'bulk-case-editor',
'base_data_editor.py',
'BulkStringEditor',
'{"bgColor": "#7EC8E3", "circleColor": "#AEC6CF", "show": true}',
'{"bgColor": "#7EC8E3", "circleColor": "#AEC6CF", "show": true, "previewLimit": 5}',
'fa fa-edit',
'bulk-case-editor'
),
Expand All @@ -52,7 +52,7 @@ class Migration(migrations.Migration):
'bulk-replace-editor',
'base_data_editor.py',
'BulkStringEditor',
'{"bgColor": "#27ae60", "circleColor": "#51D88C", "show": true}',
'{"bgColor": "#27ae60", "circleColor": "#51D88C", "show": true, "previewLimit": 5}',
'fa fa-edit',
'bulk-replace-editor'
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% load i18n %}

<!-- ko if: coordinateEditing() -->
<div class="card map-coordinate-editor .fixed">
<div class="card map-coordinate-editor" style="display: flex; flex-direction: column">
<div class="map-coordinate-editor-header">
<span data-bind="text: $root.translations.editCoordinates"></span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ <h3 style="margin-top: 0px;">
<!-- /ko -->
<!-- ko if: numberOfTiles() > 0 -->
<h3 style="margin-top: 0px;">
<span data-bind="text: $root.translations.previewCountStats(numberOfTiles()>5?5:numberOfTiles(),numberOfTiles(),numberOfResources())"></span>
<span data-bind="text: $root.translations.previewCountStats(numberOfTiles()>previewLimit()?previewLimit():numberOfTiles(),numberOfTiles(),numberOfResources())"></span>
</h3>
<h3 style="margin-top: 0px;color:red;" data-bind="if: numberOfTiles() > config.updateLimit">
<span style="margin: 2px;" class="fa fa-info-circle"></span><span data-bind="text: $root.translations.bulkEditLimitWarning(config.updateLimit.toLocaleString())"></span>
Expand Down
6 changes: 3 additions & 3 deletions arches/app/templates/views/components/map-editor.htm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h4 class="workbench-card-sidepanel-header" data-bind="click: hideSidePanel, tex
</div>
<div class="workbench-card-sidepanel-border"></div>
<div class="workbench-card-sidepanel-body">
<div data-bind="css: card.model.cssclass">
<div data-bind="css: card.model.cssclass" style="height: 100%">

<!-- ko if: reviewer && provisionalTileViewModel.selectedProvisionalEdit() -->
<div class="edit-message-container" style="margin-left: -16px;">
Expand All @@ -47,7 +47,7 @@ <h4 class="workbench-card-sidepanel-header" data-bind="click: hideSidePanel, tex



<div class="new-provisional-edit-card-container">
<div class="new-provisional-edit-card-container" style="height: inherit">
<!-- ko if: reviewer && provisionalTileViewModel.provisionaledits().length > 0 -->
<!-- ko if: !provisionalTileViewModel.tileIsFullyProvisional() -->
<div class='new-provisional-edits-list' style="margin-right: -20px">
Expand Down Expand Up @@ -101,7 +101,7 @@ <h4 class="workbench-card-sidepanel-header" data-bind="click: hideSidePanel, tex
<button class="btn btn-shim btn-labeled btn-lg fa fa-plus btn-mint" data-bind="css: {
disabled: geoJSONErrors().length !== 0
}, click: updateGeoJSON">
<span data-bind="text: $root.translations.update"></span>
<span data-bind="text: $root.translations.updateFeatures"></span>
</button>
</div>
<!-- ko if: geoJSONErrors().length !== 0 -->
Expand Down
5 changes: 2 additions & 3 deletions arches/app/templates/views/components/map-widget-editor.htm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
{% block sidepanel %}
<!-- ko foreach: { data: [$data], as: 'self' } -->
<!--ko if: activeTab() === 'editor' -->
<div style="height: 95%">
<div class="workbench-card-sidepanel-header-container">
<p class="workbench-card-sidepanel-header h4" tabindex="0" role="button"
data-bind="onEnterkeyClick, onSpaceClick, text: label,
Expand All @@ -30,9 +31,7 @@
"></p>
</div>
<div class="workbench-card-sidepanel-border"></div>

<div>
<div class="new-provisional-edit-card-container">
<div class="new-provisional-edit-card-container" style="height: 100%">
<!-- ko if: geoJSONString() !== undefined -->
<div class="card">
<div class="geojson-editor" data-bind="codemirror: {
Expand Down
2 changes: 1 addition & 1 deletion arches/install/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==4.2.9
Django==4.2.10
psycopg2==2.9.9
urllib3<2
elasticsearch>=8.3.1,<9.0.0
Expand Down
5 changes: 3 additions & 2 deletions releases/6.2.7.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ Arches 6.2.7 release notes

- Fix missing month/year options in search datepicker #10449
- Fix duplicate concepts from appearing in concept select dropdown #10494
- Fix error when adding new resource relations #10383


### Dependency changes:
```
Python:
Upgraded:
None
Django 3.2.23 -> 3.2.24
Added:
None
```
Expand Down Expand Up @@ -50,4 +51,4 @@ Python:
5. If you are running Celery, you should also restart your Celery worker(s). The process for doing this depends on how Celery is being run.
6. **Important**: This version of Arches introduces rate limiting on authentication endpoints to help protect your system. In order to fully take advantage of this feature, you must have your default cache configured using Memcached or Redis. See the Django docs more information on [cache configuration](https://docs.djangoproject.com/en/3.2/topics/cache/#setting-up-the-cache).
6. **Important**: As of version 6.2.6, Arches supports rate limiting on authentication endpoints to help protect your system. In order to fully take advantage of this feature, you must have your default cache configured using Memcached or Redis. See the Django docs more information on [cache configuration](https://docs.djangoproject.com/en/3.2/topics/cache/#setting-up-the-cache).
Loading

0 comments on commit bc93d4a

Please sign in to comment.