Merge pull request #803 from kasenvr/fix/domain-server-metaverse

Hide temp place name button, hide places table, hide places wizard step.
This commit is contained in:
kasenvr 2020-10-22 17:06:08 -04:00 committed by GitHub
commit 22aa9f2065
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 76 additions and 8 deletions

View file

@ -500,6 +500,31 @@ function prepareAccessTokenPrompt(callback) {
}); });
} }
function createDomainIDPrompt(callback) {
swal({
title: 'Finish Registering Domain',
type: 'input',
text: 'Enter a label for this machine.</br></br>This will help you identify which domain ID belongs to which machine.</br></br>This is a required step for registration.</br></br>',
showCancelButton: true,
confirmButtonText: "Create",
closeOnConfirm: false,
html: true
}, function (inputValue) {
if (inputValue === false) {
return false;
}
if (inputValue === "") {
swal.showInputError("Please enter a valid label for your machine.");
return false;
}
if (callback) {
callback(inputValue);
}
});
}
function getMetaverseUrl(callback) { function getMetaverseUrl(callback) {
$.ajax('/api/metaverse_info', { $.ajax('/api/metaverse_info', {
success: function(data) { success: function(data) {

View file

@ -40,6 +40,8 @@ $(document).ready(function(){
// call our method to setup the place names table // call our method to setup the place names table
setupPlacesTable(); setupPlacesTable();
// hide the places table for now because we do not want that interacted with from the domain-server
$('#' + Settings.PLACES_TABLE_ID).hide();
setupDomainNetworkingSettings(); setupDomainNetworkingSettings();
// setupDomainLabelSetting(); // setupDomainLabelSetting();
@ -711,8 +713,8 @@ $(document).ready(function(){
name: 'places', name: 'places',
label: 'Places', label: 'Places',
html_id: Settings.PLACES_TABLE_ID, html_id: Settings.PLACES_TABLE_ID,
help: "The following places currently point to this domain.</br>To point places to this domain, " help: "To point places to this domain, "
+ " go to the <a href='" + METAVERSE_URL + "/user/places'>My Places</a> " + " go to the <a href='" + METAVERSE_URL + "/user/places'>Places</a> "
+ "page in your Metaverse account.", + "page in your Metaverse account.",
read_only: true, read_only: true,
can_add_new_rows: false, can_add_new_rows: false,
@ -745,9 +747,10 @@ $(document).ready(function(){
var errorEl = createDomainLoadingError("There was an error retrieving your places."); var errorEl = createDomainLoadingError("There was an error retrieving your places.");
$("#" + Settings.PLACES_TABLE_ID).after(errorEl); $("#" + Settings.PLACES_TABLE_ID).after(errorEl);
var temporaryPlaceButton = dynamicButton(Settings.GET_TEMPORARY_NAME_BTN_ID, 'Get a temporary place name'); // DISABLE TEMP PLACE NAME BUTTON...
temporaryPlaceButton.hide(); // var temporaryPlaceButton = dynamicButton(Settings.GET_TEMPORARY_NAME_BTN_ID, 'Get a temporary place name');
$('#' + Settings.PLACES_TABLE_ID).after(temporaryPlaceButton); // temporaryPlaceButton.hide();
// $('#' + Settings.PLACES_TABLE_ID).after(temporaryPlaceButton);
if (accessTokenIsSet()) { if (accessTokenIsSet()) {
appendAddButtonToPlacesTable(); appendAddButtonToPlacesTable();
} }

View file

@ -19,7 +19,7 @@
</dl> </dl>
</div> </div>
<div class="wizard-step col-md-8 col-centered" style="display: none;"> <!-- <div class="wizard-step col-md-8 col-centered" style="display: none;">
<h4 class="step-title"></h4> <h4 class="step-title"></h4>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
@ -51,7 +51,7 @@
<button type="button" class="btn btn-md btn-block btn-primary next-button">Next</button> <button type="button" class="btn btn-md btn-block btn-primary next-button">Next</button>
</dd> </dd>
</dl> </dl>
</div> </div> -->
<div class="wizard-step col-md-9 col-centered" style="display: none;"> <div class="wizard-step col-md-9 col-centered" style="display: none;">
<h4 class="step-title"></h4> <h4 class="step-title"></h4>

View file

@ -50,6 +50,7 @@ $(document).ready(function(){
prepareAccessTokenPrompt(function(accessToken) { prepareAccessTokenPrompt(function(accessToken) {
Metaverse.accessToken = accessToken; Metaverse.accessToken = accessToken;
saveAccessToken(); saveAccessToken();
promptToCreateDomainID();
}); });
}); });
@ -171,6 +172,45 @@ function setupWizardSteps() {
$(currentStep).show(); $(currentStep).show();
} }
function promptToCreateDomainID() {
setTimeout(function () {
createDomainIDPrompt(function (label) {
var domainJSON = {
"label": label
};
$.post("/api/domains", domainJSON, function (data) {
if (data.status === "failure") {
swal.showInputError("Error: " + data.error);
return;
}
swal.close();
// we successfully created a domain ID, set it on that field
var domainID = data.domain.domainId;
console.log("Setting domain ID to ", data, domainID);
var formJSON = {
"metaverse": {
"id": domainID
}
};
// POST the form JSON to the domain-server settings.json endpoint so the settings are saved
postSettings(formJSON, goToNextStep);
}, 'json').fail(function (data) {
if (data && data.status === "failure") {
swal.showInputError("Error: " + data.error);
} else {
swal.showInputError("Error: Failed to post to metaverse.");
}
console.log("Failed to create domain ID...");
});
});
}, 500); // Apparently swal needs time before opening another prompt.
}
function updatePlaceNameLink(address) { function updatePlaceNameLink(address) {
if (address) { if (address) {
var url = URLs.PLACE_URL + '/' + address; var url = URLs.PLACE_URL + '/' + address;
@ -341,7 +381,7 @@ function saveAccessToken() {
$(this).blur(); $(this).blur();
// POST the form JSON to the domain-server settings.json endpoint so the settings are saved // POST the form JSON to the domain-server settings.json endpoint so the settings are saved
postSettings(formJSON, goToNextStep); postSettings(formJSON);
} }
function getSettingDescriptionForKey(groupKey, settingKey) { function getSettingDescriptionForKey(groupKey, settingKey) {