import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import "../components" Item { id: page property var status: ({ state: "idle" }) function stateText(s) { switch (s) { case "staging": return "Распаковка пакета…" case "switching": return "Переключение версии…" case "health_check": return "Проверка работоспособности…" case "success": return "Обновление успешно применено" case "rolledback": return "Запуск новой версии не удался — выполнен откат" case "rollback_done": return "Откат выполнен" case "error": return "Ошибка обновления" default: return "Готово к обновлению" } } function reload() { status = systemInfo.updateStatus() systemInfo.refresh() } Component.onCompleted: reload() Rectangle { anchors.fill: parent color: "#161628" } Timer { interval: 2500 running: true repeat: true onTriggered: page.reload() } ColumnLayout { anchors.fill: parent anchors.margins: 8 spacing: 12 RowLayout { Layout.fillWidth: true SettingsButton { text: "\u2190 Назад" onClicked: page.StackView.view.pop() } Label { Layout.fillWidth: true text: "Обновление ПО" font.bold: true font.pixelSize: 16 color: "#ffffff" horizontalAlignment: Text.AlignHCenter } SettingsButton { text: "\u21BB" Layout.preferredWidth: 56 onClicked: page.reload() } } Text { Layout.fillWidth: true text: "Текущая версия: " + systemInfo.currentVersion color: "#ffffff" font.pixelSize: 14 } Rectangle { Layout.fillWidth: true Layout.preferredHeight: stTxt.implicitHeight + 20 radius: 6 color: "#40222c58" border.color: "#80ffffff" border.width: 1 Text { id: stTxt anchors.fill: parent anchors.margins: 10 text: "Статус: " + page.stateText(page.status.state) + (page.status.message ? "\n" + page.status.message : "") color: "#ffffff" wrapMode: Text.Wrap } } Text { Layout.fillWidth: true text: "Загрузка нового пакета ПО выполняется через веб-конфигуратор. После применения выполняется проверка запуска; при ошибке произойдёт автоматический откат на предыдущую версию." color: "#cccccc" font.pixelSize: 12 wrapMode: Text.Wrap } Item { Layout.fillHeight: true } } }