73 lines
1.9 KiB
JavaScript
73 lines
1.9 KiB
JavaScript
/*
|
|
* 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, apiPost, parseParams, setupHeader } from "/global.js";
|
|
|
|
(function()
|
|
{
|
|
// Element names specific to this page
|
|
elements.domain = "domain";
|
|
elements.importButton = "import-button";
|
|
elements.nameserver = "nameserver";
|
|
|
|
// Data recieved from API calls
|
|
var data = {};
|
|
|
|
// Static references to UI elements
|
|
var ui = {};
|
|
ui.domain = {};
|
|
ui.importButton = {};
|
|
ui.nameserver = {};
|
|
|
|
// Click handler for import button
|
|
var handleImport = function(event)
|
|
{
|
|
if (event.currentTarget.disabled)
|
|
return;
|
|
|
|
var req = {
|
|
"domain": ui.domain.value,
|
|
"remote_nameserver": ui.nameserver.value
|
|
};
|
|
|
|
apiPost("/domains/import", 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.domain = document.getElementById(elements.domain);
|
|
ui.importButton = document.getElementById(elements.importButton);
|
|
ui.nameserver = document.getElementById(elements.nameserver);
|
|
|
|
// Attach event handlers
|
|
ui.importButton.addEventListener("click", handleImport);
|
|
};
|
|
|
|
// Attach onload handler
|
|
window.addEventListener("load", setup);
|
|
})();
|