Improve Dockge workflows and require approval after image scans
All checks were successful
Docker image / publish (push) Successful in 59s
All checks were successful
Docker image / publish (push) Successful in 59s
Update the shadcn preset and visual Compose editor. Add deployment previews, history, attention notices, and cleanup safeguards. Use the supplied icon in the app header and authentication screens.
This commit is contained in:
parent
35623ba61e
commit
d8fdeba05d
20
README.md
20
README.md
@ -1,6 +1,6 @@
|
||||
# Dockge · Weapie-Fork
|
||||
|
||||
Dockge verwaltet Docker-Compose-Stacks über eine Weboberfläche. Dieser Fork des ursprünglichen Dockge von Louis Lam wird von **Weapie** weitergepflegt. Er verwendet shadcn-vue mit Nova, Mist und Phosphor-Icons. [Ursprüngliches Dockge](https://github.com/louislam/dockge) · [UI-Konfiguration](components.json)
|
||||
Dockge verwaltet Docker-Compose-Stacks über eine Weboberfläche. Dieser Fork des ursprünglichen Dockge von Louis Lam wird von **Weapie** weitergepflegt. Die Oberfläche verwendet shadcn-vue mit dem Preset `b4a7LsmarT`. [Ursprüngliches Dockge](https://github.com/louislam/dockge) · [UI-Konfiguration](components.json)
|
||||
|
||||

|
||||
|
||||
@ -42,7 +42,7 @@ Für weitere PowerShell-Sitzungen kannst du den Wert von `$env:DOCKGE_STACKS_DIR
|
||||
### Erster Start
|
||||
|
||||
1. Öffne [http://127.0.0.1:5001](http://127.0.0.1:5001) und erstelle dein Dockge-Konto.
|
||||
2. Wähle **New stack**, vergib einen Namen und hinterlege eine `compose.yaml`. Für einen ersten Test eignet sich dieser Stack.
|
||||
2. Wähle **Neuer Stack**, vergib einen Namen und hinterlege eine `compose.yaml`. Für einen ersten Test eignet sich dieser Stack.
|
||||
|
||||
~~~yaml
|
||||
services:
|
||||
@ -53,17 +53,20 @@ Für weitere PowerShell-Sitzungen kannst du den Wert von `$env:DOCKGE_STACKS_DIR
|
||||
- "127.0.0.1:8081:80"
|
||||
~~~
|
||||
|
||||
3. Klicke auf **Deployen**. Sobald der Container läuft, erreichst du die Beispielseite unter [http://127.0.0.1:8081](http://127.0.0.1:8081).
|
||||
3. Klicke auf **Deployment prüfen**. Dockge validiert die Compose-Datei, bereitet benötigte Images vor und zeigt die geplanten Änderungen. Bestätige anschließend mit **Ja, starten**. Sobald der Container läuft, erreichst du die Beispielseite unter [http://127.0.0.1:8081](http://127.0.0.1:8081).
|
||||
|
||||
Dockge bindet die Oberfläche standardmäßig an `127.0.0.1:5001`. Der eingebundene Docker-Socket gibt Dockge weitreichenden Zugriff auf den Host. Beschränke den Zugang auf vertrauenswürdige Personen. Wenn du die Oberfläche über einen Reverse Proxy bereitstellst, verwende HTTPS und leite WebSocket-Verbindungen weiter. [Docker Engine und Sicherheit](https://docs.docker.com/engine/security/)
|
||||
|
||||
## Stacks verwalten
|
||||
|
||||
- **Übersicht** zeigt Dienste, Status, Ports und die CPU- und Speicherauslastung laufender Container. Du kannst Stacks starten, stoppen, neu starten und Images manuell aktualisieren.
|
||||
- **Konfiguration** öffnet `compose.yaml` und die Stack-`.env` im Editor mit Suche, Zeilenumbruch und Vollbildansicht.
|
||||
- **Übersicht** zeigt Dienste, Container-Instanzen, Ports und Ressourcenauslastung. In den Containerdetails findest du Healthcheck-Status, Neustarts, Netzwerke und Mounts.
|
||||
- **Klick-Editor** bietet Formulare für Image und Build, Ports, Volumes, Umgebungsvariablen, Startbefehle, Healthchecks, Abhängigkeiten und Ressourcenlimits. **Stack-Ressourcen** verwaltet benannte Netzwerke, Volumes und Links.
|
||||
- **YAML / .env** öffnet die Stack-Dateien im Editor mit Suche, Zeilenumbruch und Vollbildansicht.
|
||||
- **Protokolle** zeigt laufende Stack-Logs. Über die Aktionen eines Dienstes erreichst du dessen Logs, Terminal und Datei-Explorer.
|
||||
- **Wartung** bündelt den Update-Zeitplan und die Schwachstellenscans.
|
||||
|
||||
Die Startseite zeigt unter **Benötigt Aufmerksamkeit** ausstehende Freigaben, fehlgeschlagene Vorgänge, Container mit Healthcheck-Fehlern und kritische Scan-Funde. Der **Deployment-Verlauf** zeigt Ergebnisse und die verwendeten Image-IDs. Eine frühere Compose- und `.env`-Version kannst du als Entwurf wiederherstellen.
|
||||
|
||||
Für vorhandene Compose-Stacks erwartet Dockge je einen Unterordner im Stack-Verzeichnis, etwa `/opt/stacks/web/compose.yaml`. Lege die zugehörige `.env` und Dateien für relative Bind-Mounts in der bestehenden Verzeichnisstruktur ab. Wähle danach **Stacks-Ordner durchsuchen** im Kontomenü. Bei laufenden Projekten sollten Projektname und Arbeitsverzeichnis zur vorhandenen Bereitstellung passen. Prüfe diese vor dem erneuten Bereitstellen, damit Docker Compose das richtige Projekt anspricht.
|
||||
|
||||
Über **Einstellungen → Global .env** kannst du die Datei `global.env` im Stack-Verzeichnis pflegen. Docker Compose verwendet sie zur Variablenauflösung, wobei die `.env` des jeweiligen Stacks Vorrang hat. Auf der Startseite lässt sich auch ein `docker run`-Befehl in Compose-YAML umwandeln.
|
||||
@ -76,7 +79,8 @@ Starte auf jedem zusätzlichen Host eine Dockge-Instanz mit Zugriff auf dessen D
|
||||
|
||||

|
||||
|
||||
- **Automatische Image-Updates** sind pro Stack aktivierbar. Wähle unter **Wartung** die tägliche Uhrzeit und eine Zeitzone wie `Europe/Berlin`. Die optionale Wartezeit zählt ab der ersten Erkennung der konkreten neuen Image-Version. Nach Ablauf kann Dockge sie beim nächsten geplanten Lauf bereitstellen. Dockge lädt das neue Image schon beim Erkennen herunter und wartet mit dem Austausch des laufenden Containers. Dienste mit lokalen Builds oder noch nicht bereitgestellten Konfigurationsänderungen werden übersprungen.
|
||||
- **Automatische Image-Updates** prüfen laufende Dienste täglich zur gewählten Uhrzeit und Zeitzone. Dockge lädt neue Images, scannt sie und legt eine Freigabe an. Die optionale Wartezeit beginnt beim Erkennen der neuen Version. Nach Ablauf kannst du das Update freigeben. Dienste mit lokalen Builds oder noch nicht bereitgestellten Konfigurationsänderungen werden übersprungen.
|
||||
- **Freigabe nach dem Pull** zeigt die Ergebnisse von Grype vor dem Start. **Ja, starten** verwendet die geprüfte Image-ID und wartet auf den Containerzustand oder vorhandene Healthchecks. **Nein, abbrechen** entfernt die eigens für diesen Vorgang geladenen Images, soweit Docker sie entfernen kann. Bei einem fehlgeschlagenen Scan bleibt die Freigabe gesperrt.
|
||||
- **Images prüfen** scannt die lokalen Image-IDs der Container dieses Stacks. Der Bericht zeigt die Funde nach Schweregrad, betroffene Pakete, gemeldete korrigierte Versionen und den Stand der Datenbank. Der Erstimport der Grype-Datenbank kann einige Minuten dauern. Scanberichte bleiben bis zum Dockge-Neustart im Arbeitsspeicher.
|
||||
- **Grype** prüft auf unterstützten Linux-Architekturen unabhängig vom Dockge-Image regelmäßig auf neue Versionen. Vor jedem Scanbericht aktualisiert Dockge die Schwachstellendatenbank und kann bei einem fehlgeschlagenen Abruf eine weiterhin gültige lokale Datenbank verwenden. [Grype-Datenbank](https://oss.anchore.com/docs/guides/vulnerability/database/)
|
||||
|
||||
@ -90,9 +94,9 @@ Unter **Einstellungen → Volumes** siehst du den Treiber, den Nutzungsstatus un
|
||||
|
||||

|
||||
|
||||
Ungenutzte Einträge lassen sich einzeln löschen. **Alle ungenutzten löschen** bereinigt den gesamten gewählten Docker-Host. Die sichtbaren Suchfilter beeinflussen diese Aktion nicht. Für Images und Volumes gibt es jeweils einen eigenen täglichen Zeitplan mit Uhrzeit und Zeitzone. Beide Bereinigungen sind standardmäßig deaktiviert.
|
||||
Ungenutzte Einträge lassen sich einzeln löschen. **Bereinigung prüfen** zeigt die Kandidaten des gewählten Hosts und markiert geschützte Ressourcen. Für Images und Volumes gibt es jeweils einen eigenen täglichen Zeitplan mit Uhrzeit, Zeitzone, Mindestalter und Ausschlussliste. Beide Bereinigungen sind standardmäßig deaktiviert.
|
||||
|
||||
> **Volumes enthalten Anwendungsdaten.** Docker kann auch benannte lokale Volumes löschen, wenn kein Container sie referenziert. Ein Verweis allein in einer gespeicherten Compose-Datei schützt das Volume nicht. Sichere wichtige Volumes, bevor du eine Bereinigung aktivierst. [Docker-Bereinigung](https://docs.docker.com/engine/manage-resources/pruning/)
|
||||
> **Volumes enthalten Anwendungsdaten.** Die Massenbereinigung prüft Deklarationen in gespeicherten Stacks und schützt die erkannten Volumes. Sichere wichtige Volumes, bevor du eine Bereinigung aktivierst. [Docker-Bereinigung](https://docs.docker.com/engine/manage-resources/pruning/)
|
||||
|
||||
## Datei-Explorer
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ export class ContainerManagementSocketHandler extends AgentSocketHandler {
|
||||
};
|
||||
|
||||
on("listHostContainers", "containerInventoryFailed", async () => ({ items: await server.containerManagement.list() }));
|
||||
on("getHostContainerDetails", "containerDetailsFailed", async id => ({ details: await server.containerManagement.details(id) }));
|
||||
on("containerFiles", "containerFileFailed", request => server.containerFileExplorer.request(socket.id, request));
|
||||
socket.on("disconnect", () => server.containerFileExplorer.disconnect(socket.id));
|
||||
}
|
||||
|
||||
@ -8,6 +8,42 @@ export class DockerSocketHandler extends AgentSocketHandler {
|
||||
create(socket : DockgeSocket, server : DockgeServer, agentSocket : AgentSocket) {
|
||||
// Do not call super.create()
|
||||
|
||||
const onDeployment = (event: string, handler: (...args: unknown[]) => Promise<object>) => {
|
||||
agentSocket.on(event, async (...args: unknown[]) => {
|
||||
const callback = args.pop();
|
||||
if (typeof callback !== "function") {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
checkLogin(socket);
|
||||
callbackResult({ ok: true,
|
||||
...await handler(...args) }, callback);
|
||||
} catch (error) {
|
||||
callbackError(error instanceof ValidationError ? error : new ValidationError("deployOperationFailed"), callback);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
onDeployment("deployStack", async (name, yaml, env, isAdd, revision) => ({ deployment:
|
||||
await server.stackDeployments.prepare(name, "deploy", { yaml,
|
||||
env,
|
||||
isAdd,
|
||||
revision }) }));
|
||||
onDeployment("startStack", async name => ({ deployment: await server.stackDeployments.prepare(name, "start") }));
|
||||
onDeployment("updateStack", async name => ({ deployment: await server.stackDeployments.prepare(name, "update") }));
|
||||
onDeployment("startService", async (name, service) => ({ deployment: await server.stackDeployments.prepare(name, "service", undefined, service) }));
|
||||
onDeployment("prepareStackDeployment", async (name, mode, draft, service) => {
|
||||
if (mode !== "deploy" && mode !== "start" && mode !== "update" && mode !== "service") {
|
||||
throw new ValidationError("deployInvalidRequest");
|
||||
}
|
||||
return { deployment: await server.stackDeployments.prepare(name, mode, draft, service) };
|
||||
});
|
||||
onDeployment("getStackDeployments", name => server.stackDeployments.status(name));
|
||||
onDeployment("decideStackDeployment", async (name, id, approve) => ({ deployment:
|
||||
await server.stackDeployments.decide(name, id, approve) }));
|
||||
onDeployment("restoreStackDeployment", (name, id) => server.stackDeployments.restore(name, id));
|
||||
onDeployment("getHostAttention", () => server.getHostAttention());
|
||||
|
||||
const onStackMutation = (event: string, handler: (...args: unknown[]) => Promise<void>) => {
|
||||
agentSocket.on(event, async (...args: unknown[]) => {
|
||||
try {
|
||||
@ -24,24 +60,6 @@ export class DockerSocketHandler extends AgentSocketHandler {
|
||||
});
|
||||
};
|
||||
|
||||
onStackMutation("deployStack", async (name : unknown, composeYAML : unknown, composeENV : unknown, isAdd : unknown, revisionOrCallback, acknowledgement) => {
|
||||
const callback = typeof revisionOrCallback === "function" ? revisionOrCallback : acknowledgement;
|
||||
const revision = typeof revisionOrCallback === "function" ? undefined : revisionOrCallback;
|
||||
try {
|
||||
const stack = await this.saveStack(server, name, composeYAML, composeENV, isAdd, revision);
|
||||
await stack.deploy(socket);
|
||||
server.sendStackList();
|
||||
callbackResult({
|
||||
ok: true,
|
||||
msg: "Deployed",
|
||||
msgi18n: true,
|
||||
}, callback);
|
||||
stack.joinCombinedTerminal(socket);
|
||||
} catch (e) {
|
||||
callbackError(e, callback);
|
||||
}
|
||||
});
|
||||
|
||||
onStackMutation("saveStack", async (name : unknown, composeYAML : unknown, composeENV : unknown, isAdd : unknown, revisionOrCallback, acknowledgement) => {
|
||||
const callback = typeof revisionOrCallback === "function" ? revisionOrCallback : acknowledgement;
|
||||
const revision = typeof revisionOrCallback === "function" ? undefined : revisionOrCallback;
|
||||
@ -64,6 +82,10 @@ export class DockerSocketHandler extends AgentSocketHandler {
|
||||
if (typeof(name) !== "string") {
|
||||
throw new ValidationError("Name must be a string");
|
||||
}
|
||||
|
||||
if ((await server.stackDeployments.status(name)).pending) {
|
||||
throw new ValidationError("deployAlreadyPending");
|
||||
}
|
||||
const stack = await Stack.getStack(server, name);
|
||||
|
||||
try {
|
||||
@ -74,6 +96,7 @@ export class DockerSocketHandler extends AgentSocketHandler {
|
||||
}
|
||||
|
||||
server.imageVulnerabilityScan.forget(name);
|
||||
await server.stackDeployments.forget(name);
|
||||
server.sendStackList();
|
||||
callbackResult({
|
||||
ok: true,
|
||||
@ -173,30 +196,6 @@ export class DockerSocketHandler extends AgentSocketHandler {
|
||||
}
|
||||
});
|
||||
|
||||
// startStack
|
||||
onStackMutation("startStack", async (stackName : unknown, callback) => {
|
||||
try {
|
||||
|
||||
if (typeof(stackName) !== "string") {
|
||||
throw new ValidationError("Stack name must be a string");
|
||||
}
|
||||
|
||||
const stack = await Stack.getStack(server, stackName);
|
||||
await stack.start(socket);
|
||||
callbackResult({
|
||||
ok: true,
|
||||
msg: "Started",
|
||||
msgi18n: true,
|
||||
}, callback);
|
||||
server.sendStackList();
|
||||
|
||||
stack.joinCombinedTerminal(socket);
|
||||
|
||||
} catch (e) {
|
||||
callbackError(e, callback);
|
||||
}
|
||||
});
|
||||
|
||||
// stopStack
|
||||
onStackMutation("stopStack", async (stackName : unknown, callback) => {
|
||||
try {
|
||||
@ -241,27 +240,6 @@ export class DockerSocketHandler extends AgentSocketHandler {
|
||||
}
|
||||
});
|
||||
|
||||
// updateStack
|
||||
onStackMutation("updateStack", async (stackName : unknown, callback) => {
|
||||
try {
|
||||
|
||||
if (typeof(stackName) !== "string") {
|
||||
throw new ValidationError("Stack name must be a string");
|
||||
}
|
||||
|
||||
const stack = await Stack.getStack(server, stackName);
|
||||
await stack.update(socket);
|
||||
callbackResult({
|
||||
ok: true,
|
||||
msg: "Updated",
|
||||
msgi18n: true,
|
||||
}, callback);
|
||||
server.sendStackList();
|
||||
} catch (e) {
|
||||
callbackError(e, callback);
|
||||
}
|
||||
});
|
||||
|
||||
agentSocket.on("getStackAutoUpdate", async (name: unknown, callback) => {
|
||||
try {
|
||||
checkLogin(socket);
|
||||
@ -344,27 +322,6 @@ export class DockerSocketHandler extends AgentSocketHandler {
|
||||
}
|
||||
});
|
||||
|
||||
// Start a service
|
||||
onStackMutation("startService", async (stackName: unknown, serviceName: unknown, callback) => {
|
||||
try {
|
||||
|
||||
if (typeof (stackName) !== "string" || typeof (serviceName) !== "string") {
|
||||
throw new ValidationError("Stack name and service name must be strings");
|
||||
}
|
||||
|
||||
const stack = await Stack.getStack(server, stackName);
|
||||
await stack.startService(socket, serviceName);
|
||||
stack.joinCombinedTerminal(socket); // Ensure the combined terminal is joined
|
||||
callbackResult({
|
||||
ok: true,
|
||||
msg: "Service " + serviceName + " started"
|
||||
}, callback);
|
||||
server.sendStackList();
|
||||
} catch (e) {
|
||||
callbackError(e, callback);
|
||||
}
|
||||
});
|
||||
|
||||
// Stop a service
|
||||
onStackMutation("stopService", async (stackName: unknown, serviceName: unknown, callback) => {
|
||||
try {
|
||||
|
||||
@ -25,14 +25,16 @@ export class ResourceSocketHandler extends AgentSocketHandler {
|
||||
on("setResourceCleanup", "resourceCleanupSaveFailed", async (kind, schedule) => ({
|
||||
schedule: await server.resourceCleanup.set(kind, schedule),
|
||||
}));
|
||||
on("pruneDockerResources", "resourceCleanupFailed", async kind => {
|
||||
await server.resourceCleanup.prune(kind);
|
||||
return { msg: "resourceCleanupCompleted",
|
||||
msgi18n: true };
|
||||
});
|
||||
on("previewDockerCleanup", "resourceCleanupFailed", async kind => ({ preview: await server.resourceCleanup.preview(kind) }));
|
||||
on("pruneDockerResources", "resourceCleanupFailed", async (kind, id) => ({ result: await server.resourceCleanup.prune(kind, id) }));
|
||||
on("checkDockerImageTag", "resourceCheckFailed", async (id, tag) => ({ status: await resources.checkImage(id, tag) }));
|
||||
on("removeDockerImage", "resourceDeleteFailed", async (id, tag) => {
|
||||
await resources.removeImage(id, tag);
|
||||
await server.stackDeployments.withImageChanges(async () => {
|
||||
if (typeof id === "string" && server.stackDeployments.protectedImages().has(id)) {
|
||||
throw new ValidationError("cleanupProtectedImage");
|
||||
}
|
||||
await resources.removeImage(id, tag);
|
||||
});
|
||||
return { msg: "resourceDeleted",
|
||||
msgi18n: true };
|
||||
});
|
||||
|
||||
@ -25,13 +25,51 @@ interface ContainerRow {
|
||||
image: string;
|
||||
state: string;
|
||||
project: string;
|
||||
service: string;
|
||||
ports: string;
|
||||
status: string;
|
||||
}
|
||||
|
||||
const format = "{\"id\":{{json .ID}},\"name\":{{json .Names}},\"image\":{{json .Image}},\"state\":{{json .State}},\"project\":{{json (.Label \"com.docker.compose.project\")}}}";
|
||||
const listFields = [
|
||||
"\"id\":{{json .ID}}",
|
||||
"\"name\":{{json .Names}}",
|
||||
"\"image\":{{json .Image}}",
|
||||
"\"state\":{{json .State}}",
|
||||
"\"project\":{{json (.Label \"com.docker.compose.project\")}}",
|
||||
"\"service\":{{json (.Label \"com.docker.compose.service\")}}",
|
||||
"\"ports\":{{json .Ports}}",
|
||||
"\"status\":{{json .Status}}",
|
||||
];
|
||||
|
||||
const detailFields = [
|
||||
"\"name\":{{json .Name}}",
|
||||
"\"imageId\":{{json .Image}}",
|
||||
"\"created\":{{json .Created}}",
|
||||
"\"started\":{{json .State.StartedAt}}",
|
||||
"\"finished\":{{json .State.FinishedAt}}",
|
||||
"\"state\":{{json .State.Status}}",
|
||||
"\"health\":{{with index .State \"Health\"}}{{json .Status}}{{else}}\"\"{{end}}",
|
||||
"\"exitCode\":{{json .State.ExitCode}}",
|
||||
"\"restartCount\":{{json .RestartCount}}",
|
||||
"\"restartPolicy\":{{json .HostConfig.RestartPolicy.Name}}",
|
||||
"\"platform\":{{json .Platform}}",
|
||||
"\"memoryBytes\":{{json .HostConfig.Memory}}",
|
||||
"\"nanoCpus\":{{json .HostConfig.NanoCpus}}",
|
||||
"\"mounts\":[{{range $i, $mount := .Mounts}}{{if $i}},{{end}}" +
|
||||
"{\"type\":{{json $mount.Type}},\"name\":{{json (index $mount \"Name\")}},\"target\":{{json $mount.Destination}},\"writable\":{{json $mount.RW}}}{{end}}]",
|
||||
"\"networks\":{ {{$sep := \"\"}}{{range $name, $network := index .NetworkSettings \"Networks\"}}{{$sep}}{{json $name}}:" +
|
||||
"{\"ipv4\":{{json (index $network \"IPAddress\")}},\"ipv6\":{{json (index $network \"GlobalIPv6Address\")}}}{{$sep = \",\"}}{{end}} }",
|
||||
];
|
||||
|
||||
export class ContainerManagement {
|
||||
async list(): Promise<ContainerRow[]> {
|
||||
const { stdout } = await docker([ "container", "ls", "--all", "--no-trunc", "--format", format ]);
|
||||
const { stdout } = await docker([ "container", "ls", "--all", "--no-trunc", "--format", `{${listFields.join(",")}}` ]);
|
||||
return stdout.trim().split(/\r?\n/).filter(Boolean).map(row => JSON.parse(row) as ContainerRow);
|
||||
}
|
||||
|
||||
async details(rawId: unknown) {
|
||||
const id = containerId(rawId);
|
||||
const { stdout } = await docker([ "container", "inspect", "--format", `{${detailFields.join(",")}}`, "--", id ]);
|
||||
return JSON.parse(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ import expressStaticGzip from "express-static-gzip";
|
||||
import path from "path";
|
||||
import { TerminalSocketHandler } from "./agent-socket-handlers/terminal-socket-handler";
|
||||
import { Stack } from "./stack";
|
||||
import { StackDeployments } from "./stack-deployments";
|
||||
import { Cron } from "croner";
|
||||
import gracefulShutdown from "http-graceful-shutdown";
|
||||
import User from "./models/user";
|
||||
@ -94,8 +95,9 @@ export class DockgeServer {
|
||||
dockerResources = new DockerResources();
|
||||
containerManagement = new ContainerManagement();
|
||||
containerFileExplorer = new ContainerFileExplorer();
|
||||
resourceCleanup = new ResourceCleanup();
|
||||
resourceCleanup = new ResourceCleanup(this);
|
||||
imageVulnerabilityScan = new ImageVulnerabilityScan(this);
|
||||
stackDeployments = new StackDeployments(this);
|
||||
|
||||
/**
|
||||
*
|
||||
@ -409,6 +411,7 @@ export class DockgeServer {
|
||||
this.needSetup = true;
|
||||
}
|
||||
|
||||
await this.stackDeployments.initialize();
|
||||
// Listen
|
||||
this.httpServer.listen(this.config.port, this.config.hostname, () => {
|
||||
if (this.config.hostname) {
|
||||
@ -637,6 +640,37 @@ export class DockgeServer {
|
||||
}
|
||||
}
|
||||
|
||||
async getHostAttention() {
|
||||
const [ containers, stacks, imageCleanup, volumeCleanup ] = await Promise.all([
|
||||
this.containerManagement.list().catch(() => []),
|
||||
Stack.getStackList(this, true).catch(() => new Map<string, Stack>()),
|
||||
this.resourceCleanup.status("images").catch(() => null),
|
||||
this.resourceCleanup.status("volumes").catch(() => null),
|
||||
]);
|
||||
const recent = await Promise.all(Array.from(stacks.values()).filter(stack => stack.isManagedByDockge).slice(0, 100)
|
||||
.map(async stack => {
|
||||
const policy = await this.stackAutoUpdate.getPolicy(stack).catch(() => null);
|
||||
return policy?.lastRun?.result === "failed" ? [{ stack: stack.name,
|
||||
kind: "deployAttentionUpdate" }] : [];
|
||||
}));
|
||||
return {
|
||||
items: [
|
||||
...this.stackDeployments.attention(),
|
||||
...containers.flatMap(item => /\(unhealthy\)|^Restarting\b/i.test(item.status)
|
||||
? [{ stack: item.project,
|
||||
container: item.name,
|
||||
kind: item.state === "restarting" ? "deployAttentionRestarting" : "deployAttentionUnhealthy" }]
|
||||
: []),
|
||||
...recent.flat(),
|
||||
...this.imageVulnerabilityScan.attention(),
|
||||
...(imageCleanup?.lastRun?.result === "failed" ? [{ resource: "images",
|
||||
kind: "deployAttentionCleanup" }] : []),
|
||||
...(volumeCleanup?.lastRun?.result === "failed" ? [{ resource: "volumes",
|
||||
kind: "deployAttentionCleanup" }] : []),
|
||||
].slice(0, 100),
|
||||
};
|
||||
}
|
||||
|
||||
async getDockerNetworkList() : Promise<string[]> {
|
||||
let res = await childProcessAsync.spawn("docker", [ "network", "ls", "--format", "{{.Name}}" ], {
|
||||
encoding: "utf-8",
|
||||
@ -704,7 +738,7 @@ export class DockgeServer {
|
||||
|
||||
this.stackAutoUpdate.stop();
|
||||
this.resourceCleanup.stop();
|
||||
await this.imageVulnerabilityScan.stop();
|
||||
await Promise.all([ this.imageVulnerabilityScan.stop(), this.stackDeployments.stop() ]);
|
||||
await Database.close();
|
||||
Settings.stopCacheCleaner();
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ interface Finding {
|
||||
fixedVersions: string[];
|
||||
}
|
||||
|
||||
interface ImageScan {
|
||||
export interface ImageScan {
|
||||
id: string;
|
||||
references: string[];
|
||||
services: string[];
|
||||
@ -170,7 +170,7 @@ export class ImageVulnerabilityScan {
|
||||
constructor(private readonly server: DockgeServer) {}
|
||||
|
||||
/** Start one bounded scan per host without waiting for Docker or Grype to finish. */
|
||||
start(stack: Stack) {
|
||||
start(stack: Stack, images?: ImageScan[]) {
|
||||
if (this.active) {
|
||||
if (this.active.stackName === stack.name && this.reports.has(stack.name)) {
|
||||
return this.summary(stack.name);
|
||||
@ -191,10 +191,35 @@ export class ImageVulnerabilityScan {
|
||||
this.reports.delete(oldest);
|
||||
}
|
||||
this.active = report;
|
||||
this.activeRun = this.run(stack, report);
|
||||
this.activeRun = this.run(stack, report, images);
|
||||
return this.summary(stack.name);
|
||||
}
|
||||
|
||||
/** Scan the exact local images prepared for a deployment, before any container starts. */
|
||||
async scanPrepared(stack: Stack, images: ImageScan[]) {
|
||||
if (!images.length) {
|
||||
return { images: [] };
|
||||
}
|
||||
if (images.length > maxImages) {
|
||||
throw new ValidationError("imageScanTooManyImages");
|
||||
}
|
||||
while (this.active && !this.shutdown.signal.aborted) {
|
||||
await this.activeRun;
|
||||
}
|
||||
if (this.shutdown.signal.aborted) {
|
||||
throw new ValidationError("imageScanFailed");
|
||||
}
|
||||
this.start(stack, images);
|
||||
const report = this.active!;
|
||||
await this.activeRun;
|
||||
return {
|
||||
id: report.id,
|
||||
error: report.error,
|
||||
images: report.images.map(image => ({ ...image,
|
||||
findings: image.findings.slice(0, 8) })),
|
||||
};
|
||||
}
|
||||
|
||||
/** Return progress and counts without sending package details over the socket. */
|
||||
summary(stackName: string) {
|
||||
const report = this.reports.get(stackName);
|
||||
@ -207,6 +232,15 @@ export class ImageVulnerabilityScan {
|
||||
};
|
||||
}
|
||||
|
||||
attention() {
|
||||
return Array.from(this.reports.values()).flatMap(report => {
|
||||
const count = report.images.reduce((total, image) => total + (image.counts?.critical || 0), 0);
|
||||
return count ? [{ stack: report.stackName,
|
||||
kind: "deployAttentionCritical",
|
||||
count }] : [];
|
||||
});
|
||||
}
|
||||
|
||||
/** Page through retained findings for the requested immutable image and report. */
|
||||
page(stackName: string, reportId: unknown, imageId: unknown, severity: unknown, offset: unknown) {
|
||||
if (typeof offset !== "number" || !Number.isSafeInteger(offset) || offset < 0 || offset > maxFindings
|
||||
@ -230,8 +264,10 @@ export class ImageVulnerabilityScan {
|
||||
}
|
||||
|
||||
/** Forget reports for a deleted stack, including one still being scanned. */
|
||||
forget(stackName: string) {
|
||||
this.reports.delete(stackName);
|
||||
forget(stackName: string, reportId?: string) {
|
||||
if (!reportId || this.reports.get(stackName)?.id === reportId) {
|
||||
this.reports.delete(stackName);
|
||||
}
|
||||
}
|
||||
|
||||
private get scanner() {
|
||||
@ -251,9 +287,9 @@ export class ImageVulnerabilityScan {
|
||||
}
|
||||
|
||||
/** Scan each immutable image once and keep the successful partial results. */
|
||||
private async run(stack: Stack, report: ScanReport) {
|
||||
private async run(stack: Stack, report: ScanReport, images?: ImageScan[]) {
|
||||
try {
|
||||
report.images = await this.discoverImages(stack);
|
||||
report.images = images ?? await this.discoverImages(stack);
|
||||
if (report.images.length) {
|
||||
report.preparingDatabase = true;
|
||||
try {
|
||||
@ -337,14 +373,14 @@ export class ImageVulnerabilityScan {
|
||||
|
||||
/** Export only the immutable local image and remove the archive on every exit path. */
|
||||
private async scanImage(stack: Stack, id: string) {
|
||||
const size = Number(await this.docker(stack, [ "image", "inspect", "--format", "{{.Size}}", "--", id ]));
|
||||
const size = Number(await this.docker(stack, [ "image", "inspect", "--format", "{{.Size}}", "--", id ], os.tmpdir()));
|
||||
if (!Number.isSafeInteger(size) || size < 0 || size > maxImageBytes) {
|
||||
throw new ValidationError("imageScanImageTooLarge");
|
||||
}
|
||||
const directory = await fs.mkdtemp(path.join(os.tmpdir(), "dockge-image-scan-"));
|
||||
try {
|
||||
const archive = path.join(directory, "image.tar");
|
||||
await this.saveImage(stack, id, archive);
|
||||
await this.saveImage(id, archive);
|
||||
const stdout = await this.runGrype([ `docker-archive:${archive}`, "-o", "json" ], directory, 5 * 60 * 1000);
|
||||
try {
|
||||
return normalizeFindings(stdout);
|
||||
@ -360,7 +396,7 @@ export class ImageVulnerabilityScan {
|
||||
}
|
||||
|
||||
/** Stream Docker's export to disk with a hard archive limit and a timeout. */
|
||||
private async saveImage(stack: Stack, id: string, archive: string) {
|
||||
private async saveImage(id: string, archive: string) {
|
||||
let bytes = 0;
|
||||
const limit = new Transform({
|
||||
transform(chunk, encoding, callback) {
|
||||
@ -373,7 +409,7 @@ export class ImageVulnerabilityScan {
|
||||
},
|
||||
});
|
||||
const child = spawn("docker", [ "image", "save", "--", id ], {
|
||||
cwd: stack.path,
|
||||
cwd: os.tmpdir(),
|
||||
stdio: [ "ignore", "pipe", "ignore" ],
|
||||
timeout: 120000,
|
||||
signal: this.shutdown.signal,
|
||||
@ -401,9 +437,9 @@ export class ImageVulnerabilityScan {
|
||||
}
|
||||
|
||||
/** Run Docker without exposing raw CLI errors to the browser. */
|
||||
private async docker(stack: Stack, args: string[]): Promise<string> {
|
||||
private async docker(stack: Stack, args: string[], cwd = stack.path): Promise<string> {
|
||||
const { stdout } = await exec("docker", args, {
|
||||
cwd: stack.path,
|
||||
cwd,
|
||||
timeout: 30000,
|
||||
maxBuffer: 2 * 1024 * 1024,
|
||||
signal: this.shutdown.signal,
|
||||
|
||||
@ -1,8 +1,16 @@
|
||||
import { randomUUID } from "node:crypto";
|
||||
import { execFile } from "node:child_process";
|
||||
import { promises as fs } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
import { Cron } from "croner";
|
||||
import dotenv from "dotenv";
|
||||
import yaml from "yaml";
|
||||
import { envsubstYAML } from "../common/util-common";
|
||||
import type { DockgeServer } from "./dockge-server";
|
||||
import { log } from "./log";
|
||||
import { Settings } from "./settings";
|
||||
import { Stack } from "./stack";
|
||||
import { ValidationError } from "./util-server";
|
||||
|
||||
const exec = promisify(execFile);
|
||||
@ -10,8 +18,11 @@ const kinds = [ "images", "volumes" ] as const;
|
||||
type Kind = typeof kinds[number];
|
||||
const defaults = { enabled: false,
|
||||
time: "04:00",
|
||||
timezone: "UTC" };
|
||||
timezone: "UTC",
|
||||
minAgeHours: 0,
|
||||
excludes: [] as string[] };
|
||||
type Schedule = typeof defaults;
|
||||
type Resource = { id: string; name: string; tags?: string[]; created: string | null; size?: number | null; driver?: string; reason?: string };
|
||||
|
||||
function resourceKind(value: unknown): Kind {
|
||||
if (value !== "images" && value !== "volumes") {
|
||||
@ -27,6 +38,11 @@ function validSchedule(value: unknown): value is Schedule {
|
||||
|| typeof schedule.timezone !== "string" || !/^[A-Za-z][A-Za-z0-9_+/-]{0,99}$/.test(schedule.timezone)) {
|
||||
return false;
|
||||
}
|
||||
if (!Number.isSafeInteger(schedule.minAgeHours) || schedule.minAgeHours! < 0 || schedule.minAgeHours! > 87600
|
||||
|| !Array.isArray(schedule.excludes) || schedule.excludes.length > 200
|
||||
|| schedule.excludes.some(item => typeof item !== "string" || !item.trim() || item.length > 512 || /[\r\n\0]/.test(item))) {
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
new Intl.DateTimeFormat("en-CA", { timeZone: schedule.timezone });
|
||||
return true;
|
||||
@ -41,6 +57,9 @@ export class ResourceCleanup {
|
||||
private readonly saving = new Set<Kind>();
|
||||
private readonly shutdown = new AbortController();
|
||||
private initialization?: Promise<void>;
|
||||
private readonly previews = new Map<string, { kind: Kind; expires: number; resources: Set<string> }>();
|
||||
|
||||
constructor(private readonly server: DockgeServer) {}
|
||||
|
||||
start() {
|
||||
this.initialization ??= this.initialize();
|
||||
@ -63,7 +82,9 @@ export class ResourceCleanup {
|
||||
|
||||
private async read(kind: Kind): Promise<Schedule> {
|
||||
const value = await Settings.get(`resourceCleanup:${kind}`, false);
|
||||
return validSchedule(value) ? value : { ...defaults };
|
||||
const schedule = { ...defaults,
|
||||
...value };
|
||||
return validSchedule(schedule) ? schedule : { ...defaults };
|
||||
}
|
||||
|
||||
async status(value: unknown) {
|
||||
@ -88,10 +109,12 @@ export class ResourceCleanup {
|
||||
}
|
||||
this.saving.add(kind);
|
||||
try {
|
||||
const { enabled, time, timezone } = schedule;
|
||||
const { enabled, time, timezone, minAgeHours, excludes } = schedule;
|
||||
await Settings.set(`resourceCleanup:${kind}`, { enabled,
|
||||
time,
|
||||
timezone });
|
||||
timezone,
|
||||
minAgeHours,
|
||||
excludes: Array.from(new Set(excludes.map(item => item.trim()))) });
|
||||
this.schedule(kind, schedule);
|
||||
return await this.status(kind);
|
||||
} finally {
|
||||
@ -129,7 +152,10 @@ export class ResourceCleanup {
|
||||
result: "started" });
|
||||
let result = "success";
|
||||
try {
|
||||
await this.prune(kind);
|
||||
const result = await this.prune(kind, undefined, true);
|
||||
if (result.failed) {
|
||||
throw new Error("Could not remove some resources");
|
||||
}
|
||||
} catch {
|
||||
result = "failed";
|
||||
}
|
||||
@ -144,20 +170,168 @@ export class ResourceCleanup {
|
||||
}
|
||||
}
|
||||
|
||||
async prune(value: unknown) {
|
||||
async preview(value: unknown) {
|
||||
const kind = resourceKind(value);
|
||||
const items = await this.inventory(kind);
|
||||
const id = randomUUID();
|
||||
const now = Date.now();
|
||||
for (const [ key, preview ] of this.previews) {
|
||||
if (preview.expires <= now) {
|
||||
this.previews.delete(key);
|
||||
}
|
||||
}
|
||||
if (this.previews.size >= 24) {
|
||||
this.previews.delete(this.previews.keys().next().value!);
|
||||
}
|
||||
this.previews.set(id, { kind,
|
||||
expires: now + 5 * 60 * 1000,
|
||||
resources: new Set(items.filter(item => !item.reason).map(item => this.resourceKey(item))) });
|
||||
return { id,
|
||||
items };
|
||||
}
|
||||
|
||||
private resourceKey(item: Resource) {
|
||||
return JSON.stringify([ item.id, item.created ]);
|
||||
}
|
||||
|
||||
private async inventory(kind: Kind): Promise<Resource[]> {
|
||||
const schedule = await this.read(kind);
|
||||
const exclusions = new Set(schedule.excludes);
|
||||
const now = Date.now();
|
||||
const resources: Resource[] = [];
|
||||
const protectedImages = this.server.stackDeployments.protectedImages();
|
||||
if (kind === "images") {
|
||||
const images = await this.server.dockerResources.listImages();
|
||||
for (const item of images) {
|
||||
if (!item.containers.length && !item.referenceOnly) {
|
||||
resources.push({ id: item.id,
|
||||
name: item.tags[0] || item.id,
|
||||
tags: item.tags,
|
||||
created: item.created,
|
||||
size: item.size,
|
||||
reason: protectedImages.has(item.id) ? "cleanupProtectedImage" : undefined });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const [ volumes, declarations ] = await Promise.all([ this.server.dockerResources.listVolumes(), this.volumeDeclarations() ]);
|
||||
for (const item of volumes) {
|
||||
if (!item.containers.length) {
|
||||
const reason = declarations.names.has(item.name) ? "cleanupDeclaredVolume"
|
||||
: declarations.unresolved.some(prefix => item.name.startsWith(prefix)) ? "cleanupUnresolvedVolume"
|
||||
: item.driver !== "local" ? "cleanupExternalVolume" : undefined;
|
||||
resources.push({ id: item.name,
|
||||
name: item.name,
|
||||
created: item.created,
|
||||
driver: item.driver,
|
||||
reason });
|
||||
}
|
||||
}
|
||||
}
|
||||
for (const item of resources) {
|
||||
if (item.reason) {
|
||||
continue;
|
||||
}
|
||||
if (exclusions.has(item.id) || item.tags?.some(tag => exclusions.has(tag))) {
|
||||
item.reason = "cleanupExcluded";
|
||||
} else if (schedule.minAgeHours && (!item.created || !Number.isFinite(Date.parse(item.created))
|
||||
|| now - Date.parse(item.created) < schedule.minAgeHours * 3600000)) {
|
||||
item.reason = "cleanupTooNew";
|
||||
}
|
||||
}
|
||||
return resources.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
|
||||
private async volumeDeclarations() {
|
||||
const names = new Set<string>();
|
||||
const unresolved: string[] = [];
|
||||
const directory = this.server.stacksDir;
|
||||
const global = await fs.readFile(path.join(directory, "global.env"), "utf8").catch(() => "");
|
||||
const entries = (await fs.readdir(directory, { withFileTypes: true }))
|
||||
.filter(entry => entry.isDirectory() && /^[a-z0-9_-]+$/.test(entry.name));
|
||||
const add = async (stack: Stack) => {
|
||||
if (!stack.composeYAML) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const args = stack.getComposeOptions("config", "--format", "json", "--no-env-resolution");
|
||||
args.splice(1, 0, "--all-resources");
|
||||
const { stdout } = await exec("docker", args, {
|
||||
cwd: stack.fullPath,
|
||||
timeout: 10000,
|
||||
maxBuffer: 4 * 1024 * 1024,
|
||||
signal: this.shutdown.signal,
|
||||
windowsHide: true,
|
||||
});
|
||||
const config = JSON.parse(stdout);
|
||||
for (const [ key, value ] of Object.entries(config.volumes || {})) {
|
||||
const volume = value as { name?: string; external?: boolean } | null;
|
||||
names.add(volume?.name || (volume?.external ? key : `${config.name || stack.name}_${key}`));
|
||||
}
|
||||
return;
|
||||
} catch {
|
||||
unresolved.push(stack.name + "_");
|
||||
}
|
||||
try {
|
||||
const env = { ...dotenv.parse(global),
|
||||
...dotenv.parse(stack.composeENV) };
|
||||
const config = yaml.parse(envsubstYAML(stack.composeYAML, env), { merge: true });
|
||||
const project = config?.name || env.COMPOSE_PROJECT_NAME || stack.name;
|
||||
for (const [ key, value ] of Object.entries(config?.volumes || {})) {
|
||||
const volume = value as { name?: string; external?: boolean | { name?: string } } | null;
|
||||
const externalName = typeof volume?.external === "object" ? volume.external?.name : undefined;
|
||||
names.add(volume?.name || externalName || (volume?.external ? key : `${project}_${key}`));
|
||||
}
|
||||
} catch {
|
||||
// Keep the default project prefix if even the raw draft is invalid.
|
||||
}
|
||||
};
|
||||
for (let index = 0; index < entries.length; index += 6) {
|
||||
await Promise.all(entries.slice(index, index + 6).map(entry => add(new Stack(this.server, entry.name))));
|
||||
}
|
||||
return { names,
|
||||
unresolved };
|
||||
}
|
||||
|
||||
async prune(value: unknown, id?: unknown, scheduled = false) {
|
||||
const kind = resourceKind(value);
|
||||
if (this.running.has(kind) || this.shutdown.signal.aborted) {
|
||||
throw new ValidationError("resourceCleanupBusy");
|
||||
}
|
||||
const approval = typeof id === "string" ? this.previews.get(id) : undefined;
|
||||
if (!scheduled && (!approval || approval.kind !== kind || approval.expires <= Date.now())) {
|
||||
throw new ValidationError("cleanupPreviewExpired");
|
||||
}
|
||||
if (typeof id === "string") {
|
||||
this.previews.delete(id);
|
||||
}
|
||||
this.running.add(kind);
|
||||
try {
|
||||
// The Docker daemon determines which resources are currently unreferenced.
|
||||
await exec("docker", [ kind === "images" ? "image" : "volume", "prune", "--all", "--force" ], {
|
||||
timeout: 120000,
|
||||
maxBuffer: 8 * 1024 * 1024,
|
||||
signal: this.shutdown.signal,
|
||||
windowsHide: true,
|
||||
});
|
||||
const remove = async () => {
|
||||
let removed = 0;
|
||||
let failed = 0;
|
||||
const items = await this.inventory(kind);
|
||||
for (const item of items) {
|
||||
if (this.shutdown.signal.aborted || item.reason || (approval && !approval.resources.has(this.resourceKey(item)))) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
if (kind === "images") {
|
||||
for (const tag of item.tags?.length ? item.tags : [ "" ]) {
|
||||
await this.server.dockerResources.removeImage(item.id, tag);
|
||||
}
|
||||
} else {
|
||||
await this.server.dockerResources.removeVolume(item.id, item.created);
|
||||
}
|
||||
removed++;
|
||||
} catch {
|
||||
failed++;
|
||||
}
|
||||
}
|
||||
return { removed,
|
||||
failed,
|
||||
retained: Math.max(0, (approval?.resources.size ?? items.length) - removed - failed) };
|
||||
};
|
||||
return kind === "images" ? await this.server.stackDeployments.withImageChanges(remove) : await remove();
|
||||
} finally {
|
||||
this.running.delete(kind);
|
||||
}
|
||||
|
||||
@ -22,7 +22,8 @@ export class AgentProxySocketHandler extends SocketHandler {
|
||||
}
|
||||
|
||||
if (endpoint === ALL_ENDPOINTS) { // Send to all endpoints
|
||||
if ([ "containerFiles", "listHostContainers" ].includes(eventName)) {
|
||||
if ([ "containerFiles", "listHostContainers", "getHostContainerDetails", "prepareStackDeployment",
|
||||
"decideStackDeployment", "restoreStackDeployment", "pruneDockerResources" ].includes(eventName)) {
|
||||
throw new Error("containerActionUnavailable");
|
||||
}
|
||||
log.debug("agent", "Sending to all endpoints: " + eventName);
|
||||
|
||||
@ -15,8 +15,8 @@ const policyFile = ".dockge-auto-update.json";
|
||||
const dockgeImage = /(?:^|\/)(?:louislam\/dockge|dockge:local)(?:[:@]|$)/i;
|
||||
const stackName = /^[a-z0-9_-]+$/;
|
||||
|
||||
type Outcome = "updated" | "unchanged" | "waiting" | "skipped" | "failed";
|
||||
const outcomes: Outcome[] = [ "updated", "unchanged", "waiting", "skipped", "failed" ];
|
||||
type Outcome = "updated" | "unchanged" | "waiting" | "skipped" | "failed" | "approval";
|
||||
const outcomes: Outcome[] = [ "updated", "unchanged", "waiting", "skipped", "failed", "approval" ];
|
||||
|
||||
interface Schedule {
|
||||
enabled: boolean;
|
||||
@ -322,59 +322,14 @@ export class StackAutoUpdate {
|
||||
}
|
||||
}
|
||||
|
||||
/** Pull and recreate only running services whose image actually changed. */
|
||||
/** Prepare changed images for review while leaving the running containers in place. */
|
||||
private async update(stack: Stack, policy: Policy): Promise<Outcome> {
|
||||
const before = await this.getCandidates(stack);
|
||||
if (before.size === 0) {
|
||||
const candidates = await this.getCandidates(stack);
|
||||
if (!candidates.size) {
|
||||
return "skipped";
|
||||
}
|
||||
|
||||
await this.docker(stack, stack.getComposeOptions("pull", "--policy", "always", "--ignore-buildable", "--", ...before.keys()));
|
||||
|
||||
const after = await this.getCandidates(stack);
|
||||
const changed = new Map<string, Candidate>();
|
||||
const pending = new Map(policy.pending.map(entry => [ entry.service, entry ]));
|
||||
const waiting: PendingImage[] = [];
|
||||
const observedAt = new Date();
|
||||
let skipped = false;
|
||||
for (const [ name, original ] of before) {
|
||||
const current = after.get(name);
|
||||
if (!current || original.hash !== current.hash || original.image !== current.image
|
||||
|| original.containers.join() !== current.containers.join()) {
|
||||
skipped = true;
|
||||
continue;
|
||||
}
|
||||
const imageId = await this.docker(stack, [ "image", "inspect", "--format", "{{.Id}}", "--", current.image ]);
|
||||
if (!/^sha256:[a-f0-9]{64}$/.test(imageId)) {
|
||||
throw new Error("Docker image inspect returned an invalid image ID");
|
||||
}
|
||||
if (current.imageIds.every(id => id === imageId)) {
|
||||
continue;
|
||||
}
|
||||
const previous = pending.get(name);
|
||||
const entry = previous?.id === imageId && previous.image === current.image ? previous : {
|
||||
service: name,
|
||||
image: current.image,
|
||||
id: imageId,
|
||||
since: observedAt.toISOString(),
|
||||
};
|
||||
waiting.push(entry);
|
||||
if (observedAt.getTime() >= Date.parse(entry.since) + policy.delayHours * hourMs) {
|
||||
changed.set(name, current);
|
||||
}
|
||||
}
|
||||
|
||||
policy.pending = waiting;
|
||||
if (!changed.size) {
|
||||
return waiting.length ? "waiting" : (skipped ? "skipped" : "unchanged");
|
||||
}
|
||||
// Keep first-seen times if deployment fails or the process stops partway through.
|
||||
await this.writePolicy(stack, policy);
|
||||
const scale = Array.from(changed, ([ name, service ]) => [ "--scale", `${name}=${service.containers.length}` ]).flat();
|
||||
await this.docker(stack, stack.getComposeOptions("up", "-d", "--no-deps", "--no-build", "--pull", "never",
|
||||
"--wait", "--wait-timeout", "120", ...scale, "--", ...changed.keys()));
|
||||
policy.pending = waiting.filter(entry => !changed.has(entry.service));
|
||||
return "updated";
|
||||
policy.pending = [];
|
||||
return this.server.stackDeployments.prepareScheduled(stack, candidates, policy.delayHours);
|
||||
}
|
||||
|
||||
/** Restrict candidates to unchanged, running services owned by this stack directory. */
|
||||
@ -435,7 +390,8 @@ export class StackAutoUpdate {
|
||||
continue;
|
||||
}
|
||||
const directory = path.resolve(stack.path);
|
||||
if (!entries.every(container => container.State === "running" && container.hash === hash
|
||||
if (!entries.every(container => container.State === "running"
|
||||
&& (container.hash === hash || this.server.stackDeployments.matchesDeployedHash(stack.name, name, hash, container.hash))
|
||||
&& container.directory && path.resolve(container.directory) === directory)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
739
backend/stack-deployments.ts
Normal file
739
backend/stack-deployments.ts
Normal file
@ -0,0 +1,739 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { createHash, randomUUID } from "node:crypto";
|
||||
import { existsSync, promises as fs } from "node:fs";
|
||||
import path from "node:path";
|
||||
import { promisify } from "node:util";
|
||||
import { analyzeEnv } from "../common/env-file";
|
||||
import type { DockgeServer } from "./dockge-server";
|
||||
import type { ImageScan } from "./image-vulnerability-scan";
|
||||
import { log } from "./log";
|
||||
import { Stack } from "./stack";
|
||||
import { ValidationError } from "./util-server";
|
||||
|
||||
const exec = promisify(execFile);
|
||||
const stackNamePattern = /^[a-z0-9_-]+$/;
|
||||
const serviceNamePattern = /^[a-zA-Z0-9_.-]+$/;
|
||||
const imageIdPattern = /^sha256:[a-f0-9]{64}$/;
|
||||
const historyLimit = 12;
|
||||
const maximumConfigSize = 2 * 1024 * 1024;
|
||||
|
||||
type Phase = "preparing" | "pulling" | "scanning" | "ready" | "applying" | "deployed" | "rejected" | "failed";
|
||||
type Mode = "deploy" | "start" | "update" | "service" | "scheduled";
|
||||
type Draft = { yaml: string; env: string; isAdd: boolean; revision?: string };
|
||||
type Service = { image?: string; build?: unknown; platform?: string; pull_policy?: string; depends_on?: Record<string, unknown> | string[] };
|
||||
type Config = { name: string; services: Record<string, Service>; [key: string]: unknown };
|
||||
type Runtime = { id: string; name: string; service: string; image: string; hash: string; state: string; health: string };
|
||||
type Candidate = { imageIds: string[]; containers: string[] };
|
||||
type PreparedImage = { reference: string; platform?: string; id: string; previous?: string; fresh: boolean; retagged: boolean };
|
||||
type Change = { name: string; action: "create" | "recreate" | "start" | "keep" | "remove"; reference?: string; imageId?: string; previousImageIds?: string[] };
|
||||
|
||||
interface Deployment {
|
||||
id: string;
|
||||
name: string;
|
||||
mode: Mode;
|
||||
phase: Phase;
|
||||
startedAt: string;
|
||||
finishedAt?: string;
|
||||
error?: string;
|
||||
field?: string;
|
||||
project?: string;
|
||||
approved?: boolean;
|
||||
notBefore?: string;
|
||||
service?: string;
|
||||
draft?: Draft;
|
||||
revision?: string;
|
||||
fingerprint?: string;
|
||||
runtimeFingerprint?: string;
|
||||
changes: Change[];
|
||||
images: PreparedImage[];
|
||||
scans: ImageScan[];
|
||||
scanReportId?: string;
|
||||
sourceHashes: Record<string, string>;
|
||||
appliedHashes?: Record<string, string>;
|
||||
scale?: Record<string, number>;
|
||||
cleanup?: { removed: number; retained: number };
|
||||
}
|
||||
|
||||
type Store = { pending?: Deployment; history: Deployment[] };
|
||||
|
||||
function digest(value: unknown) {
|
||||
return createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
||||
}
|
||||
|
||||
function publicRecord(record: Deployment, includeScans = true) {
|
||||
const { id, name, mode, phase, startedAt, finishedAt, error, field, notBefore, changes, scans, cleanup } = record;
|
||||
return { id,
|
||||
name,
|
||||
mode,
|
||||
phase,
|
||||
startedAt,
|
||||
finishedAt,
|
||||
error,
|
||||
field,
|
||||
notBefore,
|
||||
changes,
|
||||
scans: includeScans ? scans : [],
|
||||
cleanup };
|
||||
}
|
||||
|
||||
class ComposeValidationError extends ValidationError {
|
||||
constructor(readonly field: string | undefined) {
|
||||
super("editorComposeInvalid");
|
||||
}
|
||||
}
|
||||
|
||||
function operationError(error: unknown, fallback: string) {
|
||||
if (error instanceof ValidationError) {
|
||||
return error.message;
|
||||
}
|
||||
const stderr = typeof error === "object" && error && "stderr" in error ? String(error.stderr) : "";
|
||||
if (/port is already allocated|address already in use/i.test(stderr)) {
|
||||
return "deployPortInUse";
|
||||
}
|
||||
if (/unhealthy|dependency failed to start/i.test(stderr)) {
|
||||
return "deployUnhealthy";
|
||||
}
|
||||
if (/no matching manifest/i.test(stderr)) {
|
||||
return "deployPlatformUnavailable";
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
export class StackDeployments {
|
||||
private readonly stores = new Map<string, Store>();
|
||||
private readonly jobs = new Map<string, Promise<void>>();
|
||||
private readonly shutdown = new AbortController();
|
||||
private loading?: Promise<void>;
|
||||
private pullQueue: Promise<unknown> = Promise.resolve();
|
||||
|
||||
constructor(private readonly server: DockgeServer) {}
|
||||
|
||||
private get directory() {
|
||||
return path.resolve(this.server.config.dataDir, "stack-deployments");
|
||||
}
|
||||
|
||||
async initialize() {
|
||||
this.loading ??= this.load();
|
||||
await this.loading;
|
||||
}
|
||||
|
||||
private async load() {
|
||||
await fs.mkdir(this.directory, { recursive: true,
|
||||
mode: 0o700 });
|
||||
for (const entry of await fs.readdir(this.directory, { withFileTypes: true })) {
|
||||
const name = entry.name;
|
||||
if (entry.isDirectory() && /^\.(apply|preview)-[a-zA-Z0-9]{6}$/.test(name)) {
|
||||
await fs.rm(path.join(this.directory, name), { recursive: true,
|
||||
force: true }).catch(() => {});
|
||||
continue;
|
||||
}
|
||||
if (entry.isFile() && /^[a-z0-9_-]+\.json\.[0-9a-f-]{36}\.tmp$/.test(name)) {
|
||||
await fs.rm(path.join(this.directory, name), { force: true }).catch(() => {});
|
||||
continue;
|
||||
}
|
||||
if (!entry.isFile() || !/^[a-z0-9_-]+\.json$/.test(name)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
const stack = name.slice(0, -5);
|
||||
const store = JSON.parse(await fs.readFile(path.join(this.directory, name), "utf8")) as Store;
|
||||
if (!Array.isArray(store.history)) {
|
||||
continue;
|
||||
}
|
||||
this.stores.set(stack, store);
|
||||
if (store.pending && ![ "ready", "failed" ].includes(store.pending.phase)) {
|
||||
store.pending.phase = "failed";
|
||||
store.pending.error = "deployInterrupted";
|
||||
await this.write(stack);
|
||||
}
|
||||
} catch {
|
||||
log.warn("deploy", "Could not load a deployment record");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async stop() {
|
||||
this.shutdown.abort();
|
||||
await Promise.allSettled(this.jobs.values());
|
||||
}
|
||||
|
||||
private store(name: string) {
|
||||
if (!this.stores.has(name)) {
|
||||
this.stores.set(name, { history: [] });
|
||||
}
|
||||
return this.stores.get(name)!;
|
||||
}
|
||||
|
||||
private async write(name: string) {
|
||||
const file = path.join(this.directory, name + ".json");
|
||||
const temp = file + "." + randomUUID() + ".tmp";
|
||||
try {
|
||||
await fs.writeFile(temp, JSON.stringify(this.store(name)), { flag: "wx",
|
||||
mode: 0o600 });
|
||||
await fs.rename(temp, file);
|
||||
} finally {
|
||||
await fs.rm(temp, { force: true });
|
||||
}
|
||||
}
|
||||
|
||||
private name(value: unknown) {
|
||||
if (typeof value !== "string" || value.length > 128 || !stackNamePattern.test(value)) {
|
||||
throw new ValidationError("deployInvalidRequest");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
async status(value: unknown) {
|
||||
await this.initialize();
|
||||
const store = this.stores.get(this.name(value));
|
||||
const record = store?.pending;
|
||||
const runtime = record?.approved && record.project && record.phase === "applying"
|
||||
? await this.runtime(record.project).catch(() => []) : [];
|
||||
const progress = runtime.filter(row => record?.changes.some(change => change.name === row.service && change.imageId === row.image))
|
||||
.map(({ service, state, health }) => ({ service,
|
||||
state,
|
||||
health }));
|
||||
return {
|
||||
pending: record ? { ...publicRecord(record),
|
||||
progress } : null,
|
||||
history: store?.history.map((item, index) => publicRecord(item, index === 0)) ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
async restore(value: unknown, id: unknown) {
|
||||
await this.initialize();
|
||||
const record = this.stores.get(this.name(value))?.history.find(item => item.id === id && item.phase === "deployed");
|
||||
if (!record?.draft) {
|
||||
throw new ValidationError("deployHistoryMissing");
|
||||
}
|
||||
return { yaml: record.draft.yaml,
|
||||
env: record.draft.env };
|
||||
}
|
||||
|
||||
async forget(value: unknown) {
|
||||
await this.initialize();
|
||||
const name = this.name(value);
|
||||
await fs.rm(path.join(this.directory, name + ".json"), { force: true });
|
||||
this.stores.delete(name);
|
||||
}
|
||||
|
||||
async prepare(value: unknown, mode: Mode, input?: unknown, service?: unknown) {
|
||||
await this.initialize();
|
||||
const name = this.name(value);
|
||||
let draft: Draft | undefined;
|
||||
if (mode === "deploy") {
|
||||
const data = input as Draft | undefined;
|
||||
if (!data || typeof data.yaml !== "string" || typeof data.env !== "string" || typeof data.isAdd !== "boolean"
|
||||
|| (data.revision !== undefined && (typeof data.revision !== "string" || !/^[a-f0-9]{64}$/.test(data.revision)))
|
||||
|| Buffer.byteLength(data.yaml) + Buffer.byteLength(data.env) > maximumConfigSize) {
|
||||
throw new ValidationError("deployInvalidRequest");
|
||||
}
|
||||
if (analyzeEnv(data.env).some(issue => issue.severity === "error")) {
|
||||
throw new ValidationError("editorInvalidEnv");
|
||||
}
|
||||
draft = { yaml: data.yaml,
|
||||
env: data.env,
|
||||
isAdd: data.isAdd,
|
||||
revision: data.revision };
|
||||
}
|
||||
if (mode === "service" && (typeof service !== "string" || !serviceNamePattern.test(service))) {
|
||||
throw new ValidationError("deployInvalidRequest");
|
||||
}
|
||||
const record = this.create(name, mode, draft);
|
||||
record.service = typeof service === "string" ? service : undefined;
|
||||
this.run(record, () => Stack.withOperation(this.server, name, () => this.prepareRecord(record)));
|
||||
return publicRecord(record);
|
||||
}
|
||||
|
||||
async prepareScheduled(stack: Stack, candidates: Map<string, Candidate>, delayHours: number) {
|
||||
await this.initialize();
|
||||
const current = this.stores.get(stack.name)?.pending;
|
||||
if (current) {
|
||||
return current.mode === "scheduled" ? (current.phase === "failed" ? "failed" : "approval") : "skipped";
|
||||
}
|
||||
const record = this.create(stack.name, "scheduled");
|
||||
this.run(record, () => this.prepareRecord(record, candidates, delayHours));
|
||||
await this.jobs.get(stack.name);
|
||||
const pending = this.stores.get(stack.name)?.pending;
|
||||
return pending ? (pending.phase === "failed" ? "failed" : "approval") : "unchanged";
|
||||
}
|
||||
|
||||
private create(name: string, mode: Mode, draft?: Draft) {
|
||||
const store = this.store(name);
|
||||
if (store.pending || this.jobs.has(name) || this.shutdown.signal.aborted) {
|
||||
throw new ValidationError("deployAlreadyPending");
|
||||
}
|
||||
const record: Deployment = {
|
||||
id: randomUUID(),
|
||||
name,
|
||||
mode,
|
||||
draft,
|
||||
phase: "preparing",
|
||||
startedAt: new Date().toISOString(),
|
||||
changes: [],
|
||||
images: [],
|
||||
scans: [],
|
||||
sourceHashes: {},
|
||||
};
|
||||
store.pending = record;
|
||||
return record;
|
||||
}
|
||||
|
||||
private run(record: Deployment, action: () => Promise<void>) {
|
||||
const job = Promise.resolve().then(action).catch(async error => {
|
||||
record.phase = "failed";
|
||||
record.error = operationError(error, "deployOperationFailed");
|
||||
record.field = error instanceof ComposeValidationError ? error.field : undefined;
|
||||
record.finishedAt = new Date().toISOString();
|
||||
await this.write(record.name).catch(() => {});
|
||||
log.warn("deploy", `${record.name}: ${record.error}`);
|
||||
}).finally(() => {
|
||||
this.jobs.delete(record.name);
|
||||
});
|
||||
this.jobs.set(record.name, job);
|
||||
}
|
||||
|
||||
private async command(args: string[], cwd?: string, timeout = 30000) {
|
||||
const { stdout } = await exec("docker", args, {
|
||||
cwd,
|
||||
timeout,
|
||||
encoding: "utf8",
|
||||
maxBuffer: 8 * 1024 * 1024,
|
||||
windowsHide: true,
|
||||
signal: this.shutdown.signal,
|
||||
});
|
||||
return stdout.trim();
|
||||
}
|
||||
|
||||
private async configure<T>(stack: Stack, draft: Draft | undefined, action: (compose: (args: string[], timeout?: number) => Promise<string>) => Promise<T>) {
|
||||
if (!draft) {
|
||||
return action(([ command, ...args ], timeout) => this.command(stack.getComposeOptions(command, ...args), stack.fullPath, timeout));
|
||||
}
|
||||
const temp = await fs.mkdtemp(path.join(this.directory, ".preview-"));
|
||||
try {
|
||||
const yaml = path.join(temp, "compose.yaml");
|
||||
const env = path.join(temp, ".env");
|
||||
await fs.writeFile(yaml, draft.yaml, { mode: 0o600 });
|
||||
await fs.writeFile(env, draft.env, { mode: 0o600 });
|
||||
const global = path.join(this.server.stacksDir, "global.env");
|
||||
const args = [ "compose", "--project-directory", stack.fullPath, "--file", yaml ];
|
||||
if (existsSync(global)) {
|
||||
args.push("--env-file", global);
|
||||
}
|
||||
args.push("--env-file", env);
|
||||
return await action((command, timeout) => this.command([ ...args, ...command ], undefined, timeout));
|
||||
} finally {
|
||||
await fs.rm(temp, { recursive: true,
|
||||
force: true });
|
||||
}
|
||||
}
|
||||
|
||||
private async readConfig(compose: (args: string[]) => Promise<string>, service?: string) {
|
||||
try {
|
||||
const config = JSON.parse(await compose([ "config", "--format", "json", ...(service ? [ "--", service ] : []) ])) as Config;
|
||||
if (!config.name || !config.services || !Object.keys(config.services).length) {
|
||||
throw new Error("Empty configuration");
|
||||
}
|
||||
const hashes = await compose([ "config", "--hash", "*", ...(service ? [ "--", service ] : []) ]);
|
||||
return { config,
|
||||
hashes: Object.fromEntries(hashes.split(/\r?\n/).filter(Boolean).map(line => line.trim().split(/\s+/, 2))) };
|
||||
} catch (error) {
|
||||
const stderr = typeof error === "object" && error && "stderr" in error ? String(error.stderr) : "";
|
||||
const field = stderr.match(/\b(?:services|networks|volumes|configs|secrets)\.[a-zA-Z0-9_.-]{1,180}\b/)?.[0];
|
||||
throw new ComposeValidationError(field);
|
||||
}
|
||||
}
|
||||
|
||||
private async runtime(project: string): Promise<Runtime[]> {
|
||||
const ids = (await this.command([ "container", "ls", "--all", "--quiet", "--no-trunc", "--filter",
|
||||
`label=com.docker.compose.project=${project}`, "--filter", "label=com.docker.compose.oneoff=False" ])).split(/\s+/).filter(Boolean);
|
||||
if (!ids.length) {
|
||||
return [];
|
||||
}
|
||||
if (ids.length > 500 || ids.some(id => !/^[a-f0-9]{64}$/.test(id))) {
|
||||
throw new ValidationError("deployTooManyContainers");
|
||||
}
|
||||
const format = "{\"id\":{{json .Id}},\"name\":{{json .Name}},\"service\":{{json (index .Config.Labels \"com.docker.compose.service\")}}," +
|
||||
"\"image\":{{json .Image}},\"hash\":{{json (index .Config.Labels \"com.docker.compose.config-hash\")}},\"state\":{{json .State.Status}}," +
|
||||
"\"health\":{{with index .State \"Health\"}}{{json .Status}}{{else}}\"\"{{end}}}";
|
||||
const rows = await this.command([ "container", "inspect", "--format", format, "--", ...ids ]);
|
||||
return rows.split(/\r?\n/).map(row => JSON.parse(row) as Runtime).sort((a, b) => a.id.localeCompare(b.id));
|
||||
}
|
||||
|
||||
private runtimeDigest(rows: Runtime[]) {
|
||||
return digest(rows.map(({ id, image, hash }) => [ id, image, hash ]));
|
||||
}
|
||||
|
||||
private async inspect(reference: string, platform?: string) {
|
||||
try {
|
||||
const args = [ "image", "inspect", "--format", "{{.Id}}" ];
|
||||
if (platform) {
|
||||
args.push("--platform", platform);
|
||||
}
|
||||
const id = await this.command([ ...args, "--", reference ]);
|
||||
return imageIdPattern.test(id) ? id : undefined;
|
||||
} catch {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
withImageChanges<T>(action: () => Promise<T>) {
|
||||
const operation = this.pullQueue.then(action);
|
||||
this.pullQueue = operation.catch(() => {});
|
||||
return operation;
|
||||
}
|
||||
|
||||
private async prepareRecord(record: Deployment, candidates?: Map<string, Candidate>, delayHours = 0) {
|
||||
await this.write(record.name);
|
||||
const stack = new Stack(this.server, record.name);
|
||||
if (record.draft?.isAdd ? existsSync(stack.path) : !stack.isManagedByDockge) {
|
||||
throw new ValidationError("editorConflict");
|
||||
}
|
||||
record.revision = record.draft?.isAdd ? undefined : stack.revision;
|
||||
if (record.draft?.revision && record.draft.revision !== record.revision) {
|
||||
throw new ValidationError("editorConflict");
|
||||
}
|
||||
const current = await this.configure(stack, record.draft, async compose => {
|
||||
const { config, hashes } = await this.readConfig(compose, record.service);
|
||||
record.sourceHashes = hashes;
|
||||
record.project = config.name;
|
||||
record.fingerprint = digest(config);
|
||||
const runtime = await this.runtime(config.name);
|
||||
record.runtimeFingerprint = this.runtimeDigest(runtime);
|
||||
const selection = record.service ? this.dependencies(config, record.service) : Object.keys(config.services);
|
||||
const names = candidates ? selection.filter(name => candidates.has(name)) : selection;
|
||||
if (!names.length) {
|
||||
throw new ValidationError("deployInvalidRequest");
|
||||
}
|
||||
record.phase = "pulling";
|
||||
record.changes = this.changes(record, config, runtime, names);
|
||||
await this.write(record.name);
|
||||
await this.withImageChanges(() => this.pull(record, compose, config, names));
|
||||
if (candidates) {
|
||||
record.changes = this.changes(record, config, runtime, names);
|
||||
for (const change of record.changes) {
|
||||
const existing = candidates.get(change.name);
|
||||
if (!existing || existing.imageIds.every(id => id === change.imageId)) {
|
||||
change.action = "keep";
|
||||
}
|
||||
}
|
||||
record.changes = record.changes.filter(change => change.action !== "keep");
|
||||
if (!record.changes.length) {
|
||||
delete this.store(record.name).pending;
|
||||
await this.write(record.name);
|
||||
return null;
|
||||
}
|
||||
record.scale = Object.fromEntries(record.changes.map(change => [ change.name, candidates.get(change.name)!.containers.length ]));
|
||||
const rejected = this.store(record.name).history.find(item => item.mode === "scheduled" && item.phase === "rejected");
|
||||
if (rejected && record.changes.every(change => rejected.changes.some(old => old.name === change.name && old.imageId === change.imageId))) {
|
||||
await this.withImageChanges(() => this.removePulled(record));
|
||||
delete this.store(record.name).pending;
|
||||
await this.write(record.name);
|
||||
return null;
|
||||
}
|
||||
if (delayHours) {
|
||||
record.notBefore = new Date(Date.now() + delayHours * 3600000).toISOString();
|
||||
}
|
||||
} else {
|
||||
const pinned = this.pin(record, config, new Set(names));
|
||||
const expected = await this.withPinnedConfig(stack, pinned, async args => {
|
||||
const hashes = await this.command([ ...args, "config", "--hash", "*" ]);
|
||||
return Object.fromEntries(hashes.split(/\r?\n/).filter(Boolean).map(line => line.trim().split(/\s+/, 2)));
|
||||
});
|
||||
record.changes = this.changes(record, config, runtime, names, expected);
|
||||
}
|
||||
return config;
|
||||
});
|
||||
if (!current) {
|
||||
return;
|
||||
}
|
||||
record.phase = "scanning";
|
||||
await this.write(record.name);
|
||||
const images = new Map<string, ImageScan>();
|
||||
for (const change of record.changes) {
|
||||
if (!change.imageId || change.action === "remove") {
|
||||
continue;
|
||||
}
|
||||
const candidate = record.images.find(image => image.id === change.imageId);
|
||||
if (change.action === "keep" && !candidate?.fresh && !candidate?.retagged) {
|
||||
continue;
|
||||
}
|
||||
const scan = images.get(change.imageId) ?? { id: change.imageId,
|
||||
references: [],
|
||||
services: [],
|
||||
status: "pending" as const,
|
||||
findings: [] };
|
||||
scan.services.push(change.name);
|
||||
if (change.reference && !scan.references.includes(change.reference)) {
|
||||
scan.references.push(change.reference);
|
||||
}
|
||||
images.set(change.imageId, scan);
|
||||
}
|
||||
if (images.size) {
|
||||
const scan = await this.server.imageVulnerabilityScan.scanPrepared(stack, Array.from(images.values()));
|
||||
record.scans = scan.images;
|
||||
record.scanReportId = scan.id;
|
||||
if (scan.error || scan.images.some(image => image.status !== "scanned")) {
|
||||
throw new ValidationError(scan.error || "deployScanIncomplete");
|
||||
}
|
||||
}
|
||||
record.phase = "ready";
|
||||
await this.write(record.name);
|
||||
}
|
||||
|
||||
private dependencies(config: Config, service: string, names = new Set<string>()) {
|
||||
const selected = config.services[service];
|
||||
if (!selected || !Object.hasOwn(config.services, service)) {
|
||||
throw new ValidationError("deployInvalidRequest");
|
||||
}
|
||||
if (!names.has(service)) {
|
||||
names.add(service);
|
||||
const dependencies = selected.depends_on || {};
|
||||
for (const name of Array.isArray(dependencies) ? dependencies : Object.keys(dependencies)) {
|
||||
if (Object.hasOwn(config.services, name)) {
|
||||
this.dependencies(config, name, names);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Array.from(names);
|
||||
}
|
||||
|
||||
private reference(config: Config, name: string) {
|
||||
return config.services[name].image || `${config.name}-${name}`;
|
||||
}
|
||||
|
||||
private changes(record: Deployment, config: Config, runtime: Runtime[], names: string[], targetHashes?: Record<string, string>) {
|
||||
const result: Change[] = names.map(name => {
|
||||
const reference = this.reference(config, name);
|
||||
const platform = config.services[name].platform;
|
||||
const imageId = record.images.find(image => image.reference === reference && image.platform === platform)?.id;
|
||||
const rows = runtime.filter(row => row.service === name);
|
||||
const matches = (row: Runtime) => targetHashes ? row.hash === targetHashes[name]
|
||||
: row.hash === record.sourceHashes[name] || this.matchesDeployedHash(record.name, name, record.sourceHashes[name], row.hash);
|
||||
const action = !rows.length ? "create"
|
||||
: rows.some(row => !matches(row) || (imageId && row.image !== imageId)) ? "recreate"
|
||||
: rows.some(row => row.state !== "running") ? "start" : "keep";
|
||||
return { name,
|
||||
reference,
|
||||
imageId,
|
||||
previousImageIds: imageId ? Array.from(new Set(rows.map(row => row.image).filter(id => id !== imageId))) : undefined,
|
||||
action };
|
||||
});
|
||||
if ([ "deploy", "start", "update" ].includes(record.mode)) {
|
||||
for (const row of runtime) {
|
||||
if (!Object.hasOwn(config.services, row.service)) {
|
||||
result.push({ name: row.name.replace(/^\//, ""),
|
||||
action: "remove" });
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
matchesDeployedHash(stack: string, service: string, sourceHash: string, containerHash: string) {
|
||||
return Boolean(sourceHash && containerHash && this.stores.get(stack)?.history.some(record => record.phase === "deployed"
|
||||
&& record.sourceHashes[service] === sourceHash && record.appliedHashes?.[service] === containerHash));
|
||||
}
|
||||
|
||||
private async pull(record: Deployment, compose: (args: string[], timeout?: number) => Promise<string>, config: Config, names: string[]) {
|
||||
const initial = new Set((await this.command([ "image", "ls", "--all", "--no-trunc", "--quiet" ])).split(/\s+/));
|
||||
for (const name of names) {
|
||||
const service = config.services[name];
|
||||
const reference = this.reference(config, name);
|
||||
const platform = service.platform;
|
||||
const existing = record.images.find(image => image.reference === reference && image.platform === platform);
|
||||
if (existing) {
|
||||
continue;
|
||||
}
|
||||
const previous = await this.inspect(reference, platform);
|
||||
try {
|
||||
if (service.build && (!previous || record.mode === "deploy" || record.mode === "update")) {
|
||||
await compose([ "build", "--", name ], 10 * 60 * 1000);
|
||||
} else if (service.image && service.pull_policy !== "never" && (!service.build || !previous)
|
||||
&& (!previous || service.pull_policy === "always" || record.mode === "update" || record.mode === "scheduled")) {
|
||||
await compose([ "pull", "--policy", "always", "--ignore-buildable", "--", name ], 10 * 60 * 1000);
|
||||
}
|
||||
} finally {
|
||||
const id = await this.inspect(reference, platform);
|
||||
if (id) {
|
||||
record.images.push({ reference,
|
||||
platform,
|
||||
id,
|
||||
previous,
|
||||
fresh: !initial.has(id),
|
||||
retagged: previous !== id });
|
||||
await this.write(record.name);
|
||||
}
|
||||
}
|
||||
if (!record.images.some(image => image.reference === reference && image.platform === platform)) {
|
||||
throw new ValidationError("deployImageMissing");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async decide(value: unknown, id: unknown, approve: unknown) {
|
||||
await this.initialize();
|
||||
const name = this.name(value);
|
||||
const previous = this.stores.get(name)?.pending;
|
||||
if (previous && previous.id === id && [ "ready", "failed" ].includes(previous.phase)) {
|
||||
await this.jobs.get(name);
|
||||
}
|
||||
const record = this.stores.get(name)?.pending;
|
||||
if (!record || record.id !== id || typeof approve !== "boolean" || this.jobs.has(name)
|
||||
|| ![ "ready", "failed" ].includes(record.phase)) {
|
||||
throw new ValidationError("deployInvalidDecision");
|
||||
}
|
||||
if (approve && (record.phase !== "ready" || (record.notBefore && Date.parse(record.notBefore) > Date.now()))) {
|
||||
throw new ValidationError("deployInvalidDecision");
|
||||
}
|
||||
record.phase = "applying";
|
||||
record.approved = approve;
|
||||
this.run(record, () => Stack.withOperation(this.server, name, async () => {
|
||||
await this.write(name);
|
||||
if (approve) {
|
||||
await this.apply(record);
|
||||
record.phase = "deployed";
|
||||
} else {
|
||||
record.cleanup = await this.withImageChanges(() => this.removePulled(record));
|
||||
if (record.scanReportId) {
|
||||
this.server.imageVulnerabilityScan.forget(record.name, record.scanReportId);
|
||||
}
|
||||
record.phase = "rejected";
|
||||
}
|
||||
record.finishedAt = new Date().toISOString();
|
||||
const store = this.store(name);
|
||||
store.history.unshift(record);
|
||||
store.history = store.history.slice(0, historyLimit);
|
||||
delete store.pending;
|
||||
await this.write(name);
|
||||
void this.server.sendStackList();
|
||||
}));
|
||||
return publicRecord(record);
|
||||
}
|
||||
|
||||
private async apply(record: Deployment) {
|
||||
const stack = new Stack(this.server, record.name);
|
||||
if (record.draft?.isAdd ? existsSync(stack.path) : !stack.isManagedByDockge || stack.revision !== record.revision) {
|
||||
throw new ValidationError("editorConflict");
|
||||
}
|
||||
const { config } = await this.configure(stack, record.draft, compose => this.readConfig(compose, record.service));
|
||||
if (digest(config) !== record.fingerprint || this.runtimeDigest(await this.runtime(config.name)) !== record.runtimeFingerprint) {
|
||||
throw new ValidationError("deployPlanChanged");
|
||||
}
|
||||
const names = new Set(record.changes.filter(change => change.action !== "remove").map(change => change.name));
|
||||
const pinned = this.pin(record, config, names);
|
||||
for (const name of names) {
|
||||
const service = config.services[name];
|
||||
const image = record.images.find(item => item.reference === this.reference(config, name) && item.platform === service.platform);
|
||||
if (!image || await this.inspect(image.id, image.platform) !== image.id) {
|
||||
throw new ValidationError("deployImageMissing");
|
||||
}
|
||||
}
|
||||
if (record.draft) {
|
||||
const draft = new Stack(this.server, record.name, record.draft.yaml, record.draft.env);
|
||||
await draft.save(record.draft.isAdd, record.revision);
|
||||
} else {
|
||||
record.draft = { yaml: stack.composeYAML,
|
||||
env: stack.composeENV,
|
||||
isAdd: false };
|
||||
}
|
||||
await this.withPinnedConfig(stack, pinned, async args => {
|
||||
const selected = record.mode === "scheduled" ? [ ...names ] : record.service ? [ record.service ] : [];
|
||||
const scale = Object.entries(record.scale || {}).flatMap(([ name, count ]) => [ "--scale", `${name}=${count}` ]);
|
||||
const flags = record.mode === "scheduled" ? [ "--no-deps", ...scale ] : record.service ? [] : [ "--remove-orphans" ];
|
||||
await this.command([ ...args, "up", "-d", "--no-build", "--pull", "never", "--wait", "--wait-timeout", "120",
|
||||
...flags, ...(selected.length ? [ "--", ...selected ] : []) ], stack.fullPath, 180000);
|
||||
const runtime = await this.runtime(config.name);
|
||||
record.appliedHashes = Object.fromEntries(runtime.filter(row => names.has(row.service)).map(row => [ row.service, row.hash ]));
|
||||
});
|
||||
}
|
||||
|
||||
private pin(record: Deployment, config: Config, names: Set<string>) {
|
||||
const services = Object.fromEntries(Object.entries(config.services).map(([ name, service ]) => {
|
||||
if (!names.has(name)) {
|
||||
return [ name, service ];
|
||||
}
|
||||
const image = record.images.find(item => item.reference === this.reference(config, name) && item.platform === service.platform);
|
||||
if (!image) {
|
||||
throw new ValidationError("deployImageMissing");
|
||||
}
|
||||
return [ name, { ...service,
|
||||
image: image.id,
|
||||
pull_policy: "never" }];
|
||||
}));
|
||||
return { ...config,
|
||||
services };
|
||||
}
|
||||
|
||||
private async withPinnedConfig<T>(stack: Stack, config: Config, action: (args: string[]) => Promise<T>) {
|
||||
const temp = await fs.mkdtemp(path.join(this.directory, ".apply-"));
|
||||
try {
|
||||
const file = path.join(temp, "compose.json");
|
||||
// The Compose config renderer already escapes literal dollars for re-reading.
|
||||
await fs.writeFile(file, JSON.stringify(config), { mode: 0o600 });
|
||||
return await action([ "compose", "--project-directory", stack.fullPath, "--file", file ]);
|
||||
} finally {
|
||||
await fs.rm(temp, { recursive: true,
|
||||
force: true });
|
||||
}
|
||||
}
|
||||
|
||||
private async removePulled(record: Deployment) {
|
||||
const shared = this.protectedImages(record.id);
|
||||
const fresh = new Set<string>();
|
||||
for (const image of record.images) {
|
||||
if (image.fresh) {
|
||||
fresh.add(image.id);
|
||||
}
|
||||
if (!image.retagged || !image.previous || image.reference.includes("@") || imageIdPattern.test(image.reference)
|
||||
|| await this.inspect(image.reference, image.platform) !== image.id) {
|
||||
continue;
|
||||
}
|
||||
await this.command([ "image", "tag", "--", image.previous, image.reference ]).catch(() => {});
|
||||
}
|
||||
let removed = 0;
|
||||
for (const id of fresh) {
|
||||
if (shared.has(id)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
// Docker performs the final reference check, including stopped containers.
|
||||
await this.command([ "image", "rm", "--no-prune", "--", id ]);
|
||||
removed++;
|
||||
} catch {
|
||||
// The image may have acquired another tag or container reference.
|
||||
}
|
||||
}
|
||||
return { removed,
|
||||
retained: fresh.size - removed };
|
||||
}
|
||||
|
||||
protectedImages(except?: string) {
|
||||
const ids = new Set<string>();
|
||||
for (const store of this.stores.values()) {
|
||||
const deployments = store.history.filter(item => item.phase === "deployed").slice(0, 2);
|
||||
if (store.pending?.id !== except && store.pending) {
|
||||
deployments.push(store.pending);
|
||||
}
|
||||
for (const deployment of deployments) {
|
||||
for (const image of deployment.images) {
|
||||
ids.add(image.id);
|
||||
if (image.previous && deployment === store.pending) {
|
||||
ids.add(image.previous);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
attention() {
|
||||
return Array.from(this.stores.entries()).flatMap(([ stack, store ]) => {
|
||||
if (store.pending?.phase === "ready" || store.pending?.phase === "failed") {
|
||||
return [{ stack,
|
||||
kind: store.pending.phase === "ready" ? "deployAttentionApproval" : "deployAttentionFailed" }];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,6 @@ import {
|
||||
CREATED_STACK,
|
||||
EXITED, getCombinedTerminalName,
|
||||
getComposeTerminalName, getContainerExecTerminalName,
|
||||
PROGRESS_TERMINAL_ROWS,
|
||||
RUNNING, TERMINAL_ROWS,
|
||||
UNKNOWN
|
||||
} from "../common/util-common";
|
||||
@ -269,19 +268,6 @@ export class Stack {
|
||||
}
|
||||
}
|
||||
|
||||
async deploy(socket : DockgeSocket) : Promise<number> {
|
||||
const terminalName = getComposeTerminalName(socket.endpoint, this.name);
|
||||
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("config", "--quiet"), this.path);
|
||||
if (exitCode !== 0) {
|
||||
throw new ValidationError("editorComposeInvalid");
|
||||
}
|
||||
exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("up", "-d", "--remove-orphans"), this.path);
|
||||
if (exitCode !== 0) {
|
||||
throw new Error("Failed to deploy, please check the terminal output for more information.");
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
async delete(socket: DockgeSocket) : Promise<number> {
|
||||
const terminalName = getComposeTerminalName(socket.endpoint, this.name);
|
||||
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("down", "--remove-orphans"), this.path);
|
||||
@ -487,15 +473,6 @@ export class Stack {
|
||||
return options;
|
||||
}
|
||||
|
||||
async start(socket: DockgeSocket) {
|
||||
const terminalName = getComposeTerminalName(socket.endpoint, this.name);
|
||||
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("up", "-d", "--remove-orphans"), this.path);
|
||||
if (exitCode !== 0) {
|
||||
throw new Error("Failed to start, please check the terminal output for more information.");
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
async stop(socket: DockgeSocket) : Promise<number> {
|
||||
const terminalName = getComposeTerminalName(socket.endpoint, this.name);
|
||||
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("stop"), this.path);
|
||||
@ -523,27 +500,6 @@ export class Stack {
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
async update(socket: DockgeSocket) {
|
||||
const terminalName = getComposeTerminalName(socket.endpoint, this.name);
|
||||
let exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("pull"), this.path);
|
||||
if (exitCode !== 0) {
|
||||
throw new Error("Failed to pull, please check the terminal output for more information.");
|
||||
}
|
||||
|
||||
// If the stack is not running, we don't need to restart it
|
||||
await this.updateStatus();
|
||||
log.debug("update", "Status: " + this.status);
|
||||
if (this.status !== RUNNING) {
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", this.getComposeOptions("up", "-d", "--remove-orphans"), this.path);
|
||||
if (exitCode !== 0) {
|
||||
throw new Error("Failed to restart, please check the terminal output for more information.");
|
||||
}
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
async joinCombinedTerminal(socket: DockgeSocket) {
|
||||
const terminalName = getCombinedTerminalName(socket.endpoint, this.name);
|
||||
const terminal = Terminal.getOrCreateTerminal(this.server, terminalName, "docker", this.getComposeOptions("logs", "-f", "--tail", "100"), this.path);
|
||||
@ -580,7 +536,7 @@ export class Stack {
|
||||
let statusList = new Map<string, Array<object>>();
|
||||
|
||||
try {
|
||||
let res = await childProcessAsync.spawn("docker", this.getComposeOptions("ps", "--no-trunc", "--orphans=false", "--format", "json"), {
|
||||
let res = await childProcessAsync.spawn("docker", this.getComposeOptions("ps", "--all", "--no-trunc", "--orphans=false", "--format", "json"), {
|
||||
cwd: this.path,
|
||||
encoding: "utf-8",
|
||||
});
|
||||
@ -591,7 +547,7 @@ export class Stack {
|
||||
|
||||
let lines = res.stdout?.toString().split("\n");
|
||||
|
||||
const addLine = (obj: { ID: string, Service: string, State: string, Name: string, Health: string }) => {
|
||||
const addLine = (obj: { ID: string, Service: string, State: string, Name: string, Health: string, ExitCode?: number, Publishers?: unknown[] }) => {
|
||||
if (!statusList.has(obj.Service)) {
|
||||
statusList.set(obj.Service, []);
|
||||
}
|
||||
@ -599,7 +555,9 @@ export class Stack {
|
||||
id: obj.ID,
|
||||
state: obj.State,
|
||||
status: obj.Health || obj.State,
|
||||
name: obj.Name
|
||||
name: obj.Name,
|
||||
exitCode: obj.ExitCode,
|
||||
ports: obj.Publishers ?? [],
|
||||
});
|
||||
};
|
||||
|
||||
@ -622,16 +580,6 @@ export class Stack {
|
||||
}
|
||||
}
|
||||
|
||||
async startService(socket: DockgeSocket, serviceName: string) {
|
||||
const terminalName = getComposeTerminalName(socket.endpoint, this.name);
|
||||
const exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "up", "-d", serviceName ], this.path);
|
||||
if (exitCode !== 0) {
|
||||
throw new Error(`Failed to start service ${serviceName}, please check logs for more information.`);
|
||||
}
|
||||
|
||||
return exitCode;
|
||||
}
|
||||
|
||||
async stopService(socket: DockgeSocket, serviceName: string): Promise<number> {
|
||||
const terminalName = getComposeTerminalName(socket.endpoint, this.name);
|
||||
const exitCode = await Terminal.exec(this.server, socket, terminalName, "docker", [ "compose", "stop", serviceName ], this.path);
|
||||
|
||||
@ -5,13 +5,13 @@
|
||||
"tailwind": {
|
||||
"config": "",
|
||||
"css": "frontend/src/styles/theme.css",
|
||||
"baseColor": "mist",
|
||||
"baseColor": "zinc",
|
||||
"cssVariables": true
|
||||
},
|
||||
"iconLibrary": "phosphor",
|
||||
"iconLibrary": "remixicon",
|
||||
"rtl": false,
|
||||
"menuColor": "default",
|
||||
"menuAccent": "bold",
|
||||
"menuColor": "inverted-translucent",
|
||||
"menuAccent": "subtle",
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"ui": "@/components/ui",
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<DialogClose as-child>
|
||||
<UiButton variant="outline">{{ $t("cancel") }}</UiButton>
|
||||
</DialogClose>
|
||||
<UiButton type="submit" :variant="destructive ? 'destructive' : 'default'">{{ action }}</UiButton>
|
||||
<UiButton type="submit" :variant="destructive ? 'destructive' : 'default'" :disabled="disabled">{{ action }}</UiButton>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
</DialogContent>
|
||||
@ -28,10 +28,14 @@ export default {
|
||||
action: { type: String,
|
||||
required: true },
|
||||
destructive: Boolean,
|
||||
disabled: Boolean,
|
||||
},
|
||||
emits: [ "update:modelValue", "confirm" ],
|
||||
methods: {
|
||||
confirm() {
|
||||
if (this.disabled) {
|
||||
return;
|
||||
}
|
||||
this.$emit("update:modelValue", false);
|
||||
this.$emit("confirm");
|
||||
},
|
||||
|
||||
@ -1,124 +0,0 @@
|
||||
<template>
|
||||
<div v-if="valid" class="grid gap-2">
|
||||
<ul v-if="isArrayInited" class="grid gap-1.5">
|
||||
<li v-for="(_, index) in array" :key="index" class="flex items-center gap-1.5">
|
||||
<UiInput v-model="array[index]" :aria-label="displayName" :placeholder="placeholder" />
|
||||
<UiButton type="button" variant="ghost" size="icon" class="text-destructive" :aria-label="$t('removeEntry')" @click="remove(index)">
|
||||
<AppIcon name="x" />
|
||||
</UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
<UiButton type="button" variant="outline" size="sm" class="justify-self-start" @click="addField">
|
||||
<AppIcon name="plus" /> {{ $t("addListItem", [ displayName ]) }}
|
||||
</UiButton>
|
||||
</div>
|
||||
<p v-else class="text-sm text-muted-foreground">{{ $t("LongSyntaxNotSupported") }}</p>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: { containerEditor: { default: null },
|
||||
composePage: {} },
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
objectType: {
|
||||
type: String,
|
||||
default: "service",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
array() {
|
||||
// Create the array if not exists, it should be safe.
|
||||
if (!this.service[this.name]) {
|
||||
return [];
|
||||
}
|
||||
return this.service[this.name];
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if the array is inited before called v-for.
|
||||
* Prevent empty arrays inserted to the YAML file.
|
||||
* @return {boolean}
|
||||
*/
|
||||
isArrayInited() {
|
||||
return this.service[this.name] !== undefined;
|
||||
},
|
||||
|
||||
/**
|
||||
* Not a good name, but it is used to get the object.
|
||||
*/
|
||||
service() {
|
||||
if (this.objectType === "service") {
|
||||
// Used in Container.vue
|
||||
return this.containerEditor.service;
|
||||
} else if (this.objectType === "x-dockge") {
|
||||
|
||||
if (!this.composePage.jsonConfig["x-dockge"]) {
|
||||
return {};
|
||||
}
|
||||
|
||||
// Used in Compose.vue
|
||||
return this.composePage.jsonConfig["x-dockge"];
|
||||
} else {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
|
||||
valid() {
|
||||
// Check if the array is actually an array
|
||||
if (!Array.isArray(this.array)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the array contains non-object only.
|
||||
for (let item of this.array) {
|
||||
if (typeof item === "object") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
addField() {
|
||||
|
||||
// Create the object if not exists.
|
||||
if (this.objectType === "x-dockge") {
|
||||
if (!this.composePage.jsonConfig["x-dockge"]) {
|
||||
this.composePage.jsonConfig["x-dockge"] = {};
|
||||
}
|
||||
}
|
||||
|
||||
// Create the array if not exists.
|
||||
if (!this.service[this.name]) {
|
||||
this.service[this.name] = [];
|
||||
}
|
||||
|
||||
this.array.push("");
|
||||
},
|
||||
remove(index) {
|
||||
this.array.splice(index, 1);
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -1,102 +0,0 @@
|
||||
<template>
|
||||
<div v-if="valid" class="grid gap-2">
|
||||
<ul v-if="isArrayInited" class="grid gap-1.5">
|
||||
<li v-for="(_, index) in array" :key="index" class="flex items-center gap-1.5">
|
||||
<UiNativeSelect v-model="array[index]" :aria-label="displayName" class="min-w-0 flex-1">
|
||||
<option value="">{{ $t("Select a network...") }}</option>
|
||||
<option v-for="option in options" :key="option" :value="option">{{ option }}</option>
|
||||
</UiNativeSelect>
|
||||
<UiButton type="button" variant="ghost" size="icon" class="text-destructive" :aria-label="$t('removeEntry')" @click="remove(index)">
|
||||
<AppIcon name="x" />
|
||||
</UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
<UiButton type="button" variant="outline" size="sm" class="justify-self-start" @click="addField">
|
||||
<AppIcon name="plus" /> {{ $t("addListItem", [ displayName ]) }}
|
||||
</UiButton>
|
||||
</div>
|
||||
<p v-else class="text-sm text-muted-foreground">{{ $t("LongSyntaxNotSupported") }}</p>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
inject: { containerEditor: { default: null },
|
||||
composePage: {} },
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
placeholder: {
|
||||
type: String,
|
||||
default: "",
|
||||
},
|
||||
displayName: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
array() {
|
||||
// Create the array if not exists, it should be safe.
|
||||
if (!this.service[this.name]) {
|
||||
return [];
|
||||
}
|
||||
return this.service[this.name];
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if the array is inited before called v-for.
|
||||
* Prevent empty arrays inserted to the YAML file.
|
||||
* @return {boolean}
|
||||
*/
|
||||
isArrayInited() {
|
||||
return this.service[this.name] !== undefined;
|
||||
},
|
||||
|
||||
service() {
|
||||
return this.containerEditor.service;
|
||||
},
|
||||
|
||||
valid() {
|
||||
// Check if the array is actually an array
|
||||
if (!Array.isArray(this.array)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the array contains non-object only.
|
||||
for (let item of this.array) {
|
||||
if (typeof item === "object") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
},
|
||||
created() {
|
||||
|
||||
},
|
||||
methods: {
|
||||
addField() {
|
||||
// Create the array if not exists.
|
||||
if (!this.service[this.name]) {
|
||||
this.service[this.name] = [];
|
||||
}
|
||||
this.array.push("");
|
||||
},
|
||||
remove(index) {
|
||||
this.array.splice(index, 1);
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@ -1,13 +1,14 @@
|
||||
<template>
|
||||
<div class="grid min-h-dvh place-items-center px-4 py-10">
|
||||
<div class="grid w-full max-w-sm gap-5">
|
||||
<div class="grid w-full max-w-md gap-5">
|
||||
<div class="flex items-center justify-center gap-2 font-heading text-lg font-semibold">
|
||||
<PhStack class="size-5" weight="duotone" />
|
||||
<img src="/icon.svg" alt="" width="20" height="20" class="shrink-0" />
|
||||
Dockge
|
||||
</div>
|
||||
<UiCard>
|
||||
<CardHeader>
|
||||
<CardTitle class="font-heading text-xl"><h1>{{ title }}</h1></CardTitle>
|
||||
<CardDescription v-if="description">{{ description }}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<slot />
|
||||
@ -19,9 +20,12 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { PhStack } from "@phosphor-icons/vue";
|
||||
import ForkCredit from "./ForkCredit.vue";
|
||||
|
||||
defineProps({ title: { type: String,
|
||||
required: true } });
|
||||
defineProps({
|
||||
title: { type: String,
|
||||
required: true },
|
||||
description: { type: String,
|
||||
default: "" },
|
||||
});
|
||||
</script>
|
||||
|
||||
165
frontend/src/components/ComposeCollection.vue
Normal file
165
frontend/src/components/ComposeCollection.vue
Normal file
@ -0,0 +1,165 @@
|
||||
<template>
|
||||
<section class="grid gap-2">
|
||||
<div>
|
||||
<h4 class="text-sm font-medium">{{ label }}</h4>
|
||||
<p v-if="hint" class="mt-0.5 text-xs text-muted-foreground">{{ hint }}</p>
|
||||
</div>
|
||||
<p v-if="!supported" class="text-xs text-muted-foreground">{{ $t("composeAdvancedValue") }}</p>
|
||||
<template v-else>
|
||||
<ul v-if="entries.length" class="grid gap-2">
|
||||
<li v-for="entry in entries" :key="entry.key" class="flex items-start gap-2 rounded-md border bg-background p-2.5">
|
||||
<div class="grid min-w-0 flex-1 gap-2">
|
||||
<code v-if="mapping" class="break-all text-xs font-semibold">{{ entry.key }}</code>
|
||||
<p v-if="Array.isArray(entry.value)" class="text-xs text-muted-foreground">{{ $t("composeAdvancedValue") }}</p>
|
||||
<div v-else-if="isStructured(entry.value)" class="grid gap-2 sm:grid-cols-2 lg:grid-cols-3">
|
||||
<ComposeField
|
||||
v-for="field in fields" :key="field.key" :label="$t(field.label)"
|
||||
:model-value="fieldValue(entry.value, field)" :kind="field.kind" :options="field.options" :suggestions="field.suggestions"
|
||||
:placeholder="field.placeholder" @update:model-value="patchEntry(entry, field, $event)"
|
||||
/>
|
||||
<p v-if="!fields.length" class="text-xs text-muted-foreground">{{ $t("composeAdvancedValue") }}</p>
|
||||
</div>
|
||||
<UiInput
|
||||
v-else :model-value="entry.value ?? ''" :aria-label="mapping ? String(entry.key) : label"
|
||||
:placeholder="placeholder" @update:model-value="setEntry(entry.key, String($event))"
|
||||
/>
|
||||
</div>
|
||||
<UiButton type="button" variant="ghost" size="icon-sm" class="text-destructive" :aria-label="$t('removeEntry')" @click="remove(entry.key)">
|
||||
<AppIcon name="trash" />
|
||||
</UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<template v-if="mapping">
|
||||
<UiInput v-model="newKey" class="max-w-64" :list="suggestions.length ? listId : undefined" :aria-label="$t('composeNewEntryName')" :placeholder="$t('composeNewEntryName')" @keydown.enter.prevent="add()" />
|
||||
<datalist v-if="suggestions.length" :id="listId">
|
||||
<option v-for="suggestion in suggestions" :key="suggestion" :value="suggestion" />
|
||||
</datalist>
|
||||
<UiButton type="button" size="sm" variant="outline" :disabled="!canAddKey" @click="add()">
|
||||
<AppIcon name="plus" /> {{ $t("addListItem", [ label ]) }}
|
||||
</UiButton>
|
||||
</template>
|
||||
<template v-else>
|
||||
<UiButton type="button" size="sm" variant="outline" @click="add(preferDetails)">
|
||||
<AppIcon name="plus" /> {{ addLabel || $t("addListItem", [ label ]) }}
|
||||
</UiButton>
|
||||
<UiButton v-if="fields.length" type="button" size="sm" variant="ghost" @click="add(!preferDetails)">
|
||||
{{ $t(preferDetails ? "composeAddShort" : "composeAddDetailed") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useId } from "vue";
|
||||
import ComposeField from "./ComposeField.vue";
|
||||
|
||||
export default {
|
||||
components: { ComposeField },
|
||||
props: {
|
||||
modelValue: { type: [ Object, Array, String, Number, Boolean ],
|
||||
default: undefined },
|
||||
label: { type: String,
|
||||
required: true },
|
||||
hint: { type: String,
|
||||
default: "" },
|
||||
placeholder: { type: String,
|
||||
default: "" },
|
||||
fields: { type: Array,
|
||||
default: () => [] },
|
||||
preferMapping: Boolean,
|
||||
preferDetails: Boolean,
|
||||
addLabel: { type: String,
|
||||
default: "" },
|
||||
detailDefaults: { type: Object,
|
||||
default: () => ({}) },
|
||||
defaultEntry: { type: [ String, Object, Number, Boolean ],
|
||||
default: "" },
|
||||
keepEmpty: Boolean,
|
||||
suggestions: { type: Array,
|
||||
default: () => [] },
|
||||
},
|
||||
emits: [ "update:modelValue" ],
|
||||
setup() {
|
||||
return { listId: useId() };
|
||||
},
|
||||
data() {
|
||||
return { newKey: "" };
|
||||
},
|
||||
computed: {
|
||||
mapping() {
|
||||
return this.modelValue == null ? this.preferMapping : typeof this.modelValue === "object" && !Array.isArray(this.modelValue);
|
||||
},
|
||||
supported() {
|
||||
return this.modelValue == null || this.mapping || Array.isArray(this.modelValue);
|
||||
},
|
||||
entries() {
|
||||
return this.mapping ? Object.entries(this.modelValue || {}).map(([ key, value ]) => ({ key,
|
||||
value }))
|
||||
: (this.modelValue || []).map((value, key) => ({ key,
|
||||
value }));
|
||||
},
|
||||
canAddKey() {
|
||||
return Boolean(this.newKey.trim()) && !Object.hasOwn(this.modelValue || {}, this.newKey.trim());
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
isStructured(value) {
|
||||
return (this.mapping && this.fields.length > 0 && (value == null || typeof value === "object"))
|
||||
|| (value !== null && typeof value === "object");
|
||||
},
|
||||
setEntry(key, value) {
|
||||
const collection = this.mapping ? { ...this.modelValue,
|
||||
[key]: value } : [ ...(this.modelValue || []) ];
|
||||
if (!this.mapping) {
|
||||
collection[key] = value;
|
||||
}
|
||||
this.$emit("update:modelValue", collection);
|
||||
},
|
||||
fieldValue(entry, field) {
|
||||
return (field.path || [ field.key ]).reduce((value, key) => value?.[key], entry);
|
||||
},
|
||||
patchEntry(entry, field, value) {
|
||||
this.setEntry(entry.key, this.patchPath(entry.value, field.path || [ field.key ], value) || {});
|
||||
},
|
||||
patchPath(current, [ key, ...path ], value) {
|
||||
if (current != null && (typeof current !== "object" || (typeof key === "number") !== Array.isArray(current))) {
|
||||
return current;
|
||||
}
|
||||
const next = Array.isArray(current) || typeof key === "number" ? [ ...(current || []) ] : { ...current };
|
||||
const updated = path.length ? this.patchPath(current?.[key], path, value) : value;
|
||||
if (updated === undefined) {
|
||||
if (Array.isArray(next)) {
|
||||
next.splice(key, 1);
|
||||
} else {
|
||||
delete next[key];
|
||||
}
|
||||
} else {
|
||||
next[key] = updated;
|
||||
}
|
||||
return Object.keys(next).length ? next : undefined;
|
||||
},
|
||||
add(detailed = false) {
|
||||
if (this.mapping) {
|
||||
if (this.canAddKey) {
|
||||
this.setEntry(this.newKey.trim(), this.fields.length ? { ...this.detailDefaults } : this.defaultEntry);
|
||||
this.newKey = "";
|
||||
}
|
||||
} else {
|
||||
this.setEntry(this.entries.length, detailed ? { ...this.detailDefaults } : this.defaultEntry);
|
||||
}
|
||||
},
|
||||
remove(key) {
|
||||
const collection = this.mapping ? { ...this.modelValue } : [ ...this.modelValue ];
|
||||
if (this.mapping) {
|
||||
delete collection[key];
|
||||
} else {
|
||||
collection.splice(key, 1);
|
||||
}
|
||||
this.$emit("update:modelValue", Object.keys(collection).length || this.keepEmpty ? collection : undefined);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
107
frontend/src/components/ComposeField.vue
Normal file
107
frontend/src/components/ComposeField.vue
Normal file
@ -0,0 +1,107 @@
|
||||
<template>
|
||||
<div class="grid min-w-0 content-start gap-1.5">
|
||||
<UiLabel :for="id">{{ label }}</UiLabel>
|
||||
<p v-if="!supported" class="rounded-md border bg-muted/50 p-2 text-xs text-muted-foreground">{{ $t("composeAdvancedValue") }}</p>
|
||||
<UiNativeSelect v-else-if="choices" :id="id" :model-value="display" class="w-full" @update:model-value="update">
|
||||
<option value="">{{ $t("composeDefaultValue") }}</option>
|
||||
<option v-if="display && !choices.includes(display)" :value="display">{{ display }}</option>
|
||||
<option v-for="choice in choices" :key="choice" :value="choice">{{ choiceLabel(choice) }}</option>
|
||||
</UiNativeSelect>
|
||||
<UiTextarea
|
||||
v-else-if="multiline" :id="id" :model-value="display" :placeholder="placeholder" :rows="3"
|
||||
class="font-mono text-sm" @update:model-value="update"
|
||||
/>
|
||||
<UiInput
|
||||
v-else :id="id" :model-value="display" :placeholder="placeholder"
|
||||
:inputmode="['number', 'port', 'port-range'].includes(kind) ? 'decimal' : undefined"
|
||||
:list="suggestions.length ? id + '-choices' : undefined"
|
||||
:aria-invalid="error ? 'true' : undefined" :aria-describedby="error ? id + '-error' : undefined"
|
||||
@update:model-value="update"
|
||||
/>
|
||||
<datalist v-if="suggestions.length" :id="id + '-choices'">
|
||||
<option v-for="suggestion in suggestions" :key="suggestion" :value="suggestion" />
|
||||
</datalist>
|
||||
<p v-if="error" :id="id + '-error'" class="text-xs text-destructive">{{ $t(error) }}</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { useId } from "vue";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
modelValue: { type: [ String, Number, Boolean, Object, Array ],
|
||||
default: undefined },
|
||||
label: { type: String,
|
||||
required: true },
|
||||
placeholder: { type: String,
|
||||
default: undefined },
|
||||
kind: { type: String,
|
||||
default: "text" },
|
||||
options: { type: Array,
|
||||
default: undefined },
|
||||
suggestions: { type: Array,
|
||||
default: () => [] },
|
||||
multiline: Boolean,
|
||||
nullable: Boolean,
|
||||
},
|
||||
emits: [ "update:modelValue" ],
|
||||
setup() {
|
||||
return { id: useId() };
|
||||
},
|
||||
computed: {
|
||||
choices() {
|
||||
return this.kind === "boolean" ? [ "true", "false" ] : this.options;
|
||||
},
|
||||
display() {
|
||||
return this.modelValue == null ? "" : String(this.modelValue);
|
||||
},
|
||||
supported() {
|
||||
return this.modelValue == null || [ "string", "number", "boolean" ].includes(typeof this.modelValue);
|
||||
},
|
||||
error() {
|
||||
if (!this.display || this.display.includes("$") || !this.supported) {
|
||||
return "";
|
||||
}
|
||||
if (this.kind === "number" && !/^-?\d+(\.\d+)?$/.test(this.display)) {
|
||||
return "composeFieldNumber";
|
||||
}
|
||||
if ([ "port", "port-range" ].includes(this.kind)) {
|
||||
const parts = this.display.split("-");
|
||||
const min = this.kind === "port" ? 1 : 0;
|
||||
if (parts.length > (this.kind === "port" ? 1 : 2) || parts.some(part => !/^\d+$/.test(part) || Number(part) < min || Number(part) > 65535)
|
||||
|| (parts.length === 2 && Number(parts[0]) > Number(parts[1]))) {
|
||||
return "composeFieldPort";
|
||||
}
|
||||
}
|
||||
if (this.kind === "subnet" && !/^([a-f0-9.:]+)\/\d{1,3}$/i.test(this.display)) {
|
||||
return "composeFieldSubnet";
|
||||
}
|
||||
return "";
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
choiceLabel(choice) {
|
||||
if (this.kind === "boolean") {
|
||||
return this.$t(choice === "true" ? "composeEnabled" : "composeDisabled");
|
||||
}
|
||||
if ([ "service_started", "service_healthy", "service_completed_successfully" ].includes(choice)) {
|
||||
return this.$t("composeDependencyChoice." + choice);
|
||||
}
|
||||
return choice;
|
||||
},
|
||||
update(value) {
|
||||
const text = String(value);
|
||||
if (!text && !this.nullable) {
|
||||
this.$emit("update:modelValue", undefined);
|
||||
} else if (this.kind === "boolean") {
|
||||
this.$emit("update:modelValue", text === "true");
|
||||
} else if ([ "number", "port" ].includes(this.kind) && /^-?\d+(\.\d+)?$/.test(text) && Number.isFinite(Number(text))) {
|
||||
this.$emit("update:modelValue", Number(text));
|
||||
} else {
|
||||
this.$emit("update:modelValue", text);
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<UiCard class="gap-0 py-0">
|
||||
<CardContent class="grid gap-3 p-3">
|
||||
<CardContent class="grid min-w-0 grid-cols-[minmax(0,1fr)] gap-3 p-3">
|
||||
<div class="flex flex-wrap items-start justify-between gap-2">
|
||||
<div class="min-w-0 flex-1">
|
||||
<h3 class="break-all font-heading text-sm font-semibold">{{ name }}</h3>
|
||||
@ -42,11 +42,20 @@
|
||||
</DropdownMenu>
|
||||
</template>
|
||||
</div>
|
||||
<div v-if="!isEditMode && envsubstService.ports?.length" class="flex flex-wrap gap-1.5">
|
||||
<UiBadge v-for="port in envsubstService.ports" :key="port" as-child variant="secondary">
|
||||
<a :href="parsePort(port).url" target="_blank" rel="noopener noreferrer">{{ parsePort(port).display }}</a>
|
||||
</UiBadge>
|
||||
</div>
|
||||
<template v-if="!isEditMode">
|
||||
<dl class="grid gap-2 text-sm sm:grid-cols-3">
|
||||
<div><dt class="text-xs text-muted-foreground">{{ $t("containerInstances") }}</dt><dd>{{ $t("containerRunningInstances", { running: fileTargets.length, total: instances.length }) }}</dd></div>
|
||||
<div><dt class="text-xs text-muted-foreground">{{ $t("restartPolicy") }}</dt><dd>{{ envsubstService.restart || $t("composeDefaultValue") }}</dd></div>
|
||||
<div><dt class="text-xs text-muted-foreground">{{ $t("composeMounts") }}</dt><dd>{{ envsubstService.volumes?.length || 0 }}</dd></div>
|
||||
</dl>
|
||||
<div v-if="portLabels.length" class="flex flex-wrap items-center gap-1.5">
|
||||
<span class="text-xs text-muted-foreground">{{ $t("composePublishedPorts") }}</span>
|
||||
<UiBadge v-for="port in portLabels" :key="port.display" :as-child="Boolean(port.url)" variant="secondary">
|
||||
<a v-if="port.url" :href="port.url" target="_blank" rel="noopener noreferrer">{{ port.display }}</a>
|
||||
<template v-else>{{ port.display }}</template>
|
||||
</UiBadge>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<Collapsible v-if="!isEditMode && statsInstances.length" class="border-t pt-2">
|
||||
<CollapsibleTrigger as-child>
|
||||
@ -60,30 +69,13 @@
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
|
||||
<div v-if="isEditMode && showConfig" class="grid gap-4 border-t pt-3">
|
||||
<div class="grid gap-1.5">
|
||||
<UiLabel :for="name + '-image'">{{ $t("dockerImage") }}</UiLabel>
|
||||
<UiInput :id="name + '-image'" v-model="service.image" />
|
||||
</div>
|
||||
<div class="grid gap-1.5">
|
||||
<UiLabel :for="name + '-restart'">{{ $t("restartPolicy") }}</UiLabel>
|
||||
<UiNativeSelect :id="name + '-restart'" :model-value="service.restart || 'no'" class="w-full" @update:model-value="service.restart = $event">
|
||||
<option value="always">{{ $t("restartPolicyAlways") }}</option>
|
||||
<option value="unless-stopped">{{ $t("restartPolicyUnlessStopped") }}</option>
|
||||
<option value="on-failure">{{ $t("restartPolicyOnFailure") }}</option>
|
||||
<option value="no">{{ $t("restartPolicyNo") }}</option>
|
||||
</UiNativeSelect>
|
||||
</div>
|
||||
<div v-for="field in listFields" :key="field.name" class="grid gap-1.5">
|
||||
<p class="text-sm font-medium">{{ field.plural ? $tc(field.label, 2) : $t(field.label) }}</p>
|
||||
<ArrayInput :name="field.name" :display-name="$t(field.label)" :placeholder="field.placeholder || $t('containerName')" />
|
||||
</div>
|
||||
<div class="grid gap-1.5">
|
||||
<p class="text-sm font-medium">{{ $tc("network", 2) }}</p>
|
||||
<UiAlert v-if="!networkList.length && service.networks?.length">{{ $t("NoNetworksAvailable") }}</UiAlert>
|
||||
<ArraySelect name="networks" :display-name="$t('network')" :options="networkList" />
|
||||
</div>
|
||||
</div>
|
||||
<template v-if="!isEditMode">
|
||||
<ContainerDetails
|
||||
v-for="instance in instances.filter(item => /^[0-9a-f]{64}$/.test(item.id || ''))" :id="instance.id" :key="instance.id"
|
||||
:endpoint="endpoint" :label="instances.length > 1 ? instance.name : ''"
|
||||
/>
|
||||
</template>
|
||||
<ServiceEditor v-if="isEditMode && showConfig" class="border-t pt-3" :service="service" @change="changeField" />
|
||||
</CardContent>
|
||||
</UiCard>
|
||||
</template>
|
||||
@ -91,18 +83,15 @@
|
||||
<script>
|
||||
import { defineComponent } from "vue";
|
||||
import { parseDockerPort } from "../../../common/util-common";
|
||||
import ArrayInput from "./ArrayInput.vue";
|
||||
import ArraySelect from "./ArraySelect.vue";
|
||||
import DockerStat from "./DockerStat.vue";
|
||||
import ServiceEditor from "./ServiceEditor.vue";
|
||||
import ContainerDetails from "./ContainerDetails.vue";
|
||||
|
||||
export default defineComponent({
|
||||
components: { ArrayInput,
|
||||
ArraySelect,
|
||||
DockerStat },
|
||||
components: { DockerStat,
|
||||
ServiceEditor,
|
||||
ContainerDetails },
|
||||
inject: [ "composePage" ],
|
||||
provide() {
|
||||
return { containerEditor: this };
|
||||
},
|
||||
props: {
|
||||
name: {
|
||||
type: String,
|
||||
@ -113,7 +102,7 @@ export default defineComponent({
|
||||
default: false,
|
||||
},
|
||||
serviceStatus: {
|
||||
type: Object,
|
||||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
dockerStats: {
|
||||
@ -128,40 +117,37 @@ export default defineComponent({
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
showConfig: false,
|
||||
listFields: [
|
||||
{ name: "ports",
|
||||
label: "port",
|
||||
placeholder: "HOST:CONTAINER",
|
||||
plural: true },
|
||||
{ name: "volumes",
|
||||
label: "volume",
|
||||
placeholder: "HOST:CONTAINER",
|
||||
plural: true },
|
||||
{ name: "environment",
|
||||
label: "environmentVariable",
|
||||
placeholder: "KEY=VALUE",
|
||||
plural: true },
|
||||
{ name: "depends_on",
|
||||
label: "dependsOn" },
|
||||
],
|
||||
showConfig: this.composePage.serviceNames.length === 1,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
|
||||
networkList() {
|
||||
let list = [];
|
||||
for (const networkName in this.jsonObject.networks) {
|
||||
list.push(networkName);
|
||||
}
|
||||
return list;
|
||||
},
|
||||
|
||||
fileTargets() {
|
||||
return (this.serviceStatus || []).filter(instance => instance.state === "running" && /^[0-9a-f]{64}$/.test(instance.id || ""));
|
||||
return this.instances.filter(instance => instance.state === "running" && /^[0-9a-f]{64}$/.test(instance.id || ""));
|
||||
},
|
||||
instances() {
|
||||
return this.serviceStatus || [];
|
||||
},
|
||||
portLabels() {
|
||||
const published = this.instances.flatMap(instance => (instance.ports || []).filter(port => port.PublishedPort > 0)
|
||||
.map(port => {
|
||||
const protocol = port.Protocol || "tcp";
|
||||
const bind = port.URL && ![ "0.0.0.0", "::" ].includes(port.URL) ? port.URL : "";
|
||||
const address = bind.includes(":") ? `[${bind}]` : bind;
|
||||
const display = `${address ? address + ":" : ""}${port.PublishedPort} → ${port.TargetPort}/${protocol}`;
|
||||
const url = protocol === "tcp" && instance.state === "running" ? this.parsePort(`${port.PublishedPort}:${port.TargetPort}`).url : "";
|
||||
return { display,
|
||||
url };
|
||||
}));
|
||||
const configured = Array.isArray(this.envsubstService.ports) ? this.envsubstService.ports.filter(port => port != null) : [];
|
||||
const ports = published.length ? published : configured.map(port => ({
|
||||
display: typeof port === "object" ? [ port.host_ip, port.published, port.target ].filter(Boolean).join(":") + (port.protocol ? "/" + port.protocol : "") : String(port),
|
||||
url: "",
|
||||
}));
|
||||
return Array.from(new Map(ports.map(port => [ port.display, port ])).values());
|
||||
},
|
||||
shellAvailable() {
|
||||
return this.status === "running" || this.status === "healthy";
|
||||
return this.instances.some(instance => instance.state === "running");
|
||||
},
|
||||
terminalRouteLink() {
|
||||
if (this.endpoint) {
|
||||
@ -231,7 +217,16 @@ export default defineComponent({
|
||||
.sort((a, b) => a.Name.localeCompare(b.Name));
|
||||
},
|
||||
status() {
|
||||
return this.serviceStatus?.[0]?.status ?? "N/A";
|
||||
if (!this.instances.length) {
|
||||
return "notCreated";
|
||||
}
|
||||
if (this.instances.some(instance => instance.status === "unhealthy")) {
|
||||
return "unhealthy";
|
||||
}
|
||||
if (this.instances.some(instance => instance.status !== this.instances[0].status)) {
|
||||
return "mixed";
|
||||
}
|
||||
return this.instances[0].status;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -249,7 +244,18 @@ export default defineComponent({
|
||||
}
|
||||
},
|
||||
remove() {
|
||||
delete this.jsonObject.services[this.name];
|
||||
const services = { ...this.jsonObject.services };
|
||||
delete services[this.name];
|
||||
this.jsonObject.services = services;
|
||||
},
|
||||
changeField(key, value) {
|
||||
const service = { ...this.service,
|
||||
[key]: value };
|
||||
if (value === undefined) {
|
||||
delete service[key];
|
||||
}
|
||||
this.jsonObject.services = { ...this.jsonObject.services,
|
||||
[this.name]: service };
|
||||
},
|
||||
startService() {
|
||||
this.$emit("start-service", this.name);
|
||||
|
||||
135
frontend/src/components/ContainerDetails.vue
Normal file
135
frontend/src/components/ContainerDetails.vue
Normal file
@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<Collapsible v-model:open="open" class="grid gap-2">
|
||||
<CollapsibleTrigger as-child>
|
||||
<UiButton type="button" size="sm" variant="ghost" class="group w-fit">
|
||||
<AppIcon name="caret-down" class="group-data-[state=closed]:-rotate-90" />
|
||||
{{ label || $t("containerDetails") }}
|
||||
</UiButton>
|
||||
</CollapsibleTrigger>
|
||||
<CollapsibleContent class="grid gap-3 rounded-md border bg-muted/20 p-3">
|
||||
<p v-if="loading" role="status" class="text-sm text-muted-foreground">{{ $t("resourceLoading") }}</p>
|
||||
<UiAlert v-else-if="error" variant="destructive">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<span>{{ $t(error) }}</span>
|
||||
<UiButton type="button" size="sm" variant="outline" @click="load">{{ $t("resourceRefresh") }}</UiButton>
|
||||
</div>
|
||||
</UiAlert>
|
||||
<template v-else-if="details">
|
||||
<dl class="grid gap-x-4 gap-y-2 text-sm sm:grid-cols-2 xl:grid-cols-3">
|
||||
<div v-for="[key, value] in facts" :key="key" class="min-w-0">
|
||||
<dt class="text-xs text-muted-foreground">{{ $t(key) }}</dt>
|
||||
<dd class="break-all">{{ value }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div v-if="Object.keys(details.networks || {}).length" class="grid gap-1.5 border-t pt-2">
|
||||
<h4 class="section-title">{{ $t("composeNetworks") }}</h4>
|
||||
<ul class="grid gap-1 text-sm">
|
||||
<li v-for="(network, name) in details.networks" :key="name" class="break-all">
|
||||
{{ name }} <code v-if="network.ipv4 || network.ipv6" class="text-xs text-muted-foreground">{{ [network.ipv4, network.ipv6].filter(Boolean).join(' · ') }}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="details.mounts?.length" class="grid gap-1.5 border-t pt-2">
|
||||
<h4 class="section-title">{{ $t("composeMounts") }}</h4>
|
||||
<ul class="grid gap-1 text-sm">
|
||||
<li v-for="mount in details.mounts" :key="mount.target" class="flex flex-wrap items-center gap-x-2 gap-y-1 break-all">
|
||||
<code class="text-xs">{{ mount.target }}</code>
|
||||
<span class="text-muted-foreground">{{ mount.name || mount.type }}</span>
|
||||
<UiBadge variant="outline">{{ $t(mount.writable ? "composeWritable" : "composeReadOnly") }}</UiBadge>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
</CollapsibleContent>
|
||||
</Collapsible>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
id: { type: String,
|
||||
required: true },
|
||||
endpoint: { type: String,
|
||||
default: "" },
|
||||
label: { type: String,
|
||||
default: "" },
|
||||
},
|
||||
data() {
|
||||
return { open: false,
|
||||
loading: false,
|
||||
error: "",
|
||||
details: null,
|
||||
generation: 0 };
|
||||
},
|
||||
computed: {
|
||||
facts() {
|
||||
const details = this.details;
|
||||
const numbers = new Intl.NumberFormat(this.$i18n.locale, { maximumFractionDigits: 2 });
|
||||
return [
|
||||
[ "containerImageId", details.imageId ],
|
||||
[ "containerIdentifier", this.id ],
|
||||
[ "composePlatform", details.platform ],
|
||||
[ "containerCreated", this.formatDate(details.created) ],
|
||||
[ "containerStarted", this.formatDate(details.started) ],
|
||||
[ "containerFinished", this.formatDate(details.finished) ],
|
||||
[ "containerHealth", details.health ? this.$t("resourceContainerState." + details.health, details.health) : "" ],
|
||||
[ "containerExitCode", details.state === "exited" || details.state === "dead" ? details.exitCode : "" ],
|
||||
[ "containerRestarts", details.restartCount ],
|
||||
[ "restartPolicy", details.restartPolicy ],
|
||||
[ "composeCpuLimit", details.nanoCpus ? numbers.format(details.nanoCpus / 1e9) : "" ],
|
||||
[ "composeMemoryLimit", details.memoryBytes ? numbers.format(details.memoryBytes / 1048576) + " MiB" : "" ],
|
||||
].filter(([ , value ]) => value !== "" && value != null);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
open(value) {
|
||||
if (value) {
|
||||
this.load();
|
||||
}
|
||||
},
|
||||
id: "reset",
|
||||
endpoint: "reset",
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.generation++;
|
||||
},
|
||||
methods: {
|
||||
formatDate(value) {
|
||||
const date = new Date(value);
|
||||
return Number.isFinite(date.getTime()) && date.getFullYear() > 1 ? date.toLocaleString(this.$i18n.locale) : "";
|
||||
},
|
||||
reset() {
|
||||
this.generation++;
|
||||
this.details = null;
|
||||
this.loading = false;
|
||||
this.error = "";
|
||||
if (this.open) {
|
||||
this.load();
|
||||
}
|
||||
},
|
||||
async load() {
|
||||
const generation = ++this.generation;
|
||||
this.loading = true;
|
||||
this.error = "";
|
||||
try {
|
||||
const response = await this.$root.getSocket().timeout(20000).emitWithAck("agent", this.endpoint, "getHostContainerDetails", this.id);
|
||||
if (generation === this.generation) {
|
||||
if (response.ok) {
|
||||
this.details = response.details;
|
||||
} else {
|
||||
this.error = response.msg || "containerDetailsFailed";
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
if (generation === this.generation) {
|
||||
this.error = "containerDetailsFailed";
|
||||
}
|
||||
} finally {
|
||||
if (generation === this.generation) {
|
||||
this.loading = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
96
frontend/src/components/HostAttention.vue
Normal file
96
frontend/src/components/HostAttention.vue
Normal file
@ -0,0 +1,96 @@
|
||||
<template>
|
||||
<UiCard>
|
||||
<CardHeader class="flex flex-wrap items-center justify-between gap-2">
|
||||
<CardTitle>{{ $t("deployAttentionTitle") }}</CardTitle>
|
||||
<UiButton type="button" variant="outline" size="sm" :disabled="loading" @click="load">
|
||||
<AppIcon name="restart" /> {{ $t("resourceRefresh") }}
|
||||
</UiButton>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p v-if="loading && !items.length" role="status" class="text-sm text-muted-foreground">{{ $t("resourceLoading") }}</p>
|
||||
<p v-else-if="!items.length" class="text-sm text-muted-foreground">{{ $t("deployAttentionEmpty") }}</p>
|
||||
<ul v-else class="divide-y">
|
||||
<li v-for="(item, index) in items" :key="index">
|
||||
<router-link :to="destination(item)" class="flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md p-2 hover:bg-muted/50">
|
||||
<span class="min-w-0 flex-1">
|
||||
<span class="block break-words text-sm font-medium">{{ item.container || item.stack || hostName(item.endpoint) }}</span>
|
||||
<span class="text-xs text-muted-foreground">{{ $t(item.kind, { count: item.count || 0 }) }} · {{ hostName(item.endpoint) }}</span>
|
||||
</span>
|
||||
<AppIcon name="caret-right" class="size-4 text-muted-foreground" />
|
||||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
</CardContent>
|
||||
</UiCard>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return { remoteItems: [],
|
||||
loading: false,
|
||||
timer: null,
|
||||
generation: 0 };
|
||||
},
|
||||
computed: {
|
||||
items() {
|
||||
const offline = Object.entries(this.$root.agentStatusList).filter(([ endpoint, state ]) => endpoint && state === "offline")
|
||||
.map(([ endpoint ]) => ({ endpoint,
|
||||
kind: "deployAttentionOffline" }));
|
||||
return [ ...offline, ...this.remoteItems ];
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.load();
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.generation++;
|
||||
clearTimeout(this.timer);
|
||||
},
|
||||
methods: {
|
||||
hostName(endpoint) {
|
||||
return this.$root.endpointDisplayFunction(endpoint) || this.$t("stackListLocal");
|
||||
},
|
||||
destination(item) {
|
||||
const suffix = item.endpoint ? "/" + encodeURIComponent(item.endpoint) : "";
|
||||
if (item.resource) {
|
||||
return { path: "/settings/" + item.resource,
|
||||
query: { host: item.endpoint || undefined } };
|
||||
}
|
||||
if (item.stack && this.$root.completeStackList[item.stack + "_" + item.endpoint]?.isManagedByDockge
|
||||
|| item.stack && [ "deployAttentionApproval", "deployAttentionFailed" ].includes(item.kind)) {
|
||||
const review = [ "deployAttentionApproval", "deployAttentionFailed" ].includes(item.kind);
|
||||
return { path: "/compose/" + encodeURIComponent(item.stack) + suffix,
|
||||
query: review ? { review: "1" } : { tab: item.container ? "logs" : "maintenance" } };
|
||||
}
|
||||
return item.container ? { path: "/containers",
|
||||
query: { host: item.endpoint || undefined,
|
||||
search: item.container } } : "/#dockge-agents";
|
||||
},
|
||||
async load() {
|
||||
if (this.loading) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(this.timer);
|
||||
const generation = ++this.generation;
|
||||
this.loading = true;
|
||||
try {
|
||||
const endpoints = [ "", ...Object.entries(this.$root.agentStatusList).filter(([ host, state ]) => host && state === "online").map(([ host ]) => host) ];
|
||||
const responses = await Promise.allSettled(endpoints.map(async endpoint => {
|
||||
const result = await this.$root.getSocket().timeout(10000).emitWithAck("agent", endpoint, "getHostAttention");
|
||||
return result.ok ? result.items.map(item => ({ ...item,
|
||||
endpoint })) : [];
|
||||
}));
|
||||
if (generation === this.generation) {
|
||||
this.remoteItems = responses.flatMap(result => result.status === "fulfilled" ? result.value : []);
|
||||
}
|
||||
} finally {
|
||||
if (generation === this.generation) {
|
||||
this.loading = false;
|
||||
this.timer = setTimeout(() => this.load(), 30000);
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -8,7 +8,12 @@
|
||||
</div>
|
||||
<div class="grid gap-2">
|
||||
<UiLabel for="login-password">{{ $t("Password") }}</UiLabel>
|
||||
<UiInput id="login-password" v-model="password" type="password" autocomplete="current-password" required />
|
||||
<div class="flex gap-2">
|
||||
<UiInput id="login-password" v-model="password" :type="showPassword ? 'text' : 'password'" autocomplete="current-password" required />
|
||||
<UiButton type="button" variant="outline" size="icon" :aria-label="$t('Password')" :aria-pressed="showPassword" @click="showPassword = !showPassword">
|
||||
<AppIcon :name="showPassword ? 'eye-off' : 'eye'" />
|
||||
</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="grid gap-2">
|
||||
@ -35,6 +40,7 @@ export default {
|
||||
processing: false,
|
||||
username: "",
|
||||
password: "",
|
||||
showPassword: false,
|
||||
token: "",
|
||||
res: null,
|
||||
tokenRequired: false,
|
||||
|
||||
@ -1,182 +1,104 @@
|
||||
<template>
|
||||
<div class="grid gap-4">
|
||||
<section class="grid gap-2">
|
||||
<h3 class="text-sm font-medium">{{ $t("Internal Networks") }}</h3>
|
||||
<ul class="grid gap-1.5">
|
||||
<li v-for="(networkRow, index) in networkList" :key="index" class="flex gap-1.5">
|
||||
<UiInput v-model="networkRow.key" :aria-label="$t('Network name...')" :placeholder="$t('Network name...')" />
|
||||
<UiButton type="button" variant="ghost" size="icon" class="text-destructive" :aria-label="$t('removeEntry')" @click="remove(index)"><AppIcon name="x" /></UiButton>
|
||||
</li>
|
||||
</ul>
|
||||
<UiButton type="button" variant="outline" size="sm" class="justify-self-start" @click="addField"><AppIcon name="plus" /> {{ $t("addInternalNetwork") }}</UiButton>
|
||||
</section>
|
||||
<section class="grid gap-2 border-t pt-3">
|
||||
<h3 class="text-sm font-medium">{{ $t("External Networks") }}</h3>
|
||||
<p v-if="!externalNetworkList.length" class="text-sm text-muted-foreground">{{ $t("No External Networks") }}</p>
|
||||
<div v-for="(networkName, index) in externalNetworkList" :key="networkName" class="flex items-center gap-2">
|
||||
<UiSwitch :id="'external-network-' + index" v-model="selectedExternalList[networkName]" />
|
||||
<UiLabel :for="'external-network-' + index">{{ networkName }}</UiLabel>
|
||||
</div>
|
||||
</section>
|
||||
<ComposeCollection
|
||||
:label="$t('composeNetworks')" :model-value="networks" prefer-mapping :fields="fields"
|
||||
@update:model-value="$emit('update:modelValue', $event)"
|
||||
/>
|
||||
<div v-if="available.length" class="grid gap-1.5 border-t pt-3">
|
||||
<UiLabel for="external-network">{{ $t("External Networks") }}</UiLabel>
|
||||
<UiNativeSelect id="external-network" :model-value="''" class="w-full" @update:model-value="attach">
|
||||
<option value="">{{ $t("composeSelectNetwork") }}</option>
|
||||
<option v-for="name in available" :key="name" :value="name">{{ name }}</option>
|
||||
</UiNativeSelect>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ComposeCollection from "./ComposeCollection.vue";
|
||||
|
||||
export default {
|
||||
inject: [ "composePage" ],
|
||||
components: { ComposeCollection },
|
||||
props: {
|
||||
modelValue: { type: [ Object, Array, String, Number, Boolean ],
|
||||
default: undefined },
|
||||
endpoint: { type: String,
|
||||
default: "" },
|
||||
stackName: { type: String,
|
||||
default: "" },
|
||||
},
|
||||
emits: [ "update:modelValue" ],
|
||||
data() {
|
||||
return {
|
||||
networkList: [],
|
||||
externalList: {},
|
||||
selectedExternalList: {},
|
||||
externalNetworkList: [],
|
||||
loadingNetworkList: false,
|
||||
applyingNetworks: false,
|
||||
hostNetworks: [],
|
||||
generation: 0,
|
||||
fields: [
|
||||
{ key: "driver",
|
||||
label: "composeDriver" },
|
||||
{ key: "name",
|
||||
label: "composeEntryName" },
|
||||
{ key: "external",
|
||||
label: "composeExternal",
|
||||
kind: "boolean" },
|
||||
{ key: "internal",
|
||||
label: "composeInternalNetwork",
|
||||
kind: "boolean" },
|
||||
{ key: "attachable",
|
||||
label: "composeAttachableNetwork",
|
||||
kind: "boolean" },
|
||||
{ key: "enable_ipv6",
|
||||
label: "composeEnableIPv6",
|
||||
kind: "boolean" },
|
||||
{ key: "subnet",
|
||||
path: [ "ipam", "config", 0, "subnet" ],
|
||||
label: "composeSubnet",
|
||||
kind: "subnet",
|
||||
placeholder: "172.28.0.0/24" },
|
||||
{ key: "gateway",
|
||||
path: [ "ipam", "config", 0, "gateway" ],
|
||||
label: "composeGateway",
|
||||
placeholder: "172.28.0.1" },
|
||||
],
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
jsonConfig() {
|
||||
return this.composePage.jsonConfig;
|
||||
networks() {
|
||||
return this.modelValue;
|
||||
},
|
||||
|
||||
stack() {
|
||||
return this.composePage.stack;
|
||||
},
|
||||
|
||||
endpoint() {
|
||||
return this.composePage.endpoint;
|
||||
available() {
|
||||
if (this.networks && (typeof this.networks !== "object" || Array.isArray(this.networks))) {
|
||||
return [];
|
||||
}
|
||||
return this.hostNetworks.filter(name => ![ "none", "host", "bridge" ].includes(name)
|
||||
&& !(this.stackName && name.startsWith(this.stackName + "_")) && !Object.hasOwn(this.networks || {}, name));
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
"jsonConfig.networks": {
|
||||
handler() {
|
||||
if (!this.applyingNetworks) {
|
||||
this.loadNetworkList();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
flush: "sync",
|
||||
},
|
||||
|
||||
"selectedExternalList": {
|
||||
handler() {
|
||||
if (this.loadingNetworkList) {
|
||||
return;
|
||||
}
|
||||
for (const networkName in this.selectedExternalList) {
|
||||
const enable = this.selectedExternalList[networkName];
|
||||
|
||||
if (enable) {
|
||||
if (!this.externalList[networkName]) {
|
||||
this.externalList[networkName] = {};
|
||||
}
|
||||
this.externalList[networkName].external = true;
|
||||
} else {
|
||||
delete this.externalList[networkName];
|
||||
}
|
||||
}
|
||||
this.applyToYAML();
|
||||
},
|
||||
deep: true,
|
||||
flush: "sync",
|
||||
},
|
||||
|
||||
"networkList": {
|
||||
handler() {
|
||||
if (!this.loadingNetworkList) {
|
||||
this.applyToYAML();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
flush: "sync",
|
||||
}
|
||||
|
||||
endpoint: { handler: "load",
|
||||
immediate: true },
|
||||
},
|
||||
mounted() {
|
||||
this.loadNetworkList();
|
||||
this.loadExternalNetworkList();
|
||||
beforeUnmount() {
|
||||
this.generation++;
|
||||
},
|
||||
methods: {
|
||||
loadNetworkList() {
|
||||
this.loadingNetworkList = true;
|
||||
this.networkList = [];
|
||||
this.externalList = {};
|
||||
|
||||
for (const key in this.jsonConfig.networks) {
|
||||
let obj = {
|
||||
key: key,
|
||||
value: this.jsonConfig.networks[key],
|
||||
};
|
||||
|
||||
if (obj.value && obj.value.external) {
|
||||
this.externalList[key] = Object.assign({}, obj.value);
|
||||
} else {
|
||||
this.networkList.push(obj);
|
||||
async load() {
|
||||
const generation = ++this.generation;
|
||||
this.hostNetworks = [];
|
||||
try {
|
||||
const result = await this.$root.getSocket().timeout(10000).emitWithAck("agent", this.endpoint, "getDockerNetworkList");
|
||||
if (generation === this.generation && result.ok) {
|
||||
this.hostNetworks = result.dockerNetworkList;
|
||||
}
|
||||
} catch {
|
||||
// Existing Compose network definitions remain editable when a host is offline.
|
||||
}
|
||||
|
||||
// Restore selectedExternalList
|
||||
this.selectedExternalList = {};
|
||||
for (const networkName in this.externalList) {
|
||||
this.selectedExternalList[networkName] = true;
|
||||
}
|
||||
this.loadingNetworkList = false;
|
||||
},
|
||||
|
||||
loadExternalNetworkList() {
|
||||
this.$root.emitAgent(this.endpoint, "getDockerNetworkList", (res) => {
|
||||
if (res.ok) {
|
||||
this.externalNetworkList = res.dockerNetworkList.filter((n) => {
|
||||
// Filter out this stack networks
|
||||
if (n.startsWith(this.stack.name + "_")) {
|
||||
return false;
|
||||
}
|
||||
// They should be not supported.
|
||||
// https://docs.docker.com/compose/compose-file/06-networks/#host-or-none
|
||||
if (n === "none" || n === "host" || n === "bridge") {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
} else {
|
||||
this.$root.toastRes(res);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
addField() {
|
||||
this.networkList.push({
|
||||
key: "",
|
||||
value: {},
|
||||
});
|
||||
},
|
||||
|
||||
remove(index) {
|
||||
this.networkList.splice(index, 1);
|
||||
},
|
||||
|
||||
applyToYAML() {
|
||||
if (this.loadingNetworkList) {
|
||||
return;
|
||||
attach(name) {
|
||||
if (this.available.includes(name)) {
|
||||
this.$emit("update:modelValue", { ...this.networks,
|
||||
[name]: { external: true } });
|
||||
}
|
||||
|
||||
const networks = {};
|
||||
|
||||
// Internal networks
|
||||
for (const networkRow of this.networkList) {
|
||||
networks[networkRow.key] = networkRow.value;
|
||||
}
|
||||
|
||||
// External networks
|
||||
for (const networkName in this.externalList) {
|
||||
networks[networkName] = this.externalList[networkName];
|
||||
}
|
||||
|
||||
this.applyingNetworks = true;
|
||||
this.jsonConfig.networks = networks;
|
||||
this.applyingNetworks = false;
|
||||
}
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
391
frontend/src/components/ServiceEditor.vue
Normal file
391
frontend/src/components/ServiceEditor.vue
Normal file
@ -0,0 +1,391 @@
|
||||
<template>
|
||||
<Tabs v-model="section" class="w-full min-w-0 gap-4">
|
||||
<TabsList variant="line" class="w-full flex-wrap justify-start gap-1 group-data-horizontal/tabs:h-auto" :aria-label="$t('composeServiceFields')">
|
||||
<TabsTrigger v-for="group in groups" :key="group.key" :value="group.key" class="h-8 flex-none sm:flex-1">{{ $t(group.label) }}</TabsTrigger>
|
||||
</TabsList>
|
||||
<TabsContent v-for="group in groups" :key="group.key" :value="group.key" class="grid min-w-0 gap-4">
|
||||
<div v-for="panel in group.panels" :key="panel.label" class="grid gap-3 rounded-lg border bg-muted/20 p-3 sm:p-4">
|
||||
<h3 class="section-title">{{ $t(panel.label) }}</h3>
|
||||
<p v-if="!canEdit(panel.scope)" class="text-xs text-muted-foreground">{{ $t("composeAdvancedValue") }}</p>
|
||||
<template v-else>
|
||||
<div v-if="panel.fields" class="grid gap-3 sm:grid-cols-2">
|
||||
<template v-for="field in panel.fields" :key="field.key">
|
||||
<ComposeCollection
|
||||
v-if="field.command && Array.isArray(read(panel.scope, field.key))"
|
||||
class="sm:col-span-2" :label="$t(field.label)" :model-value="read(panel.scope, field.key)" keep-empty
|
||||
@update:model-value="write(panel.scope, field.key, $event)"
|
||||
/>
|
||||
<ComposeField
|
||||
v-else :label="$t(field.label)" :model-value="read(panel.scope, field.key)"
|
||||
:options="field.options" :kind="field.kind" :placeholder="field.placeholder" :multiline="field.command"
|
||||
@update:model-value="write(panel.scope, field.key, $event)"
|
||||
/>
|
||||
</template>
|
||||
</div>
|
||||
<template v-for="field in panel.collections" :key="field.key">
|
||||
<ComposeField
|
||||
v-if="field.scalar && typeof read(panel.scope, field.key) === 'string'"
|
||||
:label="$t(field.label)" :model-value="read(panel.scope, field.key)"
|
||||
@update:model-value="write(panel.scope, field.key, $event)"
|
||||
/>
|
||||
<ComposeCollection
|
||||
v-else :label="$t(field.label)" :model-value="read(panel.scope, field.key)"
|
||||
:hint="field.hint ? $t(field.hint) : ''" :placeholder="field.placeholder" :fields="collectionFields(field)"
|
||||
:prefer-mapping="field.mapping" :default-entry="field.defaultEntry" :suggestions="suggestions(field.key)"
|
||||
:prefer-details="Boolean(field.addLabel)" :add-label="field.addLabel ? $t(field.addLabel) : ''"
|
||||
:detail-defaults="field.detailDefaults"
|
||||
@update:model-value="write(panel.scope, field.key, $event)"
|
||||
/>
|
||||
<UiButton
|
||||
v-if="['volumes', 'networks'].includes(field.key)" type="button" variant="link" class="w-fit px-0"
|
||||
@click="composePage.workspaceTab = 'resources'"
|
||||
>
|
||||
{{ $t(field.key === "volumes" ? "composeDefineVolume" : "composeDefineSubnet") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
</template>
|
||||
</div>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ComposeField from "./ComposeField.vue";
|
||||
import ComposeCollection from "./ComposeCollection.vue";
|
||||
|
||||
const groups = [
|
||||
{ key: "general",
|
||||
label: "general",
|
||||
panels: [
|
||||
{ label: "composeIdentity",
|
||||
fields: [
|
||||
{ key: "image",
|
||||
label: "dockerImage",
|
||||
placeholder: "nginx:alpine" },
|
||||
{ key: "container_name",
|
||||
label: "composeContainerName" },
|
||||
{ key: "hostname",
|
||||
label: "composeHostname" },
|
||||
{ key: "platform",
|
||||
label: "composePlatform",
|
||||
placeholder: "linux/amd64" },
|
||||
{ key: "restart",
|
||||
label: "restartPolicy",
|
||||
options: [ "no", "always", "on-failure", "unless-stopped" ] },
|
||||
{ key: "pull_policy",
|
||||
label: "composePullPolicy",
|
||||
options: [ "always", "missing", "never", "build", "daily", "weekly" ] },
|
||||
] },
|
||||
{ label: "composeBuild",
|
||||
scope: "build",
|
||||
fields: [
|
||||
{ key: "context",
|
||||
label: "composeBuildContext",
|
||||
placeholder: "." },
|
||||
{ key: "dockerfile",
|
||||
label: "composeDockerfile",
|
||||
placeholder: "Dockerfile" },
|
||||
{ key: "target",
|
||||
label: "composeBuildTarget" },
|
||||
],
|
||||
collections: [
|
||||
{ key: "args",
|
||||
label: "composeBuildArgs",
|
||||
mapping: true },
|
||||
] },
|
||||
] },
|
||||
{ key: "network",
|
||||
label: "composeNetwork",
|
||||
panels: [
|
||||
{ label: "composeConnectivity",
|
||||
fields: [
|
||||
{ key: "network_mode",
|
||||
label: "composeNetworkMode",
|
||||
placeholder: "bridge" },
|
||||
],
|
||||
collections: [
|
||||
{ key: "ports",
|
||||
label: "composePublishedPorts",
|
||||
addLabel: "composePublishPort",
|
||||
placeholder: "127.0.0.1:8080:80",
|
||||
fields: [
|
||||
{ key: "target",
|
||||
label: "composeTargetPort",
|
||||
kind: "port" },
|
||||
{ key: "published",
|
||||
label: "composeHostPort",
|
||||
kind: "port-range" },
|
||||
{ key: "host_ip",
|
||||
label: "composeBindAddress" },
|
||||
{ key: "protocol",
|
||||
label: "composeProtocol",
|
||||
options: [ "tcp", "udp" ] },
|
||||
{ key: "name",
|
||||
label: "composeEntryName" },
|
||||
] },
|
||||
{ key: "expose",
|
||||
label: "composeExposedPorts",
|
||||
placeholder: "80/tcp" },
|
||||
{ key: "networks",
|
||||
label: "composeNetworks",
|
||||
hint: "composeNetworksHint",
|
||||
mapping: true,
|
||||
fields: [
|
||||
{ key: "ipv4_address",
|
||||
label: "composeIPv4" },
|
||||
{ key: "ipv6_address",
|
||||
label: "composeIPv6" },
|
||||
] },
|
||||
{ key: "extra_hosts",
|
||||
label: "composeExtraHosts",
|
||||
placeholder: "host.docker.internal:host-gateway" },
|
||||
{ key: "dns",
|
||||
label: "composeDns",
|
||||
placeholder: "1.1.1.1",
|
||||
scalar: true },
|
||||
] },
|
||||
] },
|
||||
{ key: "storage",
|
||||
label: "composeStorage",
|
||||
panels: [
|
||||
{ label: "composeMounts",
|
||||
fields: [
|
||||
{ key: "read_only",
|
||||
label: "composeReadOnlyRoot",
|
||||
kind: "boolean" },
|
||||
],
|
||||
collections: [
|
||||
{ key: "volumes",
|
||||
label: "composeMounts",
|
||||
addLabel: "composeAddMount",
|
||||
detailDefaults: { type: "volume" },
|
||||
hint: "composeMountsHint",
|
||||
placeholder: "data:/var/lib/app",
|
||||
fields: [
|
||||
{ key: "type",
|
||||
label: "composeMountType",
|
||||
options: [ "volume", "bind", "tmpfs", "image", "npipe" ] },
|
||||
{ key: "source",
|
||||
label: "composeMountSource" },
|
||||
{ key: "target",
|
||||
label: "composeMountTarget",
|
||||
placeholder: "/var/lib/app" },
|
||||
{ key: "read_only",
|
||||
label: "composeReadOnly",
|
||||
kind: "boolean" },
|
||||
] },
|
||||
{ key: "tmpfs",
|
||||
label: "composeTmpfs",
|
||||
placeholder: "/tmp",
|
||||
scalar: true },
|
||||
] },
|
||||
] },
|
||||
{ key: "environment",
|
||||
label: "composeEnvironment",
|
||||
panels: [
|
||||
{ label: "composeEnvironment",
|
||||
collections: [
|
||||
{ key: "environment",
|
||||
label: "composeEnvironmentVariables",
|
||||
placeholder: "KEY=value",
|
||||
mapping: true,
|
||||
defaultEntry: null },
|
||||
{ key: "env_file",
|
||||
label: "composeEnvironmentFiles",
|
||||
placeholder: ".env",
|
||||
scalar: true,
|
||||
fields: [
|
||||
{ key: "path",
|
||||
label: "containerFilePath" },
|
||||
{ key: "required",
|
||||
label: "composeRequired",
|
||||
kind: "boolean" },
|
||||
{ key: "format",
|
||||
label: "composeEnvFileFormat",
|
||||
options: [ "raw" ] },
|
||||
] },
|
||||
{ key: "labels",
|
||||
label: "composeLabels",
|
||||
mapping: true },
|
||||
{ key: "profiles",
|
||||
label: "composeProfiles",
|
||||
placeholder: "dev" },
|
||||
] },
|
||||
] },
|
||||
{ key: "lifecycle",
|
||||
label: "composeLifecycle",
|
||||
panels: [
|
||||
{ label: "composeProcess",
|
||||
fields: [
|
||||
{ key: "command",
|
||||
label: "composeCommand",
|
||||
command: true },
|
||||
{ key: "entrypoint",
|
||||
label: "composeEntrypoint",
|
||||
command: true },
|
||||
{ key: "user",
|
||||
label: "composeUser",
|
||||
placeholder: "1000:1000" },
|
||||
{ key: "working_dir",
|
||||
label: "composeWorkingDirectory",
|
||||
placeholder: "/app" },
|
||||
{ key: "init",
|
||||
label: "composeInit",
|
||||
kind: "boolean" },
|
||||
{ key: "tty",
|
||||
label: "composeTty",
|
||||
kind: "boolean" },
|
||||
{ key: "stop_signal",
|
||||
label: "composeStopSignal",
|
||||
placeholder: "SIGTERM" },
|
||||
{ key: "stop_grace_period",
|
||||
label: "composeStopGracePeriod",
|
||||
placeholder: "30s" },
|
||||
],
|
||||
collections: [
|
||||
{ key: "depends_on",
|
||||
label: "composeDependencies",
|
||||
detailDefaults: { condition: "service_started" },
|
||||
hint: "composeDependenciesHint",
|
||||
mapping: true,
|
||||
fields: [
|
||||
{ key: "condition",
|
||||
label: "composeDependencyCondition",
|
||||
options: [ "service_started", "service_healthy", "service_completed_successfully" ] },
|
||||
{ key: "restart",
|
||||
label: "restartStack",
|
||||
kind: "boolean" },
|
||||
{ key: "required",
|
||||
label: "composeRequired",
|
||||
kind: "boolean" },
|
||||
] },
|
||||
] },
|
||||
{ label: "composeHealthcheck",
|
||||
scope: "healthcheck",
|
||||
fields: [
|
||||
{ key: "test",
|
||||
label: "composeHealthcheckCommand",
|
||||
command: true },
|
||||
{ key: "disable",
|
||||
label: "composeHealthcheckDisabled",
|
||||
kind: "boolean" },
|
||||
{ key: "interval",
|
||||
label: "composeHealthcheckInterval",
|
||||
placeholder: "30s" },
|
||||
{ key: "timeout",
|
||||
label: "composeHealthcheckTimeout",
|
||||
placeholder: "5s" },
|
||||
{ key: "retries",
|
||||
label: "composeHealthcheckRetries",
|
||||
kind: "number",
|
||||
placeholder: "3" },
|
||||
{ key: "start_period",
|
||||
label: "composeHealthcheckStartPeriod",
|
||||
placeholder: "10s" },
|
||||
] },
|
||||
] },
|
||||
{ key: "resources",
|
||||
label: "composeResourceLimits",
|
||||
panels: [
|
||||
{ label: "composeResourceLimits",
|
||||
fields: [
|
||||
{ key: "cpus",
|
||||
label: "composeCpuLimit",
|
||||
kind: "number",
|
||||
placeholder: "0.5" },
|
||||
{ key: "mem_limit",
|
||||
label: "composeMemoryLimit",
|
||||
placeholder: "512m" },
|
||||
{ key: "mem_reservation",
|
||||
label: "composeMemoryReservation",
|
||||
placeholder: "128m" },
|
||||
{ key: "pids_limit",
|
||||
label: "composePidLimit",
|
||||
kind: "number",
|
||||
placeholder: "128" },
|
||||
{ key: "shm_size",
|
||||
label: "composeSharedMemory",
|
||||
placeholder: "64m" },
|
||||
] },
|
||||
{ label: "composeDeployment",
|
||||
scope: "deploy",
|
||||
fields: [
|
||||
{ key: "replicas",
|
||||
label: "composeReplicas",
|
||||
kind: "number",
|
||||
placeholder: "1" },
|
||||
] },
|
||||
{ label: "composeLogging",
|
||||
scope: "logging",
|
||||
fields: [
|
||||
{ key: "driver",
|
||||
label: "composeDriver",
|
||||
placeholder: "json-file" },
|
||||
],
|
||||
collections: [
|
||||
{ key: "options",
|
||||
label: "composeLoggingOptions",
|
||||
mapping: true },
|
||||
] },
|
||||
] },
|
||||
];
|
||||
|
||||
export default {
|
||||
components: { ComposeField,
|
||||
ComposeCollection },
|
||||
inject: [ "composePage" ],
|
||||
props: { service: { type: Object,
|
||||
required: true } },
|
||||
emits: [ "change" ],
|
||||
data() {
|
||||
return { section: "general",
|
||||
groups };
|
||||
},
|
||||
methods: {
|
||||
collectionFields(field) {
|
||||
if (field.key !== "volumes") {
|
||||
return field.fields;
|
||||
}
|
||||
const suggestions = Object.keys(this.composePage.jsonConfig.volumes || {});
|
||||
return field.fields.map(item => item.key === "source" ? { ...item,
|
||||
suggestions } : item);
|
||||
},
|
||||
canEdit(scope) {
|
||||
const value = this.service[scope];
|
||||
return !scope || value == null || (scope === "build" && typeof value === "string")
|
||||
|| (typeof value === "object" && !Array.isArray(value));
|
||||
},
|
||||
suggestions(key) {
|
||||
if (key === "networks") {
|
||||
return [ ...new Set([ "default", ...Object.keys(this.composePage.jsonConfig.networks || {}) ]) ];
|
||||
}
|
||||
if (key === "depends_on") {
|
||||
return this.composePage.serviceNames.filter(name => this.composePage.jsonConfig.services[name] !== this.service);
|
||||
}
|
||||
return [];
|
||||
},
|
||||
sectionValues(scope) {
|
||||
const value = this.service[scope];
|
||||
if (scope === "build" && typeof value === "string") {
|
||||
return { context: value };
|
||||
}
|
||||
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
||||
},
|
||||
read(scope, key) {
|
||||
return (scope ? this.sectionValues(scope) : this.service)[key];
|
||||
},
|
||||
write(scope, key, value) {
|
||||
if (!scope) {
|
||||
this.$emit("change", key, value);
|
||||
return;
|
||||
}
|
||||
const next = { ...this.sectionValues(scope),
|
||||
[key]: value };
|
||||
if (value === undefined) {
|
||||
delete next[key];
|
||||
}
|
||||
this.$emit("change", scope, Object.keys(next).length ? next : undefined);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -12,12 +12,6 @@
|
||||
<span v-if="envErrorCount" class="text-destructive">{{ envErrorCount }}</span>
|
||||
</TabsTrigger>
|
||||
</TabsList>
|
||||
<div class="flex flex-wrap items-center gap-0.5">
|
||||
<UiButton type="button" variant="ghost" size="sm" @click="find">{{ $t("editorFind") }}</UiButton>
|
||||
<UiButton v-if="editable && activeFile === 'yaml'" type="button" variant="ghost" size="sm" :disabled="disabled || yamlErrorCount > 0" @click="formatYAML">{{ $t("editorFormat") }}</UiButton>
|
||||
<UiButton type="button" variant="ghost" size="sm" :aria-pressed="wrap" @click="wrap = !wrap">{{ $t("editorWrap") }}</UiButton>
|
||||
<UiButton v-if="fullscreenAvailable" type="button" variant="ghost" size="sm" :aria-pressed="fullscreen" @click="toggleFullscreen">{{ $t(fullscreen ? "editorExitFullscreen" : "editorFullscreen") }}</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<TabsContent value="yaml" class="config-tab-content">
|
||||
|
||||
251
frontend/src/components/StackDeployments.vue
Normal file
251
frontend/src/components/StackDeployments.vue
Normal file
@ -0,0 +1,251 @@
|
||||
<template>
|
||||
<div v-if="pending || (managed && history.length)" class="flex flex-wrap items-center gap-2">
|
||||
<UiButton v-if="pending" variant="secondary" size="sm" @click="reviewOpen = true">
|
||||
<AppIcon name="rocket" /> {{ $t("deploymentPhase." + pending.phase) }}
|
||||
</UiButton>
|
||||
<UiButton v-if="history.length" variant="outline" size="sm" @click="historyOpen = true">
|
||||
{{ $t("deployHistory") }}
|
||||
</UiButton>
|
||||
</div>
|
||||
|
||||
<Dialog v-model:open="reviewOpen">
|
||||
<DialogContent class="max-h-[90dvh] overflow-y-auto sm:max-w-3xl" :close-label="$t('Close')" :aria-describedby="undefined">
|
||||
<DialogHeader><DialogTitle>{{ $t("deployReview") }}</DialogTitle></DialogHeader>
|
||||
<p v-if="busy && !review" role="status">{{ $t("resourceLoading") }}</p>
|
||||
<UiAlert v-if="error" variant="destructive">{{ $t(error) }}</UiAlert>
|
||||
<template v-if="review">
|
||||
<p role="status" class="text-sm font-medium">{{ $t("deploymentPhase." + review.phase) }}</p>
|
||||
<UiAlert v-if="review.error" variant="destructive">
|
||||
{{ $t(review.error) }}
|
||||
<code v-if="review.field" class="break-all">{{ review.field }}</code>
|
||||
</UiAlert>
|
||||
<p v-if="review.notBefore && delayed" class="text-sm text-muted-foreground">{{ $t("deployAvailableAt", { time: formatTime(review.notBefore) }) }}</p>
|
||||
<p v-if="review.phase === 'ready'" class="text-sm text-muted-foreground">{{ $t("deployApprovalPrompt") }}</p>
|
||||
<p v-if="review.phase === 'rejected' && review.cleanup" class="text-sm text-muted-foreground">{{ $t("deployRejectResult", review.cleanup) }}</p>
|
||||
<ul v-if="review.progress?.length" class="flex flex-wrap gap-1">
|
||||
<li v-for="(item, index) in review.progress" :key="index">
|
||||
<UiBadge variant="outline" class="status-badge" :data-status="item.health || item.state">
|
||||
{{ item.service }} · {{ $t("resourceContainerState." + (item.health || item.state), item.health || item.state) }}
|
||||
</UiBadge>
|
||||
</li>
|
||||
</ul>
|
||||
<div v-if="review.changes.length" class="grid gap-1">
|
||||
<h3 class="section-title">{{ $t("deployChanges") }}</h3>
|
||||
<ul class="divide-y rounded-lg border">
|
||||
<li v-for="(change, index) in review.changes" :key="index" class="flex flex-wrap items-center gap-2 p-2">
|
||||
<div class="min-w-0 flex-1 basis-36">
|
||||
<p class="break-all text-sm font-medium">{{ change.name }}</p>
|
||||
<code v-if="change.reference" class="break-all text-xs text-muted-foreground">
|
||||
{{ change.reference }}
|
||||
<span v-if="change.imageId">· <template v-if="change.previousImageIds?.length">{{ change.previousImageIds.map(id => id.slice(7, 19)).join(", ") }} → </template>{{ change.imageId.slice(7, 19) }}</span>
|
||||
</code>
|
||||
</div>
|
||||
<UiBadge variant="outline">{{ $t("deploymentChange." + change.action) }}</UiBadge>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div v-if="review.scans.length" class="grid gap-2">
|
||||
<h3 class="section-title">{{ $t("imageScanTitle") }}</h3>
|
||||
<div v-for="scan in review.scans" :key="scan.id" class="grid gap-2 rounded-lg border p-2.5">
|
||||
<p class="break-all font-mono text-xs">{{ scan.references.join(", ") || scan.id }}</p>
|
||||
<p v-if="scan.error" class="text-sm text-destructive">{{ $t(scan.error) }}</p>
|
||||
<p v-if="scan.databaseBuiltAt" class="text-xs text-muted-foreground">{{ $t("imageScanDatabase", { time: formatTime(scan.databaseBuiltAt) }) }}</p>
|
||||
<div v-if="scan.counts" class="flex flex-wrap gap-1">
|
||||
<UiBadge v-for="(count, severity) in scan.counts" :key="severity" variant="outline" class="severity-badge" :data-severity="severity">
|
||||
{{ $t("imageScanSeverity." + severity) }} {{ count }}
|
||||
</UiBadge>
|
||||
</div>
|
||||
<ul v-if="scan.findings.length" class="grid gap-1 border-t pt-2 text-xs">
|
||||
<li v-for="(finding, index) in scan.findings" :key="index" class="break-words">
|
||||
{{ finding.id }} · {{ finding.packageName }} {{ finding.installedVersion }}
|
||||
<span v-if="finding.fixedVersions.length" class="text-muted-foreground">→ {{ finding.fixedVersions.join(", ") }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<DialogFooter>
|
||||
<UiButton type="button" variant="outline" @click="reviewOpen = false">{{ $t("Close") }}</UiButton>
|
||||
<template v-if="pending && ['ready', 'failed'].includes(pending.phase)">
|
||||
<UiButton type="button" variant="destructive" :disabled="busy" @click="decide(false)">{{ $t("deployReject") }}</UiButton>
|
||||
<UiButton type="button" :disabled="busy || pending.phase !== 'ready' || delayed" @click="decide(true)">{{ $t("deployApprove") }}</UiButton>
|
||||
</template>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
<Dialog v-model:open="historyOpen">
|
||||
<DialogContent class="max-h-[90dvh] overflow-y-auto sm:max-w-2xl" :close-label="$t('Close')" :aria-describedby="undefined">
|
||||
<DialogHeader><DialogTitle>{{ $t("deployHistory") }}</DialogTitle></DialogHeader>
|
||||
<ul class="divide-y rounded-lg border">
|
||||
<li v-for="entry in history" :key="entry.id" class="grid gap-2 p-3">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<div class="grid gap-1">
|
||||
<p class="text-sm font-medium">{{ $t("deploymentPhase." + entry.phase) }} · {{ $t("deploymentMode." + entry.mode) }}</p>
|
||||
<p class="text-xs text-muted-foreground">{{ formatTime(entry.finishedAt || entry.startedAt) }}</p>
|
||||
</div>
|
||||
<UiButton v-if="entry.phase === 'deployed'" variant="outline" size="sm" :disabled="busy" @click="restore(entry.id)">{{ $t("deployRestoreDraft") }}</UiButton>
|
||||
</div>
|
||||
<p v-if="entry.error" class="text-xs text-destructive">{{ $t(entry.error) }}</p>
|
||||
<code v-for="change in entry.changes.filter(item => item.imageId)" :key="change.name" class="break-all text-xs text-muted-foreground">{{ change.name }} · {{ change.imageId }}</code>
|
||||
</li>
|
||||
</ul>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
stackName: { type: String,
|
||||
default: "" },
|
||||
endpoint: { type: String,
|
||||
default: "" },
|
||||
managed: Boolean,
|
||||
},
|
||||
emits: [ "deployed", "restore", "pending" ],
|
||||
data() {
|
||||
return { pending: null,
|
||||
history: [],
|
||||
reviewId: "",
|
||||
reviewOpen: false,
|
||||
historyOpen: false,
|
||||
error: "",
|
||||
busy: false,
|
||||
timer: null,
|
||||
generation: 0,
|
||||
now: Date.now() };
|
||||
},
|
||||
computed: {
|
||||
review() {
|
||||
return this.pending || this.history.find(entry => entry.id === this.reviewId);
|
||||
},
|
||||
delayed() {
|
||||
return Boolean(this.pending?.notBefore && Date.parse(this.pending.notBefore) > this.now);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
stackName: "reset",
|
||||
endpoint: "reset",
|
||||
pending(value) {
|
||||
this.$emit("pending", Boolean(value));
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.reviewOpen = this.$route.query.review === "1";
|
||||
this.reset();
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.generation++;
|
||||
clearTimeout(this.timer);
|
||||
},
|
||||
methods: {
|
||||
request(event, ...args) {
|
||||
return this.$root.getSocket().timeout(15000).emitWithAck("agent", this.endpoint, event, ...args);
|
||||
},
|
||||
reset() {
|
||||
clearTimeout(this.timer);
|
||||
const generation = ++this.generation;
|
||||
this.pending = null;
|
||||
this.history = [];
|
||||
if (/^[a-z0-9_-]+$/.test(this.stackName)) {
|
||||
this.poll(generation);
|
||||
}
|
||||
},
|
||||
async poll(generation) {
|
||||
clearTimeout(this.timer);
|
||||
try {
|
||||
const result = await this.request("getStackDeployments", this.stackName);
|
||||
if (result.ok && generation === this.generation) {
|
||||
const prior = this.pending;
|
||||
this.pending = result.pending;
|
||||
this.history = result.history;
|
||||
const completed = prior && result.history.find(entry => entry.id === prior.id);
|
||||
if (completed) {
|
||||
this.reviewId = completed.id;
|
||||
if (completed.phase === "deployed") {
|
||||
this.$emit("deployed", completed);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// A reconnect can pick up the persisted review.
|
||||
} finally {
|
||||
if (generation === this.generation) {
|
||||
this.now = Date.now();
|
||||
this.timer = setTimeout(() => this.poll(generation), this.reviewOpen || this.pending ? 2000 : 12000);
|
||||
}
|
||||
}
|
||||
},
|
||||
async prepare(event, ...args) {
|
||||
if (this.busy) {
|
||||
return;
|
||||
}
|
||||
this.reviewOpen = true;
|
||||
this.error = "";
|
||||
this.reviewId = "";
|
||||
this.busy = true;
|
||||
try {
|
||||
const [ name, yaml, env, isAdd, revision ] = args;
|
||||
const mode = { deployStack: "deploy",
|
||||
startStack: "start",
|
||||
updateStack: "update",
|
||||
startService: "service" }[event];
|
||||
const draft = mode === "deploy" ? { yaml,
|
||||
env,
|
||||
isAdd,
|
||||
revision } : null;
|
||||
const result = await this.request("prepareStackDeployment", name, mode, draft, mode === "service" ? yaml : null);
|
||||
if (result.ok && result.deployment) {
|
||||
this.pending = result.deployment;
|
||||
this.reviewId = result.deployment.id;
|
||||
} else {
|
||||
this.error = result.msg || "deployOperationFailed";
|
||||
}
|
||||
void this.poll(this.generation);
|
||||
} catch {
|
||||
this.error = "deployReviewUnavailable";
|
||||
} finally {
|
||||
this.busy = false;
|
||||
}
|
||||
},
|
||||
async decide(approve) {
|
||||
this.error = "";
|
||||
this.busy = true;
|
||||
try {
|
||||
const result = await this.request("decideStackDeployment", this.stackName, this.pending.id, approve);
|
||||
if (result.ok) {
|
||||
this.pending = result.deployment;
|
||||
void this.poll(this.generation);
|
||||
} else {
|
||||
this.error = result.msg || "deployOperationFailed";
|
||||
}
|
||||
} catch {
|
||||
this.error = "deployOperationFailed";
|
||||
} finally {
|
||||
this.busy = false;
|
||||
}
|
||||
},
|
||||
async restore(id) {
|
||||
this.busy = true;
|
||||
try {
|
||||
const result = await this.request("restoreStackDeployment", this.stackName, id);
|
||||
if (result.ok) {
|
||||
this.historyOpen = false;
|
||||
this.$emit("restore", { yaml: result.yaml,
|
||||
env: result.env });
|
||||
} else {
|
||||
this.$root.toastRes(result);
|
||||
}
|
||||
} catch {
|
||||
this.$root.toastError("deployHistoryMissing");
|
||||
} finally {
|
||||
this.busy = false;
|
||||
}
|
||||
},
|
||||
formatTime(value) {
|
||||
return new Date(value).toLocaleString(this.$i18n.locale);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@ -19,7 +19,7 @@
|
||||
</div>
|
||||
<CollapsibleTrigger as-child>
|
||||
<UiButton variant="outline" size="icon" :aria-label="$t('toggleFilters')" :title="$t('toggleFilters')">
|
||||
<PhFunnel :weight="filtersActive ? 'fill' : 'regular'" />
|
||||
<RiFilter3Line />
|
||||
</UiButton>
|
||||
</CollapsibleTrigger>
|
||||
</div>
|
||||
@ -77,7 +77,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { PhFunnel } from "@phosphor-icons/vue";
|
||||
import { RiFilter3Line } from "@remixicon/vue";
|
||||
import { useId } from "vue";
|
||||
import StackListItem from "./StackListItem.vue";
|
||||
import { CREATED_FILE, CREATED_STACK, EXITED, RUNNING, UNKNOWN, statusNameShort } from "../../../common/util-common";
|
||||
@ -87,7 +87,7 @@ const statusOrder = [ RUNNING, EXITED, CREATED_STACK, CREATED_FILE, UNKNOWN ];
|
||||
|
||||
export default {
|
||||
components: {
|
||||
PhFunnel,
|
||||
RiFilter3Line,
|
||||
StackListItem,
|
||||
},
|
||||
emits: [ "navigate" ],
|
||||
|
||||
@ -10,6 +10,12 @@
|
||||
<AppIcon name="restart" /> {{ $t("resourceRefresh") }}
|
||||
</UiButton>
|
||||
</div>
|
||||
<dl v-if="!loading && !error" class="grid grid-cols-3 gap-2">
|
||||
<div v-for="[label, count] in usageSummary" :key="label" class="rounded-md border bg-background px-3 py-2">
|
||||
<dt class="text-xs text-muted-foreground">{{ $t(label) }}</dt>
|
||||
<dd class="font-heading text-lg tabular-nums">{{ count }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<UiInput v-model.trim="search" type="search" :aria-label="$t('resourceSearch')" :placeholder="$t('resourceSearch')" class="w-full sm:max-w-xs" />
|
||||
<UiNativeSelect v-model="usage" :aria-label="$t('stackListStatus')">
|
||||
@ -140,7 +146,7 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
endpoint: "",
|
||||
endpoint: typeof this.$route.query.host === "string" ? this.$route.query.host : "",
|
||||
usage: "all",
|
||||
search: "",
|
||||
items: [],
|
||||
@ -157,6 +163,14 @@ export default {
|
||||
images() {
|
||||
return this.kind === "images";
|
||||
},
|
||||
usageSummary() {
|
||||
const used = this.items.filter(item => item.containers.length).length;
|
||||
return [
|
||||
[ "resourceTotal", this.items.length ],
|
||||
[ "resourceUsed", used ],
|
||||
[ "resourceUnused", this.items.length - used ],
|
||||
];
|
||||
},
|
||||
hosts() {
|
||||
const remote = Object.entries(this.$root.agentList).filter(([ endpoint ]) => endpoint).map(([ endpoint, agent ]) => ({
|
||||
endpoint,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<template>
|
||||
<section class="grid gap-3 border-t pt-4">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<UiButton variant="destructive" :disabled="!canPrune || pruning" @click="confirmOpen = true">
|
||||
<AppIcon name="trash" /> {{ $t(pruning ? "resourceCleanupRunning" : "resourceCleanupAll") }}
|
||||
<UiButton variant="outline" :disabled="!canPrune || pruning || previewLoading" @click="showPreview">
|
||||
<AppIcon name="trash" /> {{ $t(pruning ? "resourceCleanupRunning" : "cleanupPreview") }}
|
||||
</UiButton>
|
||||
<UiButton variant="outline" :aria-expanded="scheduleOpen" @click="scheduleOpen = !scheduleOpen">
|
||||
{{ $t("resourceCleanupAutomation") }}
|
||||
@ -17,6 +17,16 @@
|
||||
<UiSwitch id="resource-cleanup-enabled" v-model="enabled" :disabled="saving" />
|
||||
<UiLabel for="resource-cleanup-enabled">{{ $t("resourceCleanupEnable") }}</UiLabel>
|
||||
</div>
|
||||
<div class="grid max-w-lg gap-2 sm:grid-cols-[10rem_minmax(0,1fr)]">
|
||||
<div class="grid content-start gap-1.5">
|
||||
<UiLabel for="cleanup-age">{{ $t("cleanupMinimumAge") }}</UiLabel>
|
||||
<UiInput id="cleanup-age" v-model="minAgeHours" type="number" min="0" max="87600" step="1" required :disabled="saving" />
|
||||
</div>
|
||||
<div class="grid gap-1.5">
|
||||
<UiLabel for="cleanup-exclusions">{{ $t("cleanupExclusions") }}</UiLabel>
|
||||
<UiTextarea id="cleanup-exclusions" v-model="excludes" rows="3" :placeholder="$t('cleanupExclusionsHint')" :disabled="saving" />
|
||||
</div>
|
||||
</div>
|
||||
<p class="max-w-prose text-sm text-muted-foreground">{{ $t(description, { host }) }}</p>
|
||||
<div class="grid max-w-lg gap-3 sm:grid-cols-[10rem_minmax(0,1fr)]">
|
||||
<div class="grid gap-1.5">
|
||||
@ -39,9 +49,18 @@
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
<ActionDialog v-model="confirmOpen" :title="$t('resourceCleanupAll')" :action="$t('deleteStack')" destructive @confirm="prune">
|
||||
<ActionDialog v-model="confirmOpen" :title="$t('cleanupPreview')" :action="$t('cleanupConfirmCount', { count: eligibleCount })" :disabled="!eligibleCount || previewLoading" destructive @confirm="prune">
|
||||
<p>{{ $t(description, { host }) }}</p>
|
||||
<p>{{ $t("resourceCleanupAllFilters") }}</p>
|
||||
<p v-if="previewLoading" role="status">{{ $t("resourceLoading") }}</p>
|
||||
<UiAlert v-else-if="previewError" variant="destructive">{{ $t(previewError) }}</UiAlert>
|
||||
<p v-else-if="!preview?.items.length">{{ $t("cleanupNoCandidates") }}</p>
|
||||
<ul v-else class="max-h-64 divide-y overflow-y-auto rounded-md border">
|
||||
<li v-for="item in preview.items" :key="item.id" class="grid gap-1 p-2">
|
||||
<code class="break-all text-xs">{{ item.name }}</code>
|
||||
<span v-if="item.tags?.length > 1" class="break-all text-xs">{{ item.tags.join(", ") }}</span>
|
||||
<span class="text-xs" :class="item.reason ? 'text-muted-foreground' : 'text-destructive'">{{ $t(item.reason || "cleanupWillRemove") }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</ActionDialog>
|
||||
</template>
|
||||
|
||||
@ -70,6 +89,11 @@ export default {
|
||||
enabled: false,
|
||||
time: "04:00",
|
||||
timezone: "UTC",
|
||||
minAgeHours: 0,
|
||||
excludes: "",
|
||||
preview: null,
|
||||
previewError: "",
|
||||
previewLoading: false,
|
||||
timezones,
|
||||
saving: false,
|
||||
pruning: false,
|
||||
@ -82,7 +106,11 @@ export default {
|
||||
},
|
||||
dirty() {
|
||||
return this.schedule && (this.enabled !== this.schedule.enabled || this.time !== this.schedule.time
|
||||
|| this.timezone !== this.schedule.timezone);
|
||||
|| this.timezone !== this.schedule.timezone || Number(this.minAgeHours) !== (this.schedule.minAgeHours ?? 0)
|
||||
|| this.excludes !== (this.schedule.excludes || []).join("\n"));
|
||||
},
|
||||
eligibleCount() {
|
||||
return this.preview?.items.filter(item => !item.reason).length || 0;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
@ -104,6 +132,8 @@ export default {
|
||||
this.enabled = schedule.enabled;
|
||||
this.time = schedule.time;
|
||||
this.timezone = schedule.timezone;
|
||||
this.minAgeHours = schedule.minAgeHours ?? 0;
|
||||
this.excludes = (schedule.excludes || []).join("\n");
|
||||
},
|
||||
async load() {
|
||||
this.loadError = false;
|
||||
@ -124,6 +154,8 @@ export default {
|
||||
enabled: this.enabled,
|
||||
time: this.time,
|
||||
timezone: this.timezone,
|
||||
minAgeHours: Number(this.minAgeHours),
|
||||
excludes: this.excludes.split(/\r?\n/).map(item => item.trim()).filter(Boolean),
|
||||
});
|
||||
if (res.ok) {
|
||||
this.apply(res.schedule);
|
||||
@ -137,14 +169,36 @@ export default {
|
||||
this.saving = false;
|
||||
}
|
||||
},
|
||||
async showPreview() {
|
||||
this.preview = null;
|
||||
this.previewError = "";
|
||||
this.previewLoading = true;
|
||||
this.confirmOpen = true;
|
||||
try {
|
||||
const result = await this.request("previewDockerCleanup", 30000);
|
||||
if (result.ok) {
|
||||
this.preview = result.preview;
|
||||
} else {
|
||||
this.previewError = result.msg || "resourceCleanupFailed";
|
||||
}
|
||||
} catch {
|
||||
this.previewError = "resourceCleanupFailed";
|
||||
} finally {
|
||||
this.previewLoading = false;
|
||||
}
|
||||
},
|
||||
async prune() {
|
||||
if (!this.canPrune || this.pruning) {
|
||||
if (!this.eligibleCount || this.pruning) {
|
||||
return;
|
||||
}
|
||||
this.pruning = true;
|
||||
try {
|
||||
const res = await this.request("pruneDockerResources", 135000);
|
||||
this.$root.toastRes(res);
|
||||
const res = await this.request("pruneDockerResources", 135000, this.preview.id);
|
||||
if (res.ok) {
|
||||
this.$root.toastSuccess(this.$t("cleanupOutcome", res.result));
|
||||
} else {
|
||||
this.$root.toastRes(res);
|
||||
}
|
||||
} catch {
|
||||
this.$root.toastError("resourceCleanupFailed");
|
||||
} finally {
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import type { CheckboxRootEmits, CheckboxRootProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { PhCheck } from "@phosphor-icons/vue";
|
||||
import { RiCheckLine } from "@remixicon/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from "reka-ui";
|
||||
@ -27,7 +27,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
class="[&>svg]:size-3.5 grid place-content-center text-current transition-none"
|
||||
>
|
||||
<slot v-bind="slotProps">
|
||||
<PhCheck />
|
||||
<RiCheckLine />
|
||||
</slot>
|
||||
</CheckboxIndicator>
|
||||
</CheckboxRoot>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import type { DialogContentEmits, DialogContentProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { PhX } from "@phosphor-icons/vue";
|
||||
import { RiCloseLine } from "@remixicon/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
@ -45,7 +45,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
as-child
|
||||
>
|
||||
<Button variant="ghost" class="absolute top-2 right-2" size="icon-sm" :aria-label="closeLabel">
|
||||
<PhX />
|
||||
<RiCloseLine />
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogContent>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import type { DialogContentEmits, DialogContentProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { PhX } from "@phosphor-icons/vue";
|
||||
import { RiCloseLine } from "@remixicon/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
@ -51,7 +51,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
<DialogClose
|
||||
class="absolute top-4 right-4 p-0.5 transition-colors rounded-md hover:bg-secondary"
|
||||
>
|
||||
<PhX class="w-4 h-4" />
|
||||
<RiCloseLine class="w-4 h-4" />
|
||||
<span class="sr-only">Close</span>
|
||||
</DialogClose>
|
||||
</DialogContent>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import type { DropdownMenuCheckboxItemEmits, DropdownMenuCheckboxItemProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { PhCheck } from "@phosphor-icons/vue";
|
||||
import { RiCheckLine } from "@remixicon/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
@ -34,7 +34,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
>
|
||||
<DropdownMenuItemIndicator>
|
||||
<slot name="indicator-icon">
|
||||
<PhCheck />
|
||||
<RiCheckLine />
|
||||
</slot>
|
||||
</DropdownMenuItemIndicator>
|
||||
</span>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import type { DropdownMenuRadioItemEmits, DropdownMenuRadioItemProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { PhCheck } from "@phosphor-icons/vue";
|
||||
import { RiCheckLine } from "@remixicon/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
@ -35,7 +35,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
>
|
||||
<DropdownMenuItemIndicator>
|
||||
<slot name="indicator-icon">
|
||||
<PhCheck />
|
||||
<RiCheckLine />
|
||||
</slot>
|
||||
</DropdownMenuItemIndicator>
|
||||
</span>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import type { DropdownMenuSubTriggerProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { PhCaretRight } from "@phosphor-icons/vue";
|
||||
import { RiArrowRightSLine } from "@remixicon/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
@ -27,6 +27,6 @@ const forwardedProps = useForwardProps(delegatedProps);
|
||||
)"
|
||||
>
|
||||
<slot />
|
||||
<PhCaretRight class="cn-rtl-flip ml-auto" />
|
||||
<RiArrowRightSLine class="cn-rtl-flip ml-auto" />
|
||||
</DropdownMenuSubTrigger>
|
||||
</template>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import type { AcceptableValue } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { PhCaretDown } from "@phosphor-icons/vue";
|
||||
import { RiArrowDownSLine } from "@remixicon/vue";
|
||||
import { reactiveOmit, useVModel } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
@ -43,6 +43,6 @@ const delegatedProps = reactiveOmit(props, "class", "size");
|
||||
>
|
||||
<slot />
|
||||
</select>
|
||||
<PhCaretDown class="text-muted-foreground top-1/2 right-2.5 size-4 -translate-y-1/2 pointer-events-none absolute select-none" aria-hidden="true" data-slot="native-select-icon" />
|
||||
<RiArrowDownSLine class="text-muted-foreground top-1/2 right-2.5 size-4 -translate-y-1/2 pointer-events-none absolute select-none" aria-hidden="true" data-slot="native-select-icon" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
import type { DialogContentEmits, DialogContentProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { PhX } from "@phosphor-icons/vue";
|
||||
import { RiCloseLine } from "@remixicon/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
import {
|
||||
@ -54,7 +54,7 @@ const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
as-child
|
||||
>
|
||||
<Button variant="ghost" class="absolute top-3 right-3" size="icon-sm" :aria-label="closeLabel">
|
||||
<PhX />
|
||||
<RiCloseLine />
|
||||
</Button>
|
||||
</DialogClose>
|
||||
</DialogContent>
|
||||
|
||||
@ -2,13 +2,13 @@
|
||||
import type { ToasterProps } from "vue-sonner";
|
||||
|
||||
import {
|
||||
PhCheckCircle,
|
||||
PhInfo,
|
||||
PhSpinnerGap,
|
||||
PhXCircle,
|
||||
PhWarning,
|
||||
PhX,
|
||||
} from "@phosphor-icons/vue";
|
||||
RiCheckboxCircleLine,
|
||||
RiInformationLine,
|
||||
RiLoader4Line,
|
||||
RiCloseCircleLine,
|
||||
RiAlertLine,
|
||||
RiCloseLine,
|
||||
} from "@remixicon/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { Toaster as Sonner } from "vue-sonner";
|
||||
@ -39,24 +39,24 @@ const delegatedProps = reactiveOmit(props, "class", "toastOptions");
|
||||
v-bind="delegatedProps"
|
||||
>
|
||||
<template #success-icon>
|
||||
<PhCheckCircle class="size-4" />
|
||||
<RiCheckboxCircleLine class="size-4" />
|
||||
</template>
|
||||
<template #info-icon>
|
||||
<PhInfo class="size-4" />
|
||||
<RiInformationLine class="size-4" />
|
||||
</template>
|
||||
<template #warning-icon>
|
||||
<PhWarning class="size-4" />
|
||||
<RiAlertLine class="size-4" />
|
||||
</template>
|
||||
<template #error-icon>
|
||||
<PhXCircle class="size-4" />
|
||||
<RiCloseCircleLine class="size-4" />
|
||||
</template>
|
||||
<template #loading-icon>
|
||||
<div>
|
||||
<PhSpinnerGap class="size-4 animate-spin" />
|
||||
<RiLoader4Line class="size-4 animate-spin" />
|
||||
</div>
|
||||
</template>
|
||||
<template #close-icon>
|
||||
<PhX class="size-4" />
|
||||
<RiCloseLine class="size-4" />
|
||||
</template>
|
||||
</Sonner>
|
||||
</template>
|
||||
|
||||
@ -1,32 +1,33 @@
|
||||
import { defineComponent, h, type PropType } from "vue";
|
||||
import {
|
||||
PhArrowClockwise, PhArrowDown, PhCaretDown, PhCaretUp, PhCloudArrowDown,
|
||||
PhDotsThree, PhFile, PhFolder, PhUploadSimple, PhFloppyDisk, PhMagnifyingGlass, PhPencilSimple, PhPlay,
|
||||
PhPlus, PhRocketLaunch, PhSquare, PhTerminal, PhTrash, PhX, PhEye, PhEyeSlash,
|
||||
} from "@phosphor-icons/vue";
|
||||
RiRestartLine, RiDownloadLine, RiArrowDownSLine, RiArrowRightSLine, RiArrowUpSLine, RiDownloadCloud2Line,
|
||||
RiMoreLine, RiFileLine, RiFolderLine, RiUpload2Line, RiSaveLine, RiSearchLine, RiPencilLine, RiPlayLine,
|
||||
RiAddLine, RiRocket2Line, RiStopLine, RiTerminalLine, RiDeleteBinLine, RiCloseLine, RiEyeLine, RiEyeOffLine,
|
||||
} from "@remixicon/vue";
|
||||
|
||||
const icons = {
|
||||
"caret-down": PhCaretDown,
|
||||
"caret-up": PhCaretUp,
|
||||
"cloud-download": PhCloudArrowDown,
|
||||
"dots": PhDotsThree,
|
||||
"download": PhArrowDown,
|
||||
"edit": PhPencilSimple,
|
||||
"eye": PhEye,
|
||||
"eye-off": PhEyeSlash,
|
||||
"file": PhFile,
|
||||
"folder": PhFolder,
|
||||
"play": PhPlay,
|
||||
"plus": PhPlus,
|
||||
"restart": PhArrowClockwise,
|
||||
"rocket": PhRocketLaunch,
|
||||
"save": PhFloppyDisk,
|
||||
"search": PhMagnifyingGlass,
|
||||
"stop": PhSquare,
|
||||
"terminal": PhTerminal,
|
||||
"upload": PhUploadSimple,
|
||||
"trash": PhTrash,
|
||||
"x": PhX,
|
||||
"caret-down": RiArrowDownSLine,
|
||||
"caret-right": RiArrowRightSLine,
|
||||
"caret-up": RiArrowUpSLine,
|
||||
"cloud-download": RiDownloadCloud2Line,
|
||||
"dots": RiMoreLine,
|
||||
"download": RiDownloadLine,
|
||||
"edit": RiPencilLine,
|
||||
"eye": RiEyeLine,
|
||||
"eye-off": RiEyeOffLine,
|
||||
"file": RiFileLine,
|
||||
"folder": RiFolderLine,
|
||||
"play": RiPlayLine,
|
||||
"plus": RiAddLine,
|
||||
"restart": RiRestartLine,
|
||||
"rocket": RiRocket2Line,
|
||||
"save": RiSaveLine,
|
||||
"search": RiSearchLine,
|
||||
"stop": RiStopLine,
|
||||
"terminal": RiTerminalLine,
|
||||
"upload": RiUpload2Line,
|
||||
"trash": RiDeleteBinLine,
|
||||
"x": RiCloseLine,
|
||||
};
|
||||
|
||||
export const AppIcon = defineComponent({
|
||||
|
||||
@ -1,4 +1,231 @@
|
||||
{
|
||||
"deployReview": "Deployment prüfen",
|
||||
"deployHistory": "Deployment-Verlauf",
|
||||
"deployAvailableAt": "Die Freigabe ist ab {time} möglich.",
|
||||
"deployApprovalPrompt": "Dienste mit den geprüften Images starten?",
|
||||
"deployApprove": "Ja, starten",
|
||||
"deployReject": "Nein, abbrechen",
|
||||
"deployRejectResult": "Images entfernt: {removed} · behalten: {retained}.",
|
||||
"deployChanges": "Geplante Änderungen",
|
||||
"deployRestoreDraft": "Als Entwurf wiederherstellen",
|
||||
"deployAlreadyPending": "Für diesen Stack läuft bereits ein Vorgang oder wartet auf Freigabe. Öffne die Vorschau.",
|
||||
"deployInvalidRequest": "Ungültige Deployment-Anfrage.",
|
||||
"deployInvalidDecision": "Der Vorgang kann diese Entscheidung noch nicht annehmen. Aktualisiere die Vorschau.",
|
||||
"deployHistoryMissing": "Dieser Deployment-Stand ist nicht verfügbar.",
|
||||
"deployInterrupted": "Dockge wurde während der Vorbereitung oder Bereitstellung neu gestartet. Prüfe den Vorgang vor einem neuen Versuch.",
|
||||
"deployOperationFailed": "Der Deployment-Schritt ist fehlgeschlagen.",
|
||||
"editorComposeInvalid": "Docker Compose konnte den Entwurf nicht validieren. Prüfe die YAML-Datei und die Umgebungsvariablen.",
|
||||
"deployReviewUnavailable": "Die Deployment-Vorschau konnte nicht geladen werden. Prüfe die Verbindung und ob der Agent diese Funktion unterstützt.",
|
||||
"deployPortInUse": "Ein Host-Port ist bereits belegt. Prüfe die veröffentlichten Ports.",
|
||||
"deployUnhealthy": "Ein Dienst hat seinen Healthcheck nicht bestanden. Details findest du in den Stack-Protokollen.",
|
||||
"deployPlatformUnavailable": "Das Image hat kein Manifest für die gewählte Plattform.",
|
||||
"deployTooManyContainers": "Für die Vorschau sind zu viele Container in diesem Stack vorhanden.",
|
||||
"deployImageMissing": "Ein benötigtes Image ist nicht verfügbar. Prüfe Image-Namen, Registry-Zugriff und Plattform.",
|
||||
"deployPlanChanged": "Der Stack oder seine wirksame Konfiguration hat sich seit der Prüfung geändert. Brich die Vorschau ab und bereite sie erneut vor.",
|
||||
"deployScanIncomplete": "Der Scan konnte nicht abgeschlossen werden. Die Images können noch nicht freigegeben werden.",
|
||||
"deployAttentionTitle": "Benötigt Aufmerksamkeit",
|
||||
"deployAttentionEmpty": "Auf den verbundenen Hosts wurden keine Probleme gemeldet.",
|
||||
"deployAttentionApproval": "Deployment wartet auf Freigabe",
|
||||
"deployAttentionFailed": "Deployment fehlgeschlagen",
|
||||
"deployAttentionCritical": "{count} kritische Scan-Funde",
|
||||
"deployAttentionRestarting": "Container startet wiederholt neu",
|
||||
"deployAttentionUnhealthy": "Container hat den Healthcheck nicht bestanden",
|
||||
"deployAttentionUpdate": "Geplantes Update fehlgeschlagen",
|
||||
"deployAttentionCleanup": "Geplante Bereinigung fehlgeschlagen",
|
||||
"deployAttentionOffline": "Docker-Host ist offline",
|
||||
"cleanupPreview": "Bereinigung prüfen",
|
||||
"cleanupConfirmCount": "{count} löschen",
|
||||
"cleanupWillRemove": "Wird entfernt",
|
||||
"cleanupNoCandidates": "Keine ungenutzten Ressourcen gefunden.",
|
||||
"cleanupMinimumAge": "Mindestalter (Stunden)",
|
||||
"cleanupExclusions": "Ausschlüsse",
|
||||
"cleanupExclusionsHint": "Ein exakter Image-Tag, eine ID oder ein Volume-Name pro Zeile",
|
||||
"cleanupProtectedImage": "Für ein Deployment oder einen früheren Stand reserviert.",
|
||||
"cleanupDeclaredVolume": "In einem gespeicherten Compose-Stack deklariert.",
|
||||
"cleanupUnresolvedVolume": "Die Compose-Konfiguration dieses Projekts konnte nicht vollständig geprüft werden.",
|
||||
"cleanupExternalVolume": "Das Volume verwendet einen nicht lokalen Treiber.",
|
||||
"cleanupExcluded": "Steht auf der Ausschlussliste.",
|
||||
"cleanupTooNew": "Mindestalter noch nicht erreicht oder unbekannt.",
|
||||
"cleanupPreviewExpired": "Die Vorschau ist abgelaufen. Öffne vor dem Löschen eine neue Vorschau.",
|
||||
"cleanupOutcome": "Entfernt: {removed} · fehlgeschlagen: {failed} · behalten: {retained}",
|
||||
"composeAddShort": "Kurze Schreibweise hinzufügen",
|
||||
"composePublishPort": "Port veröffentlichen",
|
||||
"composeAddMount": "Mount hinzufügen",
|
||||
"composeDefineVolume": "Benannte Volumes in den Stack-Ressourcen verwalten",
|
||||
"composeDefineSubnet": "Netzwerke und Subnetze konfigurieren",
|
||||
"composeSubnet": "Subnetz (CIDR)",
|
||||
"composeGateway": "Gateway",
|
||||
"composeFieldNumber": "Gib eine Zahl ein.",
|
||||
"composeFieldPort": "Gib einen gültigen Port oder Portbereich bis 65535 ein.",
|
||||
"composeFieldSubnet": "Gib ein Subnetz in CIDR-Schreibweise ein, etwa 172.28.0.0/24.",
|
||||
"deploymentPhase": {
|
||||
"preparing": "Compose wird geprüft",
|
||||
"pulling": "Images werden vorbereitet",
|
||||
"scanning": "Grype prüft die Images",
|
||||
"ready": "Wartet auf Freigabe",
|
||||
"applying": "Entscheidung wird ausgeführt",
|
||||
"deployed": "Dienste laufen oder sind gesund",
|
||||
"rejected": "Abgebrochen",
|
||||
"failed": "Fehlgeschlagen"
|
||||
},
|
||||
"deploymentChange": {
|
||||
"create": "Erstellen",
|
||||
"recreate": "Neu erstellen",
|
||||
"start": "Starten",
|
||||
"keep": "Beibehalten",
|
||||
"remove": "Entfernen"
|
||||
},
|
||||
"deploymentMode": {
|
||||
"deploy": "Deployment",
|
||||
"start": "Stack starten",
|
||||
"update": "Manuelles Update",
|
||||
"service": "Dienst starten",
|
||||
"scheduled": "Geplantes Update"
|
||||
},
|
||||
"composeDependencyChoice": {
|
||||
"service_started": "Gestartet",
|
||||
"service_healthy": "Healthcheck bestanden",
|
||||
"service_completed_successfully": "Erfolgreich beendet"
|
||||
},
|
||||
"composeNewEntryName": "Name des neuen Eintrags",
|
||||
"stackListTitle": "Stacks",
|
||||
"stackListNew": "Neuer Stack",
|
||||
"stackListSearch": "Stacks suchen",
|
||||
"stackListSearchPlaceholder": "Name oder Tag",
|
||||
"stackListHost": "Docker-Host",
|
||||
"stackListAllHosts": "Alle Hosts",
|
||||
"stackListStatus": "Status",
|
||||
"stackListAllStatuses": "Alle Status",
|
||||
"stackListUnknown": "Unbekannt",
|
||||
"stackListLocal": "Lokaler Host",
|
||||
"stackListUnmanaged": "Extern verwaltet",
|
||||
"stackListEmpty": "Noch keine Stacks vorhanden.",
|
||||
"stackListHostEmpty": "Auf diesem Host gibt es keine Stacks.",
|
||||
"stackListNoMatches": "Keine passenden Stacks.",
|
||||
"stackListLoading": "Stacks werden geladen …",
|
||||
"stackListStale": "Verbindung unterbrochen. Der Status kann veraltet sein.",
|
||||
"stackListResetFilters": "Filter zurücksetzen",
|
||||
"stackListClose": "Stack-Liste schließen",
|
||||
"stackListCount": "Keine Stacks | 1 Stack | {count} Stacks",
|
||||
"composeAdvancedValue": "Diesen Wert kannst du in YAML bearbeiten.",
|
||||
"composeDefaultValue": "Standard",
|
||||
"composeEnabled": "Aktiviert",
|
||||
"composeDisabled": "Deaktiviert",
|
||||
"composeEntryName": "Name",
|
||||
"composeAddDetailed": "Mit Optionen hinzufügen",
|
||||
"composeServiceFields": "Diensteinstellungen",
|
||||
"composeIdentity": "Image und Identität",
|
||||
"composeContainerName": "Containername",
|
||||
"composeHostname": "Hostname",
|
||||
"composePlatform": "Plattform",
|
||||
"composePullPolicy": "Richtlinie für Image-Downloads",
|
||||
"composeBuild": "Build aus Dockerfile",
|
||||
"composeBuildContext": "Build-Kontext",
|
||||
"composeDockerfile": "Dockerfile",
|
||||
"composeBuildTarget": "Build-Ziel",
|
||||
"composeBuildArgs": "Build-Argumente",
|
||||
"composeNetwork": "Netzwerk",
|
||||
"composeConnectivity": "Netzwerk und Ports",
|
||||
"composeNetworkMode": "Netzwerkmodus",
|
||||
"composePublishedPorts": "Veröffentlichte Ports",
|
||||
"composeTargetPort": "Container-Port",
|
||||
"composeHostPort": "Host-Port",
|
||||
"composeBindAddress": "Bind-Adresse",
|
||||
"composeProtocol": "Protokoll",
|
||||
"composeExposedPorts": "Interne Ports",
|
||||
"composeNetworks": "Netzwerke",
|
||||
"composeNetworksHint": "Verwende einen Netzwerknamen aus den Stack-Ressourcen.",
|
||||
"composeIPv4": "IPv4-Adresse",
|
||||
"composeIPv6": "IPv6-Adresse",
|
||||
"composeExtraHosts": "Zusätzliche Hosts",
|
||||
"composeDns": "DNS-Server",
|
||||
"composeStorage": "Speicher",
|
||||
"composeMounts": "Mounts",
|
||||
"composeReadOnlyRoot": "Schreibgeschütztes Root-Dateisystem",
|
||||
"composeMountsHint": "Lege benannte Volumes unter Stack-Ressourcen an. Bind-Mounts verwenden einen Pfad auf dem Docker-Host.",
|
||||
"composeMountType": "Mount-Typ",
|
||||
"composeMountSource": "Quelle",
|
||||
"composeMountTarget": "Pfad im Container",
|
||||
"composeReadOnly": "Schreibgeschützt",
|
||||
"composeWritable": "Beschreibbar",
|
||||
"composeTmpfs": "Temporäre Dateisysteme",
|
||||
"composeEnvironment": "Umgebung",
|
||||
"composeEnvironmentVariables": "Umgebungsvariablen",
|
||||
"composeEnvironmentFiles": "Umgebungsdateien",
|
||||
"composeRequired": "Erforderlich",
|
||||
"composeEnvFileFormat": "Dateiformat",
|
||||
"composeLabels": "Labels",
|
||||
"composeProfiles": "Profile",
|
||||
"composeLifecycle": "Start und Zustand",
|
||||
"composeProcess": "Containerprozess",
|
||||
"composeCommand": "Startbefehl",
|
||||
"composeEntrypoint": "Entrypoint",
|
||||
"composeUser": "Benutzer",
|
||||
"composeWorkingDirectory": "Arbeitsverzeichnis",
|
||||
"composeInit": "Init-Prozess verwenden",
|
||||
"composeTty": "TTY zuweisen",
|
||||
"composeStopSignal": "Stoppsignal",
|
||||
"composeStopGracePeriod": "Wartezeit beim Stoppen",
|
||||
"composeDependencies": "Dienstabhängigkeiten",
|
||||
"composeDependenciesHint": "Gib den Namen eines anderen Dienstes aus diesem Stack ein.",
|
||||
"composeDependencyCondition": "Startbedingung",
|
||||
"composeHealthcheck": "Healthcheck",
|
||||
"composeHealthcheckCommand": "Prüfbefehl",
|
||||
"composeHealthcheckDisabled": "Healthcheck deaktivieren",
|
||||
"composeHealthcheckInterval": "Intervall",
|
||||
"composeHealthcheckTimeout": "Zeitlimit",
|
||||
"composeHealthcheckRetries": "Wiederholungen",
|
||||
"composeHealthcheckStartPeriod": "Schonfrist beim Start",
|
||||
"composeResourceLimits": "Ressourcenlimits",
|
||||
"composeCpuLimit": "CPU-Limit",
|
||||
"composeMemoryLimit": "Arbeitsspeicherlimit",
|
||||
"composeMemoryReservation": "Arbeitsspeicherreservierung",
|
||||
"composePidLimit": "Prozesslimit",
|
||||
"composeSharedMemory": "Größe des Shared Memory",
|
||||
"composeDeployment": "Bereitstellung",
|
||||
"composeReplicas": "Replikate",
|
||||
"composeLogging": "Protokollierung",
|
||||
"composeDriver": "Treiber",
|
||||
"composeLoggingOptions": "Treiberoptionen",
|
||||
"composeClickEditor": "Klick-Editor",
|
||||
"composeStackResources": "Stack-Ressourcen",
|
||||
"composeFixYaml": "Korrigiere die YAML-Syntax, um den Stack weiter zu bearbeiten.",
|
||||
"composeNamedVolumes": "Benannte Volumes",
|
||||
"composeExternal": "Externe Ressource",
|
||||
"composeInvalidServiceName": "Beginne den Dienstnamen mit einem Buchstaben oder einer Zahl. Erlaubt sind Buchstaben, Zahlen, Punkte, Bindestriche und Unterstriche.",
|
||||
"containerDetails": "Containerdetails",
|
||||
"containerDetailsFailed": "Die Details dieses Containers konnten nicht geladen werden.",
|
||||
"containerImageId": "Image-ID",
|
||||
"containerIdentifier": "Container-ID",
|
||||
"containerCreated": "Erstellt",
|
||||
"containerStarted": "Gestartet",
|
||||
"containerFinished": "Beendet um",
|
||||
"containerHealth": "Zustand",
|
||||
"containerExitCode": "Exit-Code",
|
||||
"containerRestarts": "Neustarts",
|
||||
"containerInstances": "Container-Instanzen",
|
||||
"containerRunningInstances": "{running} von {total} laufen",
|
||||
"composeServices": "Dienste",
|
||||
"composeRunning": "Laufend",
|
||||
"composeStopped": "Gestoppt",
|
||||
"composeUnhealthy": "Fehlerhaft",
|
||||
"dashboardStacks": "Docker-Compose-Stacks",
|
||||
"dashboardOpenContainers": "Docker-Container öffnen",
|
||||
"dashboardStackCount": "{count} Stacks auf verbundenen Hosts",
|
||||
"dashboardTools": "Werkzeuge",
|
||||
"dashboardNoStacks": "Erstelle einen Stack oder durchsuche den konfigurierten Stack-Ordner.",
|
||||
"settingsDescription": "Verwalte Dockge, Docker-Ressourcen und dein Konto.",
|
||||
"resourceTotal": "Gesamt",
|
||||
"fileSelectionCount": "{shown} von {total} Einträgen",
|
||||
"fileContainerPath": "Aktueller Pfad",
|
||||
"terminalHostContext": "Docker-Host",
|
||||
"terminalOpenStack": "Stack öffnen",
|
||||
"consoleHostDescription": "Docker-Befehle werden auf dem gewählten Host ausgeführt.",
|
||||
"setupDescription": "Erstelle das Konto für die Verwaltung deiner Docker-Hosts.",
|
||||
"composeSelectNetwork": "Vorhandenes Docker-Netzwerk hinzufügen",
|
||||
"composeInternalNetwork": "Internes Netzwerk",
|
||||
"composeAttachableNetwork": "Eigenständige Container zulassen",
|
||||
"composeEnableIPv6": "IPv6 aktivieren",
|
||||
"languageName": "Deutsch",
|
||||
"Create your admin account": "Erstelle dein Admin-Konto",
|
||||
"authIncorrectCreds": "Falscher Benutzername oder falsches Passwort.",
|
||||
@ -183,7 +410,9 @@
|
||||
"removing": "Wird entfernt",
|
||||
"healthy": "Fehlerfrei",
|
||||
"unhealthy": "Fehlerhaft",
|
||||
"starting": "Startet"
|
||||
"starting": "Startet",
|
||||
"notCreated": "Noch nicht erstellt",
|
||||
"mixed": "Gemischter Status"
|
||||
},
|
||||
"resourceDeleteTitle": "Docker-Ressource entfernen",
|
||||
"resourceDeleteImageMessage": "Diese lokale Image-Referenz wird entfernt. Weitere Tags können das Image lokal halten.",
|
||||
@ -205,12 +434,12 @@
|
||||
"stackResourceStats": "Ressourcenverbrauch",
|
||||
"autoUpdateTitle": "Automatische Image-Updates",
|
||||
"autoUpdateEnable": "Automatische Updates für diesen Stack",
|
||||
"autoUpdateDescription": "Dockge prüft laufende Dienste täglich zur gewählten Uhrzeit. Dienste mit noch nicht ausgerollten Änderungen werden übersprungen.",
|
||||
"autoUpdateDescription": "Dockge prüft laufende Dienste täglich zur gewählten Uhrzeit. Neue Images werden geladen, mit Grype geprüft und zur Freigabe vorgelegt.",
|
||||
"autoUpdateLegacyDescription": "Dieser Agent prüft täglich um 04:00 UTC.",
|
||||
"autoUpdateTime": "Tägliche Prüfung um",
|
||||
"autoUpdateTimezone": "Zeitzone",
|
||||
"autoUpdateDelay": "Mit der Installation neuer Images warten",
|
||||
"autoUpdateDelayHelp": "Die Wartezeit beginnt, sobald Dockge ein neues Image erkennt. Es kann beim ersten geplanten Termin nach Ablauf der Frist installiert werden.",
|
||||
"autoUpdateDelayHelp": "Die Wartezeit beginnt, sobald Dockge ein neues Image erkennt. Nach Ablauf kannst du den Start freigeben.",
|
||||
"autoUpdateDelayHours": "Wartezeit in Stunden",
|
||||
"autoUpdateNextRun": "Nächste Prüfung {time}",
|
||||
"autoUpdatePending": "{service} kann beim ersten Termin nach {time} aktualisiert werden.",
|
||||
@ -286,6 +515,7 @@
|
||||
"unknown": "Unbekannt"
|
||||
},
|
||||
"autoUpdateResult": {
|
||||
"approval": "Images zur Freigabe vorbereitet",
|
||||
"updated": "Aktualisiert",
|
||||
"unchanged": "Keine Änderung",
|
||||
"waiting": "Wartezeit läuft",
|
||||
@ -298,8 +528,8 @@
|
||||
"resourceCleanupAutomation": "Automatische Bereinigung",
|
||||
"resourceCleanupEnable": "Tägliche Bereinigung aktivieren",
|
||||
"resourceCleanupTime": "Täglich um",
|
||||
"resourceCleanupImagesMessage": "Docker löscht auf {host} ungenutzte Images, auch solche mit Tags. Images, auf die laufende oder gestoppte Container verweisen, bleiben erhalten.",
|
||||
"resourceCleanupVolumesMessage": "Docker löscht auf {host} die Daten ungenutzter lokaler Volumes dauerhaft, auch bei benannten Volumes. Eine gespeicherte Compose-Datei kann weiterhin auf ein solches Volume verweisen.",
|
||||
"resourceCleanupImagesMessage": "Dockge bereinigt ungenutzte Images auf {host}. Die Vorschau zeigt auch Images, die für eine Freigabe oder einen früheren Stand reserviert sind.",
|
||||
"resourceCleanupVolumesMessage": "Dockge löscht die Daten der ausgewählten ungenutzten lokalen Volumes auf {host} dauerhaft. Deklarationen in gespeicherten Stacks und die Ausschlussliste werden geprüft.",
|
||||
"resourceCleanupAllFilters": "Die Bereinigung gilt für den gesamten gewählten Host, unabhängig von den Listenfiltern.",
|
||||
"resourceCleanupNext": "Nächste Bereinigung {time}",
|
||||
"resourceCleanupLast": "Letzte geplante Bereinigung {time} · {result}",
|
||||
|
||||
@ -1,4 +1,211 @@
|
||||
{
|
||||
"deployReview": "Deployment review",
|
||||
"deployHistory": "Deployment history",
|
||||
"deployAvailableAt": "Approval is available from {time}.",
|
||||
"deployApprovalPrompt": "Start the services with the reviewed images?",
|
||||
"deployApprove": "Yes, start",
|
||||
"deployReject": "No, cancel",
|
||||
"deployRejectResult": "Images removed: {removed} · retained: {retained}.",
|
||||
"deployChanges": "Planned changes",
|
||||
"deployRestoreDraft": "Restore as draft",
|
||||
"deployAlreadyPending": "A deployment is waiting or running for this stack. Open its review to continue.",
|
||||
"deployInvalidRequest": "The deployment request is invalid.",
|
||||
"deployInvalidDecision": "The deployment cannot accept this decision yet. Refresh the review.",
|
||||
"deployHistoryMissing": "This deployment snapshot is unavailable.",
|
||||
"deployInterrupted": "Dockge restarted while preparing or starting the stack. Review the result before retrying.",
|
||||
"deployOperationFailed": "The deployment step failed.",
|
||||
"deployReviewUnavailable": "The deployment review could not load. Check the connection and whether this agent supports reviews.",
|
||||
"deployPortInUse": "A host port is already in use. Check the published ports.",
|
||||
"deployUnhealthy": "A service did not pass its health check. Open the stack logs for details.",
|
||||
"deployPlatformUnavailable": "The image has no manifest for the requested platform.",
|
||||
"deployTooManyContainers": "There are too many containers to review this stack.",
|
||||
"deployImageMissing": "A required image is unavailable. Check the image name, registry access, and platform.",
|
||||
"deployPlanChanged": "The stack or its effective configuration changed after review. Cancel this review and prepare it again.",
|
||||
"deployScanIncomplete": "The scan could not complete. The images cannot be approved.",
|
||||
"deployAttentionTitle": "Needs attention",
|
||||
"deployAttentionEmpty": "No issues reported on connected hosts.",
|
||||
"deployAttentionApproval": "Deployment awaits approval",
|
||||
"deployAttentionFailed": "Deployment failed",
|
||||
"deployAttentionCritical": "{count} critical scan findings",
|
||||
"deployAttentionRestarting": "Container keeps restarting",
|
||||
"deployAttentionUnhealthy": "Container is unhealthy",
|
||||
"deployAttentionUpdate": "Scheduled update failed",
|
||||
"deployAttentionCleanup": "Scheduled cleanup failed",
|
||||
"deployAttentionOffline": "Host is offline",
|
||||
"cleanupPreview": "Preview cleanup",
|
||||
"cleanupConfirmCount": "Remove {count}",
|
||||
"cleanupWillRemove": "Will be removed",
|
||||
"cleanupNoCandidates": "No unused resources found.",
|
||||
"cleanupMinimumAge": "Minimum age (hours)",
|
||||
"cleanupExclusions": "Exclusions",
|
||||
"cleanupExclusionsHint": "One exact image tag, ID or volume name per line",
|
||||
"cleanupProtectedImage": "Reserved for a deployment or recent recovery point.",
|
||||
"cleanupDeclaredVolume": "Referenced in a saved Compose stack.",
|
||||
"cleanupUnresolvedVolume": "The Compose configuration for this project could not be fully verified.",
|
||||
"cleanupExternalVolume": "Volume uses a non-local driver.",
|
||||
"cleanupExcluded": "On the exclusion list.",
|
||||
"cleanupTooNew": "Minimum age has not been reached or is unknown.",
|
||||
"cleanupPreviewExpired": "The cleanup preview expired. Open a new preview before deleting.",
|
||||
"cleanupOutcome": "Removed {removed} · failed {failed} · retained {retained}",
|
||||
"composeAddShort": "Add short syntax",
|
||||
"composePublishPort": "Publish a port",
|
||||
"composeAddMount": "Add a mount",
|
||||
"composeDefineVolume": "Manage named volumes in stack resources",
|
||||
"composeDefineSubnet": "Configure networks and subnets",
|
||||
"composeSubnet": "Subnet (CIDR)",
|
||||
"composeGateway": "Gateway",
|
||||
"composeFieldNumber": "Enter a number.",
|
||||
"composeFieldPort": "Enter a valid port or port range up to 65535.",
|
||||
"composeFieldSubnet": "Enter a subnet in CIDR notation, such as 172.28.0.0/24.",
|
||||
"deploymentPhase": {
|
||||
"preparing": "Validating Compose",
|
||||
"pulling": "Preparing images",
|
||||
"scanning": "Scanning images with Grype",
|
||||
"ready": "Ready for approval",
|
||||
"applying": "Applying decision",
|
||||
"deployed": "Services running or healthy",
|
||||
"rejected": "Cancelled",
|
||||
"failed": "Failed"
|
||||
},
|
||||
"deploymentChange": {
|
||||
"create": "Create",
|
||||
"recreate": "Recreate",
|
||||
"start": "Start",
|
||||
"keep": "Keep",
|
||||
"remove": "Remove"
|
||||
},
|
||||
"deploymentMode": {
|
||||
"deploy": "Deployment",
|
||||
"start": "Start stack",
|
||||
"update": "Manual update",
|
||||
"service": "Start service",
|
||||
"scheduled": "Scheduled update"
|
||||
},
|
||||
"composeDependencyChoice": {
|
||||
"service_started": "Started",
|
||||
"service_healthy": "Healthy",
|
||||
"service_completed_successfully": "Completed successfully"
|
||||
},
|
||||
"composeNewEntryName": "New entry name",
|
||||
"composeAdvancedValue": "This value can be edited in YAML.",
|
||||
"composeDefaultValue": "Default",
|
||||
"composeEnabled": "Enabled",
|
||||
"composeDisabled": "Disabled",
|
||||
"composeEntryName": "Name",
|
||||
"composeAddDetailed": "Add with options",
|
||||
"composeServiceFields": "Service settings",
|
||||
"composeIdentity": "Image and identity",
|
||||
"composeContainerName": "Container name",
|
||||
"composeHostname": "Hostname",
|
||||
"composePlatform": "Platform",
|
||||
"composePullPolicy": "Image pull policy",
|
||||
"composeBuild": "Build from Dockerfile",
|
||||
"composeBuildContext": "Build context",
|
||||
"composeDockerfile": "Dockerfile",
|
||||
"composeBuildTarget": "Build target",
|
||||
"composeBuildArgs": "Build arguments",
|
||||
"composeNetwork": "Network",
|
||||
"composeConnectivity": "Network and ports",
|
||||
"composeNetworkMode": "Network mode",
|
||||
"composePublishedPorts": "Published ports",
|
||||
"composeTargetPort": "Container port",
|
||||
"composeHostPort": "Host port",
|
||||
"composeBindAddress": "Bind address",
|
||||
"composeProtocol": "Protocol",
|
||||
"composeExposedPorts": "Internal ports",
|
||||
"composeNetworks": "Networks",
|
||||
"composeNetworksHint": "Use a network name defined in stack resources.",
|
||||
"composeIPv4": "IPv4 address",
|
||||
"composeIPv6": "IPv6 address",
|
||||
"composeExtraHosts": "Extra hosts",
|
||||
"composeDns": "DNS servers",
|
||||
"composeStorage": "Storage",
|
||||
"composeMounts": "Mounts",
|
||||
"composeReadOnlyRoot": "Read-only root filesystem",
|
||||
"composeMountsHint": "Declare named volumes under stack resources. Bind mounts use a path on the Docker host.",
|
||||
"composeMountType": "Mount type",
|
||||
"composeMountSource": "Source",
|
||||
"composeMountTarget": "Path in container",
|
||||
"composeReadOnly": "Read only",
|
||||
"composeWritable": "Writable",
|
||||
"composeTmpfs": "Temporary filesystems",
|
||||
"composeEnvironment": "Environment",
|
||||
"composeEnvironmentVariables": "Environment variables",
|
||||
"composeEnvironmentFiles": "Environment files",
|
||||
"composeRequired": "Required",
|
||||
"composeEnvFileFormat": "File format",
|
||||
"composeLabels": "Labels",
|
||||
"composeProfiles": "Profiles",
|
||||
"composeLifecycle": "Start and health",
|
||||
"composeProcess": "Container process",
|
||||
"composeCommand": "Command",
|
||||
"composeEntrypoint": "Entrypoint",
|
||||
"composeUser": "User",
|
||||
"composeWorkingDirectory": "Working directory",
|
||||
"composeInit": "Run init process",
|
||||
"composeTty": "Allocate TTY",
|
||||
"composeStopSignal": "Stop signal",
|
||||
"composeStopGracePeriod": "Stop timeout",
|
||||
"composeDependencies": "Service dependencies",
|
||||
"composeDependenciesHint": "Enter another service name from this stack.",
|
||||
"composeDependencyCondition": "Start condition",
|
||||
"composeHealthcheck": "Health check",
|
||||
"composeHealthcheckCommand": "Test command",
|
||||
"composeHealthcheckDisabled": "Disable health check",
|
||||
"composeHealthcheckInterval": "Interval",
|
||||
"composeHealthcheckTimeout": "Timeout",
|
||||
"composeHealthcheckRetries": "Retries",
|
||||
"composeHealthcheckStartPeriod": "Startup grace period",
|
||||
"composeResourceLimits": "Resource limits",
|
||||
"composeCpuLimit": "CPU limit",
|
||||
"composeMemoryLimit": "Memory limit",
|
||||
"composeMemoryReservation": "Memory reservation",
|
||||
"composePidLimit": "Process limit",
|
||||
"composeSharedMemory": "Shared memory size",
|
||||
"composeDeployment": "Deployment",
|
||||
"composeReplicas": "Replicas",
|
||||
"composeLogging": "Logging",
|
||||
"composeDriver": "Driver",
|
||||
"composeLoggingOptions": "Driver options",
|
||||
"composeClickEditor": "Visual editor",
|
||||
"composeStackResources": "Stack resources",
|
||||
"composeFixYaml": "Fix the syntax in YAML to continue editing this stack.",
|
||||
"composeNamedVolumes": "Named volumes",
|
||||
"composeExternal": "External resource",
|
||||
"composeInvalidServiceName": "Start the service name with a letter or number. Use letters, numbers, dots, hyphens, and underscores.",
|
||||
"containerDetails": "Container details",
|
||||
"containerDetailsFailed": "Could not load details for this container.",
|
||||
"containerImageId": "Image ID",
|
||||
"containerIdentifier": "Container ID",
|
||||
"containerCreated": "Created",
|
||||
"containerStarted": "Started",
|
||||
"containerFinished": "Stopped at",
|
||||
"containerHealth": "Health",
|
||||
"containerExitCode": "Exit code",
|
||||
"containerRestarts": "Restarts",
|
||||
"containerInstances": "Container instances",
|
||||
"containerRunningInstances": "{running} of {total} running",
|
||||
"composeServices": "Services",
|
||||
"composeRunning": "Running",
|
||||
"composeStopped": "Stopped",
|
||||
"composeUnhealthy": "Unhealthy",
|
||||
"dashboardStacks": "Docker Compose stacks",
|
||||
"dashboardOpenContainers": "Open Docker containers",
|
||||
"dashboardStackCount": "{count} stacks on connected hosts",
|
||||
"dashboardTools": "Tools",
|
||||
"dashboardNoStacks": "Create a stack or scan the configured stack folder.",
|
||||
"settingsDescription": "Configure Dockge, Docker resources, and your account.",
|
||||
"resourceTotal": "Total",
|
||||
"fileSelectionCount": "{shown} of {total} entries",
|
||||
"fileContainerPath": "Current path",
|
||||
"terminalHostContext": "Docker host",
|
||||
"terminalOpenStack": "Open stack",
|
||||
"consoleHostDescription": "Docker commands run on the selected host.",
|
||||
"setupDescription": "Create the account used to manage your Docker hosts.",
|
||||
"composeSelectNetwork": "Add an existing Docker network",
|
||||
"composeInternalNetwork": "Internal network",
|
||||
"composeAttachableNetwork": "Allow standalone containers",
|
||||
"composeEnableIPv6": "Enable IPv6",
|
||||
"languageName": "English",
|
||||
"Create your admin account": "Create your admin account",
|
||||
"authIncorrectCreds": "Incorrect username or password.",
|
||||
@ -92,10 +299,11 @@
|
||||
"unknown": "Unknown"
|
||||
},
|
||||
"autoUpdateEnable": "Enable automatic updates for this stack",
|
||||
"autoUpdateDescription": "Dockge checks running services daily at the selected time. Services with undeployed configuration changes are skipped.",
|
||||
"autoUpdateDescription": "Dockge checks running services daily at the selected time. New images are pulled, scanned with Grype, and submitted for approval.",
|
||||
"autoUpdateLastRun": "Last run: {time} · {result}",
|
||||
"autoUpdateSaveFailed": "Dockge could not confirm the automatic update setting. Reopen this stack to check it.",
|
||||
"autoUpdateResult": {
|
||||
"approval": "Images prepared for approval",
|
||||
"updated": "Image updates applied",
|
||||
"unchanged": "Eligible images up to date",
|
||||
"skipped": "No eligible services",
|
||||
@ -130,7 +338,7 @@
|
||||
"editorConflict": "The configuration changed on the host. Your edits are still here. Discard them to load the saved version, or copy them before reloading.",
|
||||
"editorSaveFailed": "Dockge could not save this configuration.",
|
||||
"editorSaveUnconfirmed": "The host did not confirm the save. Your edits are still here. Retry saving or reload the stack to check the saved version.",
|
||||
"editorComposeInvalid": "Docker Compose validation failed. Check the progress output for details.",
|
||||
"editorComposeInvalid": "Docker Compose could not validate the draft. Check the YAML file and the environment variables.",
|
||||
"editorFileConflict": "Compose and .env resolve to the same file. Save them to separate files.",
|
||||
"editorFileNotRegular": "The configuration path must point to a regular file.",
|
||||
"editorSaveRecoveryFailed": "Saving failed and automatic recovery was incomplete. Check the .dockge-*.bak files alongside the affected configuration files before retrying.",
|
||||
@ -315,7 +523,9 @@
|
||||
"removing": "Removing",
|
||||
"healthy": "Healthy",
|
||||
"unhealthy": "Unhealthy",
|
||||
"starting": "Starting"
|
||||
"starting": "Starting",
|
||||
"notCreated": "Not created",
|
||||
"mixed": "Mixed status"
|
||||
},
|
||||
"resourceDeleteTitle": "Remove Docker resource",
|
||||
"resourceDeleteImageMessage": "Remove this local image reference. Images with other tags may remain in the local store.",
|
||||
@ -339,7 +549,7 @@
|
||||
"autoUpdateTime": "Daily check at",
|
||||
"autoUpdateTimezone": "Time zone",
|
||||
"autoUpdateDelay": "Wait before installing new images",
|
||||
"autoUpdateDelayHelp": "The waiting period begins when Dockge first detects an image. It can be installed at the first scheduled check after the wait ends.",
|
||||
"autoUpdateDelayHelp": "The waiting period begins when Dockge first detects an image. You can approve the deployment after the wait ends.",
|
||||
"autoUpdateDelayHours": "Waiting period in hours",
|
||||
"autoUpdateNextRun": "Next check {time}",
|
||||
"autoUpdatePending": "{service} can update at the first check after {time}.",
|
||||
@ -351,8 +561,8 @@
|
||||
"resourceCleanupAutomation": "Automatic cleanup",
|
||||
"resourceCleanupEnable": "Enable daily cleanup",
|
||||
"resourceCleanupTime": "Daily at",
|
||||
"resourceCleanupImagesMessage": "On {host}, Docker removes unused images, including tagged images. Images referenced by running or stopped containers are kept.",
|
||||
"resourceCleanupVolumesMessage": "On {host}, Docker permanently removes data from unused local volumes, including named volumes. A saved Compose file can still reference one of these volumes.",
|
||||
"resourceCleanupImagesMessage": "Dockge cleans up unused images on {host}. The preview also shows images reserved for an approval or a recent deployment.",
|
||||
"resourceCleanupVolumesMessage": "Dockge permanently deletes data in the selected unused local volumes on {host}. Saved stack declarations and the exclusion list are checked.",
|
||||
"resourceCleanupAllFilters": "This applies to the entire selected host, regardless of the list filters.",
|
||||
"resourceCleanupNext": "Next cleanup {time}",
|
||||
"resourceCleanupLast": "Last scheduled cleanup {time} · {result}",
|
||||
|
||||
@ -1,28 +1,28 @@
|
||||
<template>
|
||||
<div class="min-h-dvh">
|
||||
<header v-if="$root.loggedIn" class="sticky top-0 z-30 border-b bg-background/95 backdrop-blur">
|
||||
<div class="flex h-14 items-center justify-between gap-2 px-3 sm:px-5">
|
||||
<router-link to="/" class="inline-flex items-center gap-2 rounded-md font-heading text-base font-semibold">
|
||||
<PhStack class="size-5" weight="duotone" />
|
||||
<div class="mx-auto flex h-14 max-w-[112rem] items-center justify-between gap-2 px-3 sm:px-5">
|
||||
<router-link to="/" class="inline-flex shrink-0 items-center gap-2 rounded-md font-heading text-base font-semibold">
|
||||
<img src="/icon.svg" alt="" width="20" height="20" class="shrink-0" />
|
||||
Dockge
|
||||
</router-link>
|
||||
|
||||
<nav class="flex items-center gap-1" :aria-label="$t('navigation')">
|
||||
<UiButton as-child :variant="['hostContainers', 'containerFiles'].includes($route.name) ? 'secondary' : 'ghost'">
|
||||
<router-link to="/containers" :aria-label="$t('hostContainers')">
|
||||
<PhCube />
|
||||
<RiBox3Line />
|
||||
<span class="hidden sm:inline">{{ $t("hostContainers") }}</span>
|
||||
</router-link>
|
||||
</UiButton>
|
||||
<UiButton as-child :variant="$route.path.startsWith('/console') ? 'secondary' : 'ghost'">
|
||||
<router-link to="/console" :aria-label="$t('console')">
|
||||
<PhTerminalWindow />
|
||||
<RiTerminalBoxLine />
|
||||
<span class="hidden sm:inline">{{ $t("console") }}</span>
|
||||
</router-link>
|
||||
</UiButton>
|
||||
<UiButton as-child :variant="$route.path.startsWith('/settings') ? 'secondary' : 'ghost'">
|
||||
<router-link to="/settings/general" :aria-label="$t('Settings')">
|
||||
<PhGear />
|
||||
<RiSettings3Line />
|
||||
<span class="hidden sm:inline">{{ $t("Settings") }}</span>
|
||||
</router-link>
|
||||
</UiButton>
|
||||
@ -38,10 +38,10 @@
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem @select="scanFolder">
|
||||
<PhArrowsClockwise /> {{ $t("scanFolder") }}
|
||||
<RiRefreshLine /> {{ $t("scanFolder") }}
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem v-if="$root.username" @select="$root.logout()">
|
||||
<PhSignOut /> {{ $t("Logout") }}
|
||||
<RiLogoutBoxRLine /> {{ $t("Logout") }}
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
<main>
|
||||
<UiAlert v-if="!$root.socketIO.connected && !$root.socketIO.firstConnect" variant="destructive" class="mx-4 mt-4">
|
||||
<PhWarningCircle />
|
||||
<RiErrorWarningLine />
|
||||
<div>
|
||||
{{ $root.socketIO.connectionErrorMsg }}
|
||||
<p v-if="$root.socketIO.showReverseProxyGuide" class="mt-1">
|
||||
@ -68,19 +68,18 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { PhArrowsClockwise, PhCube, PhGear, PhSignOut, PhStack, PhTerminalWindow, PhWarningCircle } from "@phosphor-icons/vue";
|
||||
import { RiRefreshLine, RiBox3Line, RiSettings3Line, RiLogoutBoxRLine, RiTerminalBoxLine, RiErrorWarningLine } from "@remixicon/vue";
|
||||
import Login from "../components/Login.vue";
|
||||
import { ALL_ENDPOINTS } from "../../../common/util-common";
|
||||
|
||||
export default {
|
||||
components: { Login,
|
||||
PhArrowsClockwise,
|
||||
PhCube,
|
||||
PhGear,
|
||||
PhSignOut,
|
||||
PhStack,
|
||||
PhTerminalWindow,
|
||||
PhWarningCircle },
|
||||
RiRefreshLine,
|
||||
RiBox3Line,
|
||||
RiSettings3Line,
|
||||
RiLogoutBoxRLine,
|
||||
RiTerminalBoxLine,
|
||||
RiErrorWarningLine },
|
||||
methods: {
|
||||
scanFolder() {
|
||||
this.$root.emitAgent(ALL_ENDPOINTS, "requestStackList", (res) => this.$root.toastRes(res));
|
||||
|
||||
70
frontend/src/lib/compose-document.ts
Normal file
70
frontend/src/lib/compose-document.ts
Normal file
@ -0,0 +1,70 @@
|
||||
import { isMap, isNode, isScalar, isSeq, type Document } from "yaml";
|
||||
|
||||
function isMapping(value: unknown): value is Record<string, unknown> {
|
||||
return value !== null && typeof value === "object" && !Array.isArray(value);
|
||||
}
|
||||
|
||||
function equal(a: unknown, b: unknown) {
|
||||
return a === b || (typeof a === "object" && typeof b === "object" && JSON.stringify(a) === JSON.stringify(b));
|
||||
}
|
||||
|
||||
/** Update only changed nodes so unrelated comments, anchors and tags survive form edits. */
|
||||
export function updateComposeDocument(document: Document, previous: unknown, next: unknown, path: (string | number)[] = []) {
|
||||
if (equal(previous, next)) {
|
||||
return;
|
||||
}
|
||||
const node = path.length ? document.getIn(path, true) : document.contents;
|
||||
if (isMapping(previous) && isMapping(next) && isMap(node)) {
|
||||
// A removed inherited key requires replacing this mapping to remove the merge.
|
||||
if (!Object.keys(previous).some(key => !Object.hasOwn(next, key) && !node.has(key))) {
|
||||
for (const key of Object.keys(previous)) {
|
||||
if (!Object.hasOwn(next, key)) {
|
||||
document.deleteIn([ ...path, key ]);
|
||||
}
|
||||
}
|
||||
for (const key of Object.keys(next)) {
|
||||
updateComposeDocument(document, Object.hasOwn(previous, key) ? previous[key] : undefined, next[key], [ ...path, key ]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (Array.isArray(previous) && Array.isArray(next) && isSeq(node)) {
|
||||
if (previous.length === next.length) {
|
||||
next.forEach((value, index) => updateComposeDocument(document, previous[index], value, [ ...path, index ]));
|
||||
} else {
|
||||
let start = 0;
|
||||
let end = 0;
|
||||
const common = Math.min(previous.length, next.length);
|
||||
while (start < common && equal(previous[start], next[start])) {
|
||||
start++;
|
||||
}
|
||||
while (start + end < common && equal(previous.at(-1 - end), next.at(-1 - end))) {
|
||||
end++;
|
||||
}
|
||||
const shared = common - start - end;
|
||||
for (let index = start; index < start + shared; index++) {
|
||||
updateComposeDocument(document, previous[index], next[index], [ ...path, index ]);
|
||||
}
|
||||
node.items.splice(start + shared, previous.length - start - shared - end,
|
||||
...next.slice(start + shared, next.length - end).map(value => document.createNode(value)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
const replacement = document.createNode(next);
|
||||
if (isNode(node)) {
|
||||
Object.assign(replacement, {
|
||||
comment: node.comment,
|
||||
commentBefore: node.commentBefore,
|
||||
spaceBefore: node.spaceBefore,
|
||||
});
|
||||
// Preserve an existing anchor when replacing the value it names.
|
||||
if ("anchor" in node && node.anchor && (isScalar(replacement) || isMap(replacement) || isSeq(replacement))) {
|
||||
replacement.anchor = node.anchor;
|
||||
}
|
||||
}
|
||||
if (path.length) {
|
||||
document.setIn(path, replacement);
|
||||
} else {
|
||||
document.contents = replacement;
|
||||
}
|
||||
}
|
||||
@ -1,27 +1,27 @@
|
||||
<template>
|
||||
<section class="grid min-w-0 gap-5">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="workspace-heading">
|
||||
<div class="min-w-0">
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<h1 class="page-title break-all">{{ isAdd ? $t("compose") : stack.name }}</h1>
|
||||
<Uptime v-if="!isAdd" :stack="globalStack || stack" />
|
||||
</div>
|
||||
<p v-if="!isAdd && $root.agentCount > 1" class="mt-1 text-sm text-muted-foreground">{{ endpointDisplay }}</p>
|
||||
<p v-if="!isAdd" class="mt-1 text-sm text-muted-foreground">{{ endpointDisplay || $t("stackListLocal") }} · {{ stack.composeFileName || 'compose.yaml' }}</p>
|
||||
</div>
|
||||
|
||||
<div v-if="stack.isManagedByDockge" class="flex flex-wrap items-center gap-2">
|
||||
<template v-if="isEditMode">
|
||||
<UiButton v-if="!isAdd" variant="ghost" :disabled="processing" @click="discardStack">{{ $t("discardStack") }}</UiButton>
|
||||
<UiButton variant="outline" :disabled="processing || hasConfigErrors || (!isAdd && !dirty)" @click="saveStack">
|
||||
<UiButton variant="outline" :disabled="processing || deploymentPending || hasConfigErrors || (!isAdd && !dirty)" @click="saveStack">
|
||||
<AppIcon name="save" /> {{ $t("saveStackDraft") }}
|
||||
</UiButton>
|
||||
<UiButton :disabled="processing || hasConfigErrors" @click="deployStack">
|
||||
<AppIcon name="rocket" /> {{ $t("deployStack") }}
|
||||
<UiButton :disabled="processing || deploymentPending || hasConfigErrors" @click="deployStack">
|
||||
<AppIcon name="rocket" /> {{ $t("deployReview") }}
|
||||
</UiButton>
|
||||
</template>
|
||||
<template v-else>
|
||||
<UiButton variant="outline" :disabled="processing" @click="enableEditMode"><AppIcon name="edit" /> {{ $t("editStack") }}</UiButton>
|
||||
<UiButton v-if="!active" :disabled="processing" @click="runStackOperation('startStack')"><AppIcon name="play" /> {{ $t("startStack") }}</UiButton>
|
||||
<UiButton v-if="!active" :disabled="processing || deploymentPending" @click="runStackOperation('startStack')"><AppIcon name="play" /> {{ $t("startStack") }}</UiButton>
|
||||
<UiButton v-else :disabled="processing" @click="runStackOperation('stopStack')"><AppIcon name="stop" /> {{ $t("stopStack") }}</UiButton>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger as-child>
|
||||
@ -29,7 +29,7 @@
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end">
|
||||
<DropdownMenuItem v-if="active" @select="runStackOperation('restartStack')"><AppIcon name="restart" /> {{ $t("restartStack") }}</DropdownMenuItem>
|
||||
<DropdownMenuItem @select="runStackOperation('updateStack')"><AppIcon name="cloud-download" /> {{ $t("updateStack") }}</DropdownMenuItem>
|
||||
<DropdownMenuItem :disabled="deploymentPending" @select="runStackOperation('updateStack')"><AppIcon name="cloud-download" /> {{ $t("updateStack") }}</DropdownMenuItem>
|
||||
<DropdownMenuItem @select="runStackOperation('downStack')"><AppIcon name="stop" /> {{ $t("downStack") }}</DropdownMenuItem>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem variant="destructive" @select="showDeleteDialog = true"><AppIcon name="trash" /> {{ $t("deleteStack") }}</DropdownMenuItem>
|
||||
@ -39,8 +39,20 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<StackDeployments
|
||||
ref="deployments" :stack-name="stack.name || ''" :endpoint="endpoint" :managed="Boolean(stack.isManagedByDockge)"
|
||||
@deployed="deploymentFinished" @restore="restoreDraft" @pending="deploymentPending = $event"
|
||||
/>
|
||||
|
||||
<UiAlert v-if="saveError" variant="destructive">{{ $t(saveError) }}</UiAlert>
|
||||
<UiAlert v-if="!stack.isManagedByDockge && !processing">{{ $t("stackNotManagedByDockgeMsg") }}</UiAlert>
|
||||
<UiAlert v-if="!stack.isManagedByDockge && !processing">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<span>{{ $t("stackNotManagedByDockgeMsg") }}</span>
|
||||
<UiButton as-child variant="outline" size="sm">
|
||||
<router-link :to="{ name: 'hostContainers', query: { host: endpoint || undefined, search: stack.name } }">{{ $t("hostContainers") }}</router-link>
|
||||
</UiButton>
|
||||
</div>
|
||||
</UiAlert>
|
||||
|
||||
<div v-show="showProgressTerminal" class="grid min-w-0 gap-2">
|
||||
<UiButton variant="outline" size="sm" class="justify-self-start" :aria-expanded="progressOpen" aria-controls="stack-progress-output" @click="progressOpen = !progressOpen">
|
||||
@ -53,7 +65,7 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<fieldset v-if="stack.isManagedByDockge" :disabled="processing" class="grid min-w-0 gap-4">
|
||||
<fieldset v-if="stack.isManagedByDockge" :disabled="processing || (isEditMode && deploymentPending)" class="grid min-w-0 gap-4">
|
||||
<UiCard v-if="isAdd" size="sm">
|
||||
<CardContent class="grid gap-3 sm:grid-cols-2">
|
||||
<div class="grid min-w-0 gap-1.5">
|
||||
@ -74,14 +86,20 @@
|
||||
<Tabs v-model="workspaceTab" class="min-w-0 gap-4" :unmount-on-hide="false">
|
||||
<TabsList variant="line" class="w-full justify-start overflow-x-auto border-b" :aria-label="$t('stackViewTabs')">
|
||||
<TabsTrigger v-if="!isEditMode" value="overview">{{ $t("overview") }}</TabsTrigger>
|
||||
<TabsTrigger value="configuration">{{ $t("configuration") }}</TabsTrigger>
|
||||
<TabsTrigger v-if="isEditMode" value="services">{{ $tc("container", 2) }}</TabsTrigger>
|
||||
<TabsTrigger v-if="isEditMode" value="resources">{{ $t("stackNetworkAndLinks") }}</TabsTrigger>
|
||||
<TabsTrigger v-if="isEditMode" value="services">{{ $t("composeClickEditor") }}</TabsTrigger>
|
||||
<TabsTrigger v-if="isEditMode" value="resources">{{ $t("composeStackResources") }}</TabsTrigger>
|
||||
<TabsTrigger value="configuration">{{ isEditMode ? 'YAML / .env' : $t("configuration") }}</TabsTrigger>
|
||||
<TabsTrigger v-if="!isEditMode" value="logs">{{ $t("stackLogs") }}</TabsTrigger>
|
||||
<TabsTrigger v-if="!isEditMode && (autoUpdate || imageScanSupported)" value="maintenance">{{ $t("stackMaintenance") }}</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent v-if="!isEditMode" value="overview" class="min-w-0">
|
||||
<dl class="mb-4 grid grid-cols-2 gap-2 sm:grid-cols-4">
|
||||
<UiCard v-for="[label, value] in stackFacts" :key="label" class="gap-1 p-3">
|
||||
<dt class="text-xs text-muted-foreground">{{ $t(label) }}</dt>
|
||||
<dd class="font-heading text-xl tabular-nums">{{ value }}</dd>
|
||||
</UiCard>
|
||||
</dl>
|
||||
<div v-if="urls.length" class="mb-4 flex flex-wrap items-center gap-2">
|
||||
<span class="text-xs text-muted-foreground">{{ $tc("url", 2) }}</span>
|
||||
<UiBadge v-for="urlItem in urls" :key="urlItem.url" as-child variant="outline">
|
||||
@ -112,26 +130,42 @@
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent v-if="isEditMode" value="services" class="min-w-0">
|
||||
<form class="mb-3 flex flex-wrap gap-2" @submit.prevent="addContainer">
|
||||
<UiInput v-model="newContainerName" :aria-label="$t('New Container Name...')" :placeholder="$t('New Container Name...')" class="w-full sm:max-w-xs" />
|
||||
<UiButton type="submit" variant="outline"><AppIcon name="plus" /> {{ $t("addContainer") }}</UiButton>
|
||||
</form>
|
||||
<div ref="containerList" class="grid gap-2">
|
||||
<Container v-for="name in serviceNames" :key="name" :name="name" is-edit-mode />
|
||||
</div>
|
||||
<UiAlert v-if="yamlError" variant="destructive" class="mb-3">{{ $t("composeFixYaml") }}</UiAlert>
|
||||
<fieldset :disabled="Boolean(yamlError)" class="grid min-w-0 gap-3">
|
||||
<form class="flex flex-wrap gap-2" @submit.prevent="addContainer">
|
||||
<UiInput v-model.trim="newContainerName" :aria-label="$t('New Container Name...')" :placeholder="$t('New Container Name...')" class="w-full sm:max-w-xs" />
|
||||
<UiButton type="submit" variant="outline"><AppIcon name="plus" /> {{ $t("addContainer") }}</UiButton>
|
||||
</form>
|
||||
<div ref="containerList" class="grid gap-2">
|
||||
<Container v-for="name in serviceNames" :key="name" :name="name" is-edit-mode />
|
||||
</div>
|
||||
</fieldset>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent v-if="isEditMode" value="resources" class="min-w-0">
|
||||
<div class="grid gap-3 lg:grid-cols-2">
|
||||
<UiAlert v-if="yamlError" variant="destructive" class="mb-3">{{ $t("composeFixYaml") }}</UiAlert>
|
||||
<fieldset :disabled="Boolean(yamlError)" class="grid min-w-0 gap-3 lg:grid-cols-2">
|
||||
<UiCard>
|
||||
<CardHeader><CardTitle>{{ $tc("network", 2) }}</CardTitle></CardHeader>
|
||||
<CardContent><NetworkInput /></CardContent>
|
||||
<CardContent>
|
||||
<NetworkInput :model-value="jsonConfig.networks" :endpoint="endpoint" :stack-name="stack.name" @update:model-value="setResource('networks', $event)" />
|
||||
</CardContent>
|
||||
</UiCard>
|
||||
<UiCard>
|
||||
<CardHeader><CardTitle>{{ $tc("url", 2) }}</CardTitle></CardHeader>
|
||||
<CardContent><ArrayInput name="urls" :display-name="$t('url')" placeholder="https://" object-type="x-dockge" /></CardContent>
|
||||
<CardContent>
|
||||
<ComposeCollection
|
||||
:label="$t('composeNamedVolumes')" :model-value="jsonConfig.volumes" prefer-mapping :fields="volumeFields"
|
||||
@update:model-value="setResource('volumes', $event)"
|
||||
/>
|
||||
</CardContent>
|
||||
</UiCard>
|
||||
</div>
|
||||
<UiCard class="lg:col-span-2">
|
||||
<CardHeader><CardTitle>{{ $tc("url", 2) }}</CardTitle></CardHeader>
|
||||
<CardContent>
|
||||
<ComposeCollection :model-value="jsonConfig['x-dockge']?.urls" :label="$t('url')" placeholder="https://" @update:model-value="setStackLinks" />
|
||||
</CardContent>
|
||||
</UiCard>
|
||||
</fieldset>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent v-if="!isEditMode" value="logs" class="min-w-0">
|
||||
@ -163,16 +197,18 @@
|
||||
import Container from "../components/Container.vue";
|
||||
import Terminal from "../components/Terminal.vue";
|
||||
import Uptime from "../components/Uptime.vue";
|
||||
import ArrayInput from "../components/ArrayInput.vue";
|
||||
import ActionDialog from "../components/ActionDialog.vue";
|
||||
import ImageVulnerabilities from "../components/ImageVulnerabilities.vue";
|
||||
import StackConfigEditor from "../components/StackConfigEditor.vue";
|
||||
import StackUpdateSettings from "../components/StackUpdateSettings.vue";
|
||||
import { parseDocument, Document } from "yaml";
|
||||
import StackDeployments from "../components/StackDeployments.vue";
|
||||
import ComposeCollection from "../components/ComposeCollection.vue";
|
||||
import { parseDocument } from "yaml";
|
||||
import { updateComposeDocument } from "../lib/compose-document";
|
||||
|
||||
import {
|
||||
COMBINED_TERMINAL_COLS,
|
||||
copyYAMLComments, envsubstYAML,
|
||||
envsubstYAML,
|
||||
getCombinedTerminalName,
|
||||
getComposeTerminalName,
|
||||
PROGRESS_TERMINAL_ROWS,
|
||||
@ -198,11 +234,12 @@ let dockerStatsTimeout = null;
|
||||
|
||||
export default {
|
||||
components: {
|
||||
ArrayInput,
|
||||
ActionDialog,
|
||||
ImageVulnerabilities,
|
||||
StackConfigEditor,
|
||||
StackUpdateSettings,
|
||||
StackDeployments,
|
||||
ComposeCollection,
|
||||
NetworkInput,
|
||||
Container,
|
||||
Terminal,
|
||||
@ -223,10 +260,12 @@ export default {
|
||||
envsubstJSONConfig: {},
|
||||
yamlError: "",
|
||||
yamlDoc: null,
|
||||
yamlSnapshot: null,
|
||||
updatingFromYaml: false,
|
||||
savedConfig: null,
|
||||
saveError: "",
|
||||
processing: true,
|
||||
deploymentPending: false,
|
||||
autoUpdate: null,
|
||||
autoUpdateSaving: false,
|
||||
imageScanSupported: false,
|
||||
@ -245,6 +284,15 @@ export default {
|
||||
submitted: false,
|
||||
showDeleteDialog: false,
|
||||
newContainerName: "",
|
||||
volumeFields: [
|
||||
{ key: "driver",
|
||||
label: "composeDriver" },
|
||||
{ key: "name",
|
||||
label: "composeEntryName" },
|
||||
{ key: "external",
|
||||
label: "composeExternal",
|
||||
kind: "boolean" },
|
||||
],
|
||||
stopServiceStatusTimeout: false,
|
||||
stopDockerStatsTimeout: false,
|
||||
};
|
||||
@ -253,6 +301,15 @@ export default {
|
||||
serviceNames() {
|
||||
return Object.keys(this.jsonConfig.services ?? {});
|
||||
},
|
||||
stackFacts() {
|
||||
const instances = Object.values(this.serviceStatusList).flat();
|
||||
return [
|
||||
[ "composeServices", this.serviceNames.length ],
|
||||
[ "containerInstances", instances.length ],
|
||||
[ "composeRunning", instances.filter(instance => instance.state === "running").length ],
|
||||
[ "composeUnhealthy", instances.filter(instance => instance.status === "unhealthy").length ],
|
||||
];
|
||||
},
|
||||
dirty() {
|
||||
return this.isEditMode && this.savedConfig !== null
|
||||
&& (this.stack.composeYAML !== this.savedConfig.yaml || this.stack.composeENV !== this.savedConfig.env
|
||||
@ -359,17 +416,13 @@ export default {
|
||||
|
||||
jsonConfig: {
|
||||
handler() {
|
||||
if (!this.updatingFromYaml && !this.yamlError) {
|
||||
|
||||
let doc = new Document(this.jsonConfig);
|
||||
|
||||
// Stick back the yaml comments
|
||||
if (this.yamlDoc) {
|
||||
copyYAMLComments(doc, this.yamlDoc);
|
||||
}
|
||||
|
||||
this.stack.composeYAML = doc.toString();
|
||||
if (!this.updatingFromYaml && !this.yamlError && this.yamlDoc) {
|
||||
const next = JSON.parse(JSON.stringify(this.jsonConfig));
|
||||
const doc = this.yamlDoc.clone();
|
||||
updateComposeDocument(doc, this.yamlSnapshot, next);
|
||||
this.yamlDoc = markRaw(doc);
|
||||
this.yamlSnapshot = markRaw(next);
|
||||
this.stack.composeYAML = doc.toString();
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
@ -377,7 +430,7 @@ export default {
|
||||
},
|
||||
|
||||
isEditMode(editing) {
|
||||
this.workspaceTab = editing ? "configuration" : "overview";
|
||||
this.workspaceTab = editing ? "services" : "overview";
|
||||
},
|
||||
workspaceTab(value) {
|
||||
if (value === "configuration") {
|
||||
@ -521,6 +574,9 @@ export default {
|
||||
this.saveError = "";
|
||||
this.processing = false;
|
||||
this.bindTerminal();
|
||||
if ([ "logs", "maintenance" ].includes(this.$route.query.tab)) {
|
||||
this.workspaceTab = this.$route.query.tab;
|
||||
}
|
||||
} else {
|
||||
this.$root.toastRes(res);
|
||||
this.processing = false;
|
||||
@ -563,60 +619,20 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
deployStack() {
|
||||
if (this.hasConfigErrors) {
|
||||
async deployStack() {
|
||||
if (this.hasConfigErrors || !this.serviceNames.length) {
|
||||
return;
|
||||
}
|
||||
this.processing = true;
|
||||
|
||||
if (!this.jsonConfig.services || Object.keys(this.jsonConfig.services).length === 0) {
|
||||
this.$root.toastError("No services found in compose.yaml");
|
||||
this.processing = false;
|
||||
return;
|
||||
if (!this.stack.name) {
|
||||
this.stack.name = String(this.jsonConfig.services[this.serviceNames[0]].container_name || this.serviceNames[0]).toLowerCase();
|
||||
}
|
||||
|
||||
// Check if services is object
|
||||
if (typeof this.jsonConfig.services !== "object") {
|
||||
this.$root.toastError("Services must be an object");
|
||||
this.processing = false;
|
||||
return;
|
||||
}
|
||||
|
||||
let serviceNameList = Object.keys(this.jsonConfig.services);
|
||||
|
||||
// Set the stack name if empty, use the first container name
|
||||
if (!this.stack.name && serviceNameList.length > 0) {
|
||||
let serviceName = serviceNameList[0];
|
||||
let service = this.jsonConfig.services[serviceName];
|
||||
|
||||
if (service && service.container_name) {
|
||||
this.stack.name = service.container_name;
|
||||
} else {
|
||||
this.stack.name = serviceName;
|
||||
}
|
||||
}
|
||||
|
||||
this.progressOpen = true;
|
||||
this.bindTerminal();
|
||||
|
||||
const args = [ this.stack.name, this.stack.composeYAML, this.stack.composeENV, this.isAdd ];
|
||||
if (this.stack.revision) {
|
||||
args.push(this.stack.revision);
|
||||
}
|
||||
this.saveError = "";
|
||||
this.$root.emitAgent(this.endpoint, "deployStack", ...args, (res) => {
|
||||
this.processing = false;
|
||||
this.progressOpen = !res.ok;
|
||||
this.$root.toastRes(res);
|
||||
|
||||
if (res.ok) {
|
||||
this.isEditMode = false;
|
||||
this.captureSavedConfig();
|
||||
this.$router.push(this.url);
|
||||
} else {
|
||||
this.saveError = res.msg || "editorSaveFailed";
|
||||
}
|
||||
});
|
||||
await this.$nextTick();
|
||||
await this.$refs.deployments.prepare("deployStack", ...args);
|
||||
},
|
||||
|
||||
async saveStack() {
|
||||
@ -658,6 +674,10 @@ export default {
|
||||
},
|
||||
|
||||
runStackOperation(event) {
|
||||
if (event === "startStack" || event === "updateStack") {
|
||||
this.$refs.deployments.prepare(event, this.stack.name);
|
||||
return;
|
||||
}
|
||||
this.processing = true;
|
||||
this.progressOpen = true;
|
||||
this.$root.emitAgent(this.endpoint, event, this.stack.name, (res) => {
|
||||
@ -667,6 +687,28 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
deploymentFinished() {
|
||||
this.isEditMode = false;
|
||||
this.captureSavedConfig();
|
||||
if (this.isAdd) {
|
||||
this.submitted = true;
|
||||
this.$router.push(this.url);
|
||||
} else {
|
||||
this.loadStack();
|
||||
this.requestServiceStatus();
|
||||
}
|
||||
},
|
||||
|
||||
restoreDraft(config) {
|
||||
if (this.deploymentPending || (this.dirty && !confirm(this.$t("confirmLeaveStack")))) {
|
||||
return;
|
||||
}
|
||||
this.isEditMode = true;
|
||||
this.stack.composeYAML = config.yaml;
|
||||
this.stack.composeENV = config.env;
|
||||
this.yamlCodeChange();
|
||||
},
|
||||
|
||||
deleteDialog() {
|
||||
this.$root.emitAgent(this.endpoint, "deleteStack", this.stack.name, (res) => {
|
||||
this.$root.toastRes(res);
|
||||
@ -685,7 +727,7 @@ export default {
|
||||
},
|
||||
|
||||
yamlToJSON(yaml) {
|
||||
let doc = parseDocument(yaml);
|
||||
let doc = parseDocument(yaml, { merge: true });
|
||||
if (doc.errors.length > 0) {
|
||||
throw doc.errors[0];
|
||||
}
|
||||
@ -717,6 +759,7 @@ export default {
|
||||
|
||||
this.updatingFromYaml = true;
|
||||
this.yamlDoc = markRaw(doc);
|
||||
this.yamlSnapshot = markRaw(JSON.parse(JSON.stringify(config)));
|
||||
this.yamlError = "";
|
||||
this.jsonConfig = config;
|
||||
this.updateEnvironmentPreview();
|
||||
@ -772,7 +815,7 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.jsonConfig.services[this.newContainerName]) {
|
||||
if (Object.hasOwn(this.jsonConfig.services, this.newContainerName)) {
|
||||
this.$root.toastError("Container name already exists");
|
||||
return;
|
||||
}
|
||||
@ -782,8 +825,12 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
this.jsonConfig.services[this.newContainerName] = {
|
||||
restart: "unless-stopped",
|
||||
if (!/^[a-zA-Z0-9][a-zA-Z0-9_.-]*$/.test(this.newContainerName)) {
|
||||
this.$root.toastError("composeInvalidServiceName");
|
||||
return;
|
||||
}
|
||||
this.jsonConfig.services = { ...this.jsonConfig.services,
|
||||
[this.newContainerName]: { restart: "unless-stopped" },
|
||||
};
|
||||
this.newContainerName = "";
|
||||
this.$nextTick(() => {
|
||||
@ -794,18 +841,25 @@ export default {
|
||||
stackNameToLowercase() {
|
||||
this.stack.name = this.stack?.name?.toLowerCase();
|
||||
},
|
||||
setResource(key, value) {
|
||||
if (value === undefined) {
|
||||
delete this.jsonConfig[key];
|
||||
} else {
|
||||
this.jsonConfig[key] = value;
|
||||
}
|
||||
},
|
||||
setStackLinks(value) {
|
||||
const extra = { ...this.jsonConfig["x-dockge"] };
|
||||
if (value === undefined) {
|
||||
delete extra.urls;
|
||||
} else {
|
||||
extra.urls = value;
|
||||
}
|
||||
this.setResource("x-dockge", Object.keys(extra).length ? extra : undefined);
|
||||
},
|
||||
|
||||
startService(serviceName) {
|
||||
this.processing = true;
|
||||
|
||||
this.$root.emitAgent(this.endpoint, "startService", this.stack.name, serviceName, (res) => {
|
||||
this.processing = false;
|
||||
this.$root.toastRes(res);
|
||||
|
||||
if (res.ok) {
|
||||
this.requestServiceStatus(); // Refresh service status
|
||||
}
|
||||
});
|
||||
this.$refs.deployments.prepare("startService", this.stack.name, serviceName);
|
||||
},
|
||||
|
||||
stopService(serviceName) {
|
||||
|
||||
@ -1,7 +1,21 @@
|
||||
<template>
|
||||
<section v-if="!processing" class="grid min-w-0 gap-4">
|
||||
<h1 class="page-title">{{ $t("console") }}</h1>
|
||||
<Terminal v-if="enableConsole" class="terminal" :rows="20" mode="mainTerminal" name="console" :endpoint="endpoint" />
|
||||
<section class="grid min-w-0 gap-4">
|
||||
<div class="workspace-heading">
|
||||
<div>
|
||||
<h1 class="page-title">{{ $t("console") }}</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">{{ $t("consoleHostDescription") }}</p>
|
||||
</div>
|
||||
<div class="grid min-w-40 gap-1">
|
||||
<UiLabel for="console-host">{{ $t("terminalHostContext") }}</UiLabel>
|
||||
<UiNativeSelect id="console-host" :model-value="endpoint" @update:model-value="selectHost">
|
||||
<option value="">{{ $t("stackListLocal") }}</option>
|
||||
<option v-for="(agent, host) in remoteHosts" :key="host" :value="host" :disabled="$root.agentStatusList[host] !== 'online'">{{ agent.name || host }}</option>
|
||||
</UiNativeSelect>
|
||||
</div>
|
||||
</div>
|
||||
<p v-if="processing" role="status" class="text-sm text-muted-foreground">{{ $t("resourceLoading") }}</p>
|
||||
<UiAlert v-else-if="failed" variant="destructive">{{ $t("resourceLoadFailed") }}</UiAlert>
|
||||
<Terminal v-else-if="enableConsole" :key="endpoint" class="terminal" :rows="20" mode="mainTerminal" name="console" :endpoint="endpoint" />
|
||||
<UiAlert v-else class="max-w-2xl">
|
||||
<h2 class="section-title">{{ $t("Console is not enabled") }}</h2>
|
||||
<i18n-t keypath="ConsoleNotEnabledMSG1" tag="p" class="text-muted-foreground">
|
||||
@ -26,21 +40,48 @@ export default {
|
||||
return {
|
||||
processing: true,
|
||||
enableConsole: false,
|
||||
failed: false,
|
||||
generation: 0,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
endpoint() {
|
||||
return this.$route.params.endpoint || "";
|
||||
},
|
||||
remoteHosts() {
|
||||
return Object.fromEntries(Object.entries(this.$root.agentList).filter(([ host ]) => host));
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$root.emitAgent(this.endpoint, "checkMainTerminal", (res) => {
|
||||
this.enableConsole = res.ok;
|
||||
this.processing = false;
|
||||
});
|
||||
watch: {
|
||||
endpoint: { handler: "checkConsole",
|
||||
immediate: true },
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.generation++;
|
||||
},
|
||||
methods: {
|
||||
|
||||
selectHost(host) {
|
||||
return this.$router.push(host ? "/console/" + encodeURIComponent(host) : "/console");
|
||||
},
|
||||
async checkConsole() {
|
||||
const generation = ++this.generation;
|
||||
this.processing = true;
|
||||
this.failed = false;
|
||||
try {
|
||||
const result = await this.$root.getSocket().timeout(10000).emitWithAck("agent", this.endpoint, "checkMainTerminal");
|
||||
if (generation === this.generation) {
|
||||
this.enableConsole = result.ok;
|
||||
}
|
||||
} catch {
|
||||
if (generation === this.generation) {
|
||||
this.failed = true;
|
||||
}
|
||||
} finally {
|
||||
if (generation === this.generation) {
|
||||
this.processing = false;
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
@ -1,12 +1,14 @@
|
||||
<template>
|
||||
<section class="grid min-w-0 gap-4">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="workspace-heading">
|
||||
<div class="min-w-0">
|
||||
<router-link :to="{ name: 'hostContainers', query: endpoint ? { host: endpoint } : {} }" class="text-sm text-muted-foreground hover:underline">
|
||||
{{ $t("hostContainers") }}
|
||||
</router-link>
|
||||
<h1 class="page-title mt-1">{{ $t("containerFileExplorer") }}</h1>
|
||||
<p class="mt-1 break-all font-mono text-sm text-muted-foreground">{{ name || id.slice(0, 12) }}</p>
|
||||
<p class="mt-1 break-all text-sm text-muted-foreground">
|
||||
{{ $root.endpointDisplayFunction(endpoint) || $t("stackListLocal") }} · <code>{{ name || id.slice(0, 12) }}</code>
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<UiButton variant="outline" :disabled="busy || loading || !ready" @click="openAction('mkdir')"><AppIcon name="folder" /> {{ $t("containerFileNewFolder") }}</UiButton>
|
||||
@ -17,7 +19,7 @@
|
||||
</div>
|
||||
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<nav class="flex min-w-0 flex-1 flex-wrap items-center gap-1 rounded-lg border p-1" :aria-label="$t('containerFilePath')">
|
||||
<nav class="flex min-w-0 flex-1 flex-wrap items-center gap-1 rounded-lg border p-1" :aria-label="$t('fileContainerPath')">
|
||||
<UiButton v-for="crumb in breadcrumbs" :key="crumb.path" variant="ghost" size="sm" class="max-w-full" :disabled="busy || loading" @click="load(crumb.path)">
|
||||
<span class="truncate">{{ crumb.label }}</span>
|
||||
</UiButton>
|
||||
@ -25,7 +27,10 @@
|
||||
<UiButton variant="outline" size="icon" :disabled="busy || loading" :aria-label="$t('resourceRefresh')" @click="load(path)"><AppIcon name="restart" /></UiButton>
|
||||
</div>
|
||||
|
||||
<UiInput v-model="search" type="search" class="sm:max-w-xs" :aria-label="$t('containerFileSearch')" :placeholder="$t('containerFileSearch')" />
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<UiInput v-model="search" type="search" class="w-full sm:max-w-xs" :aria-label="$t('containerFileSearch')" :placeholder="$t('containerFileSearch')" />
|
||||
<p v-if="ready && !loading" class="text-xs text-muted-foreground" role="status">{{ $t("fileSelectionCount", { shown: visible.length, total: entries.length }) }}</p>
|
||||
</div>
|
||||
<p v-if="busy || loading" role="status" class="text-sm text-muted-foreground">{{ $t(busy ? "containerFileWorking" : "resourceLoading") }}</p>
|
||||
<UiAlert v-if="error" variant="destructive">{{ $t(error) }}</UiAlert>
|
||||
<ul v-if="visible.length" class="divide-y rounded-xl border bg-card">
|
||||
|
||||
@ -1,15 +1,16 @@
|
||||
<template>
|
||||
<section class="grid min-w-0 gap-4">
|
||||
<div class="flex flex-wrap items-start justify-between gap-3">
|
||||
<div class="workspace-heading">
|
||||
<div class="min-w-0">
|
||||
<router-link :to="stackPath" class="text-sm text-muted-foreground hover:underline">{{ $t("terminalOpenStack") }} · {{ stackName }}</router-link>
|
||||
<h1 class="page-title break-all">{{ serviceName }}</h1>
|
||||
<p class="mt-1 break-all text-sm text-muted-foreground">{{ stackName }} · {{ $t("terminal") }}</p>
|
||||
<p class="mt-1 break-all text-sm text-muted-foreground">{{ $root.endpointDisplayFunction(endpoint) || $t("stackListLocal") }} · <code>{{ shell }}</code></p>
|
||||
</div>
|
||||
<UiButton v-if="shell !== 'sh'" as-child variant="outline">
|
||||
<router-link :to="sh"><AppIcon name="terminal" /> {{ $t("Switch to sh") }}</router-link>
|
||||
</UiButton>
|
||||
</div>
|
||||
<Terminal class="terminal" :rows="20" mode="interactive" :name="terminalName" :stack-name="stackName" :service-name="serviceName" :shell="shell" :endpoint="endpoint" />
|
||||
<Terminal :key="$route.fullPath" class="terminal" :rows="20" mode="interactive" :name="terminalName" :stack-name="stackName" :service-name="serviceName" :shell="shell" :endpoint="endpoint" />
|
||||
</section>
|
||||
</template>
|
||||
|
||||
@ -23,6 +24,9 @@ export default {
|
||||
stackName() {
|
||||
return this.$route.params.stackName;
|
||||
},
|
||||
stackPath() {
|
||||
return "/compose/" + encodeURIComponent(this.stackName) + (this.endpoint ? "/" + encodeURIComponent(this.endpoint) : "");
|
||||
},
|
||||
endpoint() {
|
||||
return this.$route.params.endpoint || "";
|
||||
},
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<div class="md:grid md:grid-cols-[17rem_minmax(0,1fr)] xl:grid-cols-[19rem_minmax(0,1fr)]">
|
||||
<div class="mx-auto max-w-[112rem] md:grid md:grid-cols-[15rem_minmax(0,1fr)] xl:grid-cols-[18rem_minmax(0,1fr)]">
|
||||
<aside v-if="desktop" class="sticky top-14 h-[calc(100dvh-3.5rem)] overflow-y-auto border-e border-sidebar-border bg-sidebar text-sidebar-foreground">
|
||||
<StackList />
|
||||
</aside>
|
||||
@ -7,7 +7,7 @@
|
||||
<Sheet v-model:open="stackListOpen">
|
||||
<SheetTrigger as-child>
|
||||
<UiButton variant="outline">
|
||||
<PhList /> {{ $t("stackListTitle") }}
|
||||
<RiMenuLine /> {{ $t("stackListTitle") }}
|
||||
</UiButton>
|
||||
</SheetTrigger>
|
||||
<SheetContent side="left" :close-label="$t('stackListClose')" :aria-describedby="undefined" class="data-[side=left]:w-[min(90vw,22rem)] overflow-y-auto bg-sidebar p-0">
|
||||
@ -27,13 +27,13 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { PhList } from "@phosphor-icons/vue";
|
||||
import { RiMenuLine } from "@remixicon/vue";
|
||||
import StackList from "../components/StackList.vue";
|
||||
|
||||
const desktopViewport = window.matchMedia("(min-width: 768px)");
|
||||
|
||||
export default {
|
||||
components: { PhList,
|
||||
components: { RiMenuLine,
|
||||
StackList },
|
||||
data() {
|
||||
return {
|
||||
|
||||
@ -1,12 +1,22 @@
|
||||
<template>
|
||||
<section v-if="$route.name === 'DashboardHome'" class="grid gap-5">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<h1 class="page-title">{{ $t("overview") }}</h1>
|
||||
<UiButton as-child class="md:hidden">
|
||||
<router-link to="/compose"><AppIcon name="plus" /> {{ $t("stackListNew") }}</router-link>
|
||||
</UiButton>
|
||||
<div class="workspace-heading">
|
||||
<div>
|
||||
<h1 class="page-title">{{ $t("dashboardStacks") }}</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">{{ $t("dashboardStackCount", { count: stacks.length }) }}</p>
|
||||
</div>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<UiButton as-child variant="outline">
|
||||
<router-link to="/containers">{{ $t("dashboardOpenContainers") }}</router-link>
|
||||
</UiButton>
|
||||
<UiButton as-child>
|
||||
<router-link to="/compose"><AppIcon name="plus" /> {{ $t("stackListNew") }}</router-link>
|
||||
</UiButton>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<HostAttention />
|
||||
|
||||
<dl class="grid grid-cols-3 gap-2 sm:gap-3" :aria-label="$t('statusSummary')">
|
||||
<UiCard v-for="status in statusSummary" :key="status.name" class="min-w-0 gap-0 py-0">
|
||||
<CardContent class="px-3 py-3 sm:px-5">
|
||||
@ -19,8 +29,27 @@
|
||||
</UiCard>
|
||||
</dl>
|
||||
|
||||
<UiCard v-if="stacks.length || $root.stackListLoaded">
|
||||
<CardHeader><CardTitle>{{ $t("stackListTitle") }}</CardTitle></CardHeader>
|
||||
<CardContent>
|
||||
<ul v-if="stacks.length" class="divide-y">
|
||||
<li v-for="stack in stacks.slice(0, 6)" :key="stack.name + '_' + (stack.endpoint || '')">
|
||||
<router-link :to="stackUrl(stack)" class="flex items-center gap-3 rounded-md py-2 hover:bg-muted/50">
|
||||
<span class="min-w-0 flex-1">
|
||||
<span class="block truncate text-sm font-semibold">{{ stack.name }}</span>
|
||||
<span class="text-xs text-muted-foreground">{{ $root.endpointDisplayFunction(stack.endpoint || '') || $t("stackListLocal") }}</span>
|
||||
</span>
|
||||
<UiBadge variant="outline" class="status-badge" :data-status="stackStatus(stack)">{{ $t(stackStatus(stack)) }}</UiBadge>
|
||||
<AppIcon name="caret-right" class="size-4 text-muted-foreground" />
|
||||
</router-link>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else class="text-sm text-muted-foreground">{{ $t("dashboardNoStacks") }}</p>
|
||||
</CardContent>
|
||||
</UiCard>
|
||||
|
||||
<div class="grid items-start gap-4 xl:grid-cols-2">
|
||||
<UiCard>
|
||||
<UiCard id="dockge-agents">
|
||||
<CardHeader class="flex flex-wrap items-center justify-between gap-2">
|
||||
<CardTitle class="font-heading text-base">{{ $tc("dockgeAgent", 2) }}</CardTitle>
|
||||
<UiButton variant="outline" size="sm" :aria-expanded="showAgentForm" @click="showAgentForm = !showAgentForm">
|
||||
@ -73,9 +102,13 @@
|
||||
|
||||
<UiCard>
|
||||
<CardHeader>
|
||||
<CardTitle class="font-heading text-base">{{ $t("Convert to Compose") }}</CardTitle>
|
||||
<CardTitle class="font-heading text-base">{{ $t("dashboardTools") }}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div class="mb-4 flex flex-wrap gap-2">
|
||||
<UiButton as-child variant="outline" size="sm"><router-link to="/settings/images">{{ $t("resourceImages") }}</router-link></UiButton>
|
||||
<UiButton as-child variant="outline" size="sm"><router-link to="/settings/volumes">{{ $t("resourceVolumes") }}</router-link></UiButton>
|
||||
</div>
|
||||
<form class="grid gap-3" @submit.prevent="convertDockerRun">
|
||||
<div class="grid gap-1.5">
|
||||
<UiLabel for="docker-run">{{ $t("Docker Run") }}</UiLabel>
|
||||
@ -95,11 +128,13 @@
|
||||
|
||||
<script>
|
||||
import ActionDialog from "../components/ActionDialog.vue";
|
||||
import HostAttention from "../components/HostAttention.vue";
|
||||
import ForkCredit from "../components/ForkCredit.vue";
|
||||
import { statusNameShort } from "../../../common/util-common";
|
||||
|
||||
export default {
|
||||
components: { ActionDialog,
|
||||
HostAttention,
|
||||
ForkCredit },
|
||||
data() {
|
||||
return {
|
||||
@ -134,12 +169,22 @@ export default {
|
||||
},
|
||||
|
||||
computed: {
|
||||
stacks() {
|
||||
return Object.values(this.$root.completeStackList).sort((a, b) => a.name.localeCompare(b.name));
|
||||
},
|
||||
statusSummary() {
|
||||
return [ "active", "exited", "inactive" ].map(name => ({ name,
|
||||
count: this.getStatusNum(name) }));
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
stackStatus(stack) {
|
||||
const status = statusNameShort(stack.status);
|
||||
return status === "?" ? "stackListUnknown" : status;
|
||||
},
|
||||
stackUrl(stack) {
|
||||
return "/compose/" + encodeURIComponent(stack.name) + (stack.endpoint ? "/" + encodeURIComponent(stack.endpoint) : "");
|
||||
},
|
||||
|
||||
addAgent() {
|
||||
this.connectingAgent = true;
|
||||
|
||||
@ -1,17 +1,24 @@
|
||||
<template>
|
||||
<section class="grid min-w-0 gap-4">
|
||||
<div class="flex flex-wrap items-center justify-between gap-2">
|
||||
<div class="workspace-heading">
|
||||
<div>
|
||||
<h1 class="page-title">{{ $t("hostContainers") }}</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">{{ $t("hostContainersDescription") }}</p>
|
||||
</div>
|
||||
<UiButton variant="outline" :disabled="loading" @click="load"><AppIcon name="restart" /> {{ $t("resourceRefresh") }}</UiButton>
|
||||
</div>
|
||||
<dl v-if="items.length && !loading && !error" class="grid grid-cols-3 gap-2">
|
||||
<UiCard v-for="[label, count] in counts" :key="label" class="gap-1 p-3">
|
||||
<dt class="text-xs text-muted-foreground">{{ $t(label) }}</dt>
|
||||
<dd class="font-heading text-xl tabular-nums">{{ count }}</dd>
|
||||
</UiCard>
|
||||
</dl>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<UiInput v-model="search" type="search" :aria-label="$t('containerSearch')" :placeholder="$t('containerSearch')" class="w-full sm:max-w-xs" />
|
||||
<UiNativeSelect v-model="filter" :aria-label="$t('stackListStatus')">
|
||||
<option value="all">{{ $t("containerAll") }}</option>
|
||||
<option value="running">{{ $t("resourceContainerState.running") }}</option>
|
||||
<option value="stopped">{{ $t("composeStopped") }}</option>
|
||||
</UiNativeSelect>
|
||||
<UiNativeSelect v-if="hosts.length > 1" v-model="endpoint" :aria-label="$t('stackListHost')">
|
||||
<option v-for="host in hosts" :key="host.value" :value="host.value" :disabled="!host.online">{{ host.label }}</option>
|
||||
@ -22,30 +29,41 @@
|
||||
<p v-else-if="loading" class="text-sm text-muted-foreground" role="status">{{ $t("resourceLoading") }}</p>
|
||||
<p v-else-if="!visible.length" class="rounded-lg border border-dashed p-5 text-sm text-muted-foreground">{{ $t("resourceNoMatches") }}</p>
|
||||
<ul v-else class="divide-y rounded-xl border bg-card">
|
||||
<li v-for="item in visible" :key="item.id" class="flex flex-wrap items-center gap-2 p-3">
|
||||
<div class="min-w-0 flex-1 basis-44">
|
||||
<p class="break-all font-heading text-sm font-semibold">{{ item.name }}</p>
|
||||
<p class="break-all font-mono text-xs text-muted-foreground">{{ item.image }}</p>
|
||||
<p v-if="item.project" class="mt-1 text-xs text-muted-foreground">{{ $t("containerComposeProject", { name: item.project }) }}</p>
|
||||
<li v-for="item in visible" :key="item.id" class="grid min-w-0 gap-2 p-3 sm:p-4">
|
||||
<div class="flex flex-wrap items-start gap-2">
|
||||
<div class="min-w-0 flex-1 basis-40">
|
||||
<p class="break-all font-heading text-sm font-semibold">{{ item.name }}</p>
|
||||
<p class="break-all font-mono text-xs text-muted-foreground">{{ item.image }} · {{ item.id.slice(0, 12) }}</p>
|
||||
<p v-if="item.project" class="mt-1 text-xs text-muted-foreground">
|
||||
<router-link v-if="stackPath(item)" :to="stackPath(item)" class="font-medium text-foreground hover:underline">{{ item.project }}</router-link>
|
||||
<span v-else>{{ $t("containerComposeProject", { name: item.project }) }}</span>
|
||||
<span v-if="item.service"> / {{ item.service }}</span>
|
||||
</p>
|
||||
</div>
|
||||
<UiBadge variant="outline" class="status-badge" :data-status="item.state" :title="item.status">{{ $t("resourceContainerState." + item.state, item.state) }}</UiBadge>
|
||||
<UiButton v-if="item.state === 'running'" as-child variant="outline" size="sm">
|
||||
<router-link :to="{ name: 'containerFiles', params: { id: item.id, endpoint } }">
|
||||
<AppIcon name="folder" /> {{ $t("containerFiles") }}
|
||||
</router-link>
|
||||
</UiButton>
|
||||
</div>
|
||||
<UiBadge variant="outline" class="status-badge" :data-status="item.state">{{ $t("resourceContainerState." + item.state, item.state) }}</UiBadge>
|
||||
<UiButton v-if="item.state === 'running'" as-child variant="outline" size="sm">
|
||||
<router-link :to="{ name: 'containerFiles', params: { id: item.id, endpoint } }">
|
||||
<AppIcon name="folder" /> {{ $t("containerFiles") }}
|
||||
</router-link>
|
||||
</UiButton>
|
||||
<p v-if="item.ports" class="break-all font-mono text-xs text-muted-foreground">{{ item.ports }}</p>
|
||||
<ContainerDetails :id="item.id" :endpoint="endpoint" />
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ContainerDetails from "../components/ContainerDetails.vue";
|
||||
|
||||
export default {
|
||||
components: { ContainerDetails },
|
||||
data() {
|
||||
return {
|
||||
endpoint: typeof this.$route.query.host === "string" ? this.$route.query.host : "",
|
||||
items: [],
|
||||
search: "",
|
||||
search: typeof this.$route.query.search === "string" ? this.$route.query.search : "",
|
||||
filter: "all",
|
||||
loading: false,
|
||||
error: "",
|
||||
@ -53,6 +71,13 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
counts() {
|
||||
return [
|
||||
[ "containerAll", this.items.length ],
|
||||
[ "composeRunning", this.items.filter(item => item.state === "running").length ],
|
||||
[ "composeStopped", this.items.filter(item => this.isStopped(item)).length ],
|
||||
];
|
||||
},
|
||||
hosts() {
|
||||
return [{ value: "",
|
||||
label: this.$t("stackListLocal"),
|
||||
@ -65,8 +90,8 @@ export default {
|
||||
},
|
||||
visible() {
|
||||
const query = this.search.trim().toLocaleLowerCase();
|
||||
return this.items.filter(item => (this.filter === "all" || item.state === "running")
|
||||
&& [ item.name, item.image, item.project, item.id ].some(value => (value || "").toLocaleLowerCase().includes(query)));
|
||||
return this.items.filter(item => (this.filter === "all" || (this.filter === "running" ? item.state === "running" : this.isStopped(item)))
|
||||
&& [ item.name, item.image, item.project, item.service, item.id, item.ports ].some(value => (value || "").toLocaleLowerCase().includes(query)));
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
@ -79,6 +104,15 @@ export default {
|
||||
this.generation++;
|
||||
},
|
||||
methods: {
|
||||
isStopped(item) {
|
||||
return [ "created", "exited", "dead" ].includes(item.state);
|
||||
},
|
||||
stackPath(item) {
|
||||
if (!this.$root.completeStackList[item.project + "_" + this.endpoint]) {
|
||||
return "";
|
||||
}
|
||||
return "/compose/" + encodeURIComponent(item.project) + (this.endpoint ? "/" + encodeURIComponent(this.endpoint) : "");
|
||||
},
|
||||
async load() {
|
||||
const generation = ++this.generation;
|
||||
this.loading = true;
|
||||
|
||||
@ -1,9 +1,14 @@
|
||||
<template>
|
||||
<section class="grid min-w-0 gap-5" :class="{ 'max-w-4xl': !resourcePage }">
|
||||
<h1 class="page-title">{{ $t("Settings") }}</h1>
|
||||
<nav :aria-label="$t('Settings')" class="flex flex-wrap gap-1 border-b pb-3">
|
||||
<header class="workspace-heading">
|
||||
<div>
|
||||
<h1 class="page-title">{{ $t("Settings") }}</h1>
|
||||
<p class="mt-1 text-sm text-muted-foreground">{{ $t("settingsDescription") }}</p>
|
||||
</div>
|
||||
</header>
|
||||
<nav :aria-label="$t('Settings')" class="flex gap-1 overflow-x-auto pb-1">
|
||||
<UiButton v-for="(item, key) in subMenus" :key="key" as-child :variant="currentPage === key ? 'secondary' : 'ghost'">
|
||||
<router-link :to="'/settings/' + key">{{ item.title }}</router-link>
|
||||
<router-link :to="'/settings/' + key" class="shrink-0">{{ item.title }}</router-link>
|
||||
</UiButton>
|
||||
</nav>
|
||||
<router-view v-if="resourcePage" />
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<AuthCard :title="$t('Create your admin account')" data-cy="setup-form">
|
||||
<AuthCard :title="$t('Create your admin account')" :description="$t('setupDescription')" data-cy="setup-form">
|
||||
<form class="grid gap-4" @submit.prevent="submit">
|
||||
<div class="grid gap-2">
|
||||
<UiLabel for="language">{{ $t("Language") }}</UiLabel>
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
/* shadcn preset b2fms620zo */
|
||||
/* shadcn preset b4a7LsmarT */
|
||||
@import "tailwindcss" source(none);
|
||||
@import "tw-animate-css";
|
||||
@import "@fontsource-variable/roboto-slab";
|
||||
@import "@fontsource-variable/public-sans";
|
||||
@import "@fontsource-variable/roboto";
|
||||
@import "@fontsource-variable/merriweather";
|
||||
@import "./workspace.css";
|
||||
|
||||
@source "../";
|
||||
@ -11,76 +11,76 @@
|
||||
|
||||
:root {
|
||||
--background: oklch(1 0 0);
|
||||
--foreground: oklch(0.148 0.004 228.8);
|
||||
--foreground: oklch(0.141 0.005 285.823);
|
||||
--card: oklch(1 0 0);
|
||||
--card-foreground: oklch(0.148 0.004 228.8);
|
||||
--card-foreground: oklch(0.141 0.005 285.823);
|
||||
--popover: oklch(1 0 0);
|
||||
--popover-foreground: oklch(0.148 0.004 228.8);
|
||||
--primary: oklch(0.218 0.008 223.9);
|
||||
--primary-foreground: oklch(0.987 0.002 197.1);
|
||||
--secondary: oklch(0.963 0.002 197.1);
|
||||
--secondary-foreground: oklch(0.218 0.008 223.9);
|
||||
--muted: oklch(0.963 0.002 197.1);
|
||||
--muted-foreground: oklch(0.56 0.021 213.5);
|
||||
--accent: oklch(0.218 0.008 223.9);
|
||||
--accent-foreground: oklch(0.987 0.002 197.1);
|
||||
--popover-foreground: oklch(0.141 0.005 285.823);
|
||||
--primary: oklch(0.491 0.27 292.581);
|
||||
--primary-foreground: oklch(0.969 0.016 293.756);
|
||||
--secondary: oklch(0.967 0.001 286.375);
|
||||
--secondary-foreground: oklch(0.21 0.006 285.885);
|
||||
--muted: oklch(0.967 0.001 286.375);
|
||||
--muted-foreground: oklch(0.552 0.016 285.938);
|
||||
--accent: oklch(0.967 0.001 286.375);
|
||||
--accent-foreground: oklch(0.21 0.006 285.885);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
--border: oklch(0.925 0.005 214.3);
|
||||
--input: oklch(0.925 0.005 214.3);
|
||||
--ring: oklch(0.723 0.014 214.4);
|
||||
--chart-1: oklch(0.811 0.111 293.571);
|
||||
--chart-2: oklch(0.606 0.25 292.717);
|
||||
--chart-3: oklch(0.541 0.281 293.009);
|
||||
--chart-4: oklch(0.491 0.27 292.581);
|
||||
--chart-5: oklch(0.432 0.232 292.759);
|
||||
--radius: 0.625rem;
|
||||
--sidebar: oklch(0.987 0.002 197.1);
|
||||
--sidebar-foreground: oklch(0.148 0.004 228.8);
|
||||
--sidebar-primary: oklch(0.218 0.008 223.9);
|
||||
--sidebar-primary-foreground: oklch(0.987 0.002 197.1);
|
||||
--sidebar-accent: oklch(0.963 0.002 197.1);
|
||||
--sidebar-accent-foreground: oklch(0.218 0.008 223.9);
|
||||
--sidebar-border: oklch(0.925 0.005 214.3);
|
||||
--sidebar-ring: oklch(0.723 0.014 214.4);
|
||||
--border: oklch(0.92 0.004 286.32);
|
||||
--input: oklch(0.92 0.004 286.32);
|
||||
--ring: oklch(0.705 0.015 286.067);
|
||||
--chart-1: oklch(0.827 0.119 306.383);
|
||||
--chart-2: oklch(0.627 0.265 303.9);
|
||||
--chart-3: oklch(0.558 0.288 302.321);
|
||||
--chart-4: oklch(0.496 0.265 301.924);
|
||||
--chart-5: oklch(0.438 0.218 303.724);
|
||||
--radius: 0.45rem;
|
||||
--sidebar: oklch(0.985 0 0);
|
||||
--sidebar-foreground: oklch(0.141 0.005 285.823);
|
||||
--sidebar-primary: oklch(0.541 0.281 293.009);
|
||||
--sidebar-primary-foreground: oklch(0.969 0.016 293.756);
|
||||
--sidebar-accent: oklch(0.967 0.001 286.375);
|
||||
--sidebar-accent-foreground: oklch(0.21 0.006 285.885);
|
||||
--sidebar-border: oklch(0.92 0.004 286.32);
|
||||
--sidebar-ring: oklch(0.705 0.015 286.067);
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: oklch(0.148 0.004 228.8);
|
||||
--foreground: oklch(0.987 0.002 197.1);
|
||||
--card: oklch(0.218 0.008 223.9);
|
||||
--card-foreground: oklch(0.987 0.002 197.1);
|
||||
--popover: oklch(0.218 0.008 223.9);
|
||||
--popover-foreground: oklch(0.987 0.002 197.1);
|
||||
--primary: oklch(0.925 0.005 214.3);
|
||||
--primary-foreground: oklch(0.218 0.008 223.9);
|
||||
--secondary: oklch(0.275 0.011 216.9);
|
||||
--secondary-foreground: oklch(0.987 0.002 197.1);
|
||||
--muted: oklch(0.275 0.011 216.9);
|
||||
--muted-foreground: oklch(0.723 0.014 214.4);
|
||||
--accent: oklch(0.925 0.005 214.3);
|
||||
--accent-foreground: oklch(0.218 0.008 223.9);
|
||||
--background: oklch(0.141 0.005 285.823);
|
||||
--foreground: oklch(0.985 0 0);
|
||||
--card: oklch(0.21 0.006 285.885);
|
||||
--card-foreground: oklch(0.985 0 0);
|
||||
--popover: oklch(0.21 0.006 285.885);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--primary: oklch(0.432 0.232 292.759);
|
||||
--primary-foreground: oklch(0.969 0.016 293.756);
|
||||
--secondary: oklch(0.274 0.006 286.033);
|
||||
--secondary-foreground: oklch(0.985 0 0);
|
||||
--muted: oklch(0.274 0.006 286.033);
|
||||
--muted-foreground: oklch(0.705 0.015 286.067);
|
||||
--accent: oklch(0.274 0.006 286.033);
|
||||
--accent-foreground: oklch(0.985 0 0);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
--border: oklch(1 0 0 / 10%);
|
||||
--input: oklch(1 0 0 / 15%);
|
||||
--ring: oklch(0.56 0.021 213.5);
|
||||
--chart-1: oklch(0.811 0.111 293.571);
|
||||
--chart-2: oklch(0.606 0.25 292.717);
|
||||
--chart-3: oklch(0.541 0.281 293.009);
|
||||
--chart-4: oklch(0.491 0.27 292.581);
|
||||
--chart-5: oklch(0.432 0.232 292.759);
|
||||
--sidebar: oklch(0.218 0.008 223.9);
|
||||
--sidebar-foreground: oklch(0.987 0.002 197.1);
|
||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||
--sidebar-primary-foreground: oklch(0.987 0.002 197.1);
|
||||
--sidebar-accent: oklch(0.275 0.011 216.9);
|
||||
--sidebar-accent-foreground: oklch(0.987 0.002 197.1);
|
||||
--ring: oklch(0.552 0.016 285.938);
|
||||
--chart-1: oklch(0.827 0.119 306.383);
|
||||
--chart-2: oklch(0.627 0.265 303.9);
|
||||
--chart-3: oklch(0.558 0.288 302.321);
|
||||
--chart-4: oklch(0.496 0.265 301.924);
|
||||
--chart-5: oklch(0.438 0.218 303.724);
|
||||
--sidebar: oklch(0.21 0.006 285.885);
|
||||
--sidebar-foreground: oklch(0.985 0 0);
|
||||
--sidebar-primary: oklch(0.606 0.25 292.717);
|
||||
--sidebar-primary-foreground: oklch(0.969 0.016 293.756);
|
||||
--sidebar-accent: oklch(0.274 0.006 286.033);
|
||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||
--sidebar-border: oklch(1 0 0 / 10%);
|
||||
--sidebar-ring: oklch(0.56 0.021 213.5);
|
||||
--sidebar-ring: oklch(0.552 0.016 285.938);
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--font-serif: 'Roboto Slab Variable', serif;
|
||||
--font-heading: 'Public Sans Variable', sans-serif;
|
||||
--font-sans: 'Roboto Variable', sans-serif;
|
||||
--font-heading: 'Merriweather Variable', serif;
|
||||
--color-sidebar-ring: var(--sidebar-ring);
|
||||
--color-sidebar-border: var(--sidebar-border);
|
||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||
@ -129,6 +129,6 @@
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
html {
|
||||
@apply font-serif;
|
||||
@apply font-sans;
|
||||
}
|
||||
}
|
||||
@ -26,6 +26,26 @@
|
||||
}
|
||||
|
||||
@layer components {
|
||||
:is([data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-sub-content"]) {
|
||||
--popover: oklch(0.21 0.006 285.885 / 93%);
|
||||
--popover-foreground: oklch(0.985 0 0);
|
||||
--accent: oklch(1 0 0 / 10%);
|
||||
--accent-foreground: var(--popover-foreground);
|
||||
--destructive: oklch(0.704 0.191 22.216);
|
||||
backdrop-filter: blur(12px);
|
||||
}
|
||||
|
||||
.dark :is([data-slot="dropdown-menu-content"], [data-slot="dropdown-menu-sub-content"]) {
|
||||
--popover: oklch(0.985 0 0 / 93%);
|
||||
--popover-foreground: oklch(0.141 0.005 285.823);
|
||||
--accent: oklch(0 0 0 / 8%);
|
||||
--destructive: oklch(0.577 0.245 27.325);
|
||||
}
|
||||
|
||||
.workspace-heading {
|
||||
@apply flex flex-wrap items-start justify-between gap-3 border-b pb-4;
|
||||
}
|
||||
|
||||
.status-dot {
|
||||
display: inline-block;
|
||||
flex: none;
|
||||
@ -85,7 +105,7 @@
|
||||
}
|
||||
|
||||
:root {
|
||||
--syntax-key: oklch(0.432 0.232 292.759);
|
||||
--syntax-key: var(--primary);
|
||||
--syntax-string: oklch(0.45 0.105 164);
|
||||
--syntax-value: oklch(0.47 0.14 255);
|
||||
}
|
||||
|
||||
69
package-lock.json
generated
69
package-lock.json
generated
@ -8,9 +8,12 @@
|
||||
"name": "dockge",
|
||||
"version": "1.5.0",
|
||||
"dependencies": {
|
||||
"@fontsource-variable/merriweather": "^5.3.0",
|
||||
"@fontsource-variable/roboto": "^5.3.0",
|
||||
"@homebridge/node-pty-prebuilt-multiarch": "0.11.14",
|
||||
"@inventage/envsubst": "^0.16.0",
|
||||
"@louislam/sqlite3": "~15.1.6",
|
||||
"@remixicon/vue": "^4.9.0",
|
||||
"bcryptjs": "~2.4.3",
|
||||
"check-password-strength": "~2.0.10",
|
||||
"command-exists": "~1.2.9",
|
||||
@ -46,11 +49,8 @@
|
||||
"@codemirror/lint": "6.9.2",
|
||||
"@codemirror/search": "6.5.11",
|
||||
"@codemirror/view": "6.39.6",
|
||||
"@fontsource-variable/public-sans": "^5.3.0",
|
||||
"@fontsource-variable/roboto-slab": "^5.3.0",
|
||||
"@fontsource/jetbrains-mono": "^5.2.5",
|
||||
"@lezer/highlight": "^1.2.5",
|
||||
"@phosphor-icons/vue": "^2.2.1",
|
||||
"@tailwindcss/vite": "^4.3.5",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/command-exists": "~1.2.3",
|
||||
@ -122,7 +122,6 @@
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz",
|
||||
"integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@ -132,7 +131,6 @@
|
||||
"version": "7.25.9",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
|
||||
"integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
@ -142,7 +140,6 @@
|
||||
"version": "7.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz",
|
||||
"integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.27.0"
|
||||
@ -171,7 +168,6 @@
|
||||
"version": "7.27.0",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz",
|
||||
"integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/helper-string-parser": "^7.25.9",
|
||||
@ -848,22 +844,20 @@
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@fontsource-variable/public-sans": {
|
||||
"node_modules/@fontsource-variable/merriweather": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/public-sans/-/public-sans-5.3.0.tgz",
|
||||
"integrity": "sha512-AVfkmAt50BMXWpOO21FAntiJFKGX6xTc2dSL8dxtDteONe9IuRXJWGbs0EbG955vAMCq23ENeuopuW87cGWDSQ==",
|
||||
"dev": true,
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/merriweather/-/merriweather-5.3.0.tgz",
|
||||
"integrity": "sha512-wK7S4NtPXWUWll/sZCdub93pqSCnFkpKFbnoOE8fh+9Ut6JFjgkc9UlBxHJ0RVMkDpoWwGwMwYYTMvd3G9aAXA==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/roboto-slab": {
|
||||
"node_modules/@fontsource-variable/roboto": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/roboto-slab/-/roboto-slab-5.3.0.tgz",
|
||||
"integrity": "sha512-eByKAjLM9td0qsXCOZhlUGfhsjen//epd6/cAJOg+o73RtYBijrI1jz+lTp2X0ebwTCLmKB1+Kt/QiRMgmNPTw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/roboto/-/roboto-5.3.0.tgz",
|
||||
"integrity": "sha512-BoaaZiQf8fgtxv07KXkTwx1bKz/EoqIlTXq2OOKKXINxp6qXWdnlChqV+hSaDANS49yyUASFl3OVBMMDTCIHFA==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
@ -1166,7 +1160,6 @@
|
||||
"version": "1.6.0",
|
||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz",
|
||||
"integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@jridgewell/trace-mapping": {
|
||||
@ -1514,19 +1507,6 @@
|
||||
"@octokit/openapi-types": "^24.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@phosphor-icons/vue": {
|
||||
"version": "2.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@phosphor-icons/vue/-/vue-2.2.1.tgz",
|
||||
"integrity": "sha512-3RNg1utc2Z5RwPKWFkW3eXI/0BfQAwXgtFxPUPeSzi55jGYUq16b+UqcgbKLazWFlwg5R92OCLKjDiJjeiJcnA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"vue": ">=3.2.39"
|
||||
}
|
||||
},
|
||||
"node_modules/@pkgjs/parseargs": {
|
||||
"version": "0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
|
||||
@ -1537,6 +1517,15 @@
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/@remixicon/vue": {
|
||||
"version": "4.9.0",
|
||||
"resolved": "https://registry.npmjs.org/@remixicon/vue/-/vue-4.9.0.tgz",
|
||||
"integrity": "sha512-4P0MY5ScL+MRLnHu1iT3xHAsliBwOGDIgSgHCZhSj2wkLa5NzqiQ4SGD/04VoHM+BRr8+xjmF7ZemkOUlMDJ3A==",
|
||||
"license": "Remix Icon License 1.0",
|
||||
"peerDependencies": {
|
||||
"vue": ">= 3"
|
||||
}
|
||||
},
|
||||
"node_modules/@rollup/rollup-android-arm-eabi": {
|
||||
"version": "4.60.2",
|
||||
"resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.2.tgz",
|
||||
@ -2706,7 +2695,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.13.tgz",
|
||||
"integrity": "sha512-oOdAkwqUfW1WqpwSYJce06wvt6HljgY3fGeM9NcVA1HaYOij3mZG9Rkysn0OHuyUAGMbEbARIpsG+LPVlBJ5/Q==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.25.3",
|
||||
@ -2720,7 +2708,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.13.tgz",
|
||||
"integrity": "sha512-ZOJ46sMOKUjO3e94wPdCzQ6P1Lx/vhp2RSvfaab88Ajexs0AHeV0uasYhi99WPaogmBlRHNRuly8xV75cNTMDA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/compiler-core": "3.5.13",
|
||||
@ -2731,7 +2718,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.13.tgz",
|
||||
"integrity": "sha512-6VdaljMpD82w6c2749Zhf5T9u5uLBWKnVue6XWxprDobftnletJ8+oel7sexFfM3qIxNmVE7LSFGTpv6obNyaQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/parser": "^7.25.3",
|
||||
@ -2749,7 +2735,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.13.tgz",
|
||||
"integrity": "sha512-wMH6vrYHxQl/IybKJagqbquvxpWCuVYpoUJfCqFZwa/JY1GdATAQ+TgVtgrwwMZ0D07QhA99rs/EAAWfvG6KpA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.5.13",
|
||||
@ -2767,7 +2752,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.13.tgz",
|
||||
"integrity": "sha512-NaCwtw8o48B9I6L1zl2p41OHo/2Z4wqYGGIK1Khu5T7yxrn+ATOixn/Udn2m+6kZKB/J7cuT9DbWWhRxqixACg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/shared": "3.5.13"
|
||||
@ -2777,7 +2761,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.13.tgz",
|
||||
"integrity": "sha512-Fj4YRQ3Az0WTZw1sFe+QDb0aXCerigEpw418pw1HBUKFtnQHWzwojaukAs2X/c9DQz4MQ4bsXTGlcpGxU/RCIw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "3.5.13",
|
||||
@ -2788,7 +2771,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.13.tgz",
|
||||
"integrity": "sha512-dLaj94s93NYLqjLiyFzVs9X6dWhTdAlEAciC3Moq7gzAc13VJUdCnjjRurNM6uTLFATRHexHCTu/Xp3eW6yoog==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/reactivity": "3.5.13",
|
||||
@ -2801,7 +2783,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.13.tgz",
|
||||
"integrity": "sha512-wAi4IRJV/2SAW3htkTlB+dHeRmpTiVIK1OGLWV1yeStVSebSQQOwGwIq0D3ZIoBj2C2qpgz5+vX9iEBkTdk5YA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/compiler-ssr": "3.5.13",
|
||||
@ -2815,7 +2796,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.13.tgz",
|
||||
"integrity": "sha512-/hnE/qP5ZoGpol0a5mDi45bOd7t3tjYJBjsgCsivow7D48cJeV5l05RD82lPqi7gRiphZM37rnhW1l6ZoCNNnQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@vueuse/core": {
|
||||
@ -4036,7 +4016,6 @@
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
|
||||
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/data-view-buffer": {
|
||||
@ -4508,7 +4487,6 @@
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
||||
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
||||
"dev": true,
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.12"
|
||||
@ -5002,7 +4980,6 @@
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
|
||||
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/esutils": {
|
||||
@ -7148,7 +7125,6 @@
|
||||
"version": "0.30.21",
|
||||
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
|
||||
"integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@jridgewell/sourcemap-codec": "^1.5.5"
|
||||
@ -7527,7 +7503,6 @@
|
||||
"version": "3.3.11",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz",
|
||||
"integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
@ -8017,7 +7992,6 @@
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
@ -8055,7 +8029,6 @@
|
||||
"version": "8.5.3",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.3.tgz",
|
||||
"integrity": "sha512-dle9A3yYxlBSrt8Fu+IpjGT8SY8hN0mlaA6GY8t0P5PjIOZemULz/E2Bnm/2dcUOena75OTNkHI76uZBNUUq3A==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@ -9489,7 +9462,6 @@
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
@ -10158,7 +10130,7 @@
|
||||
"version": "5.2.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz",
|
||||
"integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
@ -10802,7 +10774,6 @@
|
||||
"version": "3.5.13",
|
||||
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.13.tgz",
|
||||
"integrity": "sha512-wmeiSMxkZCSc+PM2w2VRsOYAZC8GdipNFRTsLSfodVqI9mbejKeXEGr8SckuLnrQPGe3oJN5c3K0vpoU9q/wCQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "3.5.13",
|
||||
|
||||
@ -21,9 +21,12 @@
|
||||
"reset-password": "tsx ./extra/reset-password.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource-variable/merriweather": "^5.3.0",
|
||||
"@fontsource-variable/roboto": "^5.3.0",
|
||||
"@homebridge/node-pty-prebuilt-multiarch": "0.11.14",
|
||||
"@inventage/envsubst": "^0.16.0",
|
||||
"@louislam/sqlite3": "~15.1.6",
|
||||
"@remixicon/vue": "^4.9.0",
|
||||
"bcryptjs": "~2.4.3",
|
||||
"check-password-strength": "~2.0.10",
|
||||
"command-exists": "~1.2.9",
|
||||
@ -59,11 +62,8 @@
|
||||
"@codemirror/lint": "6.9.2",
|
||||
"@codemirror/search": "6.5.11",
|
||||
"@codemirror/view": "6.39.6",
|
||||
"@fontsource-variable/public-sans": "^5.3.0",
|
||||
"@fontsource-variable/roboto-slab": "^5.3.0",
|
||||
"@fontsource/jetbrains-mono": "^5.2.5",
|
||||
"@lezer/highlight": "^1.2.5",
|
||||
"@phosphor-icons/vue": "^2.2.1",
|
||||
"@tailwindcss/vite": "^4.3.5",
|
||||
"@types/bcryptjs": "^2.4.6",
|
||||
"@types/command-exists": "~1.2.3",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user