Merge pull request 'DNS Updates' (#6) from dns-updates into master
Reviewed-on: https://git.bradleylaboon.com/lb.laboon/lmc/pulls/6
This commit is contained in:
commit
37a8b9f641
14
dns/dns.js
14
dns/dns.js
@ -63,9 +63,10 @@ import { settings, elements, apiGet, parseParams, setupHeader } from "/global.js
|
|||||||
type.innerHTML = domain.type;
|
type.innerHTML = domain.type;
|
||||||
row.appendChild(type);
|
row.appendChild(type);
|
||||||
|
|
||||||
var email = document.createElement("td");
|
var modified = document.createElement("td");
|
||||||
email.innerHTML = domain.soa_email;
|
var modifiedDate = new Date(domain.updated + "Z");
|
||||||
row.appendChild(email);
|
modified.innerHTML = modifiedDate.toLocaleString();
|
||||||
|
row.appendChild(modified);
|
||||||
|
|
||||||
var status = document.createElement("td");
|
var status = document.createElement("td");
|
||||||
status.innerHTML = domain.status.charAt(0).toUpperCase() + domain.status.slice(1).replace(/_/g, " ");
|
status.innerHTML = domain.status.charAt(0).toUpperCase() + domain.status.slice(1).replace(/_/g, " ");
|
||||||
@ -84,9 +85,14 @@ import { settings, elements, apiGet, parseParams, setupHeader } from "/global.js
|
|||||||
var removeLink = document.createElement("a");
|
var removeLink = document.createElement("a");
|
||||||
removeLink.href = "/dns/domain_delete?did=" + domain.id;
|
removeLink.href = "/dns/domain_delete?did=" + domain.id;
|
||||||
removeLink.innerHTML = "Remove";
|
removeLink.innerHTML = "Remove";
|
||||||
|
var zoneFileLink = document.createElement("a");
|
||||||
|
zoneFileLink.href = "/dns/domain_zonefile?did=" + domain.id;
|
||||||
|
zoneFileLink.innerHTML = "Zone file";
|
||||||
options.appendChild(editLink);
|
options.appendChild(editLink);
|
||||||
options.appendChild(separator);
|
options.appendChild(separator);
|
||||||
options.appendChild(removeLink);
|
options.appendChild(removeLink);
|
||||||
|
options.appendChild(separator.cloneNode(true));
|
||||||
|
options.appendChild(zoneFileLink);
|
||||||
row.appendChild(options);
|
row.appendChild(options);
|
||||||
|
|
||||||
return row;
|
return row;
|
||||||
@ -107,7 +113,7 @@ import { settings, elements, apiGet, parseParams, setupHeader } from "/global.js
|
|||||||
title.innerHTML = tag;
|
title.innerHTML = tag;
|
||||||
headRow1.appendChild(title);
|
headRow1.appendChild(title);
|
||||||
var headRow2 = document.createElement("tr");
|
var headRow2 = document.createElement("tr");
|
||||||
var cells = ["Domain Zone", "Type", "SOA Email", "Status", "Options"];
|
var cells = ["Domain Zone", "Type", "Last Modified", "Status", "Options"];
|
||||||
title.colspan = cells.length;
|
title.colspan = cells.length;
|
||||||
for (var i = 0; i < cells.length; i++) {
|
for (var i = 0; i < cells.length; i++) {
|
||||||
var cell = document.createElement("td");
|
var cell = document.createElement("td");
|
||||||
|
22
dns/domain_zonefile/domain_zonefile.css
Normal file
22
dns/domain_zonefile/domain_zonefile.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');
|
||||||
|
|
||||||
|
#domain-zonefile {
|
||||||
|
padding: 0px 15px 15px;
|
||||||
|
}
|
92
dns/domain_zonefile/domain_zonefile.js
Normal file
92
dns/domain_zonefile/domain_zonefile.js
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* 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, parseParams, setupHeader } from "/global.js";
|
||||||
|
|
||||||
|
(function()
|
||||||
|
{
|
||||||
|
// Element names specific to this page
|
||||||
|
elements.domainLabel = "domain-label";
|
||||||
|
elements.domainTag = "domain-tag";
|
||||||
|
elements.domainTagLink = "domain-tag-link";
|
||||||
|
elements.zoneFile = "zonefile";
|
||||||
|
|
||||||
|
// Data recieved from API calls
|
||||||
|
var data = {};
|
||||||
|
data.domain = {};
|
||||||
|
|
||||||
|
// Static references to UI elements
|
||||||
|
var ui = {};
|
||||||
|
ui.domainLabel = {};
|
||||||
|
ui.domainTag = {};
|
||||||
|
ui.domainTagLink = {};
|
||||||
|
ui.zoneFile = {};
|
||||||
|
|
||||||
|
// 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";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Display zonefile contents
|
||||||
|
var displayZoneFile = function(response)
|
||||||
|
{
|
||||||
|
ui.zoneFile.innerHTML = response.zone_file.join("\n");
|
||||||
|
};
|
||||||
|
|
||||||
|
// 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 domain 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.domainLabel = document.getElementById(elements.domainLabel);
|
||||||
|
ui.domainTag = document.getElementById(elements.domainTag);
|
||||||
|
ui.domainTagLink = document.getElementById(elements.domainTagLink);
|
||||||
|
ui.zoneFile = document.getElementById(elements.zoneFile);
|
||||||
|
|
||||||
|
// Get data from API
|
||||||
|
apiGet("/domains/" + data.params.did, displayDetails, null);
|
||||||
|
apiGet("/domains/" + data.params.did + "/zone-file", displayZoneFile, null);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Attach onload handler
|
||||||
|
window.addEventListener("load", setup);
|
||||||
|
})();
|
35
dns/domain_zonefile/index.shtml
Normal file
35
dns/domain_zonefile/index.shtml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
<!--
|
||||||
|
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 - Zone File</title>
|
||||||
|
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
|
||||||
|
<link rel="stylesheet" type="text/css" href="domain_zonefile.css" />
|
||||||
|
<script src="domain_zonefile.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">Zone dump</span></div>
|
||||||
|
<div id="domain-zonefile">
|
||||||
|
<pre id="zonefile"></pre>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user