start removing lots of print
This commit is contained in:
@@ -39,8 +39,8 @@
|
||||
{% endif %}
|
||||
<details><summary>Upload settings</summary>
|
||||
<form>
|
||||
<div>
|
||||
<fieldset><legend>Select how series should be ordered when uploaded</legend>
|
||||
<div>
|
||||
<fieldset><legend>Select how series should be ordered when uploaded</legend>
|
||||
<div class="helptext">
|
||||
This will affect how series are displayed when viewing with the built in site viewer. By default when exporting from Insight the order is not maintained so you should choose to order either by slice location or instance number.<br/>
|
||||
If you are not sure, leave this as the default.
|
||||
@@ -57,8 +57,8 @@
|
||||
<input type="radio" id="order-series-none" value="order-series-none" name="order-series" >
|
||||
<label for="order-series-none">None</label><br/>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
|
||||
@@ -69,15 +69,15 @@
|
||||
title="Deleted selected uploads"
|
||||
>Delete Uploads</button>
|
||||
|
||||
<button id="import-dicoms-sequential-button"
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
>Import {% if case %}into case{% endif %} (one at a time)</button>
|
||||
<button id="import-dicoms-sequential-button"
|
||||
type="button"
|
||||
class="btn btn-primary"
|
||||
>Import {% if case %}into case{% endif %} (one at a time)</button>
|
||||
|
||||
<div id="import-status"></div>
|
||||
<div id="import-status"></div>
|
||||
|
||||
<div class="indicator"><div class="loader"></div>Loading...</div>
|
||||
<div id="import-status"></div>
|
||||
<div id="import-status"></div>
|
||||
|
||||
<div class="imported">
|
||||
|
||||
@@ -89,136 +89,138 @@
|
||||
|
||||
<p><a href="{% url 'atlas:series_view' %}?case=null&sort=-modified_date">View orphan series</a></p>
|
||||
|
||||
<script>
|
||||
document.getElementById('import-dicoms-sequential-button').addEventListener('click', async function() {
|
||||
const checkboxes = Array.from(document.querySelectorAll('input[name="selection"]:checked'));
|
||||
const allCheckboxes = Array.from(document.querySelectorAll('input[name="selection"]'));
|
||||
<script>
|
||||
const importButton = document.getElementById('import-dicoms-sequential-button');
|
||||
if (importButton) {
|
||||
document.getElementById('import-dicoms-sequential-button').addEventListener('click', async function() {
|
||||
const checkboxes = Array.from(document.querySelectorAll('input[name="selection"]:checked'));
|
||||
const allCheckboxes = Array.from(document.querySelectorAll('input[name="selection"]'));
|
||||
// Only include checkboxes that are not disabled (i.e., not already imported)
|
||||
const selectableCheckboxes = allCheckboxes.filter(cb => !cb.disabled);
|
||||
const toImport = checkboxes.length
|
||||
? checkboxes.filter(cb => !cb.disabled)
|
||||
: selectableCheckboxes;
|
||||
if (toImport.length === 0) {
|
||||
alert("Please select at least one series to import (not already imported).");
|
||||
return;
|
||||
}
|
||||
const statusDiv = document.getElementById('import-status');
|
||||
statusDiv.innerHTML = '';
|
||||
const orderSeries = document.querySelector('input[name="order-series"]:checked').value;
|
||||
const csrfToken = '{{ csrf_token }}';
|
||||
{% if case %}
|
||||
const importUrl = "{% url 'api-1:import_dicoms_case' case.id %}";
|
||||
{% else %}
|
||||
const importUrl = "{% url 'api-1:import_dicoms' %}";
|
||||
{% endif %}
|
||||
for (let i = 0; i < toImport.length; i++) {
|
||||
const seriesId = toImport[i].value;
|
||||
statusDiv.innerHTML += `<div id="import-status-${seriesId}">Importing series ${seriesId}...</div>`;
|
||||
try {
|
||||
const response = await fetch(importUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"X-CSRFToken": csrfToken,
|
||||
},
|
||||
body: `selection=${encodeURIComponent(seriesId)}&order-series=${encodeURIComponent(orderSeries)}`
|
||||
});
|
||||
const text = await response.text();
|
||||
document.getElementById(`import-status-${seriesId}`).innerHTML = `Series ${seriesId}: ${text}`;
|
||||
const selectableCheckboxes = allCheckboxes.filter(cb => !cb.disabled);
|
||||
const toImport = checkboxes.length
|
||||
? checkboxes.filter(cb => !cb.disabled)
|
||||
: selectableCheckboxes;
|
||||
if (toImport.length === 0) {
|
||||
alert("Please select at least one series to import (not already imported).");
|
||||
return;
|
||||
}
|
||||
const statusDiv = document.getElementById('import-status');
|
||||
statusDiv.innerHTML = '';
|
||||
const orderSeries = document.querySelector('input[name="order-series"]:checked').value;
|
||||
const csrfToken = '{{ csrf_token }}';
|
||||
{% if case %}
|
||||
const importUrl = "{% url 'api-1:import_dicoms_case' case.id %}";
|
||||
{% else %}
|
||||
const importUrl = "{% url 'api-1:import_dicoms' %}";
|
||||
{% endif %}
|
||||
for (let i = 0; i < toImport.length; i++) {
|
||||
const seriesId = toImport[i].value;
|
||||
statusDiv.innerHTML += `<div id="import-status-${seriesId}">Importing series ${seriesId}...</div>`;
|
||||
try {
|
||||
const response = await fetch(importUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/x-www-form-urlencoded",
|
||||
"X-CSRFToken": csrfToken,
|
||||
},
|
||||
body: `selection=${encodeURIComponent(seriesId)}&order-series=${encodeURIComponent(orderSeries)}`
|
||||
});
|
||||
const text = await response.text();
|
||||
document.getElementById(`import-status-${seriesId}`).innerHTML = `Series ${seriesId}: ${text}`;
|
||||
// Mark as imported in the UI and make unselectable
|
||||
const li = document.querySelector(`#series-list input[value="${seriesId}"]`)?.closest('li');
|
||||
if (li && !li.classList.contains('imported')) {
|
||||
li.classList.add('imported');
|
||||
const li = document.querySelector(`#series-list input[value="${seriesId}"]`)?.closest('li');
|
||||
if (li && !li.classList.contains('imported')) {
|
||||
li.classList.add('imported');
|
||||
// Add badge if not already present
|
||||
if (!li.querySelector('.badge.bg-success')) {
|
||||
const badge = document.createElement('span');
|
||||
badge.className = 'badge bg-success ms-2';
|
||||
badge.textContent = 'Imported';
|
||||
li.appendChild(badge);
|
||||
}
|
||||
if (!li.querySelector('.badge.bg-success')) {
|
||||
const badge = document.createElement('span');
|
||||
badge.className = 'badge bg-success ms-2';
|
||||
badge.textContent = 'Imported';
|
||||
li.appendChild(badge);
|
||||
}
|
||||
// Disable checkbox and prevent further selection
|
||||
const checkbox = li.querySelector('input[name="selection"]');
|
||||
if (checkbox) {
|
||||
checkbox.disabled = true;
|
||||
checkbox.checked = false;
|
||||
}
|
||||
const checkbox = li.querySelector('input[name="selection"]');
|
||||
if (checkbox) {
|
||||
checkbox.disabled = true;
|
||||
checkbox.checked = false;
|
||||
}
|
||||
// Remove click handler for selection
|
||||
li.querySelector('span').onclick = null;
|
||||
li.style.pointerEvents = "none";
|
||||
li.style.opacity = "0.7";
|
||||
}
|
||||
} catch (e) {
|
||||
document.getElementById(`import-status-${seriesId}`).innerHTML = `Series ${seriesId}: <span style="color:red;">Failed</span>`;
|
||||
li.querySelector('span').onclick = null;
|
||||
li.style.pointerEvents = "none";
|
||||
li.style.opacity = "0.7";
|
||||
}
|
||||
} catch (e) {
|
||||
document.getElementById(`import-status-${seriesId}`).innerHTML = `Series ${seriesId}: <span style="color:red;">Failed</span>`;
|
||||
}
|
||||
}
|
||||
statusDiv.innerHTML += "<div>All done.</div>";
|
||||
});
|
||||
}
|
||||
}
|
||||
statusDiv.innerHTML += "<div>All done.</div>";
|
||||
});
|
||||
</script>
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block css %}
|
||||
<style>
|
||||
.indicator {
|
||||
display: none;
|
||||
}
|
||||
<style>
|
||||
.indicator {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.indicator.htmx-request {
|
||||
display: block;
|
||||
}
|
||||
.indicator.htmx-request {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.loader {
|
||||
width: 50px;
|
||||
aspect-ratio: 1;
|
||||
display: grid;
|
||||
}
|
||||
.loader::before,
|
||||
.loader::after {
|
||||
content:"";
|
||||
grid-area: 1/1;
|
||||
--c:no-repeat radial-gradient(farthest-side,#25b09b 92%,#0000);
|
||||
background:
|
||||
var(--c) 50% 0,
|
||||
var(--c) 50% 100%,
|
||||
var(--c) 100% 50%,
|
||||
var(--c) 0 50%;
|
||||
background-size: 12px 12px;
|
||||
animation: l12 1s infinite;
|
||||
}
|
||||
.loader::before {
|
||||
margin: 4px;
|
||||
filter: hue-rotate(45deg);
|
||||
background-size: 8px 8px;
|
||||
animation-timing-function: linear
|
||||
}
|
||||
.loader {
|
||||
width: 50px;
|
||||
aspect-ratio: 1;
|
||||
display: grid;
|
||||
}
|
||||
.loader::before,
|
||||
.loader::after {
|
||||
content:"";
|
||||
grid-area: 1/1;
|
||||
--c:no-repeat radial-gradient(farthest-side,#25b09b 92%,#0000);
|
||||
background:
|
||||
var(--c) 50% 0,
|
||||
var(--c) 50% 100%,
|
||||
var(--c) 100% 50%,
|
||||
var(--c) 0 50%;
|
||||
background-size: 12px 12px;
|
||||
animation: l12 1s infinite;
|
||||
}
|
||||
.loader::before {
|
||||
margin: 4px;
|
||||
filter: hue-rotate(45deg);
|
||||
background-size: 8px 8px;
|
||||
animation-timing-function: linear
|
||||
}
|
||||
|
||||
@keyframes l12 {
|
||||
100%{transform: rotate(.5turn)}
|
||||
}
|
||||
@keyframes l12 {
|
||||
100%{transform: rotate(.5turn)}
|
||||
}
|
||||
|
||||
#series-list {
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
#series-list {
|
||||
user-select: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#series-list li {
|
||||
}
|
||||
#series-list .selected {
|
||||
color: white;
|
||||
border: 1px solid #52057b;
|
||||
user-select: none;
|
||||
margin: -1px;
|
||||
#series-list li {
|
||||
}
|
||||
#series-list .selected {
|
||||
color: white;
|
||||
border: 1px solid #52057b;
|
||||
user-select: none;
|
||||
margin: -1px;
|
||||
|
||||
}
|
||||
.series-block-popup-link {
|
||||
float: right;
|
||||
}
|
||||
#series-list li.imported {
|
||||
border-color: #e6ffe6;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
|
||||
}
|
||||
.series-block-popup-link {
|
||||
float: right;
|
||||
}
|
||||
#series-list li.imported {
|
||||
border-color: #e6ffe6;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
|
||||
{% endblock css %}
|
||||
|
||||
Reference in New Issue
Block a user