fix: handle log format volumes
This commit is contained in:
parent
05fb26a49b
commit
2adad3a7bd
@ -78,6 +78,7 @@ export default async function (data) {
|
|||||||
// TODO: If we support separated volume for each service, we need to add it here
|
// TODO: If we support separated volume for each service, we need to add it here
|
||||||
if (value['volumes']?.length > 0) {
|
if (value['volumes']?.length > 0) {
|
||||||
value['volumes'] = value['volumes'].map((volume) => {
|
value['volumes'] = value['volumes'].map((volume) => {
|
||||||
|
if (typeof volume === 'string') {
|
||||||
let [v, path, permission] = volume.split(':');
|
let [v, path, permission] = volume.split(':');
|
||||||
if (
|
if (
|
||||||
v.startsWith('.') ||
|
v.startsWith('.') ||
|
||||||
@ -86,7 +87,7 @@ export default async function (data) {
|
|||||||
v.startsWith('~') ||
|
v.startsWith('~') ||
|
||||||
v.startsWith('$PWD')
|
v.startsWith('$PWD')
|
||||||
) {
|
) {
|
||||||
v = v.replace('$.', `~`).replace('$..', '~').replace('$$PWD', '~');
|
v = v.replace(/^\./, `~`).replace(/^\.\./, '~').replace(/^\$PWD/, '~');
|
||||||
} else {
|
} else {
|
||||||
if (!path) {
|
if (!path) {
|
||||||
path = v;
|
path = v;
|
||||||
@ -98,8 +99,33 @@ export default async function (data) {
|
|||||||
name: v
|
name: v
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${v}:${path}${permission ? ':' + permission : ''}`;
|
return `${v}:${path}${permission ? ':' + permission : ''}`;
|
||||||
|
}
|
||||||
|
if (typeof volume === 'object') {
|
||||||
|
let { source, target, mode } = volume;
|
||||||
|
if (
|
||||||
|
source.startsWith('.') ||
|
||||||
|
source.startsWith('..') ||
|
||||||
|
source.startsWith('/') ||
|
||||||
|
source.startsWith('~') ||
|
||||||
|
source.startsWith('$PWD')
|
||||||
|
) {
|
||||||
|
|
||||||
|
source = source.replace(/^\./, `~`).replace(/^\.\./, '~').replace(/^\$PWD/, '~');
|
||||||
|
console.log({source})
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (!target) {
|
||||||
|
target = source;
|
||||||
|
source = `${applicationId}${source.replace(/\//gi, '-').replace(/\./gi, '')}`;
|
||||||
|
} else {
|
||||||
|
source = `${applicationId}${source.replace(/\//gi, '-').replace(/\./gi, '')}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${source}:${target}${mode ? ':' + mode : ''}`;
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (volumes.length > 0) {
|
if (volumes.length > 0) {
|
||||||
|
@ -427,29 +427,6 @@
|
|||||||
</svg> Stop
|
</svg> Stop
|
||||||
</button>
|
</button>
|
||||||
{:else if $isDeploymentEnabled && !$page.url.pathname.startsWith(`/applications/${id}/configuration/`)}
|
{:else if $isDeploymentEnabled && !$page.url.pathname.startsWith(`/applications/${id}/configuration/`)}
|
||||||
{#if $status.application.overallStatus === 'degraded'}
|
|
||||||
<button
|
|
||||||
on:click={stopApplication}
|
|
||||||
type="submit"
|
|
||||||
disabled={!$isDeploymentEnabled || !$appSession.isAdmin}
|
|
||||||
class="btn btn-sm gap-2"
|
|
||||||
>
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
class="w-6 h-6 text-error"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke-width="1.5"
|
|
||||||
stroke="currentColor"
|
|
||||||
fill="none"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
>
|
|
||||||
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
|
||||||
<rect x="6" y="5" width="4" height="14" rx="1" />
|
|
||||||
<rect x="14" y="5" width="4" height="14" rx="1" />
|
|
||||||
</svg> Stop
|
|
||||||
</button>
|
|
||||||
{/if}
|
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm gap-2"
|
class="btn btn-sm gap-2"
|
||||||
disabled={!$isDeploymentEnabled || !$appSession.isAdmin}
|
disabled={!$isDeploymentEnabled || !$appSession.isAdmin}
|
||||||
@ -493,6 +470,29 @@
|
|||||||
: 'Redeploy Stack'
|
: 'Redeploy Stack'
|
||||||
: 'Deploy'}
|
: 'Deploy'}
|
||||||
</button>
|
</button>
|
||||||
|
{#if $status.application.overallStatus === 'degraded'}
|
||||||
|
<button
|
||||||
|
on:click={stopApplication}
|
||||||
|
type="submit"
|
||||||
|
disabled={!$isDeploymentEnabled || !$appSession.isAdmin}
|
||||||
|
class="btn btn-sm gap-2"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="w-6 h-6 text-error"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
fill="none"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
>
|
||||||
|
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
|
||||||
|
<rect x="6" y="5" width="4" height="14" rx="1" />
|
||||||
|
<rect x="14" y="5" width="4" height="14" rx="1" />
|
||||||
|
</svg> Stop
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if $location && $status.application.overallStatus === 'healthy'}
|
{#if $location && $status.application.overallStatus === 'healthy'}
|
||||||
<a href={$location} target="_blank noreferrer" class="btn btn-sm gap-2 text-sm bg-primary"
|
<a href={$location} target="_blank noreferrer" class="btn btn-sm gap-2 text-sm bg-primary"
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
for (const [_, service] of Object.entries(composeJson.services)) {
|
for (const [_, service] of Object.entries(composeJson.services)) {
|
||||||
if (service?.volumes) {
|
if (service?.volumes) {
|
||||||
for (const [_, volumeName] of Object.entries(service.volumes)) {
|
for (const [_, volumeName] of Object.entries(service.volumes)) {
|
||||||
|
if (typeof volumeName === 'string') {
|
||||||
let [volume, target] = volumeName.split(':');
|
let [volume, target] = volumeName.split(':');
|
||||||
if (
|
if (
|
||||||
volume.startsWith('.') ||
|
volume.startsWith('.') ||
|
||||||
@ -43,7 +44,7 @@
|
|||||||
volume.startsWith('~') ||
|
volume.startsWith('~') ||
|
||||||
volume.startsWith('$PWD')
|
volume.startsWith('$PWD')
|
||||||
) {
|
) {
|
||||||
volume = volume.replace('$.', `~`).replace('$..', '~').replace('$$PWD', '~');
|
volume = volume.replace(/^\./, `~`).replace(/^\.\./, '~').replace(/^\$PWD/, '~');
|
||||||
} else {
|
} else {
|
||||||
if (!target) {
|
if (!target) {
|
||||||
target = volume;
|
target = volume;
|
||||||
@ -54,6 +55,27 @@
|
|||||||
}
|
}
|
||||||
predefinedVolumes.push({ id: volume, path: target, predefined: true });
|
predefinedVolumes.push({ id: volume, path: target, predefined: true });
|
||||||
}
|
}
|
||||||
|
if (typeof volumeName === 'object') {
|
||||||
|
let { source, target } = volumeName;
|
||||||
|
if (
|
||||||
|
source.startsWith('.') ||
|
||||||
|
source.startsWith('..') ||
|
||||||
|
source.startsWith('/') ||
|
||||||
|
source.startsWith('~') ||
|
||||||
|
source.startsWith('$PWD')
|
||||||
|
) {
|
||||||
|
source = source.replace(/^\./, `~`).replace(/^\.\./, '~').replace(/^\$PWD/, '~');
|
||||||
|
} else {
|
||||||
|
if (!target) {
|
||||||
|
target = source;
|
||||||
|
source = `${application.id}${source.replace(/\//gi, '-').replace(/\./gi, '')}`;
|
||||||
|
} else {
|
||||||
|
source = `${application.id}${source.replace(/\//gi, '-').replace(/\./gi, '')}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
predefinedVolumes.push({ id: source, path: target, predefined: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user