Skip to content

Commit

Permalink
fixes merge conflict in release file for 7.6, re #10781
Browse files Browse the repository at this point in the history
  • Loading branch information
whatisgalen committed Apr 28, 2024
2 parents 170a2e0 + 6816d8a commit 16f941d
Show file tree
Hide file tree
Showing 37 changed files with 2,014 additions and 115 deletions.
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
omit =
*/python?.?/*
*/models/migrations/*
*/tests/*

show_missing = true
754 changes: 754 additions & 0 deletions .git-blame-ignore-revs

Large diffs are not rendered by default.

30 changes: 26 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,36 @@


### Issues Solved
<!--- If this Pull Request solves any issues, please list them here -->
#
<!--- If this Pull Request solves any issues, list them here, and mark the ticket "In Review" in the pipeline project -->
Closes #

### Checklist
<!--- Put an `x` in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code. -->
- I targeted one of these branches:
- [ ] dev/7.6.x (under development): features, bugfixes not covered below
- [ ] dev/7.5.x (main support): regressions, crashing bugs, security issues, major bugs in new features
- [ ] dev/6.2.x (extended support): major security issues, data loss issues
- [ ] I added a changelog in arches/releases
- [ ] I submitted a PR to arches-docs (if appropriate)
- [ ] Unit tests pass locally with my changes
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] I have added necessary documentation (if appropriate)
- [ ] I added tests that prove my fix is effective or that my feature works
- [ ] My test fails on the target branch

#### Accessibility Checklist
<!-- If your changes impacted the following areas, mark the appropriate columns. -->
[Developer Guide](https://arches.readthedocs.io/en/stable/developing/advanced/accessibility/)

| Topic | Changed | Retested |
| ---------------- | ------- | -------- |
| Color contrast | | |
| Form fields | | |
| Headings | | |
| Links | | |
| Keyboard | | |
| Responsive Design| | |
| HTML validation | | |
| Screen reader | | |


#### Ticket Background
* Sponsored by: <!--- Who is funding this effort? Getty Conservation Institute|Self Funded -->
Expand Down
144 changes: 138 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ on:
workflow_dispatch:

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

services:
postgres:
image: postgis/postgis:13-3.0
env:
POSTGRES_PASSWORD: postgis
POSTGRES_DB: arches
POSTGRES_DB: ${{ github.event.repository.name }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
Expand All @@ -25,6 +26,7 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -41,10 +43,89 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install .
pip install -r arches/install/requirements.txt
pip install -r arches/install/requirements_dev.txt
pip install -r ${{ github.event.repository.name }}/install/requirements.txt
pip install -r ${{ github.event.repository.name }}/install/requirements_dev.txt
echo Python packages installed
- uses: ankane/setup-elasticsearch@v1
with:
elasticsearch-version: 8

- name: Webpack frontend files
run: |
echo "Removing yarn.lock due to yarn v1 package resolution issues"
echo "https://github.com/iarna/wide-align/issues/63"
rm yarn.lock
yarn && yarn build_test
- name: Check for missing migrations
run: |
python manage.py makemigrations --check
- name: Ensure previous coverage data is erased
run: |
coverage erase
- name: Run unit tests
run: |
python -W default::DeprecationWarning -m coverage run manage.py test tests --settings="tests.test_settings"
- name: Generate report coverage
run: |
coverage report
coverage json
mv coverage.json feature_branch_coverage.json
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: feature-branch-coverage-report
path: feature_branch_coverage.json
overwrite: true

build_target_branch:
runs-on: ubuntu-latest

services:
postgres:
image: postgis/postgis:13-3.0
env:
POSTGRES_PASSWORD: postgis
POSTGRES_DB: ${{ github.event.repository.name }}
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

strategy:
fail-fast: false
matrix:
# python-version: ["3.10", "3.11", "3.12"]
python-version: ["3.12"]

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.ref }}

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
check-latest: true

- name: Install Java, GDAL, and other system dependencies
run: |
sudo apt update
sudo apt-get install libxml2-dev libpq-dev openjdk-8-jdk libgdal-dev libxslt-dev
echo Postgres and ES dependencies installed
- name: Install python packages
run: |
python -m pip install --upgrade pip
pip install .
pip install -r ${{ github.event.repository.name }}/install/requirements.txt
pip install -r ${{ github.event.repository.name }}/install/requirements_dev.txt
echo Python packages installed
- uses: ankane/setup-elasticsearch@v1
with:
Expand All @@ -61,10 +142,61 @@ jobs:
run: |
python manage.py makemigrations --check
- name: Run Arches unit tests
- name: Ensure previous coverage data is erased
run: |
coverage erase
- name: Run unit tests
run: |
python -W default::DeprecationWarning -m coverage run manage.py test tests --settings="tests.test_settings"
- name: Report coverage
- name: Generate report coverage
run: |
coverage report
coverage json
mv coverage.json target_branch_coverage.json
- name: Upload coverage report as artifact
uses: actions/upload-artifact@v4
with:
name: target-branch-coverage-report
path: target_branch_coverage.json
overwrite: true

check_coverage:
runs-on: ubuntu-latest
needs: [build_feature_branch, build_target_branch]
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x' # Use the latest available version
check-latest: true

- name: Download feature branch coverage report artifact
uses: actions/download-artifact@v4
with:
name: feature-branch-coverage-report
path: .

- name: Download target branch coverage report artifact
uses: actions/download-artifact@v4
with:
name: target-branch-coverage-report
path: .

- name: Compare coverage with baseline
if: github.event_name == 'pull_request'
run: |
feature_branch_coverage=$(cat feature_branch_coverage.json | grep -o '"totals": {[^}]*' | grep -o '"percent_covered": [0-9.]*' | awk -F ': ' '{print $2}')
target_branch_coverage=$(cat target_branch_coverage.json | grep -o '"totals": {[^}]*' | grep -o '"percent_covered": [0-9.]*' | awk -F ': ' '{print $2}')
# Compare current coverage with baseline coverage using floating-point comparison
if awk -v feature="$feature_branch_coverage" -v target="$target_branch_coverage" 'BEGIN { exit (feature < target) ? 0 : 1 }'; then
echo "Coverage decreased from $target_branch_coverage% to $feature_branch_coverage%"
exit 1
else
echo "Feature branch coverage ($feature_branch_coverage%) >= Target branch coverage ($target_branch_coverage%)."
fi
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ arches/settings_local.py
tests/settings_local.py
arches/logs/authority_file_errors.txt
.coverage
coverage.*
arches.log
.atom-build.json
.atom-build.yml
Expand Down Expand Up @@ -40,7 +41,6 @@ djcp.sh
pip-wheel-metadata
.eggs
*.code-workspace
coverage.xml
webpack-stats.json
.DS_STORE
CACHE
CACHE
4 changes: 2 additions & 2 deletions 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.1 release notes](https://github.com/archesproject/arches/blob/stable/7.5.0/releases/7.5.1.md)
[Version 7.5.2 release notes](https://github.com/archesproject/arches/blob/stable/7.5.2/releases/7.5.2.md)

#### Quick Install

Expand Down Expand Up @@ -61,7 +61,7 @@ Our general release cycle will typically be a functional release (either major i

#### Feature roadmap

The following a general plan for the Arches project. Be aware this plan is tentative and subject to change
The following a general plan for the Arches project. Be aware this plan is tentative and subject to change.

## 7.6 LTS - Release date: Sept 15, 2024
- Arches Application improvements
Expand Down
2 changes: 1 addition & 1 deletion arches/app/datatypes/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2123,7 +2123,7 @@ def i18n_as_sql(self, i18n_json_field, compiler, connection):

sql = i18n_json_field.attname
for prop, value in i18n_json_field.raw_value.items():
escaped_value = json.dumps(value).replace("%", "%%")
escaped_value = json.dumps(value).replace("%", "%%").replace("'", "''")
if prop == "options":
sql = f"""
__arches_i18n_update_jsonb_array('options.text', '{{"options": {escaped_value}}}', {sql}, '{i18n_json_field.lang}')
Expand Down
27 changes: 26 additions & 1 deletion arches/app/datatypes/url.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ class URLDataType(BaseDataType):

def validate(self, value, row_number=None, source=None, node=None, nodeid=None, strict=False, **kwargs):
errors = []

if value is not None:
try:
if value.get("url") is not None:
if value.get("url"):
# check URL conforms to URL structure
url_test = self.URL_REGEX.match(value["url"])
if url_test is None:
Expand All @@ -82,6 +83,14 @@ def validate(self, value, row_number=None, source=None, node=None, nodeid=None,
title = _("Invalid HTTP/HTTPS URL")
error_message = self.create_error_message(value, source, row_number, message, title)
errors.append(error_message)

# raise error if label added without URL (#10592)
if value.get("url_label") and not value.get("url"):
message = _("URL label cannot be saved without a URL")
title = _("No URL added")
error_message = self.create_error_message(value, source, row_number, message, title)
errors.append(error_message)

return errors

def transform_value_for_tile(self, value, **kwargs):
Expand Down Expand Up @@ -257,3 +266,19 @@ def default_es_mapping(self):
},
}
}

def pre_tile_save(self, tile, nodeid):
if (tile_val := tile.data[nodeid]) and "url_label" not in tile_val:
tile_val["url_label"] = ""

def clean(self, tile, nodeid):
if (data := tile.data[nodeid]):
try:
if not any([val.strip() for val in data.values()]):
tile.data[nodeid] = None
except:
pass # Let self.validate handle malformed data

def pre_structure_tile_data(self, tile, nodeid, **kwargs):
if (tile_val := tile.data[nodeid]) and "url_label" not in tile_val:
tile_val["url_label"] = ""
1 change: 1 addition & 0 deletions arches/app/etl_modules/save.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def save_to_tiles(userid, loadid):
finally:
log_event_details(cursor, loadid, "done|Reenabling the triggers in the tile table...")
cursor.execute("""
COMMIT;
ALTER TABLE TILES ENABLE TRIGGER __arches_check_excess_tiles_trigger;
ALTER TABLE TILES ENABLE TRIGGER __arches_trg_update_spatial_attributes;
""")
Expand Down
6 changes: 6 additions & 0 deletions arches/app/media/css/tree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@
margin-right: -2px;
}
}

.unsaved-edit {
background: #ffdb70;
color: #fff;
border-width: 2px;
}

a.tree-display-tool {
margin: 0px;
Expand Down
6 changes: 6 additions & 0 deletions arches/app/media/js/viewmodels/node-value-select.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ define([
initSelection: function(element, callback) {
var id = $(element).val();
var tiles = self.tiles();

// fixes #10027 where inputted values will be reset after navigating away
if (self.value()) {
id = self.value();
}

if (id !== "") {
var setSelection = function(tiles, callback) {
var selection = _.find(tiles, function(tile) {
Expand Down
10 changes: 10 additions & 0 deletions arches/app/media/js/views/components/cards/photo-gallery-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,16 @@ define([

this.fileListNodeId = getfileListNode();

this.maxFilesize = ko.computed(function(){
var mfs = "Missing maxFilesize";
self.card.widgets().forEach(function(widget){
if (widget.node_id() === self.fileListNodeId) {
mfs = widget.config.maxFilesize() || "--";
}
});
return mfs;
});

this.cleanUrl = function(url) {
const httpRegex = /^https?:\/\//;
return !url || httpRegex.test(url) || url.startsWith(arches.urls.url_subpath) ? url :
Expand Down
4 changes: 4 additions & 0 deletions arches/app/media/js/views/components/widgets/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ define([

});

if (self.currentDefaultText() === "") {
self.defaultValue("");
}

};

return ko.components.register('text-widget', {
Expand Down
Loading

0 comments on commit 16f941d

Please sign in to comment.