Initial commit. Implemented OAuth, Linodes, volumes, and images

This commit is contained in:
2020-01-10 00:24:59 -05:00
commit 9915ef3413
121 changed files with 14776 additions and 0 deletions

View File

@ -0,0 +1,38 @@
<!--
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 - Remove Volume</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="remove.css" />
<script src="remove.js" type="module"></script>
</head>
<body>
<!--#include virtual="/include/header.html"-->
<div id="main-content" class="wrapper">
<div id="top-links"><a href="/volumes">Volumes</a> » <a id="volume-label" href="/volumes/settings?vid=0"></a> » <span class="top-links-title">Remove Volume</span></div>
<div id="remove">
<div id="warning" class="warning">You must confirm that you want to remove this Volume.</div>
<p>Are you sure you want to remove the "<span id="label"></span>" volume from your account?</p>
<p><input id="confirm" type="checkbox" /> <label for="confirm">Yes, delete this Volume</label></p>
<button disabled id="delete-button" type="button">Delete this Volume</button>
</div>
</div>
</body>
</html>

30
volumes/remove/remove.css Normal file
View File

@ -0,0 +1,30 @@
/*
* 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');
#label {
font-weight: bold;
}
#remove {
padding: 0px 15px 15px;
}
#warning {
display: none;
}

102
volumes/remove/remove.js Normal file
View File

@ -0,0 +1,102 @@
/*
* 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, apiDelete, apiGet, parseParams, setupHeader } from "/global.js";
(function()
{
// Element names specific to this page
elements.confirm = "confirm";
elements.deleteButton = "delete-button";
elements.label = "label";
elements.volumeLabel = "volume-label";
elements.warning = "warning";
// Data recieved from API calls
var data = {};
// Static references to UI elements
var ui = {};
ui.confirm = {};
ui.deleteButton = {};
ui.label = {};
ui.volumeLabel = {};
ui.warning = {};
// Callback for volume API call
var displayVolume = function(response)
{
// Set page title and header stuff
document.title += " // " + response.label;
ui.volumeLabel.innerHTML = response.label;
ui.label.innerHTML = response.label;
ui.deleteButton.disabled = false;
};
// Click handler for delete button
var handleDelete = function(event)
{
if (event.currentTarget.disabled)
return;
if (!ui.confirm.checked) {
ui.warning.style.display = "block";
return;
}
apiDelete("/volumes/" + data.params.vid, function(response)
{
location.href = "/volumes";
});
};
// Initial setup
var setup = function()
{
// Parse URL parameters
data.params = parseParams();
// We need a volume ID, so die if we don't have it
if (!data.params.vid) {
alert("No volume ID supplied!");
return;
}
setupHeader();
// Update links on page to include proper volume ID
var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++)
anchors[i].href = anchors[i].href.replace("vid=0", "vid=" + data.params.vid);
// Get element references
ui.confirm = document.getElementById(elements.confirm);
ui.deleteButton = document.getElementById(elements.deleteButton);
ui.label = document.getElementById(elements.label);
ui.volumeLabel = document.getElementById(elements.volumeLabel);
ui.warning = document.getElementById(elements.warning);
// Attach event handlers
ui.deleteButton.addEventListener("click", handleDelete);
// Get data from API
apiGet("/volumes/" + data.params.vid, displayVolume, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();