Skip to content

Commit

Permalink
Merge branch 'dynamic-ng' into flex-dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
dxenes1 committed Apr 3, 2023
2 parents b6813ad + 74d358c commit ebebde4
Show file tree
Hide file tree
Showing 9 changed files with 254 additions and 142 deletions.
6 changes: 6 additions & 0 deletions neuvue_project/templates/inspect.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ <h3 class="text-white mb-3"> Inspect Task </h3>

<div id="neuroglancer" class="leftFormatting">
<div class="left">
<! Neuroglancer Container>
{% if ng_url %}
<iframe src="{{ng_url}}" class="neuroglancer-container" id="neuroglancer-container"></iframe>
{% else %}
<div id="neuroglancer-container" class="neuroglancer-container"></div>
{% endif %}

<div class="bottomBar">
<button id="btnExit" type="button" class="mainButton" onclick= "document.location='{% url 'inspect' %}'">
Exit
Expand Down
252 changes: 135 additions & 117 deletions neuvue_project/templates/workspace.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,136 +113,137 @@
</div>
{% endfor %}
</form>

<div id="neuroglancer-container" class="neuroglancer-container"></div>

<! Neuroglancer Container>
{% if ng_url %}
<iframe src="{{ng_url}}" class="neuroglancer-container" id="neuroglancer-container"></iframe>
{% else %}
<div id="neuroglancer-container" class="neuroglancer-container"></div>
{% endif %}
<! Buttons >
<form id="mainForm" action="" method="post" class="bottomBar justify-content-center">
{% csrf_token %}


<! Flag >
<div class="mainButtonWrapper">
<button
id="btnFlag"
type="button"
class="mainButton flag"
accesskey="f"
data-bs-toggle="modal"
data-bs-target="#flagModal">
Flag Task
</button>
<div class="hotkeyHint">
<span class="modifier"></span><span> + <kbd>f</kbd> </span>
</div>
<form id="mainForm" action="" method="post" class="bottomBar justify-content-center">
{% csrf_token %}
<! Flag >
<div class="mainButtonWrapper">
<button
id="btnFlag"
type="button"
class="mainButton flag"
accesskey="f"
data-bs-toggle="modal"
data-bs-target="#flagModal">
Flag Task
</button>
<div class="hotkeyHint">
<span class="modifier"></span><span> + <kbd>f</kbd> </span>
</div>
</div>


{% if allowed_to_reassgin%}
<! Remove >
<div class="mainButtonWrapper">
<button
id="btnRemove"
type="button"
class="mainButton remove"
data-bs-toggle="modal"
data-bs-target="#removeModal"
>
Remove Task
</button>
</div>
{% endif %}

<! Skip >
{% if skipable %}
<div class="mainButtonWrapper">
<button
id="btnSkipSubmit"
type="button"
class="mainButton skip"
accesskey="k"
onclick="triggerLoadingSpinner('skip_task_load')"
{% if allowed_to_reassgin%}
<! Remove >
<div class="mainButtonWrapper">
<button
id="btnRemove"
type="button"
class="mainButton remove"
data-bs-toggle="modal"
data-bs-target="#removeModal"
>
<div id = 'skip_task_load'>
Skip Task
</div>
</button>
<div class="hotkeyHint">
<span class="modifier"></span><span> + <kbd>k</kbd></span>
Remove Task
</button>
</div>
{% endif %}

<! Skip >
{% if skipable %}
<div class="mainButtonWrapper">
<button
id="btnSkipSubmit"
type="button"
class="mainButton skip"
accesskey="k"
onclick="triggerLoadingSpinner('skip_task_load')"
>
<div id = 'skip_task_load'>
Skip Task
</div>

</button>
<div class="hotkeyHint">
<span class="modifier"></span><span> + <kbd>k</kbd></span>
</div>
{% endif %}

<! Submit >
{% if submit_task_button %}
<div class="mainButtonWrapper">
<button
name="btnSubmit"
id="btnSubmit"
type="button"
class="mainButton submit"
onclick="triggerLoadingSpinner('submit_task_load')"
</div>
{% endif %}

<! Submit >
{% if submit_task_button %}
<div class="mainButtonWrapper">
<button
name="btnSubmit"
id="btnSubmit"
type="button"
class="mainButton submit"
onclick="triggerLoadingSpinner('submit_task_load')"
>
<div id = 'submit_task_load'>
Submit Task
</div>
</button>
</div>
{% endif %}

<! Save State >
<div class="mainButtonWrapper">
<button
id="btnSaveState"
type="button"
class="mainButton save_state"
onclick="triggerLoadingSpinner('save_state')"
>
<div id = 'submit_task_load'>
Submit Task
</div>
</button>
<div id = 'save_state'>
Save State
</div>
</button>
</div>

<! Stop >
<div class="mainButtonWrapper">
<button
id="btnStop"
type="button"
class="mainButton pause"
accesskey="e"
onclick="triggerLoadingSpinner('exit_task_load')"
>
<div id = 'exit_task_load'>
Save and Exit Task
</div>
</button>
<div class="hotkeyHint">
<span class="modifier"></span><span class="hotkey_button"> + <kbd>e</kbd></span>
</div>
{% endif %}
</div>

<! Save State >
<div class="mainButtonWrapper">
<button
id="btnSaveState"
type="button"
class="mainButton save_state"
onclick="triggerLoadingSpinner('save_state')"
>
<div id = 'save_state'>
Save State
</div>
</button>
{% else %}
<! In-between Tasks >
<div class="interTaskBox">
<div class="interTaskTitle">
Tasks Complete <br> {{display_name}}
</div>

<! Stop >
<div class="mainButtonWrapper">
<button
id="btnStop"
type="button"
class="mainButton pause"
accesskey="e"
onclick="triggerLoadingSpinner('exit_task_load')"
>
<div id = 'exit_task_load'>
Save and Exit Task
type="button"
class="mainButton return"
onclick= "document.location='{% url 'tasks' %}';triggerLoadingSpinner('exit_workspace')">
<div id = 'exit_workspace'>
Return to Task page
</div>
</button>
<div class="hotkeyHint">
<span class="modifier"></span><span class="hotkey_button"> + <kbd>e</kbd></span>
</div>
</div>


{% else %}
<! In-between Tasks >
<div class="interTaskBox">
<div class="interTaskTitle">
Tasks Complete <br> {{display_name}}
</div>
<div class="mainButtonWrapper">
<button
type="button"
class="mainButton return"
onclick= "document.location='{% url 'tasks' %}';triggerLoadingSpinner('exit_workspace')">
<div id = 'exit_workspace'>
Return to Task page
</div>
</button>
</div>
{% endif %}
</div>

</form>
{% endif %}
</div>
</form>
</div>
</div>
<div style="display:none;">
Expand Down Expand Up @@ -305,6 +306,7 @@
}

function saveState() {
{% if not ng_url %}
viewer.postJsonState(true, undefined, true, function() {
let state = viewer.saver.savedUrl;
let post_body = JSON.stringify({'task_id':"{{task_id}}", 'ng_state' : state});
Expand All @@ -317,6 +319,9 @@
})
});
});
{% else %}
triggerToast("Autosave disabled for embedded neuroglancer");
{% endif %}
}

function show3DSlices() {
Expand Down Expand Up @@ -370,17 +375,25 @@

function submitForm(value, form='#mainForm') {
window.removeEventListener('beforeunload', exitAlert);
let duration = Math.round(browserTimer.getTimeInMilliseconds()/1000);

{% if ng_url %}

$('<input>').attr('type', 'hidden').attr('name', 'button').attr('value', value).appendTo(form);
$('<input>').attr('type', 'hidden').attr('name', 'duration').attr('value', duration).appendTo(form);
$(form).submit();

{% else %}

updateTrackedOperations(operation_ids)
viewer.postJsonState(true, undefined, true, function() {
let state = viewer.saver.savedUrl;

// Check if state successfully saved. If not use the raw JSON state
if (!state) {
state = JSON.stringify(viewer.state.toJSON());
}

let ng_differ_stack = JSON.stringify(viewer.differ.stack);
let duration = Math.round(browserTimer.getTimeInMilliseconds()/1000);

$('<input>').attr('type', 'hidden').attr('name', 'ngState').attr('value', state).appendTo(form);
$('<input>').attr('type', 'hidden').attr('name', 'button').attr('value', value).appendTo(form);
Expand All @@ -394,6 +407,8 @@

$(form).submit();
})

{% endif %}
}

function exitAlert(e) {
Expand Down Expand Up @@ -451,13 +466,17 @@
openSideMenu();
}

// Specific to built-in NG
{% if not ng_url%}
var received_data = {{ ng_state|safe }};
viewer.state.restoreState(received_data);



// Track operation IDs every three seconds
window.setInterval(function() {
updateTrackedOperations(operation_ids);
}, 3000);
{% endif %}

// alter hotkey hints based on operating system
var os = navigator.platform.toLowerCase();
Expand Down Expand Up @@ -541,7 +560,6 @@
})

$('#btnSaveState').click(function() {
console.log("button submission: savestate");
saveState();
})

Expand Down
1 change: 1 addition & 0 deletions neuvue_project/workspace/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class NamespaceAdmin(admin.ModelAdmin):
"namespace",
"display_name",
"ng_link_type",
"ng_host",
"submission_method",
"pcg_source",
"img_source",
Expand Down
18 changes: 18 additions & 0 deletions neuvue_project/workspace/migrations/0018_namespace_ng_host.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.7 on 2023-03-14 20:19

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('workspace', '0017_namespace_decrement_priority'),
]

operations = [
migrations.AddField(
model_name='namespace',
name='ng_host',
field=models.CharField(choices=[('neuvue', 'NeuVue Built-in'), ('https://neuroglancer.bossdb.io', 'neuroglancer.bossdb.io'), ('https://clio-ng.janelia.org', 'clio-ng.janelia.org')], default='neuvue', max_length=100),
),
]
23 changes: 23 additions & 0 deletions neuvue_project/workspace/migrations/0019_auto_20230328_0926.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.7 on 2023-03-28 14:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('workspace', '0018_namespace_ng_host'),
]

operations = [
migrations.AlterField(
model_name='namespace',
name='img_source',
field=models.CharField(choices=[('https://bossdb-open-data.s3.amazonaws.com/iarpa_microns/minnie/minnie65/em', 'Minnie65'), ('gs://microns_public_datasets/pinky100_v0/son_of_alignment_v15_rechunked', 'Pinky'), ('N/A', 'Other')], default='https://bossdb-open-data.s3.amazonaws.com/iarpa_microns/minnie/minnie65/em', max_length=300),
),
migrations.AlterField(
model_name='namespace',
name='pcg_source',
field=models.CharField(choices=[('https://minnie.microns-daf.com/segmentation/table/minnie3_v1', 'Minnie65'), ('https://minnie.microns-daf.com/segmentation/table/pinky_v2_microns_sandbox', 'Pinky'), ('N/A', 'Other')], default='https://minnie.microns-daf.com/segmentation/table/minnie3_v1', max_length=300),
),
]
Loading

0 comments on commit ebebde4

Please sign in to comment.