Initial commit. Implemented OAuth, Linodes, volumes, and images
This commit is contained in:
43
linodes/backups_enable/backups_enable.css
Normal file
43
linodes/backups_enable/backups_enable.css
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* This file is part of Linode Manager Classic.
|
||||
*
|
||||
* Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
@import url('/global.css');
|
||||
|
||||
#backups_enable {
|
||||
padding: 0px 15px 15px;
|
||||
}
|
||||
|
||||
#button-block {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h2 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#price {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#price-info {
|
||||
padding-top: 15px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.top-level {
|
||||
font-weight: bold;
|
||||
}
|
117
linodes/backups_enable/backups_enable.js
Normal file
117
linodes/backups_enable/backups_enable.js
Normal file
@ -0,0 +1,117 @@
|
||||
/*
|
||||
* This file is part of Linode Manager Classic.
|
||||
*
|
||||
* Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { settings, elements, apiGet, apiPost, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.enableButton = "enable-button";
|
||||
elements.linodeLabel = "linode-label";
|
||||
elements.linodeTag = "linode-tag";
|
||||
elements.linodeTagLink = "linode-tag-link";
|
||||
elements.price = "price";
|
||||
|
||||
// Data recieved from API calls
|
||||
var data = {};
|
||||
data.linode = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.enableButton = {};
|
||||
ui.linodeLabel = {};
|
||||
ui.linodeTag = {};
|
||||
ui.linodeTagLink = {};
|
||||
ui.price = {};
|
||||
|
||||
// Callback for linode details API call
|
||||
var displayDetails = function(response)
|
||||
{
|
||||
data.linode = response;
|
||||
|
||||
// Set page title and header stuff
|
||||
document.title += " // " + data.linode.label;
|
||||
ui.linodeLabel.innerHTML = data.linode.label;
|
||||
if (data.linode.tags.length == 1) {
|
||||
ui.linodeTagLink.href = "/linodes?tag=" + data.linode.tags[0];
|
||||
ui.linodeTagLink.innerHTML = "(" + data.linode.tags[0] + ")";
|
||||
ui.linodeTag.style.display = "inline";
|
||||
}
|
||||
|
||||
// Redirect to backups page if backups are already enabled
|
||||
if (data.linode.backups.enabled)
|
||||
location.href = "/linodes/backups?lid=" + data.params.lid;
|
||||
|
||||
// Get Linode type info for backup pricing
|
||||
apiGet("/linode/types/" + data.linode.type, displayPricing, null);
|
||||
};
|
||||
|
||||
// Callback for linode type API call
|
||||
var displayPricing = function(response)
|
||||
{
|
||||
ui.price.innerHTML = "$" + response.addons.backups.price.monthly.toFixed(2) + "/mo";
|
||||
ui.enableButton.disabled = false;
|
||||
};
|
||||
|
||||
// Enable button handler
|
||||
var handleEnable = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
apiPost("/linode/instances/" + data.params.lid + "/backups/enable", {}, function(response)
|
||||
{
|
||||
location.href = "/linodes/backups?lid=" + data.params.lid;
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need a Linode ID, so die if we don't have it
|
||||
if (!data.params.lid) {
|
||||
alert("No Linode ID supplied!");
|
||||
return;
|
||||
}
|
||||
|
||||
setupHeader();
|
||||
|
||||
// Update links on page to include proper Linode ID
|
||||
var anchors = document.getElementsByTagName("a");
|
||||
for (var i = 0; i < anchors.length; i++)
|
||||
anchors[i].href = anchors[i].href.replace("lid=0", "lid=" + data.params.lid);
|
||||
|
||||
// Get element references
|
||||
ui.enableButton = document.getElementById(elements.enableButton);
|
||||
ui.linodeLabel = document.getElementById(elements.linodeLabel);
|
||||
ui.linodeTag = document.getElementById(elements.linodeTag);
|
||||
ui.linodeTagLink = document.getElementById(elements.linodeTagLink);
|
||||
ui.price = document.getElementById(elements.price);
|
||||
|
||||
// Register rebuild button handler
|
||||
ui.enableButton.addEventListener("click", handleEnable);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/linode/instances/" + data.params.lid, displayDetails, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
59
linodes/backups_enable/index.shtml
Normal file
59
linodes/backups_enable/index.shtml
Normal file
@ -0,0 +1,59 @@
|
||||
<!--
|
||||
This file is part of Linode Manager Classic.
|
||||
|
||||
Linode Manager Classic is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Linode Manager Classic is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Linode Manager Classic. If not, see <https://www.gnu.org/licenses/>.
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title>LMC - Backups Enable</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="backups_enable.css" />
|
||||
<script src="backups_enable.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!--#include virtual="/include/header.html"-->
|
||||
<!--#include virtual="/include/linode_subnav.html"-->
|
||||
<div id="main-content" class="wrapper">
|
||||
<div id="top-links"><a href="/linodes">Linodes</a> » <span id="linode-tag"><a id="linode-tag-link" href=""></a> » </span><a id="linode-label" href="/linodes/dashboard?lid=0"></a> » <a href="/linodes/backups?lid=0">Backups</a> » <span class="top-links-title">Enable</span></div>
|
||||
<div id="backups_enable">
|
||||
<h2>Backups</h2>
|
||||
<p>The Linode Backup System is designed to be an easy to use, reliable and redundant on-site backup solution for your Linode. It performs backups without causing any interruption of your running system. It provides 4 backup slots. Three of the slots are executed and rotated automatically: a daily backup, a 2-7 day old backup, and an 8-14 day old backup. The fouth backup slot is a user-initiated snapshot and remains in place until another user-initiated snapshot is taken.</p>
|
||||
<ul>
|
||||
<li>
|
||||
<span class="top-level">Resiliency:</span>
|
||||
<ul>
|
||||
<li>Linode's storage back ends tolerate hard drive failures by utilizing RAID across many drives.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="top-level">Restoring:</span>
|
||||
<ul>
|
||||
<li>You can restore a backup to any of the Linodes attached to this account, even if they do not have backups enabled. Currently only a full restore is possible.</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="top-level">Limitations:</span>
|
||||
<ul>
|
||||
<li>The backup system must be able to mount your disks on the host. If you've used fdisk on your disks to create partitions, or created encrypted volumes, or done anything other than use Linode's deployment or disk creation tools, the backup system won't be able to back up the data. The backup system operates on files, not at the block level.</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<p id="price-info">Backups for this Linode are <span id="price"></span>.</p>
|
||||
<div id="button-block"><button disabled id="enable-button" type="button">Enable backups for this Linode</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user