-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #149 from brain-image-library/feature/submitbutton
WIP Developing submit collection to be validated page
- Loading branch information
Showing
9 changed files
with
252 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ __pycache__/ | |
*.py[cod] | ||
*.swp | ||
*venv | ||
bil_site/settings.py | ||
site.cfg | ||
tags | ||
.~lock*.xls# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
function collection_send() { | ||
const csrftoken = Cookies.get('csrftoken'); | ||
let output_rows = [] | ||
$('tbody>tr').each(function(i, e){ | ||
let $e = $(e); | ||
// $e is the tr element | ||
let row_is_checked = $e.find('#collection_is_checked').is(':checked'); | ||
// row_is_checked is a boolean of whether that row is checked or not | ||
let bil_uuid = $e.find('#bilUuid') | ||
if(row_is_checked) | ||
output_rows.push({ | ||
"bil_uuid": bil_uuid.text() | ||
} | ||
) | ||
}); | ||
fetch(`${window.origin}/ingest/collection_send/`, { | ||
method: "POST", | ||
credentials: "include", | ||
body: JSON.stringify(output_rows), | ||
cache: "no-cache", | ||
headers: new Headers({ | ||
"X-CSRFToken": csrftoken, | ||
"content-type": "application/json" | ||
}) | ||
}) | ||
.then(function(response) { | ||
if (response.status !== 200) { | ||
console.log('Looks like there was a problem. Status code: ${response.status}'); | ||
return; | ||
} | ||
response.json().then(function(data) { | ||
console.log(data); | ||
window.location.replace(data['url']); | ||
}); | ||
}) | ||
.catch(function(error) { | ||
console.log("Fetch error: " + error); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
ingest/templates/ingest/submit_request_collection_list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<head> | ||
<script src="/static/ingest/sendemail.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/js-cookie@rc/dist/js.cookie.min.js"></script> | ||
</head> | ||
{% extends 'ingest/wide.html' %} | ||
{% load bootstrap4 %} | ||
{% block wide %} | ||
<h1>Submit Request to Publicize Collection</h1> | ||
<p>Select checkboxes for each collection to request validation and publication. This will submit a ticket to BIL support and be processed</p> | ||
<form id="rowform"> | ||
{% csrf_token %} | ||
<table id="CollectionTable" class="table"> | ||
<thead> | ||
<tr> | ||
<th></th> | ||
<th>Name</th> | ||
<th>Description</th> | ||
<th>Organization Lab</th> | ||
<th>Lab Name</th> | ||
<th>Project Funder ID</th> | ||
<th>Project Funder</th> | ||
<th>BIL Uuid</th> | ||
<th>Data Path</th> | ||
<th>Locked</th> | ||
<th>Submission Status</th> | ||
<th>Validation Status</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for collection in collections %} | ||
<tr> | ||
<td><input type="checkbox" id="collection_is_checked"></td> | ||
<td>{{collection.name}}</td> | ||
<td>{{collection.description}}</td> | ||
<td>{{collection.organization_name}}</td> | ||
<td>{{collection.lab_name}}</td> | ||
<td>{{collection.project_funder_id}}</td> | ||
<td>{{collection.project_funder}}</td> | ||
<td id="bilUuid">{{collection.bil_uuid}}</td> | ||
<td>{{collection.data_path}}</td> | ||
<td>{{collection.locked}}</td> | ||
<td>{{collection.submission_status}}</td> | ||
<td>{{collection.validation_status}}</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</form> | ||
<button class="btn btn-primary" onclick="collection_send();">Submit Validation Request</button> | ||
<hr> | ||
|
||
<a href="{% url 'ingest:index' %}"> | ||
<button class="cancel btn btn btn-primary" value="ignore" formnovalidate="">Cancel</button> | ||
</a> | ||
|
||
{% endblock %} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters