Implement NodeBalancers
This commit is contained in:
36
nodebalancers/remove/index.shtml
Normal file
36
nodebalancers/remove/index.shtml
Normal file
@ -0,0 +1,36 @@
|
||||
<!--
|
||||
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 NodeBalancer</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="/nodebalancers">NodeBalancers</a> » <a id="toplink-label" href="/nodebalancers/balancer?nbid=0"></a> » <span class="top-links-title">Remove</span></div>
|
||||
<div id="remove">
|
||||
<p>Are you sure you want to delete the "<span id="label"></span>" NodeBalancer?</p>
|
||||
<button id="delete-button" type="button">Yes, delete this sucker</button>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
22
nodebalancers/remove/remove.css
Normal file
22
nodebalancers/remove/remove.css
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* 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');
|
||||
|
||||
#remove {
|
||||
padding: 0px 15px 15px;
|
||||
}
|
85
nodebalancers/remove/remove.js
Normal file
85
nodebalancers/remove/remove.js
Normal file
@ -0,0 +1,85 @@
|
||||
/*
|
||||
* 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, apiDelete, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.deleteButton = "delete-button";
|
||||
elements.label = "label";
|
||||
elements.toplinkLabel = "toplink-label";
|
||||
|
||||
// Data recieved from API calls
|
||||
var data = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.deleteButton = {};
|
||||
ui.label = {};
|
||||
ui.toplinkLabel = {};
|
||||
|
||||
// Callback for image API call
|
||||
var displayNodebalancer = function(response)
|
||||
{
|
||||
ui.toplinkLabel.innerHTML = response.label;
|
||||
ui.label.innerHTML = response.label;
|
||||
};
|
||||
|
||||
// Handler for delete button
|
||||
var handleDelete = function(event)
|
||||
{
|
||||
apiDelete("/nodebalancers/" + data.params.nbid, function(response)
|
||||
{
|
||||
location.href = "/nodebalancers";
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need an image ID, so die if we don't have it
|
||||
if (!data.params.nbid) {
|
||||
alert("No NodeBalancer 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("nbid=0", "nbid=" + data.params.nbid);
|
||||
|
||||
// Get element references
|
||||
ui.deleteButton = document.getElementById(elements.deleteButton);
|
||||
ui.label = document.getElementById(elements.label);
|
||||
ui.toplinkLabel = document.getElementById(elements.toplinkLabel);
|
||||
|
||||
// Attach event handlers
|
||||
ui.deleteButton.addEventListener("click", handleDelete);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/nodebalancers/" + data.params.nbid, displayNodebalancer, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
Reference in New Issue
Block a user