Add domain label creation step 1 of wizard.

This commit is contained in:
Kalila L 2020-10-12 01:17:00 -04:00
parent 2e75166e0d
commit 2546639171
2 changed files with 57 additions and 1 deletions

View file

@ -500,6 +500,33 @@ 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);
}
swal.close();
});
}
function getMetaverseUrl(callback) { function getMetaverseUrl(callback) {
$.ajax('/api/metaverse_info', { $.ajax('/api/metaverse_info', {
success: function(data) { success: function(data) {

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,34 @@ function setupWizardSteps() {
$(currentStep).show(); $(currentStep).show();
} }
function promptToCreateDomainID() {
setTimeout(function(){
createDomainIDPrompt(function(label) {
var domainJSON = {
"label": label
}
$.post("/api/domains", domainJSON, function(data){
// 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(){
console.log("Failed to create domain ID...");
goToNextStep();
});
});
}, 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 +370,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) {