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/stream.html">Go to Re-stream View</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="UltrawideButton" style="float:right;margin-right:10px;" href="JavaScript:toggleUltrawide();">Ultrawide</a>
</div>

@ -309,9 +309,9 @@ thrimbletrimmerManualLink = function() {
}));
};
thrimbletrimmerResetLink = function() {
thrimbletrimmerResetLink = function(force) {
var rowId = /id=(.*)(?:&|$)/.exec(document.location.search)[1];
if(!confirm(
if(force && !confirm(
'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. ' +
'It is intended as a last-ditch command to clear a malfunctioning cutter, ' +
@ -321,11 +321,12 @@ thrimbletrimmerResetLink = function() {
return;
}
document.getElementById("ResetButton").disabled = true;
document.getElementById("CancelButton").disabled = true;
var body = {}
if (!!user) {
body.token = user.getAuthResponse().id_token;
}
fetch("/thrimshim/reset/"+rowId, {
fetch("/thrimshim/reset/"+rowId + "?force=" + force, {
method: 'POST',
headers: {
'Accept': 'application/json',
@ -339,8 +340,9 @@ thrimbletrimmerResetLink = function() {
console.log(error);
alert(error);
document.getElementById("ResetButton").disabled = false;
document.getElementById("CancelButton").disabled = true;
} else {
alert("Row has been reset. Reloading...");
alert("Row has been " + ((force) ? "reset" : "cancelled") +". Reloading...");
setTimeout(() => { window.location.reload(); }, 500);
}
}));

Loading…
Cancel
Save