Added a possibility to set owner for mined domain.
Fixed small errors.
This commit is contained in:
+52
-9
@@ -176,13 +176,33 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<div class="dropdown" id="advanced-dropdown" onclick="toggle(this, event);">
|
||||
<div class="dropdown-trigger">
|
||||
<button class="button" aria-haspopup="true" aria-controls="advanced-menu" onblur="closeAdvancedDropdown()">
|
||||
<span>Advanced</span>
|
||||
<span class="icon is-small">
|
||||
<svg viewBox="0 0 24 24" style="width: 20px; height: 20px;"><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"></path></svg>
|
||||
</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="dropdown-menu" id="advanced-menu" role="menu">
|
||||
<div class="dropdown-content">
|
||||
<a class="dropdown-item" onclick="showOwnerDialog();" title="You can change domain owner. Leave empty to be yours only.">Change owner</a>
|
||||
<a class="dropdown-item" onclick="showContactsDialog();" title="You can add contact information to your domain, if you wish">Set contacts</a>
|
||||
<a class="dropdown-item">Set info</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control">
|
||||
<div class="buttons has-addons">
|
||||
<button id="add_record_button" class="button is-link is-light" onclick="showNewRecordDialog();" title="Domain is nothing without good DNS records">Add record</button>
|
||||
<button disabled id="owners_button" class="button is-link is-light" onclick="showOwnersDialog();" title="You can change domain owners. Leave empty to be yours only.">
|
||||
<span>Set owners</span><span id="owners_count" class="tag is-info is-hidden ml-2">0</span>
|
||||
<!--<button disabled id="owner_button" class="button is-link is-light" onclick="showOwnerDialog();" title="You can change domain owner. Leave empty to be yours only.">
|
||||
<span>Set owner</span><span id="owner_count" class="tag is-info is-hidden ml-2">0</span>
|
||||
</button>
|
||||
<button disabled id="add_contacts_button" class="button is-link is-light" onclick="showContactsDialog();" title="You can add contact information to your domain, if you wish">Set contacts</button>
|
||||
<button disabled id="add_contacts_button" class="button is-link is-light" onclick="showContactsDialog();" title="You can add contact information to your domain, if you wish">Set contacts</button>-->
|
||||
<button id="new_domain_button" class="button is-link" onclick="createDomain();" title="Start mining">Mine domain</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -196,23 +216,46 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="owners_dialog" class="modal">
|
||||
<div id="owner_dialog" class="modal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-content">
|
||||
<div class="box">
|
||||
<div class="field">
|
||||
<label class="label">Public keys</label>
|
||||
<div class="control">
|
||||
<textarea class="textarea" id="owners_text"></textarea>
|
||||
<div class="control is-expanded has-icons-left">
|
||||
<input class="input is-expanded" type="text" placeholder="Public key" id="owner_text">
|
||||
<span class="icon is-small is-left">
|
||||
<svg viewBox="0 0 24 24" style="width: 20px; height: 20px;"><path d="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z"></path></svg>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help mb-3">Domains can be owned by several people.
|
||||
You need to add their public keys in this text field, separated by new line.
|
||||
If you don't include your own key, then domain will be completely transferred to entered owners.
|
||||
If you don't include your own key, then domain will be completely transferred to entered owner.
|
||||
If you wish to own domain by yourself, just leave this space empty.</p>
|
||||
<div class="buttons is-grouped is-centered">
|
||||
<button class="button is-link" id="owners_positive_button" onclick="ownersPositiveButton();">Ok</button>
|
||||
<button class="button is-link is-light" id="owners_negative_button" onclick="ownersCancelButton();">Cancel</button>
|
||||
<button class="button is-link" id="owner_positive_button" onclick="ownerPositiveButton();">Ok</button>
|
||||
<button class="button is-link is-light" id="owner_negative_button" onclick="ownerCancelButton();">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="contacts_dialog" class="modal">
|
||||
<div class="modal-background"></div>
|
||||
<div class="modal-content">
|
||||
<div class="box">
|
||||
<div class="field">
|
||||
<label class="label">Domain owner contacts</label>
|
||||
<div class="control">
|
||||
<textarea class="textarea" id="contacts_text"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<p class="help mb-3">You can add some contacts to your domain if you wish to be contacted in regards of your services.
|
||||
Just list your contacts, separated by new line.</p>
|
||||
<div class="buttons is-grouped is-centered">
|
||||
<button class="button is-link" id="contacts_positive_button" onclick="contactsPositiveButton();">Ok</button>
|
||||
<button class="button is-link is-light" id="contacts_negative_button" onclick="contactsCancelButton();">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+56
-46
@@ -1,5 +1,5 @@
|
||||
var recordsBuffer = [];
|
||||
var ownersBuffer = [];
|
||||
var owner = "";
|
||||
var availableZones = [];
|
||||
var myDomains = [];
|
||||
var currentZone;
|
||||
@@ -114,17 +114,21 @@ function refreshMyDomains() {
|
||||
var title = value.name;
|
||||
var domain_data = JSON.parse(value.data);
|
||||
var tags = "";
|
||||
domain_data.records.forEach(function(v, i, a) {
|
||||
if (typeof v.domain !== 'undefined') {
|
||||
var buf = tag.replace("{domain}", v.domain);
|
||||
if (typeof v.addr !== 'undefined') {
|
||||
buf = buf.replace("{ip}", v.addr);
|
||||
} else if (typeof v.host !== 'undefined') {
|
||||
buf = buf.replace("{ip}", v.host);
|
||||
if (typeof domain_data.records !== 'undefined') {
|
||||
domain_data.records.forEach(function(v, i, a) {
|
||||
if (typeof v.domain !== 'undefined') {
|
||||
var buf = tag.replace("{domain}", v.domain);
|
||||
if (typeof v.addr !== 'undefined') {
|
||||
buf = buf.replace("{ip}", v.addr);
|
||||
} else if (typeof v.host !== 'undefined') {
|
||||
buf = buf.replace("{ip}", v.host);
|
||||
}
|
||||
tags = tags + buf;
|
||||
}
|
||||
tags = tags + buf;
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
tags = tag.replace("{domain}", "No records").replace("{ip}", "");
|
||||
}
|
||||
cards = cards + card.replace("{title}", title).replace("{domain}", title).replace("{tags}", tags);
|
||||
});
|
||||
document.getElementById("my_domains").innerHTML = cards;
|
||||
@@ -138,9 +142,11 @@ function editDomain(domain) {
|
||||
var title = value.name;
|
||||
var domain_data = JSON.parse(value.data);
|
||||
recordsBuffer = [];
|
||||
domain_data.records.forEach(function(v, i, a) {
|
||||
recordsBuffer.push(v);
|
||||
});
|
||||
if (typeof domain_data.records !== 'undefined') {
|
||||
domain_data.records.forEach(function(v, i, a) {
|
||||
recordsBuffer.push(v);
|
||||
});
|
||||
}
|
||||
document.getElementById("new_domain").value = title.replace("." + domain_data.zone, "");
|
||||
changeZone(domain_data.zone);
|
||||
refreshRecordsList();
|
||||
@@ -231,11 +237,11 @@ function createDomain() {
|
||||
var data = {};
|
||||
data.domain = "";
|
||||
data.zone = currentZone.name;
|
||||
data.info = "";
|
||||
data.records = recordsBuffer;
|
||||
data.owners = []; // TODO make a dialog to fill them
|
||||
data.contacts = []; // TODO make a dialog to fill them
|
||||
data = JSON.stringify(data);
|
||||
external.invoke(JSON.stringify({cmd: 'mineDomain', name: domain, data: data}));
|
||||
external.invoke(JSON.stringify({cmd: 'mineDomain', name: domain, data: data, owner: owner}));
|
||||
}
|
||||
|
||||
function domainMiningStarted() {
|
||||
@@ -253,11 +259,11 @@ function domainMiningUnavailable() {
|
||||
//recordsBuffer = [];
|
||||
//refreshRecordsList();
|
||||
document.getElementById("new_domain_dialog").className = "modal";
|
||||
document.getElementById("tab_domains").disabled = true;
|
||||
document.getElementById("domain_records").disabled = true;
|
||||
document.getElementById("add_record_button").disabled = true;
|
||||
document.getElementById("new_domain_button").disabled = true;
|
||||
document.getElementById("new_key_button").disabled = true;
|
||||
document.getElementById("tab_domains").disabled = false;
|
||||
document.getElementById("domain_records").disabled = false;
|
||||
document.getElementById("add_record_button").disabled = false;
|
||||
document.getElementById("new_domain_button").disabled = false;
|
||||
document.getElementById("new_key_button").disabled = false;
|
||||
}
|
||||
|
||||
function sendAction(param) {
|
||||
@@ -307,8 +313,13 @@ function showModalDialog(text, callback) {
|
||||
dialog.className = "modal is-active";
|
||||
}
|
||||
|
||||
function showOwnersDialog() {
|
||||
var dialog = document.getElementById("owners_dialog");
|
||||
function showOwnerDialog() {
|
||||
var dialog = document.getElementById("owner_dialog");
|
||||
dialog.className = "modal is-active";
|
||||
}
|
||||
|
||||
function showContactsDialog() {
|
||||
var dialog = document.getElementById("contacts_dialog");
|
||||
dialog.className = "modal is-active";
|
||||
}
|
||||
|
||||
@@ -320,33 +331,25 @@ function isValidOwner(text) {
|
||||
return regexp.test(text);
|
||||
}
|
||||
|
||||
function ownersPositiveButton() {
|
||||
var text = document.getElementById("owners_text").value;
|
||||
function ownerPositiveButton() {
|
||||
var text = document.getElementById("owner_text").value;
|
||||
if (text != "") {
|
||||
ownersBuffer = [];
|
||||
var wrong = false;
|
||||
var lines = text.split("\n");
|
||||
lines.forEach(function(value, index, array) {
|
||||
if (wrong) {
|
||||
return;
|
||||
}
|
||||
if (isValidOwner(value)) {
|
||||
ownersBuffer.push(value);
|
||||
} else {
|
||||
alert("Wrong owner '{}'!".replace("{}", value));
|
||||
wrong = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (!wrong) {
|
||||
var dialog = document.getElementById("owners_dialog");
|
||||
dialog.className = "modal";
|
||||
if (isValidOwner(text)) {
|
||||
owner = text;
|
||||
} else {
|
||||
alert("Wrong owner '{}'!".replace("{}", value));
|
||||
wrong = true;
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
owner = "";
|
||||
}
|
||||
var dialog = document.getElementById("owner_dialog");
|
||||
dialog.className = "modal";
|
||||
}
|
||||
|
||||
function ownersCancelButton() {
|
||||
var dialog = document.getElementById("owners_dialog");
|
||||
function ownerCancelButton() {
|
||||
var dialog = document.getElementById("owner_dialog");
|
||||
dialog.className = "modal";
|
||||
}
|
||||
|
||||
@@ -449,6 +452,13 @@ function closeZonesDropdown() {
|
||||
}
|
||||
}
|
||||
|
||||
function closeAdvancedDropdown() {
|
||||
var active = document.activeElement;
|
||||
if (active == null || (active.id != 'advanced-menu' && active.tagName != 'BODY')) {
|
||||
document.getElementById("advanced-dropdown").className = "dropdown";
|
||||
}
|
||||
}
|
||||
|
||||
function refreshZonesList() {
|
||||
var buf = "";
|
||||
availableZones.sort(function compare(rhs, lhs) {
|
||||
|
||||
Reference in New Issue
Block a user