Regenerated
This commit is contained in:
@@ -1,90 +1,51 @@
|
||||
// --- This file has been auto-generated. For permanent changes alter the appropriate block in the README.org. ---
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
|
||||
Window {
|
||||
id: root
|
||||
width: 600
|
||||
height: 380
|
||||
width: 500
|
||||
height: 200
|
||||
visible: true
|
||||
title: "System Updater"
|
||||
|
||||
property int currentStep: 0
|
||||
property int totalSteps: 4
|
||||
property string status: "idle"
|
||||
property int progress: 0
|
||||
property string status: "Waiting..."
|
||||
|
||||
Timer {
|
||||
interval: 300
|
||||
running: true
|
||||
repeat: true
|
||||
|
||||
onTriggered: {
|
||||
let file = "/tmp/nixos-updater-status"
|
||||
|
||||
let xhr = new XMLHttpRequest()
|
||||
xhr.open("GET", "file://" + file)
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === XMLHttpRequest.DONE) {
|
||||
let parts = xhr.responseText.trim().split("|")
|
||||
|
||||
if (parts.length === 2) {
|
||||
progress = parseInt(parts[0])
|
||||
status = parts[1]
|
||||
}
|
||||
}
|
||||
}
|
||||
xhr.send()
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 16
|
||||
anchors.centerIn: parent
|
||||
spacing: 10
|
||||
|
||||
Text {
|
||||
text: "System Updater"
|
||||
font.pixelSize: 20
|
||||
}
|
||||
Text { text: status }
|
||||
|
||||
ProgressBar {
|
||||
from: 0
|
||||
to: root.totalSteps
|
||||
value: root.currentStep
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
Text {
|
||||
text: "Step " + root.currentStep + " / " + root.totalSteps
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
width: parent.width
|
||||
height: 180
|
||||
|
||||
ListView {
|
||||
id: logView
|
||||
anchors.fill: parent
|
||||
model: logModel
|
||||
}
|
||||
|
||||
ListModel {
|
||||
id: logModel
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 10
|
||||
|
||||
Button {
|
||||
text: "Run update"
|
||||
onClicked: updater.start()
|
||||
}
|
||||
|
||||
Button {
|
||||
text: "Close"
|
||||
onClicked: root.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: updater
|
||||
command: ["bash", "/home/henrov/.config/scripts/update-engine.sh"]
|
||||
|
||||
onOutput: function(data) {
|
||||
logModel.append({ text: data.trim() })
|
||||
|
||||
if (data.startsWith("STEP:")) {
|
||||
let parts = data.split(":")
|
||||
root.currentStep = parseInt(parts[1])
|
||||
}
|
||||
|
||||
if (data.startsWith("DONE")) {
|
||||
root.status = "done"
|
||||
}
|
||||
|
||||
if (data.startsWith("FAIL")) {
|
||||
root.status = "error"
|
||||
}
|
||||
to: 100
|
||||
value: progress
|
||||
width: 300
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user