mirror of
https://github.com/amir20/dozzle.git
synced 2025-12-21 21:33:18 +01:00
feat: adds option to instantly redirect to new container (#3897)
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<details class="dropdown" ref="details" v-on-click-outside="close">
|
<details class="dropdown dropdown-end" ref="details" v-on-click-outside="close">
|
||||||
<summary class="btn btn-primary flex-nowrap" v-bind="$attrs">
|
<summary class="btn btn-primary flex-nowrap" v-bind="$attrs">
|
||||||
<slot name="trigger"> {{ label }} <carbon:caret-down /></slot>
|
<slot name="trigger"> {{ label }} <carbon:caret-down /></slot>
|
||||||
</summary>
|
</summary>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<label class="label text-base-content cursor-pointer gap-4">
|
<label class="label text-base-content cursor-pointer gap-4">
|
||||||
<div class="flex-1"><slot name="label" /></div>
|
<div class="flex-1 whitespace-normal"><slot name="label" /></div>
|
||||||
<slot name="input" />
|
<slot name="input" />
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ watch(currentContainer, () => (redirectTrigger.value = false));
|
|||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (redirectTrigger.value) return;
|
if (redirectTrigger.value) return;
|
||||||
|
if (automaticRedirect.value === "none") return;
|
||||||
if (!currentContainer.value) return;
|
if (!currentContainer.value) return;
|
||||||
if (currentContainer.value.state === "running") return;
|
if (currentContainer.value.state === "running") return;
|
||||||
if (Date.now() - +currentContainer.value.finishedAt > 5 * 60 * 1000) return;
|
if (Date.now() - +currentContainer.value.finishedAt > 5 * 60 * 1000) return;
|
||||||
@@ -49,7 +50,7 @@ watchEffect(() => {
|
|||||||
|
|
||||||
if (!nextContainer) return;
|
if (!nextContainer) return;
|
||||||
|
|
||||||
if (automaticRedirect.value) {
|
if (automaticRedirect.value === "delayed") {
|
||||||
redirectTrigger.value = true;
|
redirectTrigger.value = true;
|
||||||
showToast(
|
showToast(
|
||||||
{
|
{
|
||||||
@@ -73,6 +74,16 @@ watchEffect(() => {
|
|||||||
},
|
},
|
||||||
{ timed: 4000 },
|
{ timed: 4000 },
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
router.push({ name: "/container/[id]", params: { id: nextContainer.id } });
|
||||||
|
showToast(
|
||||||
|
{
|
||||||
|
title: t("alert.redirected.title"),
|
||||||
|
message: t("alert.redirected.message", { containerId: nextContainer.id }),
|
||||||
|
type: "info",
|
||||||
|
},
|
||||||
|
{ expire: 3000 },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -119,13 +119,28 @@
|
|||||||
<div class="has-underline">
|
<div class="has-underline">
|
||||||
<h2>{{ $t("settings.options") }}</h2>
|
<h2>{{ $t("settings.options") }}</h2>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<LabeledInput>
|
||||||
|
<template #label>
|
||||||
|
{{ $t("settings.automatic-redirect") }}
|
||||||
|
</template>
|
||||||
|
<template #input>
|
||||||
|
<DropdownMenu
|
||||||
|
v-model="automaticRedirect"
|
||||||
|
:options="[
|
||||||
|
{ label: 'Instant', value: 'instant' },
|
||||||
|
{ label: 'Delayed', value: 'delayed' },
|
||||||
|
{ label: 'None', value: 'none' },
|
||||||
|
]"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
</LabeledInput>
|
||||||
|
|
||||||
<Toggle v-model="search">
|
<Toggle v-model="search">
|
||||||
{{ $t("settings.search") }} <key-shortcut char="f" class="align-top"></key-shortcut>
|
{{ $t("settings.search") }} <key-shortcut char="f" class="align-top"></key-shortcut>
|
||||||
</Toggle>
|
</Toggle>
|
||||||
|
|
||||||
<Toggle v-model="showAllContainers">{{ $t("settings.show-stopped-containers") }}</Toggle>
|
<Toggle v-model="showAllContainers">{{ $t("settings.show-stopped-containers") }}</Toggle>
|
||||||
|
|
||||||
<Toggle v-model="automaticRedirect">{{ $t("settings.automatic-redirect") }}</Toggle>
|
|
||||||
</section>
|
</section>
|
||||||
</PageWithLinks>
|
</PageWithLinks>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ export type Settings = {
|
|||||||
dateLocale: "auto" | "en-US" | "en-GB" | "de-DE" | "en-CA";
|
dateLocale: "auto" | "en-US" | "en-GB" | "de-DE" | "en-CA";
|
||||||
softWrap: boolean;
|
softWrap: boolean;
|
||||||
collapseNav: boolean;
|
collapseNav: boolean;
|
||||||
automaticRedirect: boolean;
|
automaticRedirect: "instant" | "delayed" | "none";
|
||||||
locale: string;
|
locale: string;
|
||||||
};
|
};
|
||||||
export const DEFAULT_SETTINGS: Settings = {
|
export const DEFAULT_SETTINGS: Settings = {
|
||||||
@@ -31,12 +31,20 @@ export const DEFAULT_SETTINGS: Settings = {
|
|||||||
dateLocale: "auto",
|
dateLocale: "auto",
|
||||||
softWrap: true,
|
softWrap: true,
|
||||||
collapseNav: false,
|
collapseNav: false,
|
||||||
automaticRedirect: true,
|
automaticRedirect: "delayed",
|
||||||
locale: "",
|
locale: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const settings = useProfileStorage("settings", DEFAULT_SETTINGS);
|
export const settings = useProfileStorage("settings", DEFAULT_SETTINGS);
|
||||||
|
|
||||||
|
// @ts-ignore: automaticRedirect is now a string enum, but might be a boolean in older data
|
||||||
|
if (settings.value.automaticRedirect === true) {
|
||||||
|
settings.value.automaticRedirect = "delayed";
|
||||||
|
// @ts-ignore: automaticRedirect is now a string enum, but might be a boolean in older data
|
||||||
|
} else if (settings.value.automaticRedirect === false) {
|
||||||
|
settings.value.automaticRedirect = "none";
|
||||||
|
}
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
collapseNav,
|
collapseNav,
|
||||||
compact,
|
compact,
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type Settings struct {
|
|||||||
ShowAllContainers bool `json:"showAllContainers"`
|
ShowAllContainers bool `json:"showAllContainers"`
|
||||||
SoftWrap bool `json:"softWrap"`
|
SoftWrap bool `json:"softWrap"`
|
||||||
CollapseNav bool `json:"collapseNav"`
|
CollapseNav bool `json:"collapseNav"`
|
||||||
AutomaticRedirect bool `json:"automaticRedirect"`
|
AutomaticRedirect string `json:"automaticRedirect"`
|
||||||
Size string `json:"size,omitempty"`
|
Size string `json:"size,omitempty"`
|
||||||
Compact bool `json:"compact"`
|
Compact bool `json:"compact"`
|
||||||
LightTheme string `json:"lightTheme,omitempty"`
|
LightTheme string `json:"lightTheme,omitempty"`
|
||||||
|
|||||||
Reference in New Issue
Block a user