thrimbletrimmer: Add cancel row button using the new thrimshim functionality

pull/138/head
Mike Lang 5 years ago
parent 3dfe0e8722
commit cc48f17348

@ -98,7 +98,8 @@
<a href="/thrimbletrimmer/dashboard.html">Go To Dashboard</a> | <a href="/thrimbletrimmer/dashboard.html">Go To Dashboard</a> |
<a href="/thrimbletrimmer/stream.html">Go to Re-stream View</a> | <a href="/thrimbletrimmer/stream.html">Go to Re-stream View</a> |
<a id="ManualLinkButton" href="JavaScript:toggleHiddenPane('ManualLinkPane');">Manual Link</a> | <a id="ManualLinkButton" href="JavaScript:toggleHiddenPane('ManualLinkPane');">Manual Link</a> |
<a id="ResetButton" href="JavaScript:thrimbletrimmerResetLink();">Reset Edits</a> <a id="CancelButton" href="JavaScript:thrimbletrimmerResetLink(false);">Cancel Upload</a> |
<a id="ResetButton" href="JavaScript:thrimbletrimmerResetLink(true);">Force Reset Row</a>
<a id="HelpButton" style="float:right;" href="JavaScript:toggleHiddenPane('HelpPane');">Help</a> <a id="HelpButton" style="float:right;" href="JavaScript:toggleHiddenPane('HelpPane');">Help</a>
<a id="UltrawideButton" style="float:right;margin-right:10px;" href="JavaScript:toggleUltrawide();">Ultrawide</a> <a id="UltrawideButton" style="float:right;margin-right:10px;" href="JavaScript:toggleUltrawide();">Ultrawide</a>
</div> </div>

@ -309,9 +309,9 @@ thrimbletrimmerManualLink = function() {
})); }));
}; };
thrimbletrimmerResetLink = function() { thrimbletrimmerResetLink = function(force) {
var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1]; var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1];
if(!confirm( if(force && !confirm(
'Are you sure you want to reset this event? ' + 'Are you sure you want to reset this event? ' +
'This will set the row back to UNEDITED and forget about any video that already may exist. ' + 'This will set the row back to UNEDITED and forget about any video that already may exist. ' +
'It is intended as a last-ditch command to clear a malfunctioning cutter, ' + 'It is intended as a last-ditch command to clear a malfunctioning cutter, ' +
@ -321,11 +321,12 @@ thrimbletrimmerResetLink = function() {
return; return;
} }
document.getElementById("ResetButton").disabled = true; document.getElementById("ResetButton").disabled = true;
document.getElementById("CancelButton").disabled = true;
var body = {} var body = {}
if (!!user) { if (!!user) {
body.token = user.getAuthResponse().id_token; body.token = user.getAuthResponse().id_token;
} }
fetch("/thrimshim/reset/"+rowId, { fetch("/thrimshim/reset/"+rowId + "?force=" + force, {
method: 'POST', method: 'POST',
headers: { headers: {
'Accept': 'application/json', 'Accept': 'application/json',
@ -339,8 +340,9 @@ thrimbletrimmerResetLink = function() {
console.log(error); console.log(error);
alert(error); alert(error);
document.getElementById("ResetButton").disabled = false; document.getElementById("ResetButton").disabled = false;
document.getElementById("CancelButton").disabled = true;
} else { } else {
alert("Row has been reset. Reloading..."); alert("Row has been " + ((force) ? "reset" : "cancelled") +". Reloading...");
setTimeout(() => { window.location.reload(); }, 500); setTimeout(() => { window.location.reload(); }, 500);
} }
})); }));

Loading…
Cancel
Save