mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:37:17 +02:00
Merge pull request #11729 from huffman/fix/cloud-domain-wizard-domain-id
Update wizard to make request for domain info
This commit is contained in:
commit
4842da1388
3 changed files with 227 additions and 174 deletions
|
@ -146,11 +146,54 @@ function sendUpdatePlaceRequest(id, path, domainID, clearDomainID, onSuccess, on
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pendingDomainRequest = null;
|
||||||
|
function getDomainFromAPI(callback) {
|
||||||
|
if (pendingDomainRequest !== null) {
|
||||||
|
pendingDomainRequest.success(callback);
|
||||||
|
pendingDomainRequest.error(function() { callback({ status: 'fail' }) });
|
||||||
|
return pendingDomainRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callback === undefined) {
|
||||||
|
callback = function() {};
|
||||||
|
}
|
||||||
|
|
||||||
|
var domainID = Settings.data.values.metaverse.id;
|
||||||
|
if (domainID === null || domainID === undefined || domainID === '') {
|
||||||
|
callback({ status: 'fail' });
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
pendingDomainRequest = $.ajax({
|
||||||
|
url: "/api/domains/" + domainID,
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
pendingDomainRequest = null;
|
||||||
|
|
||||||
|
if (data.status === 'success') {
|
||||||
|
DomainInfo = data.domain;
|
||||||
|
} else {
|
||||||
|
DomainInfo = null;
|
||||||
|
}
|
||||||
|
callback(data);
|
||||||
|
},
|
||||||
|
error: function() {
|
||||||
|
pendingDomainRequest = null;
|
||||||
|
|
||||||
|
DomainInfo = null;
|
||||||
|
callback({ status: 'fail' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return pendingDomainRequest;
|
||||||
|
}
|
||||||
|
|
||||||
function chooseFromHighFidelityPlaces(accessToken, forcePathTo, onSuccessfullyAdded) {
|
function chooseFromHighFidelityPlaces(accessToken, forcePathTo, onSuccessfullyAdded) {
|
||||||
if (accessToken) {
|
if (accessToken) {
|
||||||
|
|
||||||
var loadingDialog = showLoadingDialog(Strings.ADD_PLACE_LOADING_DIALOG);
|
var loadingDialog = showLoadingDialog(Strings.ADD_PLACE_LOADING_DIALOG);
|
||||||
|
|
||||||
|
function loadPlaces() {
|
||||||
$.ajax("/api/places", {
|
$.ajax("/api/places", {
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
jsonp: false,
|
jsonp: false,
|
||||||
|
@ -282,6 +325,8 @@ function chooseFromHighFidelityPlaces(accessToken, forcePathTo, onSuccessfullyAd
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maybeCreateNewDomainID() {
|
||||||
|
console.log("Maybe creating domain id", currentDomainIDType)
|
||||||
if (currentDomainIDType === DOMAIN_ID_TYPE_FULL) {
|
if (currentDomainIDType === DOMAIN_ID_TYPE_FULL) {
|
||||||
finishSettingUpPlace();
|
finishSettingUpPlace();
|
||||||
} else {
|
} else {
|
||||||
|
@ -296,6 +341,9 @@ function chooseFromHighFidelityPlaces(accessToken, forcePathTo, onSuccessfullyAd
|
||||||
bootbox.alert("FAIL");
|
bootbox.alert("FAIL");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
maybeCreateNewDomainID();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -327,6 +375,26 @@ function chooseFromHighFidelityPlaces(accessToken, forcePathTo, onSuccessfullyAd
|
||||||
loadingDialog.modal('hide');
|
loadingDialog.modal('hide');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var domainType = getCurrentDomainIDType();
|
||||||
|
if (domainType !== DOMAIN_ID_TYPE_UNKNOWN) {
|
||||||
|
loadPlaces();
|
||||||
|
} else {
|
||||||
|
getDomainFromAPI(function(data) {
|
||||||
|
if (data.status === 'success') {
|
||||||
|
var domainType = getCurrentDomainIDType();
|
||||||
|
loadPlaces();
|
||||||
|
} else {
|
||||||
|
loadingDialog.modal('hide');
|
||||||
|
bootbox.confirm("We were not able to load your domain information from the Metaverse. Would you like to retry?", function(response) {
|
||||||
|
if (response) {
|
||||||
|
chooseFromHighFidelityPlaces(accessToken, forcePathTo, onSuccessfullyAdded);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bootbox.alert({
|
bootbox.alert({
|
||||||
|
|
|
@ -980,20 +980,6 @@ function placeTableRowForPlaceObject(place) {
|
||||||
return placeTableRow(place.name, placePathOrIndex, false, place.id);
|
return placeTableRow(place.name, placePathOrIndex, false, place.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDomainFromAPI(callback) {
|
|
||||||
var domainID = Settings.data.values.metaverse.id;
|
|
||||||
$.ajax({
|
|
||||||
url: "/api/domains/" + domainID,
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(data) {
|
|
||||||
callback(data);
|
|
||||||
},
|
|
||||||
error: function() {
|
|
||||||
callback({ status: 'fail' });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadDomainInfo() {
|
function reloadDomainInfo() {
|
||||||
$('#' + Settings.PLACES_TABLE_ID + " tbody tr").not('.headers').remove();
|
$('#' + Settings.PLACES_TABLE_ID + " tbody tr").not('.headers').remove();
|
||||||
|
|
||||||
|
@ -1010,7 +996,6 @@ function reloadDomainInfo() {
|
||||||
// check if we have owner_places (for a real domain) or a name (for a temporary domain)
|
// check if we have owner_places (for a real domain) or a name (for a temporary domain)
|
||||||
if (data.status == "success") {
|
if (data.status == "success") {
|
||||||
$('.domain-loading-hide').show();
|
$('.domain-loading-hide').show();
|
||||||
DomainInfo = data.domain;
|
|
||||||
if (data.domain.owner_places) {
|
if (data.domain.owner_places) {
|
||||||
// add a table row for each of these names
|
// add a table row for each of these names
|
||||||
_.each(data.domain.owner_places, function(place){
|
_.each(data.domain.owner_places, function(place){
|
||||||
|
@ -1043,7 +1028,6 @@ function reloadDomainInfo() {
|
||||||
appendAddButtonToPlacesTable();
|
appendAddButtonToPlacesTable();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DomainInfo = null;
|
|
||||||
$('.domain-loading-error').show();
|
$('.domain-loading-error').show();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -58,6 +58,7 @@ $(document).ready(function(){
|
||||||
|
|
||||||
reloadSettings(function(success) {
|
reloadSettings(function(success) {
|
||||||
if (success) {
|
if (success) {
|
||||||
|
getDomainFromAPI();
|
||||||
setupWizardSteps();
|
setupWizardSteps();
|
||||||
updatePlaceNameDisplay();
|
updatePlaceNameDisplay();
|
||||||
updateUsernameDisplay();
|
updateUsernameDisplay();
|
||||||
|
|
Loading…
Reference in a new issue