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
2bcc086a
Commit
2bcc086a
authored
4 years ago
by
Mr. Snow Ball / projects
Browse files
Options
Downloads
Patches
Plain Diff
Add animation on click to qubesCount
parent
82c6ac15
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
+5
-6
5 additions, 6 deletions
src/QBar/Blocks/Qubes.hs
with
5 additions
and
6 deletions
src/QBar/Blocks/Qubes.hs
+
5
−
6
View file @
2bcc086a
...
...
@@ -3,7 +3,7 @@ module QBar.Blocks.Qubes where
import
QBar.BlockHelper
import
QBar.BlockOutput
import
QBar.Core
import
QBar.Qubes.AdminAPI
(
qubesUsageOfDefaultPool
,
qubesMonitorProperty
,
qubesGetProperty
,
qubesEvents
,
QubesPropertyInfo
(
..
),
qubesListVMsP
,
QubesVMState
(
..
),
vmState
)
import
QBar.Qubes.AdminAPI
(
qubesUsageOfDefaultPool
,
qubesMonitorProperty
,
qubesGetProperty
,
qubesEvents
,
QubesPropertyInfo
(
..
),
qubesListVMs
,
qubesListVMsP
,
QubesVMState
(
..
),
vmState
)
import
Control.Concurrent.Async
import
Control.Monad.Reader
(
runReaderT
)
...
...
@@ -79,13 +79,12 @@ pipeBlockWithEvents prod block = do
qubesMonitorPropertyBlock
::
BL
.
ByteString
->
Block
qubesMonitorPropertyBlock
name
=
pipeBlockWithEvents
(
qubesMonitorProperty
qubesEvents
name
>>
exitBlock
)
handle
where
handle
=
handle'
<=<
either
(
const
$
liftIO
$
qubesGetProperty
name
)
return
handle'
QubesPropertyInfo
{
propValue
,
propIsDefault
}
=
return
$
Just
$
mkBlockOutput
$
normalText
$
decode
propValue
<>
(
if
propIsDefault
then
" (D)"
else
""
)
handle
=
fmap
handle'
.
either
(
const
$
liftIO
$
qubesGetProperty
name
)
return
handle'
QubesPropertyInfo
{
propValue
,
propIsDefault
}
=
Just
$
mkBlockOutput
$
normalText
$
decode
propValue
<>
(
if
propIsDefault
then
" (D)"
else
""
)
decode
=
decodeUtf8With
lenientDecode
qubesVMCountBlock
::
Block
qubesVMCountBlock
=
qubesListVMsP
>
-
>
P
.
map
countVMs
>>
e
x
it
Block
where
countVMs
=
wrap
.
format
.
M
.
size
.
M
.
filterWithKey
isRunningVM
qubesVMCountBlock
=
pipeBlockWithEvents
(
qubesListVMsP
>>
exitBlock
)
$
f
map
countVMs
.
eit
her
(
const
$
liftIO
$
qubesListVMs
)
return
where
countVMs
=
Just
.
format
.
M
.
size
.
M
.
filterWithKey
isRunningVM
isRunningVM
name
x
=
vmState
x
==
VMRunning
&&
name
/=
"dom0"
format
n
=
mkBlockOutput
$
normalText
$
T
.
pack
(
show
n
)
<>
" Qube"
<>
(
if
n
/=
1
then
"s"
else
""
)
wrap
x
=
(
Just
(
x
,
Nothing
),
DefaultUpdate
)
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