Skip to content

Commit

Permalink
Merge branch 'main' into task/des-2569-add-facilities-to-all-project-…
Browse files Browse the repository at this point in the history
…types
  • Loading branch information
jarosenb authored Nov 14, 2023
2 parents 7e6d7ea + 59120ce commit 47f5a93
Show file tree
Hide file tree
Showing 23 changed files with 245 additions and 54 deletions.
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ coverage
.git
.docs
.github
.pytest_cache
.pytest_cache
data
2 changes: 1 addition & 1 deletion designsafe/apps/projects/models/agave/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ def to_datacite_json(self):
# remember, related works are not required, so they can be missing...
for a_proj in self.associated_projects: #relatedwork
identifier = {}
mapping = {'Linked Project': 'IsSupplementTo', 'Linked Dataset': 'IsSupplementTo', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
mapping = {'Linked Project': 'IsPartOf', 'Linked Dataset': 'IsPartOf', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
if {'type', 'href', 'hrefType'} <= a_proj.keys():
identifier['relationType'] = mapping[a_proj['type']]
identifier['relatedIdentifierType'] = a_proj['hrefType']
Expand Down
2 changes: 1 addition & 1 deletion designsafe/apps/projects/models/agave/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def to_datacite_json(self):
attributes['relatedIdentifiers'] = []
for r_work in self.related_work:
identifier = {}
mapping = {'Linked Project': 'IsSupplementTo', 'Linked Dataset': 'IsSupplementTo', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
mapping = {'Linked Project': 'IsPartOf', 'Linked Dataset': 'IsPartOf', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
if {'type', 'href', 'hrefType'} <= r_work.keys():
identifier['relationType'] = mapping[r_work['type']]
identifier['relatedIdentifierType'] = r_work['hrefType']
Expand Down
2 changes: 1 addition & 1 deletion designsafe/apps/projects/models/agave/hybrid_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def to_datacite_json(self):
attributes['relatedIdentifiers'] = []
for r_work in self.related_work:
identifier = {}
mapping = {'Linked Project': 'IsSupplementTo', 'Linked Dataset': 'IsSupplementTo', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
mapping = {'Linked Project': 'IsPartOf', 'Linked Dataset': 'IsPartOf', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
if {'type', 'href', 'hrefType'} <= r_work.keys():
identifier['relationType'] = mapping[r_work['type']]
identifier['relatedIdentifierType'] = r_work['hrefType']
Expand Down
4 changes: 2 additions & 2 deletions designsafe/apps/projects/models/agave/rapid.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def to_datacite_json(self):
attributes['relatedIdentifiers'] = []
for r_work in self.related_work:
identifier = {}
mapping = {'Linked Project': 'IsSupplementTo', 'Linked Dataset': 'IsSupplementTo', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
mapping = {'Linked Project': 'IsPartOf', 'Linked Dataset': 'IsPartOf', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
if {'type', 'href', 'hrefType'} <= r_work.keys():
identifier['relationType'] = mapping[r_work['type']]
identifier['relatedIdentifierType'] = r_work['hrefType']
Expand Down Expand Up @@ -256,7 +256,7 @@ def to_datacite_json(self):
attributes['relatedIdentifiers'] = []
for r_work in self.related_work:
identifier = {}
mapping = {'Linked Project': 'IsSupplementTo', 'Linked Dataset': 'IsSupplementTo', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
mapping = {'Linked Project': 'IsPartOf', 'Linked Dataset': 'IsPartOf', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
if {'type', 'href', 'hrefType'} <= r_work.keys():
identifier['relationType'] = mapping[r_work['type']]
identifier['relatedIdentifierType'] = r_work['hrefType']
Expand Down
2 changes: 1 addition & 1 deletion designsafe/apps/projects/models/agave/simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def to_datacite_json(self):
attributes['relatedIdentifiers'] = []
for r_work in self.related_work:
identifier = {}
mapping = {'Linked Project': 'IsSupplementTo', 'Linked Dataset': 'IsSupplementTo', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
mapping = {'Linked Project': 'IsPartOf', 'Linked Dataset': 'IsPartOf', 'Cited By': 'IsCitedBy', 'Context': 'IsDocumentedBy'}
if {'type', 'href', 'hrefType'} <= r_work.keys():
identifier['relationType'] = mapping[r_work['type']]
identifier['relatedIdentifierType'] = r_work['hrefType']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@

{% block content %}
<div class="container">
<ui-view></ui-view>
<div class="gcse-search"></div>
{{message}}
</div>
</div>
{% addtoblock "js" %}
<script src="<%= htmlWebpackPlugin.files.js %>"></script>
<script async src="https://cse.google.com/cse.js?cx=7671a7caca0a643c1">
</script>
{% endaddtoblock %}

{% endblock %}
{% block footer %}{% include 'includes/footer.html' %}{% endblock footer %}
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export function applicationAddCtrl(window, angular, $, _) {
},
'defaultProcessorsPerNode': {
'type': 'integer',
'description': 'Default number of processors per node to be used when running this app if no processor count is given in the job request',
'description': 'Total number of processors across all nodes to be used when running this app if no processor count is given in the job request',
'maxLength': 12,
'title': 'Default processor count',
'x-schema-form': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ class FilesListingCtrl {
browse($event, file) {
$event.preventDefault();
$event.stopPropagation();
if (this.doi) file.doi = this.doi;
this.onBrowse({ file });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class DataDepotToolbarCtrl {
copy() {
const { api, scheme, system, path } = this.FileListingService.listings.main.params;
const files = this.getAllSelected();
this.FileOperationService.openCopyModal({api, scheme, system, path, files});
const doi = this.FileListingService.currentDOI || this.$stateParams.doi;
this.FileOperationService.openCopyModal({api, scheme, system, path, files, doi});
}
move() {
const { api, scheme, system, path } = this.FileListingService.listings.main.params;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ class PublishedViewCtrl {
}

onBrowse(file, doi) {
if (!doi) {doi = file.doi}
if (!doi) {doi = this.$stateParams.doi}
if (file.type === 'dir') {
this.$state.go(this.$state.current.name, { filePath: file.path, query_string: null, doi: doi });
Expand Down
2 changes: 1 addition & 1 deletion designsafe/static/scripts/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
var radioValue = $('input[name="search-radio"]:checked').val();
var searchstring = $('#searchfield').val();
if (ev.which === 13 || ev.type === 'click') {
if (radioValue==='website') window.location = '/search?type_filter=all&query_string=' + searchstring;
if (radioValue==='website') window.location = '/search?q=' + searchstring;
if (radioValue ==='datasets') {
var datasetSearchUrl = `/data/browser/public/?query_string=%257B%2522queries%2522%253A%257B%2522searchString%2522%253A%2522${searchstring}%2522%252C%2522publicationYear%2522%253A%2522%2522%257D%252C%2522typeFilters%2522%253A%257B%2522experimental%2522%253Afalse%252C%2522simulation%2522%253Afalse%252C%2522field_recon%2522%253Afalse%252C%2522other%2522%253Afalse%252C%2522hybrid_simulation%2522%253Afalse%257D%252C%2522advancedFilters%2522%253A%257B%2522experimental%2522%253A%257B%2522experimentType%2522%253A%2522%2522%252C%2522experimentalFacility%2522%253A%257B%2522name%2522%253A%2522%2522%252C%2522label%2522%253A%2522%2522%257D%257D%252C%2522simulation%2522%253A%257B%2522simulationType%2522%253A%2522%2522%257D%252C%2522field_recon%2522%253A%257B%2522naturalHazardType%2522%253A%2522%2522%252C%2522naturalHazardEvent%2522%253A%2522%2522%252C%2522frType%2522%253A%2522%2522%252C%2522frDate%2522%253A%2522%2522%257D%252C%2522other%2522%253A%257B%2522dataType%2522%253A%2522%2522%257D%252C%2522hybrid_simulation%2522%253A%257B%2522hybridSimulationType%2522%253A%2522%2522%257D%257D%257D`
window.location = datasetSearchUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ class DataBrowserCopyCtrl {
destSystem: dest.system,
destPath: dest.path,
successCallback: this.successCallback,
doi: this.resolve.doi
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class DataBrowserServicePreviewCtrl {
copy() {
const { api, scheme, system, path } = this.FileListingService.listings.main.params;
const files = [this.resolve.file];
this.FileOperationService.openCopyModal({ api, scheme, system, path, files });
this.FileOperationService.openCopyModal({ api, scheme, system, path, files, doi: this.resolve.doi });
}

move() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
published="true"
on-scroll="$ctrl.scrollToBottom()"
listing="$ctrl.FileListingService.listings[collection.uuid]"
on-browse="$ctrl.onBrowse(file)">&nbsp;
on-browse="$ctrl.onBrowse(file)"
doi="mission.doi">&nbsp;
</files-listing>
</div>
</div>
Expand Down Expand Up @@ -206,7 +207,8 @@
published="true"
on-scroll="$ctrl.scrollToBottom()"
listing="$ctrl.FileListingService.listings[collection.uuid]"
on-browse="$ctrl.onBrowse(file)">&nbsp;
on-browse="$ctrl.onBrowse(file)"
doi="mission.doi">&nbsp;
</files-listing>
</div>
</div>
Expand Down Expand Up @@ -299,7 +301,8 @@
published="true"
on-scroll="$ctrl.scrollToBottom()"
listing="$ctrl.FileListingService.listings[collection.uuid]"
on-browse="$ctrl.onBrowse(file)">&nbsp;
on-browse="$ctrl.onBrowse(file)"
doi="mission.doi">&nbsp;
</files-listing>
</div>
</div>
Expand Down Expand Up @@ -347,7 +350,8 @@
published="true"
on-scroll="$ctrl.scrollToBottom()"
listing="$ctrl.FileListingService.listings[collection.uuid]"
on-browse="$ctrl.onBrowse(file)">&nbsp;
on-browse="$ctrl.onBrowse(file)"
doi="mission.doi">&nbsp;
</files-listing>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { map, tap, catchError } from 'rxjs/operators';
import { takeLatestSubscriber } from './_rxjs-utils';

export class FileOperationService {
constructor($http, $state, $rootScope, $uibModal, $q, ProjectService, Django, toastr) {
constructor($http, $state, $stateParams, $rootScope, $uibModal, $q, ProjectService, Django, toastr) {
'ngInject';
this.$state = $state;
this.$uibModal = $uibModal;
Expand All @@ -12,6 +12,7 @@ export class FileOperationService {
this.toastr = toastr;
this.$rootScope = $rootScope;
this.$http = $http;
this.$stateParams = $stateParams;
this.ProjectService = ProjectService;
this.from = from; // bind rxjs method for mocking

Expand Down Expand Up @@ -125,7 +126,7 @@ export class FileOperationService {
* @param {string} params.system System to copy files from.
* @param {Object[]} params.files Array of file objects {name, system, path} to copy.
*/
openCopyModal({ api, scheme, system, files }) {
openCopyModal({ api, scheme, system, files, doi }) {
this.operations.copy.status = {};
var modal = this.$uibModal.open({
component: 'copyModal',
Expand All @@ -134,6 +135,7 @@ export class FileOperationService {
scheme: () => scheme,
system: () => system,
files: () => files,
doi: () => doi,
},
size: 'lg',
});
Expand All @@ -154,14 +156,15 @@ export class FileOperationService {
* @param {string} params.destPath Path of directory to copy files into.
* @param {function} params.successCallback Callback on successful copy of all files.
*/
handleCopy({ srcApi, srcFiles, destApi, destSystem, destPath, successCallback }) {
handleCopy({ srcApi, srcFiles, destApi, destSystem, destPath, successCallback, doi}) {
const copyParams = {
srcApi,
srcFiles,
destApi,
destSystem,
destPath,
successCallback,
doi,
};

const copyMapping = () => this.mapParamsToCopy(copyParams);
Expand All @@ -180,7 +183,7 @@ export class FileOperationService {
* @param {Object[]} params.files Array of file objects {name, system, path} to copy.
* @param {function} params.successCallback Callback on successful copy of all files.
*/
mapParamsToCopy({ srcApi, destApi, destSystem, destPath, srcFiles, successCallback }) {
mapParamsToCopy({ srcApi, destApi, destSystem, destPath, srcFiles, successCallback, doi }) {
// Treat Shared Data as Agave for the purpose of copying files.
if (srcApi === 'shared') {
srcApi = 'agave';
Expand All @@ -193,7 +196,7 @@ export class FileOperationService {
// Copying files between APIs requires the transfer endpoint.
if (srcApi === destApi) {
const copyUrl = this.removeDuplicateSlashes(
`/api/datafiles/${srcApi}/private/copy/${f.system}/${f.path}/`
`/api/datafiles/${srcApi}/private/copy/${f.system}/${f.path}/?doi=${doi}`
);
copyRequest = this.$http.put(copyUrl, {
dest_system: destSystem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,16 +123,16 @@ export default function ApplicationFormCtrl($scope, $rootScope, $localStorage, $
let items = [];
if ($scope.form.schema.properties.inputs) {
items.push('inputs');
$scope.form.form.push({
type: 'fieldset',
readonly: readOnly,
title: 'Inputs',
items: items,
});
}
if ($scope.form.schema.properties.parameters) {
items.push('parameters');
}
$scope.form.form.push({
type: 'fieldset',
readonly: readOnly,
title: 'Inputs',
items: items,
});

/* job details */
items = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ <h1>Select an app</h1>
<div ng-if="data.bin" class="app-dropdown">
<p compile="data.bin.description" class="app-form-wrapper" ng-if="data.bin.description"></p>
<div>Select a version of <b>{{data.bin.value.definition.label}}</b> from the dropdown:</div>
<select ng-model="data.selectedApp" ng-options="app.value.definition.label for app in data.bin.applications | orderBy: 'value.definition.label'">
<select ng-model="data.selectedApp" ng-options="app.value.definition.label for app in data.bin.applications | orderBy: 'value.definition.label'" style="color:initial;">
<option value=''disabled selected>-- Please Select --</option>
</select>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<div>
<div class="input-group">
<span class="input-group-btn">
<button ng-click="wantFile($event)" class="btn btn-default" type="button">Select</button>
<button ng-click="wantFile($event)" class="btn btn-default" type="button">Select</button>
</span>
<input type="text" class="form-control" ng-model="data.input" placeholder="{{form.placeholder || 'Click to select input data'}}" />
<input
type="text"
class="form-control"
ng-model="data.input"
placeholder="{{form.placeholder || 'Click Select on the left to choose input data'}}"
/>
</div>
<span class="help-text" ng-if="requesting">
<button type="button" class="btn btn-xs btn-link" ng-click="stopWant($event)">Cancel</button>
Expand Down
Loading

0 comments on commit 47f5a93

Please sign in to comment.