mirror of
https://github.com/JasonHHouse/gaps.git
synced 2026-02-09 20:29:03 -06:00
Adding nuke
This commit is contained in:
@@ -94,11 +94,11 @@ public class GapsController {
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.PUT,
|
||||
value = "/nuke/{username}",
|
||||
value = "/nuke",
|
||||
produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@ResponseBody
|
||||
public ResponseEntity<Payload> putNuke(@PathVariable("username") final String username) {
|
||||
LOGGER.info("putNuke( " + username + " )");
|
||||
public ResponseEntity<Payload> putNuke() {
|
||||
LOGGER.info("putNuke()");
|
||||
LOGGER.info("Deleting all local files");
|
||||
Payload payload = ioService.nuke();
|
||||
if (payload.getCode() == Payload.NUKE_SUCCESSFUL.getCode()) {
|
||||
|
||||
@@ -13,6 +13,7 @@ import {Payload} from '/js/modules/payload.js';
|
||||
let plexSpinner, plexSaveSuccess, plexSaveError, plexTestSuccess, plexTestError, plexDeleteSuccess, plexDeleteError,
|
||||
plexDuplicateError;
|
||||
let tmdbSpinner, tmdbSaveSuccess, tmdbSaveError, tmdbTestSuccess, tmdbTestError;
|
||||
let deleteAllError, deleteAllSuccess;
|
||||
|
||||
window.addEventListener('load', function () {
|
||||
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
||||
@@ -45,6 +46,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
tmdbTestError = $('#tmdbTestError');
|
||||
plexDuplicateError = $('#plexDuplicateError');
|
||||
|
||||
deleteAllError = $('#deleteAllError');
|
||||
deleteAllSuccess = $('#deleteAllSuccess');
|
||||
|
||||
const socket = new SockJS('/gs-guide-websocket');
|
||||
const stompClient = Stomp.over(socket);
|
||||
stompClient.connect({}, function (frame) {
|
||||
@@ -84,6 +88,8 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
window.addPlexServer = addPlexServer;
|
||||
window.testExistingPlexServer = testExistingPlexServer;
|
||||
window.removePlexServer = removePlexServer;
|
||||
window.setDeleteAllEnabledOrDisabled = setDeleteAllEnabledOrDisabled;
|
||||
window.nuke = nuke;
|
||||
});
|
||||
|
||||
function testTmdbKey() {
|
||||
@@ -243,6 +249,31 @@ function removePlexServer(machineIdentifier) {
|
||||
});
|
||||
}
|
||||
|
||||
function setDeleteAllEnabledOrDisabled() {
|
||||
$('#deleteAll').prop("disabled", !$('#confirmDeleteAll').is(":checked"));
|
||||
}
|
||||
|
||||
function nuke() {
|
||||
$.ajax({
|
||||
type: 'PUT',
|
||||
url: '/nuke',
|
||||
success: function (result) {
|
||||
hideAllAlertsAndSpinners();
|
||||
if (result && result.code === 30) {
|
||||
deleteAllSuccess.show();
|
||||
$('#movieDbApiKey').val('');
|
||||
$('#plexServers').html('');
|
||||
} else {
|
||||
deleteAllError.show();
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
hideAllAlertsAndSpinners();
|
||||
deleteAllError.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function hideAllAlertsAndSpinners() {
|
||||
//Spinners
|
||||
plexSpinner.hide();
|
||||
@@ -261,6 +292,10 @@ function hideAllAlertsAndSpinners() {
|
||||
tmdbTestError.hide();
|
||||
tmdbSaveSuccess.hide();
|
||||
tmdbSaveError.hide();
|
||||
|
||||
//Advanced
|
||||
deleteAllSuccess.hide();
|
||||
deleteAllError.hide();
|
||||
}
|
||||
|
||||
$(function () {
|
||||
@@ -269,4 +304,4 @@ $(function () {
|
||||
// -or-, see below
|
||||
$(this).closest("." + $(this).attr("data-hide")).hide();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -61,6 +61,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#network" id="networkTab">Network</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#advanced" id="advancedTab">Advanced</a>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="tab-content top-margin" id="myTabContent">
|
||||
<div class="tab-pane fade show active top-margin" id="tmdb">
|
||||
@@ -286,6 +289,30 @@
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade top-margin" id="advanced">
|
||||
|
||||
<form class="needs-validation" id="advancedConfiguration" novalidate>
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="confirmDeleteAll" onchange="setDeleteAllEnabledOrDisabled();">
|
||||
<label class="form-check-label" for="confirmDeleteAll">Delete All Stored Data</label>
|
||||
</div>
|
||||
</div>
|
||||
<button class="btn btn-primary" id="deleteAll" onclick="nuke();" disabled type="button">Delete</button>
|
||||
</form>
|
||||
|
||||
<div class="alert alert-dismissible alert-danger gaps-hide top-margin" id="deleteAllError">
|
||||
<button class="close" data-hide="alert" type="button">×</button>
|
||||
<h4 class="alert-heading">Error!</h4>
|
||||
<p class="mb-0">Could not delete stored data. Check the logs and try again.</p>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-dismissible alert-success gaps-hide top-margin" id="deleteAllSuccess">
|
||||
<button class="close" data-hide="alert" type="button">×</button>
|
||||
<h4 class="alert-heading">Success!</h4>
|
||||
<p class="mb-0">Deleting stored data successful.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user