From 03cabc0bc22b18f8ac68beb2cb6b529c15e56653 Mon Sep 17 00:00:00 2001 From: George Shaw Date: Mon, 11 Dec 2017 14:50:38 -0600 Subject: [PATCH] nameserver config and domain cleanup --- .../domains_subdomains/domain_management.js | 36 ++++++++++++++ account/gPanel.html | 7 +++ pkg/api/bundle/create.go | 37 +++++++++++--- pkg/api/bundle/delete.go | 16 +++++++ pkg/api/settings/add_nameserver.go | 44 +++++++++++++++++ pkg/api/settings/get_admin.go | 4 +- pkg/api/settings/get_nameservers.go | 48 +++++++++++++++++++ pkg/api/settings/get_smtp.go | 4 +- pkg/api/settings/remove_nameserver.go | 44 +++++++++++++++++ pkg/api/settings/set_admin.go | 4 +- pkg/api/settings/set_smtp.go | 4 +- pkg/database/database.go | 6 +++ pkg/database/domains.go | 48 +++++++++++++++++++ pkg/gpaccount/apihandler.go | 2 + pkg/gpserver/apihandler.go | 14 ++++-- .../panelHandlers/settings/add_nameserver.js | 31 ++++++++++++ .../settings/nameserver_config.js | 43 +++++++++++++++++ .../settings/remove_nameserver.js | 30 ++++++++++++ .../assets/js/panelHandlers/users/open.js | 13 ++--- server/document_root/gPanel.html | 38 +++++++++++++++ 20 files changed, 445 insertions(+), 28 deletions(-) create mode 100644 pkg/api/settings/add_nameserver.go create mode 100644 pkg/api/settings/get_nameservers.go create mode 100644 pkg/api/settings/remove_nameserver.go create mode 100644 server/document_root/assets/js/panelHandlers/settings/add_nameserver.js create mode 100644 server/document_root/assets/js/panelHandlers/settings/nameserver_config.js create mode 100644 server/document_root/assets/js/panelHandlers/settings/remove_nameserver.js diff --git a/account/assets/js/panelHandlers/domains_subdomains/domain_management.js b/account/assets/js/panelHandlers/domains_subdomains/domain_management.js index 91d5c80..469ad47 100644 --- a/account/assets/js/panelHandlers/domains_subdomains/domain_management.js +++ b/account/assets/js/panelHandlers/domains_subdomains/domain_management.js @@ -4,9 +4,45 @@ jQuery('._js_domain-management').on('click', function(e){ e.preventDefault(); ListDomains(BUNDLE_NAME); + ListServerNameservers(); domainManagementModal.modal('show'); }); +function ListServerNameservers() { + var display = jQuery('._js_server-nameservers'); + + var xhr = new XMLHttpRequest(); + xhr.open('GET', 'api/settings/get_nameservers', true); + xhr.send(); + + xhr.onloadend = function() { + display.html(''); + + if(xhr.status == 200) { + if(xhr.response != undefined && xhr.response.length != 0) { + jsonResponse = JSON.parse(xhr.response) + jQuery.each(jsonResponse, function(k, v) { + display.append('

'+v+'

'); + }); + } + else { + display.html('

An error has occurred, please refresh. If problem persists please contact your administrator.

'); + } + } + else if(xhr.status == 204) { + display.html('

There are no nameservers stored in the server.

'); + } + else { + if(xhr.response != undefined && xhr.response.length != 0) { + alert('Error: ' + xhr.response); + } + else { + alert('An error has occurred, refresh and try again. If problem persists please contact your administrator.'); + } + } + } +} + function ListDomains(bundle_name) { var list = jQuery('._js_registered-domains'); diff --git a/account/gPanel.html b/account/gPanel.html index 3b512a1..7f47857 100644 --- a/account/gPanel.html +++ b/account/gPanel.html @@ -208,9 +208,16 @@

Registered Domains

+ Please allow up to 15 minutes for the server to track your domain.
+ +

Server Nameservers

+ Point your domains to one of these nameservers. +
+ +
+ + +
@@ -418,6 +452,7 @@
+
@@ -472,6 +507,9 @@ + + +