awips2/edexOsgi/com.raytheon.uf.edex.registry.ebxml/web/RegistrySubscriptionBackup.html
2018-07-20 10:13:41 -06:00

134 lines
3.2 KiB
HTML

<html>
<head>
<style type="text/css">
a {font-weight:bold;}
td {width:200px;}
button {width:190px;}
input{width:300px;}
table {border:0;}
select {width:200px;}
body { font-family: Helvetica;
margin-left: 75px;
margin-right: 75px;
background: #D3D3D3;}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Backup/Restore Subscriptions</title>
</head>
<body>
<h3>Backup/Restore Data Delivery Subscriptions</h3>
<table>
<tr>
<td>
<button id="backupSubscriptionButton" onClick="backupSubscription()" >Backup Subscription</button>
</td>
<td>
<input id="backupSubscriptionText" type="text"/></td>
</td>
</tr>
<tr>
<td>
<button id="backupAllSubscriptionsButton" onClick="backupAllSubscriptions()">Backup All Subscriptions</button>
</td>
<td>
</td>
</tr>
<tr>
<td>
<button id="restoreSubscriptionButton" onClick="restoreSubscription()" >Restore Subscription</button>
</td>
<td>
<input id="restoreSubscriptionText" type="text"/></td>
</td>
</tr>
<tr>
<td>
<button id="restoreSubscriptionsButton" onClick="restoreSubscriptions()">Restore Subscriptions</button>
</td>
<td>
</td>
</tr>
<tr>
<td>
<button id="viewSubscriptionsButton" onClick="viewSubscriptions()">View Subscriptions</button>
</td>
<td>
</td>
</tr>
<tr>
<td>
<button id="clearBackedUpSubscriptionsButton" onClick="clearBackupDir()">Clear Backup Files</button>
</td>
<td>
</td>
</tr>
</table>
<p>
<p>
<div id="statusSpan" style="font-weight:bold; font-size:8pt"></span>
<br>
</body>
<script language="JavaScript">
function clearBackupDir(){
updateStatus("Clearing backup files...")
updateStatus(callRESTService("clearSubscriptionBackupFiles"))
}
function viewSubscriptions(){
updateStatus("Retrieving Subscriptions...")
updateStatus(callRESTService("getSubscriptions"))
}
function restoreSubscription(){
subscription = document.getElementById("restoreSubscriptionText").value
if(subscription){
updateStatus("Restoring subscription: ["+subscription+"]...")
updateStatus(callRESTService("restoreSubscription/"+subscription))
}else{
updateStatus("Please input a subscription name to be restored")
}
}
function restoreSubscriptions(){
updateStatus("Restoring Subscriptions...")
updateStatus(callRESTService("restoreSubscriptions"))
}
function backupSubscription(){
subscription = document.getElementById("backupSubscriptionText").value
if(subscription){
updateStatus("Backing up subscription: ["+subscription+"]...")
updateStatus(callRESTService("backupSubscription/"+subscription))
}else{
updateStatus("Please input a subscription name to be backed up")
}
}
function backupAllSubscriptions(){
updateStatus("Backing up subscriptions...")
updateStatus(callRESTService("backupAllSubscriptions"))
}
function callRESTService(func){
var url = "https://"+window.location.host+"/dataDelivery/dataAccess/"+func;
var client = new XMLHttpRequest();
client.open("GET", url, false);
client.setRequestHeader("Content-Type", "text/plain");
client.send();
return client.responseText
}
function updateStatus(status){
document.getElementById("statusSpan").innerHTML = status
}
</script>
</html>