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

31
volumes/add/add.css Normal file
View File

@ -0,0 +1,31 @@
/*
* 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');
#add {
padding: 0px 15px 15px;
}
tbody tr td:first-of-type {
font-weight: bold;
text-align: right;
}
tbody tr:last-of-type {
border: none;
}

198
volumes/add/add.js Normal file
View File

@ -0,0 +1,198 @@
/*
* 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, regionNames, setupHeader } from "/global.js";
(function()
{
// Element names specific to this page
elements.addButton = "add-button";
elements.attachment = "attachment";
elements.label = "label";
elements.location = "location";
elements.size = "size";
// Data recieved from API calls
var data = {};
data.linodes = [];
data.regions = [];
// Static references to UI elements
var ui = {};
ui.addButton = {};
ui.attachment = {};
ui.label = {};
ui.location = {};
ui.size = {};
// Callback for linodes API call
var displayLinodes = function(response)
{
// Add linodes to array
data.linodes = data.linodes.concat(response.data);
// Request the next page if there are more pages
var filter = {
"+or": []
};
for (var i = 0; i < data.regions.length; i++)
filter["+or"].push({"region": data.regions[i].id});
if (response.page != response.pages) {
apiGet("/linode/instances?page=" + (response.page + 1), displayLinodes, filter);
return;
}
// Add linodes to selector
for (var i = 0; i < data.linodes.length; i++) {
var linode = document.createElement("option");
linode.value = data.linodes[i].id;
linode.innerHTML = data.linodes[i].label;
ui.attachment.appendChild(linode);
if (data.params.lid && parseInt(data.params.lid) == data.linodes[i].id) {
ui.attachment.value = data.linodes[i].id;
ui.location.value = data.linodes[i].region;
}
}
ui.addButton.disabled = false;
};
// Callback for regions API call
var displayRegions = function(response)
{
// Add regions that support block storage to array
for (var i = 0; i < response.data.length; i++) {
if (response.data[i].capabilities.includes("Block Storage"))
data.regions.push(response.data[i]);
}
// Request the next page if there are more pages
if (response.page != response.pages) {
apiGet("/regions?page=" + (response.page + 1), displayRegions, null);
return;
}
// Add regions to selector
for (var i = 0; i < data.regions.length; i++) {
var loc = document.createElement("option");
loc.value = data.regions[i].id;
if (regionNames[data.regions[i].id])
loc.innerHTML = regionNames[data.regions[i].id];
else
loc.innerHTML = data.regions[i].id;
ui.location.appendChild(loc);
}
// Request linodes in all the supported regions
var filter = {
"+or": []
};
for (var i = 0; i < data.regions.length; i++)
filter["+or"].push({"region": data.regions[i].id});
apiGet("/linode/instances", displayLinodes, filter);
};
// Click handler for add button
var handleAdd = function(event)
{
if (event.currentTarget.disabled)
return;
if (ui.location.value == "0") {
alert("You must select a location.");
return;
}
var req = {
"label": ui.label.value,
"size": parseInt(ui.size.value),
"region": ui.location.value
};
if (ui.attachment.value != "0")
req.linode_id = parseInt(ui.attachment.value);
apiPost("/volumes", req, function(response)
{
location.href = "/volumes/settings?vid=" + response.id;
});
};
// Linode select handler
var handleLinode = function(event)
{
// Set the location to the selected linode's region
var linode = null;
var lid = parseInt(ui.attachment.value);
for (var i = 0; i < data.linodes.length; i++) {
if (data.linodes[i].id == lid) {
linode = data.linodes[i];
break;
}
}
if (!linode)
return;
ui.location.value = linode.region;
};
// Location select handler
var handleLocation = function(event)
{
// Clear the linode selector
for (var i = ui.attachment.children.length - 1; i >= 1; i--)
ui.attachment.children[i].remove();
// Insert linodes in the same region
for (var i = 0; i < data.linodes.length; i++) {
if (data.linodes[i].region != ui.location.value)
continue;
var linode = document.createElement("option");
linode.value = data.linodes[i].id;
linode.innerHTML = data.linodes[i].label;
ui.attachment.appendChild(linode);
}
};
// Initial setup
var setup = function()
{
// Parse URL parameters
data.params = parseParams();
setupHeader();
// Get element references
ui.addButton = document.getElementById(elements.addButton);
ui.attachment = document.getElementById(elements.attachment);
ui.label = document.getElementById(elements.label);
ui.location = document.getElementById(elements.location);
ui.size = document.getElementById(elements.size);
// Attach event handlers
ui.addButton.addEventListener("click", handleAdd);
ui.attachment.addEventListener("input", handleLinode);
ui.location.addEventListener("input", handleLocation);
// Get data from API
apiGet("/regions", displayRegions, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();

76
volumes/add/index.shtml Normal file
View File

@ -0,0 +1,76 @@
<!--
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 - Add a Volume</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="add.css" />
<script src="add.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> » <span class="top-links-title">Add a Volume</span></div>
<div id="add">
<table class="lmc-table">
<thead>
<tr>
<td colspan="3">Add a Volume</td>
</tr>
</thead>
<tbody>
<tr class="lmc-tr3">
<td>Label</td>
<td><input id="label" type="text" /></td>
<td></td>
</tr>
<tr class="lmc-tr3">
<td>Size</td>
<td><input id="size" type="number" min="10" value="20" /></td>
<td class="info">The size of the new volume in GiB</td>
</tr>
<tr class="lmc-tr3">
<td>Location</td>
<td>
<select id="location">
<option selected disabled value="0">Choose A Location</option>
</select>
</td>
<td class="info">The datacenter where the new volume should be created</td>
</tr>
<tr class="lmc-tr3">
<td>Attach To</td>
<td>
<select id="attachment">
<option value="0">No Attachment</option>
</select>
</td>
<td class="info">If you want to attach the new volume to a Linode, select it here</td>
</tr>
<tr class="lmc-tr3">
<td></td>
<td><button disabled id="add-button" type="button">Add this Volume!</button></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>

31
volumes/attach/attach.css Normal file
View File

@ -0,0 +1,31 @@
/*
* 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');
#attach {
padding: 0px 15px 15px;
}
tbody tr td:first-of-type {
font-weight: bold;
text-align: right;
}
tbody tr:last-of-type {
border: none;
}

132
volumes/attach/attach.js Normal file
View File

@ -0,0 +1,132 @@
/*
* 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.attachButton = "attach-button";
elements.label = "label";
elements.linode = "linode";
elements.volumeLabel = "volume-label";
// Data recieved from API calls
var data = {};
data.volume = {};
// Static references to UI elements
var ui = {};
ui.attachButton = {};
ui.label = {};
ui.linode = {};
ui.volumeLabel = {};
// Callback for linodes API call
var displayLinodes = function(response)
{
// Add linodes to selector
for (var i = 0; i < response.data.length; i++) {
var linode = document.createElement("option");
linode.value = response.data[i].id;
linode.innerHTML = response.data[i].label;
ui.linode.appendChild(linode);
}
// Request the next page if there are more pages
if (response.page != response.pages) {
var filter = {
"region": data.volume.region
};
apiGet("/linode/instances?page=" + (response.page + 1), displayLinodes, null);
return;
}
ui.attachButton.disabled = false;
};
// Callback for volume API call
var displayVolume = function(response)
{
data.volume = response;
// Redirect to settings if already attached
if (data.volume.linode_id)
location.href = "/volumes/settings?vid=" + data.params.vid;
// Set page title and header stuff
document.title += " // " + data.volume.label;
ui.volumeLabel.innerHTML = data.volume.label;
ui.label.innerHTML = data.volume.label;
// Get linodes in the same DC
var filter = {
"region": data.volume.region
};
apiGet("/linode/instances", displayLinodes, filter);
};
// Click handler for attach button
var handleAttach = function(event)
{
if (event.currentTarget.disabled)
return;
var req = {
"linode_id": parseInt(ui.linode.value)
};
apiPost("/volumes/" + data.params.vid + "/attach", req, function(response)
{
location.href = "/linodes/dashboard?lid=" + response.linode_id;
});
};
// 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.attachButton = document.getElementById(elements.attachButton);
ui.label = document.getElementById(elements.label);
ui.linode = document.getElementById(elements.linode);
ui.volumeLabel = document.getElementById(elements.volumeLabel);
// Attach event handlers
ui.attachButton.addEventListener("click", handleAttach);
// Get data from API
apiGet("/volumes/" + data.params.vid, displayVolume, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();

View File

@ -0,0 +1,58 @@
<!--
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 - Attach Volume</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="attach.css" />
<script src="attach.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">Attach Volume</span></div>
<div id="attach">
<table class="lmc-table">
<thead>
<tr>
<td colspan="3">Attach a Volume</td>
</tr>
</thead>
<tbody>
<tr class="lmc-tr3">
<td>Volume</td>
<td id="label"></td>
<td class="info">The volume to attach</td>
</tr>
<tr class="lmc-tr3">
<td>Attach To</td>
<td><select id="linode"></select></td>
<td class="info">The Linode to attach this volume to</td>
</tr>
<tr class="lmc-tr3">
<td></td>
<td><button disabled id="attach-button" type="button">Attach »</button></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>

31
volumes/clone/clone.css Normal file
View File

@ -0,0 +1,31 @@
/*
* 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');
#clone {
padding: 0px 15px 15px;
}
tbody tr td:first-of-type {
font-weight: bold;
text-align: right;
}
tbody tr:last-of-type {
border: none;
}

112
volumes/clone/clone.js Normal file
View File

@ -0,0 +1,112 @@
/*
* 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, regionNames, setupHeader } from "/global.js";
(function()
{
// Element names specific to this page
elements.cloneButton = "clone-button";
elements.label = "label";
elements.location = "location";
elements.newLabel = "new-label";
elements.size = "size";
elements.volumeLabel = "volume-label";
// Data recieved from API calls
var data = {};
// Static references to UI elements
var ui = {};
ui.cloneButton = {};
ui.label = {};
ui.location = {};
ui.newLabel = {};
ui.size = {};
ui.volumeLabel = {};
// Callback for volume API call
var displayVolume = function(response)
{
// Set page title and header stuff
document.title += " // " + response.label;
ui.volumeLabel.innerHTML = response.label;
// Populate info table
ui.label.innerHTML = response.label;
ui.size.innerHTML = response.size;
if (regionNames[response.region])
ui.location.innerHTML = regionNames[response.region];
else
ui.location.innerHTML = response.region;
ui.cloneButton.disabled = false;
};
// Click handler for clone button
var handleClone = function(event)
{
if (event.currentTarget.disabled)
return;
var req = {
"label": ui.newLabel.value
};
apiPost("/volumes/" + data.params.vid + "/clone", req, 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.cloneButton = document.getElementById(elements.cloneButton);
ui.label = document.getElementById(elements.label);
ui.location = document.getElementById(elements.location);
ui.newLabel = document.getElementById(elements.newLabel);
ui.size = document.getElementById(elements.size);
ui.volumeLabel = document.getElementById(elements.volumeLabel);
// Attach event handlers
ui.cloneButton.addEventListener("click", handleClone);
// Get data from API
apiGet("/volumes/" + data.params.vid, displayVolume, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();

68
volumes/clone/index.shtml Normal file
View File

@ -0,0 +1,68 @@
<!--
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 - Clone a Volume</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="clone.css" />
<script src="clone.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">Clone a Volume</span></div>
<div id="clone">
<table class="lmc-table">
<thead>
<tr>
<td colspan="3">Clone a Volume</td>
</tr>
</thead>
<tbody>
<tr class="lmc-tr3">
<td>Volume being cloned</td>
<td id="label"></td>
<td></td>
</tr>
<tr class="lmc-tr3">
<td>Size</td>
<td><span id="size"></span> GiB</td>
<td class="info">The size of the new volume</td>
</tr>
<tr class="lmc-tr3">
<td>Location</td>
<td id="location"></td>
<td class="info">The datacenter where the new clone will be created</td>
</tr>
<tr class="lmc-tr3">
<td>Label for newly cloned volume</td>
<td><input id="new-label" type="text" /></td>
<td></td>
</tr>
<tr class="lmc-tr3">
<td></td>
<td><button disabled id="clone-button" type="button">Clone this Volume!</button></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>

26
volumes/detach/detach.css Normal file
View File

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

111
volumes/detach/detach.js Normal file
View File

@ -0,0 +1,111 @@
/*
* 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.detachButton = "detach-button";
elements.label = "label";
elements.linodeLabel = "linode-label";
elements.volumeLabel = "volume-label";
// Data recieved from API calls
var data = {};
data.volume = {};
// Static references to UI elements
var ui = {};
ui.detachButton = {};
ui.label = {};
ui.linodeLabel = {};
ui.volumeLabel = {};
// Callback for attached linode API call
var displayLinode = function(response)
{
ui.linodeLabel.innerHTML = response.label;
ui.detachButton.disabled = false;
};
// Callback for volume API call
var displayVolume = function(response)
{
data.volume = response;
// Redirect to settings if unattached
if (!data.volume.linode_id)
location.href = "/volumes/settings?vid=" + data.params.vid;
// Set page title and header stuff
document.title += " // " + data.volume.label;
ui.volumeLabel.innerHTML = data.volume.label;
ui.label.innerHTML = data.volume.label;
ui.linodeLabel.href = "/linodes/dashboard?lid=" + data.volume.linode_id;
// Get linode info
apiGet("/linode/instances/" + data.volume.linode_id, displayLinode, null);
};
// Click handler for detach button
var handleDetach = function(event)
{
if (event.currentTarget.disabled)
return;
apiPost("/volumes/" + data.params.vid + "/detach", {}, function(response)
{
location.href = "/linodes/dashboard?lid=" + data.volume.linode_id;
});
};
// 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.detachButton = document.getElementById(elements.detachButton);
ui.label = document.getElementById(elements.label);
ui.linodeLabel = document.getElementById(elements.linodeLabel);
ui.volumeLabel = document.getElementById(elements.volumeLabel);
// Attach event handlers
ui.detachButton.addEventListener("click", handleDetach);
// Get data from API
apiGet("/volumes/" + data.params.vid, displayVolume, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();

View File

@ -0,0 +1,37 @@
<!--
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 - Detach Volume</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="detach.css" />
<script src="detach.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">Detach Volume</span></div>
<div id="detach">
<p>The "<span id="label"></span>" volume will be detached from the <a id="linode-label"></a> Linode.</p>
<p>It will be removed from all config profiles.</p>
<button disabled id="detach-button" type="button">Detach</button>
</div>
</div>
</body>
</html>

52
volumes/index.shtml Normal file
View File

@ -0,0 +1,52 @@
<!--
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 - Volumes</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="volumes.css" />
<script src="volumes.js" type="module"></script>
</head>
<body>
<!--#include virtual="/include/header.html"-->
<div id="main-content" class="wrapper">
<div id="top-links"><span class="top-links-title">Volumes</span></div>
<div id="volumes">
<table class="lmc-table">
<thead>
<tr>
<td>Volume</td>
<td>Status</td>
<td>Size</td>
<td>Location</td>
<td>Attached To</td>
<td>Options</td>
</tr>
</thead>
<tbody id="volume-body">
<tr class="lmc-tr1">
<td id="loading" colspan="6">Loading...</td>
</tr>
</tbody>
</table>
<p class="sub-links"><a href="/volumes/add">Add a Volume</a></p>
</div>
</div>
</body>
</html>

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);
})();

View File

@ -0,0 +1,98 @@
<!--
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 - Volumes</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="settings.css" />
<script src="settings.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> » <span id="volume-label" class="top-links-title"></span></div>
<div id="settings">
<table class="lmc-table">
<thead>
<tr>
<td colspan="3">Block Storage Volume Settings</td>
</tr>
</thead>
<tbody>
<tr class="lmc-tr3">
<td>Label</td>
<td><input id="label" type="text" /></td>
<td class="info">A unique name for this volume</td>
</tr>
<tr class="lmc-tr3">
<td>Status</td>
<td id="status"></td>
<td class="info">The current status of the volume</td>
</tr>
<tr class="lmc-tr3">
<td>Attachment</td>
<td>
<select id="attachment">
<option selected value="0">No attachment</option>
</select>
<span id="attached"><a id="linode-label"></a> | <a href="/volumes/detach?vid=0">Detach</a></span>
</td>
<td class="info">The Linode this volume is attached to</td>
</tr>
<tr class="lmc-tr3">
<td>Size</td>
<td><input id="size" type="number" min="10" /></td>
<td class="info">The size of the volume in GiB</td>
</tr>
<tr class="lmc-tr3">
<td>Location</td>
<td id="location"></td>
<td class="info">The datacenter where this volume is located</td>
</tr>
<tr class="lmc-tr3">
<td>Filesystem Path</td>
<td id="path"></td>
<td class="info">The path that this volume is accessible through when attached to a running Linode</td>
</tr>
<tr class="lmc-tr3">
<td></td>
<td><button disabled id="save-button" type="button">Save Changes</button></td>
<td></td>
</tr>
</tbody>
<tbody class="lmc-tbody-head">
<tr>
<td colspan="3">Instructions</td>
</tr>
</tbody>
</table>
<div id="instructions">
<p>To get started with a new volume, you'll want to create a filesystem on it:</p>
<code>mkfs.ext4 /dev/disk/by-id/scsi-0Linode_Volume_test_volume</code>
<p>Once the volume has a filesystem, you can create a mountpoint for it:</p>
<code>mkdir /mnt/test_volume</code>
<p>Then you can mount the new volume:</p>
<code>mount /dev/disk/by-id/scsi-0Linode_Volume_test_volume /mnt/test_volume</code>
<p>If you want the volume to automatically mount every time your Linode boots, you'll want to add a line like the following to your <strong>/etc/fstab</strong> file:</p>
<code>/dev/disk/by-id/scsi-0Linode_Volume_test_volume /mnt/test_volume ext4 defaults,noatime,nofail 0 2</code>
</div>
</div>
</div>
</body>
</html>

View 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');
#attached {
display: none;
}
code {
border: 1px solid #E7E6E6;
display: block;
padding: 10px;
}
#instructions {
color: #333;
font-size: 13px;
padding: 0 60px;
}
#settings {
padding: 0px 15px 15px;
}
tbody:not(.lmc-tbody-head) tr td:first-of-type {
font-weight: bold;
text-align: right;
}

View File

@ -0,0 +1,209 @@
/*
* 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, regionNames, apiGet, apiPost, apiPut, parseParams, setupHeader } from "/global.js";
(function()
{
// Element names specific to this page
elements.attached = "attached";
elements.attachment = "attachment";
elements.label = "label";
elements.linodeLabel = "linode-label";
elements.location = "location";
elements.path = "path";
elements.saveButton = "save-button";
elements.size = "size";
elements.status = "status";
elements.volumeLabel = "volume-label";
// Data recieved from API calls
var data = {};
data.volume = {};
// Static references to UI elements
var ui = {};
ui.attached = {};
ui.attachment = {};
ui.label = {};
ui.linodeLabel = {};
ui.location = {};
ui.path = {};
ui.saveButton = {};
ui.size = {};
ui.status = {};
ui.volumeLabel = {};
// Temporary state
var state = {};
state.redirect = "/volumes";
state.requests = 0;
state.returns = 0;
// Callback for attached linode API call
var displayLinode = function(response)
{
ui.linodeLabel.innerHTML = response.label;
};
// Callback for linodes API call
var displayLinodes = function(response)
{
// Add linodes to selector
for (var i = 0; i < response.data.length; i++) {
var linode = document.createElement("option");
linode.value = response.data[i].id;
linode.innerHTML = response.data[i].label;
ui.attachment.appendChild(linode);
if (data.volume.linode_id && data.volume.linode_id == response.data[i].id)
ui.attachment.value = response.data[i].id;
}
// Request the next page if there are more pages
if (response.page != response.pages) {
var filter = {
"region": data.volume.region
};
apiGet("/linode/instances?page=" + (response.page + 1), displayLinodes, null);
return;
}
};
// Callback for volume API call
var displayVolume = function(response)
{
data.volume = response;
// Set page title and header stuff
document.title += " // " + data.volume.label;
ui.volumeLabel.innerHTML = data.volume.label;
// Fill in details
ui.label.value = data.volume.label;
ui.status.innerHTML = data.volume.status;
ui.size.value = data.volume.size;
ui.size.min = data.volume.size;
if (regionNames[data.volume.region])
ui.location.innerHTML = regionNames[data.volume.region];
else
ui.location.innerHTML = data.volume.region;
ui.path.innerHTML = data.volume.filesystem_path;
if (data.volume.linode_id) {
ui.attachment.style.display = "none";
ui.attached.style.display = "initial";
ui.linodeLabel.href = "/linodes/dashboard?lid=" + data.volume.linode_id;
apiGet("/linode/instances/" + data.volume.linode_id, displayLinode, null);
} else {
// Get linodes in the same DC
var filter = {
"region": data.volume.region
};
apiGet("/linode/instances", displayLinodes, filter);
}
ui.saveButton.disabled = false;
};
// Click handler for save button
var handleSave = function(event)
{
if (event.currentTarget.disabled)
return;
state.requests = 0;
state.returns = 0;
// Common callback
var callback = function(response)
{
state.returns++;
if (state.returns >= state.requests)
location.href = state.redirect;
};
// Attach request
if (!data.volume.linode_id && ui.attachment.value != "0") {
state.requests++;
state.redirect = "/linodes/dashboard?lid=" + ui.attachment.value;
var attachReq = {
"linode_id": parseInt(ui.attachment.value)
};
apiPost("/volumes/" + data.params.vid + "/attach", attachReq, callback);
}
// Label change request
if (ui.label.value != data.volume.label) {
state.requests++;
var labelReq = {
"label": ui.label.value
};
apiPut("/volumes/" + data.params.vid, labelReq, callback);
}
// Size change
var size = parseInt(ui.size.value);
if (size > data.volume.size) {
state.requests++;
var sizeReq = {
"size": size
};
apiPost("/volumes/" + data.params.vid + "/resize", sizeReq, callback);
}
};
// 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.attached = document.getElementById(elements.attached);
ui.attachment = document.getElementById(elements.attachment);
ui.label = document.getElementById(elements.label);
ui.linodeLabel = document.getElementById(elements.linodeLabel);
ui.location = document.getElementById(elements.location);
ui.path = document.getElementById(elements.path);
ui.saveButton = document.getElementById(elements.saveButton);
ui.size = document.getElementById(elements.size);
ui.status = document.getElementById(elements.status);
ui.volumeLabel = document.getElementById(elements.volumeLabel);
// Attach event handlers
ui.saveButton.addEventListener("click", handleSave);
// Get data from API
apiGet("/volumes/" + data.params.vid, displayVolume, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();

42
volumes/volumes.css Normal file
View File

@ -0,0 +1,42 @@
/*
* 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');
table td:nth-of-type(6) {
text-align: center;
}
tbody td:nth-of-type(5) {
font-weight: bold;
}
tbody td:nth-of-type(6) a {
font-weight: bold;
}
tbody td:nth-of-type(6) a:last-of-type {
font-weight: normal;
}
tbody tr {
font-size: 14px;
}
#volumes {
padding: 0px 15px 15px;
}

171
volumes/volumes.js Normal file
View File

@ -0,0 +1,171 @@
/*
* 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, regionNames, apiGet, parseParams, setupHeader } from "/global.js";
(function()
{
// Element names specific to this page
elements.lmcRow = "lmc-tr1";
elements.lmcRowAlt = "lmc-tr2";
elements.loading = "loading";
elements.volumeBody = "volume-body";
// Data recieved from API calls
var data = {};
data.linodes = {};
data.volumes = [];
// Static references to UI elements
var ui = {};
ui.loading = {};
ui.volumeBody = {};
// Generates a table row for a volume
var createVolumeRow = function(volume, alt)
{
var row = document.createElement("tr");
if (alt)
row.className = elements.lmcRowAlt;
else
row.className = elements.lmcRow;
var labelCell = document.createElement("td");
var label = document.createElement("a");
label.href = "/volumes/settings?vid=" + volume.id;
label.innerHTML = volume.label;
labelCell.appendChild(label);
row.appendChild(labelCell);
var status = document.createElement("td");
status.innerHTML = volume.status;
row.appendChild(status);
var size = document.createElement("td");
size.innerHTML = volume.size + " GiB";
row.appendChild(size);
var region = document.createElement("td");
if (regionNames[volume.region])
region.innerHTML = regionNames[volume.region];
else
region.innerHTML = volume.region;
row.appendChild(region);
var attachment = document.createElement("td");
if (volume.linode_id) {
var linode = document.createElement("a");
linode.href = "/linodes/dashboard?lid=" + volume.linode_id;
linode.innerHTML = "linode" + volume.linode_id;
translateLinode(volume.linode_id, linode);
attachment.appendChild(linode);
}
row.appendChild(attachment);
var options = document.createElement("td");
var attach = document.createElement("a");
if (volume.linode_id) {
attach.href = "/volumes/detach?vid=" + volume.id;
attach.innerHTML = "Detach";
} else {
attach.href = "/volumes/attach?vid=" + volume.id;
attach.innerHTML = "Attach";
}
var separator = document.createElement("span");
separator.innerHTML = " | ";
var clone = document.createElement("a");
clone.href = "/volumes/clone?vid=" + volume.id;
clone.innerHTML = "Clone";
var settings = document.createElement("a");
settings.href = "/volumes/settings?vid=" + volume.id;
settings.innerHTML = "Settings";
var remove = document.createElement("a");
remove.href = "/volumes/remove?vid=" + volume.id;
remove.innerHTML = "Remove";
options.appendChild(attach);
options.appendChild(separator);
options.appendChild(clone);
options.appendChild(separator.cloneNode(true));
options.appendChild(settings);
options.appendChild(separator.cloneNode(true));
options.appendChild(remove);
row.appendChild(options);
return row;
};
// Callback for volumes API call
var displayVolumes = function(response)
{
// Add volumes to array
data.volumes = data.volumes.concat(response.data);
// Request the next page if there are more pages
if (response.page != response.pages) {
var progress = (response.page / response.pages) * 100;
progress = progress.toFixed(0);
ui.loading.innerHTML = "Loading " + progress + "%...";
apiGet("/volumes?page=" + (response.page + 1), displayVolumes, null);
return;
}
// Redirect to add page if there are no volumes
if (data.volumes.length == 0)
location.href = "/volumes/add";
// Insert volumes
ui.loading.remove();
for (var i = 0; i < data.volumes.length; i++)
ui.volumeBody.appendChild(createVolumeRow(data.volumes[i], i % 2));
};
// Initial setup
var setup = function()
{
// Parse URL parameters
data.params = parseParams();
setupHeader();
// Get element references
ui.loading = document.getElementById(elements.loading);
ui.volumeBody = document.getElementById(elements.volumeBody);
// Get data from API
apiGet("/volumes", displayVolumes, null);
};
// Get the label of a given linode ID and update a cell's contents
var translateLinode = function(id, cell)
{
if (data.linodes[id.toString()]) {
cell.innerHTML = data.linodes[id.toString()].label;
return;
}
var callback = function(response)
{
data.linodes[response.id.toString()] = response;
cell.innerHTML = response.label;
};
apiGet("/linode/instances/" + id, callback, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();