Added all DNS functionality

This commit is contained in:
2020-01-18 17:50:00 -05:00
parent 4e033be21b
commit 1ffa87a980
29 changed files with 2980 additions and 1 deletions

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');
#domain-clone {
padding: 0px 15px 15px;
}
tbody:not(.lmc-tbody-head) tr:last-of-type {
border: none;
}
tbody:not(.lmc-tbody-head) tr td:first-of-type {
font-weight: bold;
text-align: right;
}

View File

@ -0,0 +1,95 @@
/*
* 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.cloneButton = "clone-button";
elements.existingDomain = "existing-domain";
elements.newDomain = "new-domain";
// Data recieved from API calls
var data = {};
// Static references to UI elements
var ui = {};
ui.cloneButton = {};
ui.existingDomain = {};
ui.newDomain = {};
// Callback for domains API call
var displayDomains = function(response)
{
// Add domains to selector
for (var i = 0; i < response.data.length; i++) {
var domain = document.createElement("option");
domain.value = response.data[i].id;
domain.innerHTML = response.data[i].domain;
ui.existingDomain.appendChild(domain);
}
// Request the next page if there are more pages
if (response.page != response.pages)
apiGet("/domains?page=" + (response.page + 1), displayDomains, null);
else
ui.cloneButton.disabled = false;
};
// Click handler for clone button
var handleClone = function(event)
{
if (event.currentTarget.disabled)
return;
// This request takes a few seconds
ui.cloneButton.disabled = true;
var req = {
"domain": ui.newDomain.value
};
apiPost("/domains/" + ui.existingDomain.value + "/clone", req, function(response)
{
location.href = "/dns/domain?did=" + response.id;
});
};
// Initial setup
var setup = function()
{
// Parse URL parameters
data.params = parseParams();
setupHeader();
// Get element references
ui.cloneButton = document.getElementById(elements.cloneButton);
ui.existingDomain = document.getElementById(elements.existingDomain);
ui.newDomain = document.getElementById(elements.newDomain);
// Attach event handlers
ui.cloneButton.addEventListener("click", handleClone);
// Get data from API
apiGet("/domains", displayDomains, null);
};
// Attach onload handler
window.addEventListener("load", setup);
})();

View File

@ -0,0 +1,55 @@
<!--
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 Zone</title>
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" href="domain_clone.css" />
<script src="domain_clone.js" type="module"></script>
</head>
<body>
<!--#include virtual="/include/header.html"-->
<div id="main-content" class="wrapper">
<div id="top-links"><a href="/dns">DNS Manager</a> » <span class="top-links-title">Clone a Zone</span></div>
<div id="domain-clone">
<table class="lmc-table">
<thead>
<tr>
<td colspan="2">Clone an existing Zone</td>
</tr>
</thead>
<tbody>
<tr class="lmc-tr3">
<td>Clone this zone</td>
<td><select id="existing-domain"></select></td>
</tr>
<tr class="lmc-tr3">
<td>Into this zone</td>
<td><input id="new-domain" type="text" size="30" /></td>
</tr>
<tr class="lmc-tr3">
<td></td>
<td><button disabled id="clone-button" type="button">Clone Zone »</button></td>
</tr>
</tbody>
</table>
</div>
</div>
</body>
</html>