diff options
Diffstat (limited to 'desktop/modules/services/ServicesPage.qml')
| -rw-r--r-- | desktop/modules/services/ServicesPage.qml | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/desktop/modules/services/ServicesPage.qml b/desktop/modules/services/ServicesPage.qml new file mode 100644 index 0000000..cc392db --- /dev/null +++ b/desktop/modules/services/ServicesPage.qml @@ -0,0 +1,92 @@ +// Copyright (C) 2026 Danilo M. <danix@danix.xyz> +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +import QtQuick +import "../.." +import "../ai" +import "../deckit" +import "../qtmaildir" + +// Shells, deck-it and the daemons, one row each: Start when stopped, Stop and +// Restart when running. The desktop shell has no Stop: it draws this page. +Column { + id: page + + required property var services + + spacing: 8 + + Component.onCompleted: { page.services.watchers++; DeckIt.watchers++; page.services.refresh(); } + Component.onDestruction: { page.services.watchers--; DeckIt.watchers--; } + + Heading { text: "Shells" } + + AiRow { + width: page.width + title: "All shells" + detail: "Restarts every one, this drawer included" + on: true + action: "Restart all" + onTriggered: page.services.restartShell("") + } + + Repeater { + model: page.services.shells + + AiRow { + required property var modelData + readonly property bool self: modelData.name === "desktop" + objectName: "shell:" + modelData.name + width: page.width + title: modelData.name + on: modelData.running + detail: (modelData.running ? "Running" : "Stopped") + (self ? " · hosts this drawer" : "") + action: !modelData.running ? "Start" : self ? "" : "Stop" + restartable: modelData.running + onTriggered: modelData.running ? page.services.stopShell(modelData.name) + : page.services.restartShell(modelData.name) + onRestart: page.services.restartShell(modelData.name) + } + } + + Heading { text: "deck-it" } + + AiRow { + width: page.width + title: "deck-it" + detail: ({ start: "Starting…", stop: "Stopping…", restart: "Restarting…" })[DeckIt.busy] ?? DeckIt.summary + on: DeckIt.running + busy: DeckIt.busy !== "" + action: DeckIt.busy ? "" : DeckIt.running ? "Stop" : "Start" + restartable: DeckIt.running && !DeckIt.busy + onTriggered: DeckIt.control(DeckIt.running ? "stop" : "start") + onRestart: DeckIt.control("restart") + } + + Heading { text: "Daemons" } + + Repeater { + model: page.services.daemons + + AiRow { + required property var modelData + objectName: "daemon:" + modelData.label + width: page.width + title: modelData.label + on: modelData.running + detail: modelData.running ? "Running" : modelData.start ? "Stopped" : "Stopped · not in autostart" + action: modelData.running ? "Stop" : modelData.start ? "Start" : "" + restartable: modelData.running && modelData.start !== "" + onTriggered: page.services.daemon(modelData, modelData.running ? "stop" : "start") + onRestart: page.services.daemon(modelData, "restart") + } + } +} |
