diff --git a/designsafe/apps/api/tasks.py b/designsafe/apps/api/tasks.py index 6247dcc57..7df8fa2bc 100644 --- a/designsafe/apps/api/tasks.py +++ b/designsafe/apps/api/tasks.py @@ -670,6 +670,8 @@ def amend_publication_data(self, project_id, amendments=None, authors=None, revi from designsafe.apps.projects.managers import publication as PublicationManager from designsafe.libs.fedora.fedora_operations import amend_project_fedora, ingest_project_experimental from designsafe.libs.fedora.sim_operations import ingest_project_sim + from designsafe.libs.fedora.fr_operations import ingest_project_fr + from designsafe.libs.fedora.hyb_sim_operations import ingest_project_hyb_sim try: amended_pub = PublicationManager.amend_publication(project_id, amendments, authors, revision) PublicationManager.amend_datacite_doi(amended_pub) @@ -680,6 +682,10 @@ def amend_publication_data(self, project_id, amendments=None, authors=None, revi ingest_project_experimental(project_id, version=revision, amend=True) if amended_pub.project.value.projectType == 'simulation': ingest_project_sim(project_id, version=revision, amend=True) + if amended_pub.project.value.projectType == 'hybrid_simulation': + ingest_project_hyb_sim(project_id, version=revision, amend=True) + if amended_pub.project.value.projectType == 'field_recon': + ingest_project_fr(project_id, version=revision, amend=True) except Exception as exc: logger.error('Proj Id: %s. %s', project_id, exc, exc_info=True) raise self.retry(exc=exc) @@ -780,41 +786,14 @@ def save_to_fedora(self, project_id, revision=None): from designsafe.libs.fedora.sim_operations import ingest_project_sim ingest_project_sim(project_id, version=revision) return - - _root = os.path.join('/corral-repl/tacc/NHERI/published', project_id) - fedora_base = 'http://fedoraweb01.tacc.utexas.edu:8080/fcrepo/rest/publications_01' - res = requests.get(fedora_base) - if res.status_code == 404 or res.status_code == 410: - requests.put(fedora_base) - - fedora_project_base = ''.join([fedora_base, '/', project_id]) - res = requests.get(fedora_project_base) - if res.status_code == 404 or res.status_code == 410: - requests.put(fedora_project_base) - - headers = {'Content-Type': 'text/plain'} - #logger.debug('walking: %s', _root) - for root, dirs, files in os.walk(_root): - for name in files: - mime = magic.Magic(mime=True) - headers['Content-Type'] = mime.from_file(os.path.join(root, name)) - #files - full_path = os.path.join(root, name) - _path = full_path.replace(_root, '', 1) - _path = _path.replace('[', '-') - _path = _path.replace(']', '-') - url = ''.join([fedora_project_base, urllib.parse.quote(_path)]) - #logger.debug('uploading: %s', url) - with open(os.path.join(root, name), 'rb') as _file: - requests.put(url, data=_file, headers=headers) - - for name in dirs: - #dirs - full_path = os.path.join(root, name) - _path = full_path.replace(_root, '', 1) - url = ''.join([fedora_project_base, _path]) - #logger.debug('creating: %s', _path) - requests.put(url) + if pub.project.value.projectType == 'hybrid_simulation': + from designsafe.libs.fedora.hyb_sim_operations import ingest_project_hyb_sim + ingest_project_hyb_sim(project_id, version=revision) + return + if pub.project.value.projectType == 'field_recon': + from designsafe.libs.fedora.fr_operations import ingest_project_fr + ingest_project_fr(project_id, version=revision) + return except Exception as exc: logger.error('Proj Id: %s. %s', project_id, exc) diff --git a/designsafe/apps/projects/managers/publication.py b/designsafe/apps/projects/managers/publication.py index 11d716d0c..88d6476a8 100644 --- a/designsafe/apps/projects/managers/publication.py +++ b/designsafe/apps/projects/managers/publication.py @@ -252,10 +252,9 @@ def draft_publication( def amend_publication(project_id, amendments=None, authors=None, revision=None): """Amend a Publication - Update Amendable fields on a publication and the corrosponding DataCite + Update Amendable fields on a publication and the corresponding DataCite records. These changes do not produce a new version of a publication, but - they do allow for limited changes to a published project. This is currently - configured to support "Other" publications only. + they do allow for limited changes to a published project. :param str project_id: Project uuid to amend :param int revision: Revision number to amend diff --git a/designsafe/libs/fedora/fedora_operations.py b/designsafe/libs/fedora/fedora_operations.py index 0320e8582..ee5bf4028 100644 --- a/designsafe/libs/fedora/fedora_operations.py +++ b/designsafe/libs/fedora/fedora_operations.py @@ -114,6 +114,9 @@ }, "influenced": { "@id": "https://www.w3.org/TR/2013/REC-prov-o-20130430/#influenced" + }, + "Influence": { + "@id": "https://www.w3.org/TR/2013/REC-prov-o-20130430/#Influence" } } @@ -297,8 +300,10 @@ def format_metadata_for_fedora(project_id, version=None): def generate_manifest_other(project_id, version=None): + fido_client = Fido() doc = IndexedPublication.from_id(project_id, revision=version) uuid = doc.project.uuid + file_tags = getattr(doc.project.value, 'fileTags', []) if version: project_id = '{}v{}'.format(project_id, str(version)) @@ -306,10 +311,15 @@ def generate_manifest_other(project_id, version=None): archive_path = os.path.join(PUBLICATIONS_MOUNT_ROOT, project_id) for path in get_child_paths(archive_path): + rel_path = os.path.relpath(path, archive_path) + + tags = filter(lambda t: t['path'].strip('/') == rel_path.strip('/'), file_tags) manifest.append({ 'parent_entity': uuid, 'corral_path': path, - 'checksum': get_sha1_hash(path) + 'checksum': get_sha1_hash(path), + 'tags': [t['tagName'] for t in tags], + 'ffi': get_fido_output(fido_client, path) }) return manifest @@ -411,7 +421,8 @@ def walk_experimental(project_id, version=None): 'uuid': doc.project.uuid, 'container_path': project_id, 'fedora_mapping': {**project_meta, 'generated': [], 'license': None}, - 'fileObjs': [] + 'fileObjs': [], + 'fileTags': [] } experiments_list = doc.experimentsList @@ -426,7 +437,8 @@ def walk_experimental(project_id, version=None): 'uuid': expt.uuid, 'container_path': expt_container_path, 'fedora_mapping': {**format_experiment(expt), 'license': license, 'wasGeneratedBy': project_id, 'generated': []}, - 'fileObjs': expt.fileObjs + 'fileObjs': expt.fileObjs, + 'fileTags': getattr(expt.value, 'fileTags', []), } full_author_list += experiment_map['fedora_mapping']['creator'] @@ -443,6 +455,7 @@ def walk_experimental(project_id, version=None): report_map = { 'uuid': report.uuid, 'fileObjs': report.fileObjs, + 'fileTags': getattr(report.value, 'fileTags', []), 'container_path': report_container_path, 'fedora_mapping': {**format_report(report), 'wasGeneratedBy': 'Experiment: {}'.format(exp_doi)} } @@ -460,6 +473,7 @@ def walk_experimental(project_id, version=None): analysis_map = { 'uuid': analysis.uuid, 'fileObjs': analysis.fileObjs, + 'fileTags': getattr(analysis.value, 'fileTags', []), 'container_path': analysis_container_path, 'fedora_mapping': {**format_analysis(analysis), 'wasGeneratedBy': 'Experiment: {}'.format(exp_doi)} @@ -478,6 +492,7 @@ def walk_experimental(project_id, version=None): mc_map = { 'uuid': mc.uuid, 'fileObjs': mc.fileObjs, + 'fileTags': getattr(mc.value, 'fileTags', []), 'container_path': configs_container_path, 'fedora_mapping': {**format_model_config(mc), 'wasGeneratedBy': exp_doi} } @@ -494,6 +509,7 @@ def walk_experimental(project_id, version=None): sl_map = { 'uuid': sl.uuid, 'fileObjs': sl.fileObjs, + 'fileTags': getattr(sl.value, 'fileTags', []), 'container_path': sl_container_path, 'fedora_mapping': {**format_sensor_info(sl), 'wasGeneratedBy': 'Experiment: {}'.format(exp_doi), @@ -514,6 +530,7 @@ def walk_experimental(project_id, version=None): event_map = { 'uuid': event.uuid, 'fileObjs': event.fileObjs, + 'fileTags': getattr(event.value, 'fileTags', []), 'container_path': evt_container_path, 'fedora_mapping': {**format_event(event), 'wasGeneratedBy': 'Experiment: {}'.format(exp_doi), @@ -667,27 +684,36 @@ def generate_manifest(walk_result, project_id, version=None): archive_path = os.path.join(PUBLICATIONS_MOUNT_ROOT, project_id) for entity in walk_result: file_objs = entity['fileObjs'] + file_tags = entity.get('fileTags', []) for file in file_objs: + + file_path = os.path.join(archive_path, file['path'].strip('/')) rel_path = os.path.join(parse.unquote(entity['container_path']), file['path'].strip('/')) if file['type'] == 'dir': for path in get_child_paths(file_path): + tag_path = os.path.relpath(path, archive_path) + tags = filter(lambda t: t['path'].strip('/') == tag_path.strip('/'), file_tags) + manifest.append({ 'parent_entity': entity['uuid'], 'corral_path': path, 'project_path': path.replace(file_path, rel_path, 1), 'checksum': get_sha1_hash(path), + 'tags': [t['tagName'] for t in tags], 'ffi': get_fido_output(fido_client, path) }) else: + tags = filter(lambda t: t['path'] == file['path'], file_tags) manifest.append({ 'parent_entity': entity['uuid'], 'corral_path': file_path, 'project_path': rel_path, 'checksum': get_sha1_hash(file_path), + 'tags': [t['tagName'] for t in tags], 'ffi': get_fido_output(fido_client, file_path) }) diff --git a/designsafe/libs/fedora/fr_operations.py b/designsafe/libs/fedora/fr_operations.py index 8149959b4..111e49577 100644 --- a/designsafe/libs/fedora/fr_operations.py +++ b/designsafe/libs/fedora/fr_operations.py @@ -45,7 +45,8 @@ def walk_fr(project_id, version=None): 'uuid': doc.project.uuid, 'container_path': project_id, 'fedora_mapping': {**project_meta, 'generated': [], 'license': None}, - 'fileObjs': [] + 'fileObjs': [], + 'fileTags': [] } docs_list = getattr(doc, 'reports', []) @@ -60,7 +61,8 @@ def walk_fr(project_id, version=None): 'uuid': document.uuid, 'container_path': doc_container_path, 'fedora_mapping': {**format_docs(document), 'license': license, 'wasGeneratedBy': project_id, 'generated': [], 'hasVersion': version}, - 'fileObjs': document.fileObjs + 'fileObjs': document.fileObjs, + 'fileTags': getattr(document.value, 'fileTags', []), } relation_map.append(doc_map) @@ -77,7 +79,8 @@ def walk_fr(project_id, version=None): 'uuid': mission.uuid, 'container_path': mission_container_path, 'fedora_mapping': {**format_mission(mission), 'license': license, 'wasGeneratedBy': project_id, 'generated': [], 'hasVersion': version}, - 'fileObjs': [] + 'fileObjs': [], + 'fileTags': getattr(mission.value, 'fileTags', []), } @@ -93,6 +96,7 @@ def walk_fr(project_id, version=None): collection_map = { 'uuid': collection.uuid, 'fileObjs': collection.fileObjs, + 'fileTags': getattr(collection.value, 'fileTags', []), 'container_path': collection_container_path, 'fedora_mapping': {**format_geo(collection), 'wasGeneratedBy': 'Mission: {}'.format(mission_doi)} } @@ -110,6 +114,7 @@ def walk_fr(project_id, version=None): collection_map = { 'uuid': geo_collection.uuid, 'fileObjs': geo_collection.fileObjs, + 'fileTags': getattr(geo_collection.value, 'fileTags', []), 'container_path': geo_container_path, 'fedora_mapping': {**format_geo(geo_collection), 'wasGeneratedBy': 'Mission: {}'.format(mission_doi)} } @@ -127,6 +132,7 @@ def walk_fr(project_id, version=None): collection_map = { 'uuid': soc_collection.uuid, 'fileObjs': soc_collection.fileObjs, + 'fileTags': getattr(soc_collection.value, 'fileTags', []), 'container_path': soc_container_path, 'fedora_mapping': {**format_soc(soc_collection), 'wasGeneratedBy': 'Mission: {}'.format(mission_doi)} } @@ -144,6 +150,7 @@ def walk_fr(project_id, version=None): collection_map = { 'uuid': planning_coll.uuid, 'fileObjs': planning_coll.fileObjs, + 'fileTags': getattr(planning_coll.value, 'fileTags', []), 'container_path': planning_container_path, 'fedora_mapping': {**format_planning(planning_coll), 'wasGeneratedBy': 'Mission: {}'.format(mission_doi)} } diff --git a/designsafe/libs/fedora/hyb_sim_operations.py b/designsafe/libs/fedora/hyb_sim_operations.py new file mode 100644 index 000000000..3775e454d --- /dev/null +++ b/designsafe/libs/fedora/hyb_sim_operations.py @@ -0,0 +1,421 @@ +import requests +from requests import HTTPError +from django.conf import settings +import json +import magic +import os +import hashlib +from urllib import parse +from io import StringIO +from requests.adapters import HTTPAdapter +from requests.packages.urllib3.util.retry import Retry +from designsafe.apps.data.models.elasticsearch import IndexedPublication +from django.contrib.auth import get_user_model +from designsafe.apps.api.publications.operations import _get_user_by_username +from designsafe.libs.fedora.fedora_operations import format_metadata_for_fedora, fedora_post, fedora_update, create_fc_version, upload_manifest, generate_manifest +import logging +logger = logging.getLogger(__name__) + +def walk_hyb_sim(project_id, version=None): + """ + Walk an experimental project and reconstruct parent/child relationships + + Params + ------ + project_id: Project ID to look up (e.g. PRJ-1234) + + Returns + ------- + dict: dict in form {'uuid-ex-1': + {'children': ['title of child 1', ...], + 'parent': 'title of parent', + 'container_path': 'path/relative/to/fcroot', + 'fedora_mapping': {}}} + """ + from urllib import parse + doc = IndexedPublication.from_id(project_id, revision=version) + + relation_map = [] + + project_meta = format_metadata_for_fedora(project_id, version=version) + if version: + project_id = '{}v{}'.format(project_id, str(version)) + license = project_meta.get('license', None) + + project_map = { + 'uuid': doc.project.uuid, + 'container_path': project_id, + 'fedora_mapping': {**project_meta, 'generated': [], 'license': None}, + 'fileObjs': [], + 'fileTags': [] + } + + + + hybrid_sim_list = getattr(doc, 'hybrid_simulations', []) + for hyb_sim in hybrid_sim_list: + # Do stuff with hyb sim. + hyb_sim_container_path = "{}/{}".format(project_id, parse.quote(hyb_sim.value.title)) + print('hybrid sim ' + hyb_sim.value.title) + hyb_sim_doi = hyb_sim.doi + project_map['fedora_mapping']['generated'].append('Hybrid Simulation: {}'.format(hyb_sim_doi)) + + hyb_sim_map = { + 'uuid': hyb_sim.uuid, + 'container_path': hyb_sim_container_path, + 'fedora_mapping': {**format_hyb_sim(hyb_sim), 'license': license, 'wasGeneratedBy': project_id, 'generated': [], 'hasVersion': version}, + 'fileObjs': [], + 'fileTags': [] + } + + reports_list = filter( + lambda report: hyb_sim.uuid in report.value.hybridSimulations, + getattr(doc, 'reports', [])) + for report in reports_list: + # Do stuff with report. + report_container_path = "{}/{}".format(project_id, parse.quote(report.value.title)) + print('\treport ' + report.value.title) + project_map['fedora_mapping']['generated'].append('Report: {}'.format(report.value.title)) + + report_map = { + 'uuid': report.uuid, + 'container_path': report_container_path, + 'fedora_mapping': {**format_report(report), 'wasGeneratedBy': 'Hybrid Simulation: {}'.format(hyb_sim_doi)}, + 'fileObjs': report.fileObjs, + 'fileTags': getattr(report.value, 'fileTags', []) + } + + relation_map.append(report_map) + + + analysis_list = filter( + lambda analysis: hyb_sim.uuid in analysis.value.hybridSimulations, + getattr(doc, 'analysiss', [])) + for analysis in analysis_list: + # Do stuff with analysis. + analysis_container_path = "{}/{}".format(project_id, parse.quote(analysis.value.title)) + print('analysis ' + analysis.value.title) + project_map['fedora_mapping']['generated'].append('Analysis: {}'.format(analysis.value.title)) + + analysis_map = { + 'uuid': report.uuid, + 'container_path': analysis_container_path, + 'fedora_mapping': {**format_report(analysis), 'wasGeneratedBy': 'Hybrid Simulation: {}'.format(hyb_sim_doi)}, + 'fileObjs': analysis.fileObjs, + 'fileTags': getattr(analysis.value, 'fileTags', []) + } + + relation_map.append(analysis_map) + + + global_model_list = filter( + lambda global_model: hyb_sim.uuid in global_model.value.hybridSimulations, + getattr(doc, 'global_models', [])) + for global_model in global_model_list: + # Do stuff with global model. + global_model_container_path = "{}/{}".format(hyb_sim_container_path, parse.quote(global_model.value.title)) + print('\tGlobal Model ' + global_model.value.title) + hyb_sim_map['fedora_mapping']['generated'].append('Global Model: {}'.format(global_model.value.title)) + + global_model_map = { + 'uuid': global_model.uuid, + 'fileObjs': global_model.fileObjs, + 'fileTags': getattr(global_model.value, 'fileTags', []), + 'container_path': global_model_container_path, + 'fedora_mapping': {**format_global_modal(global_model), 'wasGeneratedBy': 'Hybrid Simulation: {}'.format(hyb_sim_doi)} + } + + + coordinator_list = filter( + lambda coordinator: global_model.uuid in coordinator.value.globalModels, + getattr(doc, 'coordinators', [])) + for coordinator in coordinator_list: + # Do stuff with coordinator. + coordinator_container_path = "{}/{}".format(global_model_container_path, parse.quote(coordinator.value.title)) + print('\t\tCoordinator ' + coordinator.value.title) + hyb_sim_map['fedora_mapping']['generated'].append('Coordinator: {}'.format(coordinator.value.title)) + + coordinator_map = { + 'uuid': coordinator.uuid, + 'fileObjs': coordinator.fileObjs, + 'fileTags': getattr(coordinator.value, 'fileTags', []), + 'container_path': coordinator_container_path, + 'fedora_mapping': {**format_coordinator(coordinator), 'wasGeneratedBy': 'Hybrid Simulation: {}'.format(hyb_sim_doi), + 'wasInfluencedBy': 'Global Model: {}'.format(global_model.value.title)} + } + + coordinator_output_list = filter( + lambda coordinator_output: coordinator.uuid in coordinator_output.value.coordinators, + getattr(doc, 'coordinator_outputs', [])) + for coordinator_output in coordinator_output_list: + # Do stuff with coordinator output. + coordinator_output_container_path = "{}/{}".format(coordinator_container_path, parse.quote(coordinator_output.value.title)) + print('\t\t\tCoordinator Output ' + coordinator_output.value.title) + hyb_sim_map['fedora_mapping']['generated'].append('Coordinator Output: {}'.format(coordinator_output.value.title)) + + coordinator_output_map = { + 'uuid': coordinator_output.uuid, + 'fileObjs': coordinator_output.fileObjs, + 'fileTags': getattr(coordinator_output.value, 'fileTags', []), + 'container_path': coordinator_output_container_path, + 'fedora_mapping': {**format_coordinator_output(coordinator_output), 'wasGeneratedBy': 'Hybrid Simulation: {}'.format(hyb_sim_doi), + 'wasInfluencedBy': 'Global Model: {}'.format(global_model.value.title), + 'wasDerivedFrom': 'Coordinator: {}'.format(coordinator.value.title)} + } + relation_map.append(coordinator_output_map) + + + sim_sub_list = filter( + lambda sim_sub: coordinator.uuid in sim_sub.value.coordinators, + getattr(doc, 'sim_substructures', [])) + for sim_sub in sim_sub_list: + # Do stuff with sim substructure. + sim_sub_container_path = "{}/{}".format(coordinator_container_path, parse.quote(sim_sub.value.title)) + print('\t\t\tSimulation Substructure ' + sim_sub.value.title) + hyb_sim_map['fedora_mapping']['generated'].append('Simulation Substructure: {}'.format(sim_sub.value.title)) + + sim_sub_map = { + 'uuid': sim_sub.uuid, + 'fileObjs': sim_sub.fileObjs, + 'fileTags': getattr(sim_sub.value, 'fileTags', []), + 'container_path': sim_sub_container_path, + 'fedora_mapping': {**format_sim_substructure(sim_sub), 'wasGeneratedBy': 'Hybrid Simulation: {}'.format(hyb_sim_doi), + 'wasInfluencedBy': 'Global Model: {}'.format(global_model.value.title), + 'wasInfluencedBy': 'Coordinator: {}'.format(coordinator.value.title)} + } + + sim_out_list = filter( + lambda sim_out: sim_sub.uuid in sim_out.value.simSubstructures, + getattr(doc, 'sim_outputs', [])) + for sim_out in sim_out_list: + # Do stuff with sim output. + sim_out_container_path = "{}/{}".format(sim_sub_container_path, parse.quote(sim_out.value.title)) + print('\t\t\t\tSimulation Output ' + sim_out.value.title) + hyb_sim_map['fedora_mapping']['generated'].append('Simulation Output: {}'.format(sim_sub.value.title)) + + sim_out_map = { + 'uuid': sim_out.uuid, + 'fileObjs': sim_out.fileObjs, + 'fileTags': getattr(sim_out.value, 'fileTags', []), + 'container_path': sim_out_container_path, + 'fedora_mapping': {**format_sim_output(sim_out), 'wasDerivedFrom': 'Simulation Substructure: {}'.format(sim_sub.value.title)} + } + relation_map.append(sim_out_map) + + relation_map.append(sim_sub_map) + + exp_sub_list = filter( + lambda exp_sub: coordinator.uuid in exp_sub.value.coordinators, + getattr(doc, 'exp_substructures', [])) + for exp_sub in exp_sub_list: + # Do stuff with experimental substructure. + exp_sub_container_path = "{}/{}".format(coordinator_container_path, parse.quote(exp_sub.value.title)) + print('\t\t\tExperimental Substructure ' + exp_sub.value.title) + hyb_sim_map['fedora_mapping']['generated'].append('Experimental Substructure: {}'.format(exp_sub.value.title)) + + exp_sub_map = { + 'uuid': exp_sub.uuid, + 'fileObjs': exp_sub.fileObjs, + 'fileTags': getattr(exp_sub.value, 'fileTags', []), + 'container_path': exp_sub_container_path, + 'fedora_mapping': {**format_exp_substructure(exp_sub), 'wasGeneratedBy': 'Hybrid Simulation: {}'.format(hyb_sim_doi), + 'wasInfluencedBy': 'Global Model: {}'.format(global_model.value.title), + 'wasInfluencedBy': 'Coordinator: {}'.format(coordinator.value.title)} + } + + exp_out_list = filter( + lambda exp_out: exp_sub.uuid in exp_out.value.expSubstructures, + getattr(doc, 'exp_outputs', [])) + for exp_out in exp_out_list: + # Do stuff with experimental output. + exp_out_container_path = "{}/{}".format(exp_sub_container_path, parse.quote(exp_out.value.title)) + print('\t\t\t\tExperimental Output ' + exp_out.value.title) + hyb_sim_map['fedora_mapping']['generated'].append('Experimental Output: {}'.format(exp_sub.value.title)) + + exp_out_map = { + 'uuid': exp_out.uuid, + 'fileObjs': exp_out.fileObjs, + 'fileTags': getattr(exp_out.value, 'fileTags', []), + 'container_path': exp_out_container_path, + 'fedora_mapping': {**format_exp_output(exp_out), 'wasDerivedFrom': 'Experimental Substructure: {}'.format(exp_sub.value.title)} + } + relation_map.append(exp_out_map) + + relation_map.append(exp_sub_map) + + relation_map.append(coordinator_map) + relation_map.append(global_model_map) + + relation_map.append(hyb_sim_map) + # project_map['fedora_mapping']['creator'] = list(set(full_author_list)) + relation_map.append(project_map) + + return relation_map[::-1] + + + +def format_hyb_sim(hyb_sim): + meta = hyb_sim.value + + try: + authors = hyb_sim.authors + creator = list(map(lambda author: "{lname}, {fname}".format(**author.to_dict()), authors)) + except AttributeError: + creator = list(map(lambda username: _get_user_by_username(hyb_sim, username), meta.authors)) + + try: + dois = list(hyb_sim.dois) + except AttributeError: + dois = [hyb_sim.doi] + + publication_date = str(hyb_sim.created) + + referenced_by = [] + part_of = [] + references = [] + + refs = getattr(meta, 'referencedData', []) + for ref in refs: + if ref['hrefType'] == 'URL': + ref_val = f"{ref['title']} ({ref['doi']})" + elif ref['hrefType'] == 'DOI': + ref_val = ref['doi'] + references.append(ref_val) + + related_work = getattr(meta, 'relatedWork', []) + for work in related_work: + if work['hrefType'] == 'URL': + work_val = f"{work['title']} ({work['href']})" + elif work['hrefType'] == 'DOI': + work_val = work['href'] + + if work['type'] == 'Linked Project': + part_of.append(work_val) + + if work['type'] == 'Linked Dataset': + part_of.append(work_val) + + if work['type'] == 'Context': + references.append(work_val) + + if work['type'] == 'Cited By': + referenced_by.append(work_val) + + return { + "title": meta.title, + "type": meta.simulationType, + "creator": creator, + "identifier": dois, + "available": publication_date, + "publisher": "DesignSafe", + "description": meta.description, + 'isReferencedBy': referenced_by, + 'isPartOf': part_of, + 'references': references + + } + +def format_global_modal(global_model): + return { + "type": "global model", + "title": global_model.value.title, + "abstract": global_model.value.description, + } + +def format_coordinator(coordinator): + return { + "type": "simulation coordinator", + "title": coordinator.value.title, + "description": coordinator.value.description + } + +def format_sim_substructure(sim_sub): + return { + "type": "simulation substructure", + "title": sim_sub.value.title, + "abstract": sim_sub.value.description + } + +def format_sim_output(sim_out): + return { + "type": "simulation output", + "title": sim_out.value.title, + "abstract": sim_out.value.description + } + +def format_exp_substructure(exp_sub): + return { + "type": "experimental substructure", + "title": exp_sub.value.title, + "description": exp_sub.value.description + } + +def format_exp_output(exp_out): + return { + "type": "experimental output", + "title": exp_out.value.title, + "description": exp_out.value.description + } + +def format_coordinator_output(coord_out): + return { + "type": "coordinator output", + "title": coord_out.value.title, + "abstract": coord_out.value.description + } + +def format_analysis(analysis): + return { + "type": "analysis", + "title": analysis.value.title, + "description": analysis.value.description + } + + +def format_report(report): + return { + "type": "report", + "title": report.value.title, + "description": report.value.description + } + + +def format_member(member): + try: + return f'{member.lname}, {member.fname}' + except AttributeError: + user_obj = get_user_model().objects.get(username=member.name) + return "{}, {}".format(user_obj.last_name, user_obj.first_name) + + + + + +def generate_manifest_hyb_sim(project_id, version=None): + walk_result = walk_hyb_sim(project_id, version=version) + return generate_manifest(walk_result, project_id, version) + + +def upload_manifest_hyb_sim(project_id, version=None): + manifest_dict = generate_manifest_hyb_sim(project_id, version=version) + return upload_manifest(manifest_dict, project_id, version) + + +def ingest_project_hyb_sim(project_id, version=None, amend=False): + """ + Ingest a project into Fedora by creating a record in the repo, updating it + with the published metadata, and uploading its files. + """ + container_path = project_id + if version: + container_path = '{}v{}'.format(container_path, str(version)) + + walk_result = walk_hyb_sim(project_id, version=version) + for entity in walk_result: + if amend: + create_fc_version(entity['container_path']) + fedora_post(entity['container_path']) + fedora_update(entity['container_path'], entity['fedora_mapping']) + + if not amend: + upload_manifest_hyb_sim(project_id, version=version) \ No newline at end of file diff --git a/designsafe/libs/fedora/sim_operations.py b/designsafe/libs/fedora/sim_operations.py index 353e58f42..2900cd6e2 100644 --- a/designsafe/libs/fedora/sim_operations.py +++ b/designsafe/libs/fedora/sim_operations.py @@ -49,7 +49,8 @@ def walk_sim(project_id, version=None): 'uuid': sim.uuid, 'container_path': sim_container_path, 'fedora_mapping': {**format_sim(sim), 'license': license, 'wasGeneratedBy': project_id, 'generated': []}, - 'fileObjs': getattr(sim, 'fileObjs', []) + 'fileObjs': getattr(sim, 'fileObjs', []), + 'fileTags': getattr(sim.value, 'fileTags', []) } full_author_list += sim_map['fedora_mapping']['creator'] @@ -67,6 +68,7 @@ def walk_sim(project_id, version=None): report_map = { 'uuid': report.uuid, 'fileObjs': report.fileObjs, + 'fileTags': getattr(report.value, 'fileTags', []), 'container_path': report_container_path, 'fedora_mapping': {**format_report(report), 'wasGeneratedBy': 'Simulation: {}'.format(sim_doi)} } @@ -85,6 +87,7 @@ def walk_sim(project_id, version=None): analysis_map = { 'uuid': analysis.uuid, 'fileObjs': analysis.fileObjs, + 'fileTags': getattr(analysis.value, 'fileTags', []), 'container_path': analysis_container_path, 'fedora_mapping': {**format_analysis(analysis), 'wasGeneratedBy': 'Simulation: {}'.format(sim_doi)} } @@ -104,6 +107,7 @@ def walk_sim(project_id, version=None): model_map = { 'uuid': model.uuid, 'fileObjs': model.fileObjs, + 'fileTags': getattr(model.value, 'fileTags', []), 'container_path': model_container_path, 'fedora_mapping': {**format_model(model), 'wasGeneratedBy': 'Simulation: {}'.format(sim_doi)} } @@ -120,11 +124,12 @@ def walk_sim(project_id, version=None): input_map = { 'uuid': input.uuid, 'fileObjs': input.fileObjs, + 'fileTags': getattr(input.value, 'fileTags', []), 'container_path': input_container_path, 'fedora_mapping': {**format_input(input), 'wasGeneratedBy': 'Simulation: {}'.format(sim_doi), 'wasDerivedFrom': 'Simulation Model: {}'.format(model.value.title), - 'wasInfluencedBy': []} + 'Influence': []} } outputs = filter( @@ -136,10 +141,11 @@ def walk_sim(project_id, version=None): output_container_path = "{}/{}".format(input_container_path, parse.quote(output.value.title)) print('\t\t\toutput ' + output.value.title) sim_map['fedora_mapping']['generated'].append('Simulation Input: {}'.format(output.value.title)) - input_map['fedora_mapping']['wasInfluencedBy'].append('Simulation Output: {}'.format(output.value.title)) + input_map['fedora_mapping']['Influence'].append('Simulation Output: {}'.format(output.value.title)) output_map = { 'uuid': output.uuid, 'fileObjs': output.fileObjs, + 'fileTags': getattr(output.value, 'fileTags', []), 'container_path': output_container_path, 'fedora_mapping': {**format_output(output), 'wasGeneratedBy': 'Simulation: {}'.format(sim_doi), diff --git a/designsafe/static/scripts/data-depot/components/projects/index.js b/designsafe/static/scripts/data-depot/components/projects/index.js index 422aef73f..d1959398f 100644 --- a/designsafe/static/scripts/data-depot/components/projects/index.js +++ b/designsafe/static/scripts/data-depot/components/projects/index.js @@ -17,10 +17,16 @@ import { VersionExperimentSelectionComponent, VersionFieldReconSelectionComponent, VersionSimulationSelectionComponent, + VersionHybSimSelectionComponent, VersionCitationComponent } from './pipeline-version/pipeline-version.component'; import { VersionChangesComponent } from './pipeline-version/pipeline-version-changes.component'; -import { AmendExperimentComponent, AmendFieldReconComponent, AmendSimulationComponent } from './pipeline-amend/pipeline-amend.component'; +import { + AmendExperimentComponent, + AmendFieldReconComponent, + AmendSimulationComponent, + AmendHybSimComponent +} from './pipeline-amend/pipeline-amend.component'; import { AmendOtherComponent } from './pipeline-amend/pipeline-amend-other.component'; import { AmendCitationComponent } from './pipeline-amend/pipeline-amend-citation.component'; import { @@ -93,12 +99,14 @@ ddProjectsComponents.component('amendOther', AmendOtherComponent); ddProjectsComponents.component('amendExperiment', AmendExperimentComponent); ddProjectsComponents.component('amendFieldRecon', AmendFieldReconComponent); ddProjectsComponents.component('amendSimulation', AmendSimulationComponent); +ddProjectsComponents.component('amendHybSim', AmendHybSimComponent); ddProjectsComponents.component('amendCitation', AmendCitationComponent); ddProjectsComponents.component('versionOtherSelection', VersionOtherSelectionComponent); ddProjectsComponents.component('versionOtherCitation', VersionOtherCitationComponent); ddProjectsComponents.component('versionExperimentSelection', VersionExperimentSelectionComponent); ddProjectsComponents.component('versionFieldReconSelection', VersionFieldReconSelectionComponent); ddProjectsComponents.component('versionSimulationSelection', VersionSimulationSelectionComponent); +ddProjectsComponents.component('versionHybSimSelection', VersionHybSimSelectionComponent); ddProjectsComponents.component('versionCitation', VersionCitationComponent); ddProjectsComponents.component('versionChanges', VersionChangesComponent); ddProjectsComponents.component('pipelineSelectExp', PipelineSelectionExpComponent); diff --git a/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/amend-hybrid-sim.template.html b/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/amend-hybrid-sim.template.html new file mode 100644 index 000000000..c1b6dd201 --- /dev/null +++ b/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/amend-hybrid-sim.template.html @@ -0,0 +1,610 @@ +
+ + Back + + +
+
+
+

Amend Metadata

+ If you need help, attend curation office hours. +
+

+ Loading... +

+
+
+ +
+
+ +
+ Some of your project's amendments were not able to be imported. Please review and amend + the the highlighted categories below. + + IMPORTANT: None of the changes made during this process will save to the project. + Changes made here will only amend the publication once submitted. + +
+
+
  • {{entity.title}}
  • +
    +
    +
    +
    +
    +
    +
      +
    • Please review the preview of your amended publication carefully.
    • +
    • Any acceptable changes you make from the project workspace are automatically imported to this preview.
    • +
    • This preview shows what your publication will look like once it is amended.
    • +
    • Categories may not be added or removed.
    • +
    • Files related to any categories may not be modified.
    • +
    • When you have finished proofreading your amended publication, click continue to move onto the next step.
    • +
    +
    + +
    +
    + + {{$ctrl.amendment.project.value.projectId}} | {{ $ctrl.amendment.project.value.title }} + +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    PI + +
    Co-PIs + +
    Project Type + {{ $ctrl.amendment.project.value.projectType.replace('_', ' ') }} + + Field Research + + | + + {{ frType }}, + {{ frType }} + + +
    Data Type{{ $ctrl.amendment.project.value.dataType }}
    Natural Hazard Type + + {{ nhtype }}, + {{ nhtype }} + +
    Awards{{ award.name }} - {{ award.number }}
    Related Work + +
    Keywords{{ $ctrl.amendment.project.value.keywords }}
    Hazmapper Maps + +
    +
    +

    {{ $ctrl.amendment.project.value.description }}

    +
    +
    + Edit Project Metadata +
    +
    + +
    +
    + +
    + +
    +
    +
    +
    diff --git a/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/pipeline-amend-citation.component.js b/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/pipeline-amend-citation.component.js index 2bc5b7008..e72adb747 100644 --- a/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/pipeline-amend-citation.component.js +++ b/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/pipeline-amend-citation.component.js @@ -101,6 +101,29 @@ class PipelineAmendCitationCtrl { this.ui.savedStatus[simulation.uuid] = false; } }); + } + else if (prj_type == 'hybrid_simulation'){ + this.amendComp = 'projects.amendHybSim'; + this.ui.placeholder = 'HybSim'; + this.amendFields = [ + 'hybrid_simulations', + 'global_models', + 'coordinators', + 'sim_substructures', + 'exp_substructures', + 'coordinator_outputs', + 'sim_outputs', + 'exp_outputs', + 'analysiss', + 'reports' + ] + this.amendment.hybrid_simulations.forEach((hybsim) => { + if (hybsim.value.dois.length) { + this.publishedEntities.push(hybsim); + this.authors[hybsim.uuid] = hybsim.authors; + this.ui.savedStatus[hybsim.uuid] = false; + } + }); } else { this.goStart(); } diff --git a/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/pipeline-amend.component.js b/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/pipeline-amend.component.js index a7e6e3b5c..bfca8deb2 100644 --- a/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/pipeline-amend.component.js +++ b/designsafe/static/scripts/data-depot/components/projects/pipeline-amend/pipeline-amend.component.js @@ -1,6 +1,7 @@ import AmendExperimentTemplate from './amend-experimental.template.html'; import AmendFieldReconTemplate from './amend-field-recon.template.html'; -import AmendSimulationTemplate from './amend-simulation.template.html' +import AmendSimulationTemplate from './amend-simulation.template.html'; +import AmendHybridSimTemplate from './amend-hybrid-sim.template.html'; import experimentalData from '../../../../projects/components/manage-experiments/experimental-data.json'; class PipelineAmendCtrl { @@ -62,6 +63,7 @@ class PipelineAmendCtrl { 'reportEntity': ['project','files','authors','dois'], 'missionEntity': ['project','files','authors','dois'], 'simulationEntity': ['project','files','authors','dois'], + 'hybsimEntity': ['project','files','authors','dois'], } let prjEnts = this.project.getAllRelatedObjects(); @@ -96,7 +98,21 @@ class PipelineAmendCtrl { 'reports' ] } - + else if (prj_type == 'hybrid_simulation') { + primaryEntNames = ['hybidsimulations'] + secondaryEntNames = [ + 'hybrid_simulations', + 'global_models', + 'coordinators', + 'sim_substructures', + 'exp_substructures', + 'coordinator_outputs', + 'sim_outputs', + 'exp_outputs', + 'analysiss', + 'reports' + ] + } if (update === 'all') { this.amendment = JSON.parse(JSON.stringify(this.publication)); } @@ -405,4 +421,15 @@ export const AmendSimulationComponent = { close: '&', dismiss: '&' }, -}; \ No newline at end of file +}; + +export const AmendHybSimComponent = { + template: AmendHybridSimTemplate, + controller: PipelineAmendCtrl, + controllerAs: '$ctrl', + bindings: { + resolve: '<', + close: '&', + dismiss: '&' + }, +}; diff --git a/designsafe/static/scripts/data-depot/components/projects/pipeline-start/pipeline-start.component.js b/designsafe/static/scripts/data-depot/components/projects/pipeline-start/pipeline-start.component.js index 7708ab53d..6285b3d72 100644 --- a/designsafe/static/scripts/data-depot/components/projects/pipeline-start/pipeline-start.component.js +++ b/designsafe/static/scripts/data-depot/components/projects/pipeline-start/pipeline-start.component.js @@ -53,7 +53,10 @@ class PipelineStartCtrl { } case 'hybrid_simulation': { this.ui.publicationComp = 'projects.pipelineSelectHybSim' + this.ui.amendComp = 'projects.amendHybSim' + this.ui.versionComp = 'projects.versionHybSimSelection' this.ui.previewComp = 'projects.previewHybSim' + this.ui.showAmendVersion = true; break; } case 'field_recon': { diff --git a/designsafe/static/scripts/data-depot/components/projects/pipeline-version/pipeline-version-changes.component.js b/designsafe/static/scripts/data-depot/components/projects/pipeline-version/pipeline-version-changes.component.js index 493bbd225..78fa9b65b 100644 --- a/designsafe/static/scripts/data-depot/components/projects/pipeline-version/pipeline-version-changes.component.js +++ b/designsafe/static/scripts/data-depot/components/projects/pipeline-version/pipeline-version-changes.component.js @@ -103,6 +103,16 @@ class PipelineVersionChangesCtrl { this.mainEntityUuids.push(entity.uuid); }); } + if (this.prjType === 'hybrid_simulation') { + this.ui.selectionComp = 'projects.versionHybSimSelection' + this.ui.citationComp = 'projects.versionCitation' + + this.pubData['hybrid_simulations'] = []; + this.selectedEnts.forEach((entity) => { + this.pubData['hybrid_simulations'].push({uuid: entity.uuid}); + this.mainEntityUuids.push(entity.uuid); + }); + } } else { this.revisionAuthors = this.publication.project.value.teamOrder this.ui.selectionComp = 'projects.versionOtherSelection' diff --git a/designsafe/static/scripts/data-depot/components/projects/pipeline-version/pipeline-version.component.js b/designsafe/static/scripts/data-depot/components/projects/pipeline-version/pipeline-version.component.js index 3c7fb764b..5fac22ef8 100644 --- a/designsafe/static/scripts/data-depot/components/projects/pipeline-version/pipeline-version.component.js +++ b/designsafe/static/scripts/data-depot/components/projects/pipeline-version/pipeline-version.component.js @@ -1,6 +1,7 @@ import VersionExperimentSelectionTemplate from './version-experiment-selection.template.html'; import VersionFieldReconSelectionTemplate from './version-field-recon-selection.template.html'; import VersionSimulationSelectionTemplate from './version-simulation-selection.template.html'; +import VersionHybSimSelectionTemplate from './version-hyb-sim-selection.template.html'; import VersionCitationTemplate from './version-citation.template.html'; import experimentalData from '../../../../projects/components/manage-experiments/experimental-data.json'; @@ -62,21 +63,48 @@ class PipelineVersionCtrl { this.ui.placeholder = 'Experiment'; this.matchingGroupKey = 'experiments'; this.publishedKeyNames = ['experimentsList']; - this.subEntities = ['modelconfig_set', 'sensorlist_set', 'event_set', 'report_set', 'analysis_set']; + this.subEntities = ['modelconfig_set', + 'sensorlist_set', + 'event_set', + 'report_set', + 'analysis_set']; } else if (prjType === 'simulation') { this.ui.selectionComp = 'projects.versionSimulationSelection'; this.ui.citationComp = 'projects.versionCitation'; this.ui.placeholder = 'Simulation'; this.matchingGroupKey = 'simulations'; this.publishedKeyNames = ['simulation']; - this.subEntities = ['simulation_set', 'model_set', 'input_set', 'output_set', 'analysis_set', 'report_set']; + this.subEntities = ['simulation_set', + 'model_set', + 'input_set', + 'output_set', + 'analysis_set', + 'report_set']; + } else if (prjType === 'hybrid_simulation') { + this.ui.selectionComp = 'projects.versionHybSimSelection'; + this.ui.citationComp = 'projects.versionCitation'; + this.ui.placeholder = 'HybSim'; + this.matchingGroupKey = 'hybrid_simulations'; + this.publishedKeyNames = ['hybrid_simulation']; + this.subEntities = ['hybridsimulation_set', + 'globalmodel_set', + 'coordinator_set', + 'simsubstructure_set', + 'expsubstructure_set', + 'coordinatoroutput_set', + 'simoutput_set', + 'expoutput_set', + 'analysis_set', + 'report_set']; } else if (prjType === 'field_recon') { this.ui.selectionComp = 'projects.versionFieldReconSelection'; this.ui.citationComp = 'projects.versionCitation'; this.ui.placeholder = 'Mission'; this.matchingGroupKey = 'missions'; this.publishedKeyNames = ['missions', 'reports']; - this.subEntities = ['planning_set', 'socialscience_set', 'geoscience_set']; + this.subEntities = ['planning_set', + 'socialscience_set', + 'geoscience_set']; this.primaryEnts = [].concat( this.project.mission_set || [], @@ -403,6 +431,17 @@ export const VersionSimulationSelectionComponent = { }, }; +export const VersionHybSimSelectionComponent = { + template: VersionHybSimSelectionTemplate, + controller: PipelineVersionCtrl, + controllerAs: '$ctrl', + bindings: { + resolve: '<', + close: '&', + dismiss: '&' + }, +}; + export const VersionCitationComponent = { template: VersionCitationTemplate, controller: PipelineVersionCtrl, diff --git a/designsafe/static/scripts/data-depot/components/projects/pipeline-version/version-hyb-sim-citation.template.html b/designsafe/static/scripts/data-depot/components/projects/pipeline-version/version-hyb-sim-citation.template.html new file mode 100644 index 000000000..bea6273b8 --- /dev/null +++ b/designsafe/static/scripts/data-depot/components/projects/pipeline-version/version-hyb-sim-citation.template.html @@ -0,0 +1,86 @@ +
    + + Back + + +
    +
    +
    +

    Confirm Author Order

    + You are required to confirm the list of Authors on your Citation(s) before continuing. + Your citation(s) will be updated to match what is shown in the preview. +
    +

    + Loading... +

    +
    +
    +
    +
    + +
    +
    + {{$ctrl.ui.placeholder}} | {{ primEnt.value.title }} +
    + +
    +

    Success

    + The author order for this {{$ctrl.ui.placeholder}} has been saved. +
    +
    + Your authors need to be updated. Edit your {{$ctrl.ui.placeholder}} and select which users are authors for the {{$ctrl.ui.placeholder}}. +
    +
    +

    + Loading... +

    +
    + +
    Citation Preview
    +
    +
    + + + + ({{ $ctrl.curDate }}) “{{ primEnt.value.title }}”, in {{ $ctrl.project.value.title }}. DesignSafe-CI. https://doi.org/10.12345/ABCDEF. + +
    +
    + + + + + + + +
    +
    + + + + {{ author.name }} + + + + {{ author.lname }}, {{ author.fname }} + +
    +
    + + + Save +
    +
    +
    +
    +
    \ No newline at end of file diff --git a/designsafe/static/scripts/data-depot/components/projects/pipeline-version/version-hyb-sim-selection.template.html b/designsafe/static/scripts/data-depot/components/projects/pipeline-version/version-hyb-sim-selection.template.html new file mode 100644 index 000000000..610ba8dd9 --- /dev/null +++ b/designsafe/static/scripts/data-depot/components/projects/pipeline-version/version-hyb-sim-selection.template.html @@ -0,0 +1,425 @@ +
    + + Back + + +
    +
    + +
    +

    Your Selection is Incomplete!

    +

    + Your selection has missing data or incomplete requirements. + Please review the following fields: +

    +
    +
    + In the {{entity.type}} {{entity.title}}, the following requirements are missing or incomplete: +
  • {{ err }}
  • +
    +
    +
    +
    +

    Version Selection

    + +
    +
    +

    + Loading... +

    +
    +
    + +
    + + +
    + +
    + +
    \ No newline at end of file diff --git a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-field-recon.component.html b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-field-recon.component.html index 9248de107..2ac669628 100644 --- a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-field-recon.component.html +++ b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-field-recon.component.html @@ -16,7 +16,7 @@
    diff --git a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-hyb-sim.component.html b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-hyb-sim.component.html index ccc609b85..84e9c8afa 100644 --- a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-hyb-sim.component.html +++ b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-hyb-sim.component.html @@ -16,7 +16,7 @@
    diff --git a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-other.component.html b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-other.component.html index d62587d90..67e6e7d34 100644 --- a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-other.component.html +++ b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-other.component.html @@ -16,7 +16,7 @@
    diff --git a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-sim.component.html b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-sim.component.html index 6bb30ad5e..a2994d213 100644 --- a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-sim.component.html +++ b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview-sim.component.html @@ -16,7 +16,7 @@
    diff --git a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview.component.html b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview.component.html index 8f2d1ee23..fcf54b012 100644 --- a/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview.component.html +++ b/designsafe/static/scripts/data-depot/components/projects/publication-preview/publication-preview.component.html @@ -16,7 +16,7 @@
    diff --git a/designsafe/static/scripts/data-depot/index.js b/designsafe/static/scripts/data-depot/index.js index 69a52d799..1906a5162 100644 --- a/designsafe/static/scripts/data-depot/index.js +++ b/designsafe/static/scripts/data-depot/index.js @@ -405,6 +405,23 @@ function config( }] } }) + .state('projects.amendHybSim', { + url: '/projects/{projectId}/curation/amend/hybsim', + component: 'amendHybSim', + params: { + project: null, + publication: null, + amendment: null + }, + resolve: { + projectId: ['$stateParams', 'ProjectService', ($stateParams, ProjectService) => { + ProjectService.resolveParams.projectId = $stateParams.projectId; + ProjectService.resolveParams.project = $stateParams.project; + ProjectService.resolveParams.publication = $stateParams.publication; + ProjectService.resolveParams.amendment = $stateParams.amendment; + }] + } + }) .state('projects.amendCitation', { url: '/projects/{projectId}/curation/amend/citation', component: 'amendCitation', @@ -515,6 +532,25 @@ function config( }] } }) + .state('projects.versionHybSimSelection', { + url: '/projects/{projectId}/curation/version/{filePath:any}', + component: 'versionHybSimSelection', + params: { + project: null, + publication: null, + selectedEnts: [], + selectedListings: null + }, + resolve: { + projectId: ['$stateParams', 'ProjectService', ($stateParams, ProjectService) => { + ProjectService.resolveParams.projectId = $stateParams.projectId; + ProjectService.resolveParams.project = $stateParams.project; + ProjectService.resolveParams.publication = $stateParams.publication; + ProjectService.resolveParams.selectedEnts = $stateParams.selectedEnts; + ProjectService.resolveParams.selectedListings = $stateParams.selectedListings; + }] + } + }) .state('projects.versionCitation', { url: '/projects/{projectId}/curation/citation', component: 'versionCitation',