Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
qbar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jens Nolte
qbar
Commits
41d19dbe
Commit
41d19dbe
authored
4 years ago
by
Mr. Snow Ball / projects
Browse files
Options
Downloads
Patches
Plain Diff
Add qubesMonitorPropertyBlock
parent
c0e24ed3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/QBar/Blocks/Qubes.hs
+14
-1
14 additions, 1 deletion
src/QBar/Blocks/Qubes.hs
with
14 additions
and
1 deletion
src/QBar/Blocks/Qubes.hs
+
14
−
1
View file @
41d19dbe
...
@@ -3,9 +3,13 @@ module QBar.Blocks.Qubes where
...
@@ -3,9 +3,13 @@ module QBar.Blocks.Qubes where
import
QBar.BlockHelper
import
QBar.BlockHelper
import
QBar.BlockOutput
import
QBar.BlockOutput
import
QBar.Core
import
QBar.Core
import
QBar.Qubes.AdminAPI
(
qubesUsageOfDefaultPool
)
import
QBar.Qubes.AdminAPI
(
qubesUsageOfDefaultPool
,
qubesMonitorProperty
,
qubesEvents
,
QubesPropertyInfo
(
..
)
)
import
qualified
Data.ByteString.Lazy
as
BL
import
qualified
Data.Text.Lazy
as
T
import
qualified
Data.Text.Lazy
as
T
import
Data.Text.Lazy.Encoding
(
decodeUtf8With
)
import
Data.Text.Encoding.Error
(
lenientDecode
)
import
Pipes
diskIcon
::
T
.
Text
diskIcon
::
T
.
Text
diskIcon
=
"💾
\xFE0E
"
diskIcon
=
"💾
\xFE0E
"
...
@@ -33,3 +37,12 @@ diskUsageQubesBlock = runPollBlock $ forever $ do
...
@@ -33,3 +37,12 @@ diskUsageQubesBlock = runPollBlock $ forever $ do
formatSize
size
=
case
filter
((
<
size
)
.
snd
)
sizeUnits
of
formatSize
size
=
case
filter
((
<
size
)
.
snd
)
sizeUnits
of
((
unit
,
factor
)
:
_
)
->
T
.
pack
(
show
$
size
`
div
`
factor
)
<>
unit
((
unit
,
factor
)
:
_
)
->
T
.
pack
(
show
$
size
`
div
`
factor
)
<>
unit
_
->
T
.
pack
(
show
size
)
<>
" bytes"
_
->
T
.
pack
(
show
size
)
<>
" bytes"
qubesMonitorPropertyBlock
::
BL
.
ByteString
->
Block
qubesMonitorPropertyBlock
name
=
fmap
(
const
ExitBlock
)
(
qubesMonitorProperty
qubesEvents
name
)
>->
forever
update
where
update
=
do
QubesPropertyInfo
{
propValue
,
propIsDefault
}
<-
await
pushBlockUpdate'
handleClick
$
mkBlockOutput
$
normalText
$
decode
propValue
<>
(
if
propIsDefault
then
" (D)"
else
""
)
handleClick
_
=
return
()
--TODO
decode
=
decodeUtf8With
lenientDecode
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment