Added all DNS functionality
This commit is contained in:
32
dns/domain_soa/domain_soa.css
Normal file
32
dns/domain_soa/domain_soa.css
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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-soa {
|
||||
padding: 0px 15px 15px;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr td:first-of-type {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
tbody:not(.lmc-tbody-head) tr:last-of-type {
|
||||
border: none;
|
||||
}
|
164
dns/domain_soa/domain_soa.js
Normal file
164
dns/domain_soa/domain_soa.js
Normal file
@ -0,0 +1,164 @@
|
||||
/*
|
||||
* 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, apiPut, parseParams, setupHeader } from "/global.js";
|
||||
|
||||
(function()
|
||||
{
|
||||
// Element names specific to this page
|
||||
elements.axfr = "axfr";
|
||||
elements.email = "email";
|
||||
elements.expire = "expire";
|
||||
elements.domain = "domain";
|
||||
elements.domainLabel = "domain-label";
|
||||
elements.domainTag = "domain-tag";
|
||||
elements.domainTagLink = "domain-tag-link";
|
||||
elements.refresh = "refresh";
|
||||
elements.retry = "retry";
|
||||
elements.saveButton = "save-button";
|
||||
elements.status = "status";
|
||||
elements.tags = "tags";
|
||||
elements.ttl = "ttl";
|
||||
|
||||
// Data recieved from API calls
|
||||
var data = {};
|
||||
data.domain = {};
|
||||
|
||||
// Static references to UI elements
|
||||
var ui = {};
|
||||
ui.axfr = {};
|
||||
ui.email = {};
|
||||
ui.expire = {};
|
||||
ui.domain = {};
|
||||
ui.domainLabel = {};
|
||||
ui.domainTag = {};
|
||||
ui.domainTagLink = {};
|
||||
ui.refresh = {};
|
||||
ui.retry = {};
|
||||
ui.saveButton = {};
|
||||
ui.status = {};
|
||||
ui.tags = {};
|
||||
ui.ttl = {};
|
||||
|
||||
// Callback for domain details API call
|
||||
var displayDetails = function(response)
|
||||
{
|
||||
data.domain = response;
|
||||
|
||||
// Set page title and header stuff
|
||||
document.title += " // " + data.domain.domain;
|
||||
ui.domainLabel.innerHTML = data.domain.domain;
|
||||
if (data.domain.tags.length == 1) {
|
||||
ui.domainTagLink.href = "/dns?tag=" + data.domain.tags[0];
|
||||
ui.domainTagLink.innerHTML = "(" + data.domain.tags[0] + ")";
|
||||
ui.domainTag.style.display = "inline";
|
||||
}
|
||||
|
||||
// Set form info
|
||||
ui.domain.value = data.domain.domain;
|
||||
ui.email.value = data.domain.soa_email;
|
||||
ui.status.value = data.domain.status;
|
||||
ui.tags.value = data.domain.tags.join(",");
|
||||
ui.axfr.value = data.domain.axfr_ips.join("\n");
|
||||
ui.ttl.value = data.domain.ttl_sec;
|
||||
ui.refresh.value = data.domain.refresh_sec;
|
||||
ui.retry.value = data.domain.retry_sec;
|
||||
ui.expire.value = data.domain.expire_sec;
|
||||
|
||||
ui.saveButton.disabled = false;
|
||||
};
|
||||
|
||||
// Click handler for save button
|
||||
var handleSave = function(event)
|
||||
{
|
||||
if (event.currentTarget.disabled)
|
||||
return;
|
||||
|
||||
// This request can take a few seconds,
|
||||
// so disable the button to prevent antsy users from double-submitting
|
||||
ui.saveButton.disabled = true;
|
||||
|
||||
var req = {
|
||||
"domain": ui.domain.value,
|
||||
"soa_email": ui.email.value,
|
||||
"status": ui.status.value,
|
||||
"tags": [],
|
||||
"axfr_ips": [],
|
||||
"ttl_sec": parseInt(ui.ttl.value),
|
||||
"refresh_sec": parseInt(ui.refresh.value),
|
||||
"retry_sec": parseInt(ui.retry.value),
|
||||
"expire_sec": parseInt(ui.expire.value)
|
||||
};
|
||||
|
||||
if (ui.tags.value.length)
|
||||
req.tags = ui.tags.value.split(",");
|
||||
if (ui.axfr.value.length) {
|
||||
var axfrLines = ui.axfr.value.split("\n");
|
||||
for (var i = 0; i < axfrLines.length; i++)
|
||||
req.axfr_ips = req.axfr_ips.concat(axfrLines[i].split(";"));
|
||||
}
|
||||
|
||||
apiPut("/domains/" + data.params.did, req, function(response)
|
||||
{
|
||||
location.href = "/dns/domain?did=" + data.params.did;
|
||||
});
|
||||
};
|
||||
|
||||
// Initial setup
|
||||
var setup = function()
|
||||
{
|
||||
// Parse URL parameters
|
||||
data.params = parseParams();
|
||||
|
||||
// We need a domain ID, so die if we don't have it
|
||||
if (!data.params.did) {
|
||||
alert("No domain 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("did=0", "did=" + data.params.did);
|
||||
|
||||
// Get element references
|
||||
ui.axfr = document.getElementById(elements.axfr);
|
||||
ui.email = document.getElementById(elements.email);
|
||||
ui.expire = document.getElementById(elements.expire);
|
||||
ui.domain = document.getElementById(elements.domain);
|
||||
ui.domainLabel = document.getElementById(elements.domainLabel);
|
||||
ui.domainTag = document.getElementById(elements.domainTag);
|
||||
ui.domainTagLink = document.getElementById(elements.domainTagLink);
|
||||
ui.refresh = document.getElementById(elements.refresh);
|
||||
ui.retry = document.getElementById(elements.retry);
|
||||
ui.saveButton = document.getElementById(elements.saveButton);
|
||||
ui.status = document.getElementById(elements.status);
|
||||
ui.tags = document.getElementById(elements.tags);
|
||||
ui.ttl = document.getElementById(elements.ttl);
|
||||
|
||||
// Attach event handlers
|
||||
ui.saveButton.addEventListener("click", handleSave);
|
||||
|
||||
// Get data from API
|
||||
apiGet("/domains/" + data.params.did, displayDetails, null);
|
||||
};
|
||||
|
||||
// Attach onload handler
|
||||
window.addEventListener("load", setup);
|
||||
})();
|
165
dns/domain_soa/index.shtml
Normal file
165
dns/domain_soa/index.shtml
Normal file
@ -0,0 +1,165 @@
|
||||
<!--
|
||||
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 - Edit Domain</title>
|
||||
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||
<link rel="stylesheet" type="text/css" href="domain_soa.css" />
|
||||
<script src="domain_soa.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 id="domain-tag"><a id="domain-tag-link" href=""></a> » </span><a id="domain-label" href="/dns/domain?did=0"></a> » <span class="top-links-title">Edit SOA Record</span></div>
|
||||
<div id="domain-soa">
|
||||
<table class="lmc-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td colspan="3">Domain Settings and Defaults</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Domain</td>
|
||||
<td><input id="domain" type="text" size="30" maxlength="63" /></td>
|
||||
<td class="info">Example: ns1.example.com</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>SOA email</td>
|
||||
<td><input id="email" type="text" size="30" /></td>
|
||||
<td class="info">Your email address</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Domain Status</td>
|
||||
<td>
|
||||
<select id="status">
|
||||
<option value="active">Active - Turn ON serving of this domain</option>
|
||||
<option value="disabled">Disabled - Turn OFF serving of this domain</option>
|
||||
<option disabled value="edit_mode">Edit Mode - Use this mode while making edits</option>
|
||||
</select>
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Tags</td>
|
||||
<td><input id="tags" type="text" size="25" /></td>
|
||||
<td class="info">Group domains together using tags! (comma-separated)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody class="lmc-tbody-head">
|
||||
<tr class="noshow">
|
||||
<td colspan="3"></td>
|
||||
<tr>
|
||||
<td colspan="3">Advanced Settings</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Domain Transfers</td>
|
||||
<td><textarea id="axfr" rows="4" cols="40"></textarea></td>
|
||||
<td class="info">
|
||||
The IP addresses allowed to AXFR this entire zone.<br />
|
||||
Semicolon or new line delimited. (maximum: 6 IPs)
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Default TTL</td>
|
||||
<td>
|
||||
<select id="ttl">
|
||||
<option value="0">Default</option>
|
||||
<option value="300">300 (5 minutes)</option>
|
||||
<option value="3600">3600 (1 hour)</option>
|
||||
<option value="7200">7200 (2 hours)</option>
|
||||
<option value="14400">14400 (4 hours)</option>
|
||||
<option value="28800">28800 (8 hours)</option>
|
||||
<option value="57600">57600 (16 hours)</option>
|
||||
<option value="86400">86400 (1 day)</option>
|
||||
<option value="172800">172800 (2 days)</option>
|
||||
<option value="345600">345600 (4 days)</option>
|
||||
<option value="604800">604800 (1 week)</option>
|
||||
<option value="1209600">1209600 (2 weeks)</option>
|
||||
<option value="2419200">2419200 (4 weeks)</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="info">Defines the default Time To Live for all entries in the zone</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Refresh Rate</td>
|
||||
<td>
|
||||
<select id="refresh">
|
||||
<option value="0">Default</option>
|
||||
<option value="300">300 (5 minutes)</option>
|
||||
<option value="3600">3600 (1 hour)</option>
|
||||
<option value="7200">7200 (2 hours)</option>
|
||||
<option value="14400">14400 (4 hours)</option>
|
||||
<option value="28800">28800 (8 hours)</option>
|
||||
<option value="57600">57600 (16 hours)</option>
|
||||
<option value="86400">86400 (1 day)</option>
|
||||
<option value="172800">172800 (2 days)</option>
|
||||
<option value="345600">345600 (4 days)</option>
|
||||
<option value="604800">604800 (1 week)</option>
|
||||
<option value="1209600">1209600 (2 weeks)</option>
|
||||
<option value="2419200">2419200 (4 weeks)</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="info">Determines how often the secondary/slave nameservers check with the master for updates</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Retry Rate</td>
|
||||
<td>
|
||||
<select id="retry">
|
||||
<option value="0">Default</option>
|
||||
<option value="300">300 (5 minutes)</option>
|
||||
<option value="3600">3600 (1 hour)</option>
|
||||
<option value="7200">7200 (2 hours)</option>
|
||||
<option value="14400">14400 (4 hours)</option>
|
||||
<option value="28800">28800 (8 hours)</option>
|
||||
<option value="57600">57600 (16 hours)</option>
|
||||
<option value="86400">86400 (1 day)</option>
|
||||
<option value="172800">172800 (2 days)</option>
|
||||
<option value="345600">345600 (4 days)</option>
|
||||
<option value="604800">604800 (1 week)</option>
|
||||
<option value="1209600">1209600 (2 weeks)</option>
|
||||
<option value="2419200">2419200 (4 weeks)</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="info">The amount of time the secondary/slave nameservers will wait to contact the master nameserver again if the last attempt failed</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td>Expire Rate</td>
|
||||
<td>
|
||||
<select id="expire">
|
||||
<option value="0">Default</option>
|
||||
<option value="604800">604800 (1 week)</option>
|
||||
<option value="1209600">1209600 (2 weeks)</option>
|
||||
<option value="2419200">2419200 (4 weeks)</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="info">How long a secondary/slave nameserver will wait before considering its DNS data stale if it can't reach the primary nameserver</td>
|
||||
</tr>
|
||||
<tr class="lmc-tr3">
|
||||
<td></td>
|
||||
<td colspan="2"><button disabled id="save-button" type="button">Save Changes</button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user