fix: ispublic status on databases
This commit is contained in:
@@ -86,7 +86,8 @@ export const status: Writable<any> = writable({
|
|||||||
isRunning: false,
|
isRunning: false,
|
||||||
isExited: false,
|
isExited: false,
|
||||||
loading: false,
|
loading: false,
|
||||||
initialLoading: true
|
initialLoading: true,
|
||||||
|
isPublic: false
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@@ -24,7 +24,6 @@
|
|||||||
let loading = false;
|
let loading = false;
|
||||||
let publicLoading = false;
|
let publicLoading = false;
|
||||||
|
|
||||||
let isPublic = database.settings.isPublic || false;
|
|
||||||
let appendOnly = database.settings.appendOnly;
|
let appendOnly = database.settings.appendOnly;
|
||||||
|
|
||||||
let databaseDefault: any;
|
let databaseDefault: any;
|
||||||
@@ -52,12 +51,12 @@
|
|||||||
return `${database.type}://${
|
return `${database.type}://${
|
||||||
databaseDbUser ? databaseDbUser + ':' : ''
|
databaseDbUser ? databaseDbUser + ':' : ''
|
||||||
}${databaseDbUserPassword}@${
|
}${databaseDbUserPassword}@${
|
||||||
isPublic
|
$status.database.isPublic
|
||||||
? database.destinationDocker.remoteEngine
|
? database.destinationDocker.remoteEngine
|
||||||
? database.destinationDocker.remoteIpAddress
|
? database.destinationDocker.remoteIpAddress
|
||||||
: $appSession.ipv4
|
: $appSession.ipv4
|
||||||
: database.id
|
: database.id
|
||||||
}:${isPublic ? database.publicPort : privatePort}/${databaseDefault}`;
|
}:${$status.database.isPublic ? database.publicPort : privatePort}/${databaseDefault}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function changeSettings(name: any) {
|
async function changeSettings(name: any) {
|
||||||
@@ -66,11 +65,11 @@
|
|||||||
}
|
}
|
||||||
publicLoading = true;
|
publicLoading = true;
|
||||||
let data = {
|
let data = {
|
||||||
isPublic,
|
isPublic: $status.database.isPublic,
|
||||||
appendOnly
|
appendOnly
|
||||||
};
|
};
|
||||||
if (name === 'isPublic') {
|
if (name === 'isPublic') {
|
||||||
data.isPublic = !isPublic;
|
data.isPublic = !$status.database.isPublic;
|
||||||
}
|
}
|
||||||
if (name === 'appendOnly') {
|
if (name === 'appendOnly') {
|
||||||
data.appendOnly = !appendOnly;
|
data.appendOnly = !appendOnly;
|
||||||
@@ -80,9 +79,9 @@
|
|||||||
isPublic: data.isPublic,
|
isPublic: data.isPublic,
|
||||||
appendOnly: data.appendOnly
|
appendOnly: data.appendOnly
|
||||||
});
|
});
|
||||||
isPublic = data.isPublic;
|
$status.database.isPublic = data.isPublic;
|
||||||
appendOnly = data.appendOnly;
|
appendOnly = data.appendOnly;
|
||||||
if (isPublic) {
|
if ($status.database.isPublic) {
|
||||||
database.publicPort = publicPort;
|
database.publicPort = publicPort;
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -191,7 +190,7 @@
|
|||||||
readonly
|
readonly
|
||||||
disabled
|
disabled
|
||||||
name="publicPort"
|
name="publicPort"
|
||||||
value={publicLoading ? 'Loading...' : isPublic ? database.publicPort : privatePort}
|
value={publicLoading ? 'Loading...' : $status.database.isPublic ? database.publicPort : privatePort}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -215,7 +214,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<label for="url" class="text-base font-bold text-stone-100"
|
<label for="url" class="text-base font-bold text-stone-100"
|
||||||
>{$t('database.connection_string')}
|
>{$t('database.connection_string')}
|
||||||
{#if !isPublic && database.destinationDocker.remoteEngine}
|
{#if !$status.database.isPublic && database.destinationDocker.remoteEngine}
|
||||||
<Explainer
|
<Explainer
|
||||||
explanation="You can only access the database with this URL if your application is deployed to the same Destination."
|
explanation="You can only access the database with this URL if your application is deployed to the same Destination."
|
||||||
/>
|
/>
|
||||||
@@ -243,7 +242,7 @@
|
|||||||
<Setting
|
<Setting
|
||||||
id="isPublic"
|
id="isPublic"
|
||||||
loading={publicLoading}
|
loading={publicLoading}
|
||||||
bind:setting={isPublic}
|
bind:setting={$status.database.isPublic}
|
||||||
on:click={() => changeSettings('isPublic')}
|
on:click={() => changeSettings('isPublic')}
|
||||||
title={$t('database.set_public')}
|
title={$t('database.set_public')}
|
||||||
description={$t('database.warning_database_public')}
|
description={$t('database.warning_database_public')}
|
||||||
|
@@ -64,6 +64,7 @@
|
|||||||
import Tooltip from '$lib/components/Tooltip.svelte';
|
import Tooltip from '$lib/components/Tooltip.svelte';
|
||||||
const { id } = $page.params;
|
const { id } = $page.params;
|
||||||
|
|
||||||
|
$status.database.isPublic = database.settings.isPublic || false;
|
||||||
let statusInterval: any = false;
|
let statusInterval: any = false;
|
||||||
let forceDelete = false;
|
let forceDelete = false;
|
||||||
|
|
||||||
@@ -90,6 +91,7 @@
|
|||||||
$status.database.loading = true;
|
$status.database.loading = true;
|
||||||
try {
|
try {
|
||||||
await post(`/databases/${database.id}/stop`, {});
|
await post(`/databases/${database.id}/stop`, {});
|
||||||
|
$status.database.isPublic = false;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return errorNotification(error);
|
return errorNotification(error);
|
||||||
} finally {
|
} finally {
|
||||||
|
Reference in New Issue
Block a user