repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
quickshell/nuguland/SystemIssueRow.qml
Rawpragma ComponentBehavior: Bound
import QtQuick
import "resources.js" as Res
PopupCard {
id: root
required property var issue
readonly property bool historical: !!issue.context
property real now: Date.now()
property bool pending: false
property bool launchBusy: false
property string launchError: ""
signal openRequested
signal agentRequested
signal focusEntered
padding: 0
attention: !historical && issue.severity === "warning"
destructive: !historical && issue.severity === "error"
height: Math.max(70, details.implicitHeight + 24)
onLaunchErrorChanged: if (launchError.length > 0)
Qt.callLater(root.focusEntered)
Text {
id: glyph
anchors.left: parent.left
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: root.historical ? "" : String(root.issue.icon || "")
textFormat: Text.PlainText
color: root.historical ? root.theme.ui.minor : root.issue.severity === "error" ? root.theme.error : root.issue.severity === "warning" ? root.theme.warning : root.theme.info
font.family: "Symbols Nerd Font Mono"
font.pixelSize: 16
}
Column {
id: details
anchors.left: glyph.right
anchors.leftMargin: 14
anchors.right: actions.left
anchors.rightMargin: 14
anchors.verticalCenter: parent.verticalCenter
spacing: 4
NuguText {
theme: root.theme
width: parent.width
variant: "title"
text: Res.issueHeading(root.issue)
textFormat: Text.PlainText
wrapMode: Text.WrapAnywhere
maximumLineCount: 2
}
NuguText {
theme: root.theme
width: parent.width
variant: "meta"
text: Res.issueDescription(root.issue)
textFormat: Text.PlainText
wrapMode: Text.Wrap
maximumLineCount: 2
}
NuguText {
visible: !!root.issue.context
theme: root.theme
width: parent.width
font.pixelSize: 12
color: root.theme.ui.minor
text: root.issue.context ? (root.issue.events ? "latest · " : "") + Res.eventTime(root.issue.context.timestamp, root.now) : ""
textFormat: Text.PlainText
}
NuguText {
visible: root.launchError.length > 0
theme: root.theme
width: parent.width
text: root.launchError
textFormat: Text.PlainText
wrapMode: Text.Wrap
color: root.theme.error
variant: "meta"
}
}
Row {
id: actions
anchors.right: parent.right
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
spacing: 8
PopupButton {
visible: !!root.issue.action
theme: root.theme
width: 34
height: 34
icon: ""
text: root.issue.events ? "open latest crash for " + Res.issueHeading(root.issue) : "open " + String(root.issue.label || "issue")
showText: false
role: root.destructive ? "destructive" : "normal"
onActiveFocusChanged: if (activeFocus)
root.focusEntered()
onClicked: root.openRequested()
}
PopupButton {
visible: Res.agentAllowed(root.issue)
theme: root.theme
height: 34
icon: ""
text: root.pending ? "opening" : "arrrgh"
enabled: !root.launchBusy
accessibleName: root.issue.events ? "assess crashes: " + Res.issueHeading(root.issue) : "fix with agent: " + String(root.issue.label || "issue")
tooltip: root.issue.events ? "assess all " + root.issue.events.length + " recorded crashes with pi" : "assess and diagnose with pi"
onActiveFocusChanged: if (activeFocus)
root.focusEntered()
onClicked: root.agentRequested()
}
}
}