provision: fix issues when refreshing

This commit is contained in:
Girish Ramakrishnan
2025-10-06 21:23:44 +02:00
parent 7fae0751b9
commit 0e09df797b
2 changed files with 21 additions and 18 deletions
+13 -13
View File
@@ -130,31 +130,28 @@ function onCopyToClipboard(value) {
onMounted(async () => {
const search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.split('='); }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {});
let [error, result] = await provisionModel.status();
const [error, status] = await provisionModel.status();
if (error) return console.error(error);
if (redirectIfNeeded(result, 'setup')) return; // redirected to some other view...
if (redirectIfNeeded(status, 'setup')) return; // redirected to some other view...
if (result.setup.active) return waitForDnsSetup();
formError.value.generic = result.setup.errorMessage; // show any previous error
if (result.provider === 'digitalocean' || result.provider === 'digitalocean-mp') {
if (status.provider === 'digitalocean' || status.provider === 'digitalocean-mp') {
provider.value = 'digitalocean';
} else if (result.provider === 'linode' || result.provider === 'linode-oneclick' || result.provider === 'linode-stackscript') {
} else if (status.provider === 'linode' || status.provider === 'linode-oneclick' || status.provider === 'linode-stackscript') {
provider.value = 'linode';
} else if (result.provider === 'vultr' || result.provider === 'vultr-mp') {
} else if (status.provider === 'vultr' || status.provider === 'vultr-mp') {
provider.value = 'vultr';
} else if (result.provider === 'gce') {
} else if (status.provider === 'gce') {
provider.value = 'gcdns';
} else if (result.provider === 'ami') {
} else if (status.provider === 'ami') {
// aws marketplace made a policy change that they one cannot provide route53 IAM credentials
provider.value = 'wildcard';
} else { // some default to make the form not feel "empty"
provider.value = 'hetzner';
}
[error, result] = await provisionModel.detectIp();
if (error) return console.error(error); // detectIp is not supposed to error
const [error2, result] = await provisionModel.detectIp();
if (error2) return console.error(error2); // detectIp is not supposed to error
ipv4Provider.value = result.ipv4 ? 'generic' : 'noop';
ipv6Provider.value = result.ipv6 ? 'generic' : 'noop';
@@ -163,6 +160,9 @@ onMounted(async () => {
setupToken.value = search.setupToken;
ready.value = true;
if (status.setup.active) return waitForDnsSetup();
formError.value.generic = status.setup.errorMessage; // show any previous error
});
</script>
@@ -174,7 +174,7 @@ onMounted(async () => {
<Transition name="fade-scale" mode="out-in">
<div class="view" v-if="waitingForDnsSetup" style="max-width: unset; height: 100%;">
<div style="display: flex; flex-direction: column; height: 100%; align-items: center;">
<Whirlpool v-if="waitingForDnsSetup"/>
<Whirlpool/>
<h1>Please wait while Cloudron is setting up the dashboard ...</h1>
<h4 style="margin-top: 0">{{ progressMessage }}</h4>
<small>You can follow the logs on the server at <code @click="onCopyToClipboard('/home/yellowtent/platformdata/logs/box.log')">/home/yellowtent/platformdata/logs/box.log</code></small>