Skip to content

Commit

Permalink
fixes merge conflict in changelog, re #10787
Browse files Browse the repository at this point in the history
  • Loading branch information
whatisgalen committed May 7, 2024
2 parents f30292e + 3940c46 commit b6dca52
Show file tree
Hide file tree
Showing 59 changed files with 1,095 additions and 309 deletions.
11 changes: 9 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
[run]
source = arches

[report]
omit =
*/python?.?/*
*/models/migrations/*
*/tests/*
*/settings*.py
*/urls.py
*/wsgi.py
*/celery.py
*/__init__.py

show_missing = true
show_missing = true
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ arches/settings_local.pyc
elasticsearch-5.2.1
virtualenv
arches/app/media/packages
arches/app/media/node_modules
node_modules
40 changes: 32 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,22 @@ jobs:

- 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
echo "Checking for yarn.lock file..."
if [ -f yarn.lock ]; then
echo "Removing yarn.lock due to yarn v1 package resolution issues"
echo "https://github.com/iarna/wide-align/issues/63"
rm yarn.lock
else
echo "yarn.lock not found, skipping remove."
fi
echo "Checking for package.json..."
if [ -f package.json ]; then
echo "package.json found, building static bundle."
yarn && yarn build_test
else
echo "package.json not found, skipping yarn commands."
fi
- name: Check for missing migrations
run: |
Expand Down Expand Up @@ -133,10 +145,22 @@ jobs:

- 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
echo "Checking for yarn.lock file..."
if [ -f yarn.lock ]; then
echo "Removing yarn.lock due to yarn v1 package resolution issues"
echo "https://github.com/iarna/wide-align/issues/63"
rm yarn.lock
else
echo "yarn.lock not found, skipping remove."
fi
echo "Checking for package.json..."
if [ -f package.json ]; then
echo "package.json found, building static bundle."
yarn && yarn build_test
else
echo "package.json not found, skipping yarn commands."
fi
- name: Check for missing migrations
run: |
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ arches/Net_files
.idea
arches/app/media/bower_components
arches/app/media/packages
arches/app/media/node_modules
node_modules
arches/tileserver/cache
docs/_build
Expand Down
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ COPY ./arches/install/package.json ${ARCHES_ROOT}/arches/install/package.json
COPY ./arches/install/.yarnrc ${ARCHES_ROOT}/arches/install/.yarnrc
COPY ./arches/install/yarn.lock ${ARCHES_ROOT}/arches/install/yarn.lock
WORKDIR ${ARCHES_ROOT}/arches/install
RUN mkdir -p ${ARCHES_ROOT}/arches/app/media/node_modules
RUN mkdir -p ${ARCHES_ROOT}/node_modules
RUN yarn install

## Install virtualenv
Expand Down
Empty file.
34 changes: 25 additions & 9 deletions arches/app/etl_modules/bulk_data_deletion.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime
import json
import logging
import pyprind
import uuid
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
Expand Down Expand Up @@ -129,19 +130,34 @@ def get_sample_data(self, nodegroup_id, resourceids):

return sample_data[0:5]

def delete_resources(self, userid, loadid, graphid, resourceids):
def delete_resources(self, userid, loadid, graphid=None, resourceids=None, verbose=False):
result = {"success": False}
user = User.objects.get(id=userid)
deleted_count = 0
user = User.objects.get(id=userid) if userid else {}
try:
if resourceids and graphid:
resources = Resource.objects.filter(graph_id=graphid).filter(pk__in=resourceids)
if resourceids:
resources = Resource.objects.filter(pk__in=resourceids)
elif graphid:
resources = Resource.objects.filter(graph_id=graphid)
elif resourceids:
resources = Resource.objects.filter(pk__in=resourceids)
else:
result["message"] = _("Unable to bulk delete resources as no graphid or resourceids specified.")
result["deleted_count"] = 0
return result

deleted_count = resources.count()

if verbose is True:
bar = pyprind.ProgBar(deleted_count)
for resource in resources.iterator(chunk_size=2000):
resource.delete(user=user, index=False, transaction_id=loadid)
if verbose is True:
bar.update()

if verbose is True:
print(bar)
result["success"] = True
result["deleted_count"] = deleted_count
result["message"] = _("Successfully deleted {} resources").format(str(deleted_count))
except Exception as e:
logger.exception(e)
result["message"] = _("Unable to delete resources: {}").format(str(e))
Expand All @@ -168,7 +184,7 @@ def delete_tiles(self, userid, loadid, nodegroupid, resourceids):

return result

def index_resource_deletion(self, loadid, resourceids):
def index_resource_deletion(self, loadid, resourceids=None):
if not resourceids:
with connection.cursor() as cursor:
cursor.execute(
Expand Down Expand Up @@ -288,7 +304,7 @@ def run_bulk_task(self, userid, loadid, graph_id, nodegroup_id, resourceids):
if nodegroup_id:
deleted = self.delete_tiles(userid, loadid, nodegroup_id, resourceids)
elif graph_id or resourceids:
deleted = self.delete_resources(userid, loadid, graph_id, resourceids)
deleted = self.delete_resources(userid, loadid, graphid=graph_id, resourceids=resourceids)

with connection.cursor() as cursor:
if deleted["success"]:
Expand Down Expand Up @@ -341,7 +357,7 @@ def run_bulk_task(self, userid, loadid, graph_id, nodegroup_id, resourceids):
if nodegroup_id:
self.index_tile_deletion(loadid)
else:
self.index_resource_deletion(loadid, resourceids)
self.index_resource_deletion(loadid, resourceids=resourceids)
except Exception as e:
logger.exception(e)
with connection.cursor() as cursor:
Expand Down
2 changes: 1 addition & 1 deletion arches/app/media/css/abstracts/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// to this list, ordered by width. For examples: (mobile, tablet, desktop).
// $mq-show-breakpoints: (mobile, mobileLandscape, tablet, desktop, wide);

//@import '../../node_modules/sass-mq/mq.import';
//@import url(node_modules/sass-mq/mq.import);

/// Responsive breakpoint manager
/// @access public
Expand Down
6 changes: 4 additions & 2 deletions arches/app/media/css/arches.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9662,11 +9662,13 @@ ul.pagination {

.search-listing-footer {
display: flex;
height: 40px;
height: fit-content;
font-size: 1.1rem;
padding: 10px 10px 0px 10px;
padding: 10px 10px 10px 10px;
background: #f5f5f5;
border-top: 1px solid #ddd;
flex-flow: row wrap;
row-gap: 10px;

a {
margin-top: -5px;
Expand Down
12 changes: 6 additions & 6 deletions arches/app/media/js/viewmodels/provisional-tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ define([
if (self.selectedProvisionalEdit() != val) {
self.selectedProvisionalEdit(val);
koMapping.fromJS(val['value'], self.selectedTile().data);
self.selectedTile()._tileData.valueHasMutated();
self.selectedTile().parent.params.handlers['tile-reset'].forEach(handler => handler(self.selectedTile()));
self.selectedTile().parent.widgets().forEach(
function(w){
var defaultconfig = w.widgetLookup[w.widget_id()].defaultconfig;
if (JSON.parse(defaultconfig).rerender === true && self.selectedTile().parent.allowProvisionalEditRerender() === true) {
self.selectedTile().parent.widgets()[0].label.valueHasMutated();
if (defaultconfig.rerender === true && self.selectedTile().parent.allowProvisionalEditRerender() === true) {
w.label.valueHasMutated();
}
if (self.selectedTile().parent.triggerUpdate) {
self.selectedTile().parent.triggerUpdate();
}
});
if (self.selectedTile().parent.triggerUpdate) {
self.selectedTile().parent.triggerUpdate();
}
}
};

Expand Down
1 change: 1 addition & 0 deletions arches/app/media/js/viewmodels/tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ define([
_.extend(this, {
filter: filter,
parent: params.card,
handlers: params.handlers,
userisreviewer: params.userisreviewer,
cards: _.filter(params.cards, function(card) {
var nodegroup = _.find(ko.unwrap(params.graphModel.get('nodegroups')), function(group) {
Expand Down
18 changes: 9 additions & 9 deletions arches/app/models/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from arches.app.models.resource import Resource, UnpublishedModelError
from arches.app.models.system_settings import settings
from arches.app.datatypes.datatypes import DataTypeFactory
from arches.app.etl_modules.bulk_data_deletion import BulkDataDeletion
from arches.app.utils.betterJSONSerializer import JSONSerializer, JSONDeserializer
from arches.app.search.search_engine_factory import SearchEngineFactory
from arches.app.utils.i18n import LanguageSynchronizer
Expand Down Expand Up @@ -563,19 +564,18 @@ def delete(self):
)
)

def delete_instances(self, verbose=False):
def delete_instances(self, userid=None, verbose=False):
"""
deletes all associated resource instances
"""
if verbose is True:
bar = pyprind.ProgBar(Resource.objects.filter(graph_id=self.graphid).count())
for resource in Resource.objects.filter(graph_id=self.graphid):
resource.delete()
if verbose is True:
bar.update()
if verbose is True:
print(bar)

bulk_deleter = BulkDataDeletion()
loadid = uuid.uuid4()
resp = bulk_deleter.delete_resources(userid, loadid, graphid=self.graphid, verbose=verbose)
bulk_deleter.index_resource_deletion(loadid)

return resp

def get_tree(self, root=None):
"""
Expand Down
5 changes: 4 additions & 1 deletion arches/app/models/migrations/9191_string_nonlocalized.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ class Migration(migrations.Migration):
"maxLength": null,
"uneditable": false,
"placeholder": "Enter text",
"defaultValue": ""
"defaultValue": "",
"i18n_properties": [
"placeholder"
]
}'
) ON CONFLICT DO NOTHING;
""",
Expand Down
11 changes: 6 additions & 5 deletions arches/app/views/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,13 @@ def delete(self, request, graphid):
elif self.action == "delete_instances":
try:
graph = Graph.objects.get(graphid=graphid)
graph.delete_instances()
resp = graph.delete_instances(userid=request.user.id)
success = resp["success"]
return JSONResponse(
{
"success": True,
"message": "All the resources associated with the Model '{0}' have been successfully deleted.".format(graph.name),
"title": "Resources Successfully Deleted.",
"success": resp["success"],
"message": resp["message"],
"title": f"Resources {'Successfully' if success else 'Unsuccessfully'} Deleted from {graph.name}.",
}
)
except GraphValidationError as e:
Expand All @@ -485,7 +486,7 @@ def delete(self, request, graphid):
try:
graph = Graph.objects.get(graphid=graphid)
if graph.isresource:
graph.delete_instances()
graph.delete_instances(userid=request.user.id)
graph.delete()
return JSONResponse({"success": True})
except GraphValidationError as e:
Expand Down
2 changes: 1 addition & 1 deletion arches/install/arches-admin
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ArchesProjectCommand(TemplateCommand):
# need to manually replace instances of {{ project_name }} in some files
path_to_project = os.path.join(target) if target else os.path.join(os.getcwd(), project_name)

for relative_file_path in [".yarnrc", "pyproject.toml"]: # relative to app root directory
for relative_file_path in ['.coveragerc', "pyproject.toml"]: # relative to app root directory
file = open(os.path.join(path_to_project, relative_file_path),'r')
file_data = file.read()
file.close()
Expand Down
2 changes: 1 addition & 1 deletion arches/install/arches-project
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class ArchesCommand(TemplateCommand):
# need to manually replace instances of {{ project_name }} in some files
path_to_project = os.path.join(target) if target else os.path.join(os.getcwd(), project_name)

for relative_file_path in [".yarnrc", "pyproject.toml"]: # relative to app root directory
for relative_file_path in ['.coveragerc', "pyproject.toml"]: # relative to app root directory
file = open(os.path.join(path_to_project, relative_file_path),'r')
file_data = file.read()
file.close()
Expand Down
15 changes: 15 additions & 0 deletions arches/install/arches-templates/.coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[run]
source =
{{ project_name }}/

omit =
*/python?.?/*
*/models/migrations/*
*/settings*.py
*/urls.py
*/wsgi.py
*/celery.py
*/__init__.py

[report]
show_missing = true
Loading

0 comments on commit b6dca52

Please sign in to comment.