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
b98f8c4f
Commit
b98f8c4f
authored
1 year ago
by
jktr
Browse files
Options
Downloads
Patches
Plain Diff
Remove dead code
parent
d7213c90
No related branches found
No related tags found
1 merge request
!8
bump deps and build tooling
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
qbar/src/QBar/Qubes/AdminAPI.hs
+1
-29
1 addition, 29 deletions
qbar/src/QBar/Qubes/AdminAPI.hs
qbar/src/QBar/Server.hs
+0
-3
0 additions, 3 deletions
qbar/src/QBar/Server.hs
with
1 addition
and
32 deletions
qbar/src/QBar/Qubes/AdminAPI.hs
+
1
−
29
View file @
b98f8c4f
...
@@ -6,7 +6,6 @@ module QBar.Qubes.AdminAPI (
...
@@ -6,7 +6,6 @@ module QBar.Qubes.AdminAPI (
qubesEvents
,
qubesEvents
,
qubesGetProperty
,
qubesGetProperty
,
qubesListLabelNames
,
qubesListLabelNames
,
qubesListLabels
,
qubesListProperties
,
qubesListProperties
,
qubesListVMs
,
qubesListVMs
,
qubesListVMsP
,
qubesListVMsP
,
...
@@ -17,7 +16,7 @@ module QBar.Qubes.AdminAPI (
...
@@ -17,7 +16,7 @@ module QBar.Qubes.AdminAPI (
import
QBar.Prelude
import
QBar.Prelude
import
Control.Monad
(
forM_
,
guard
)
import
Control.Monad
(
forM_
)
import
Data.Binary
import
Data.Binary
import
Data.Binary.Get
import
Data.Binary.Get
import
Data.Binary.Put
import
Data.Binary.Put
...
@@ -29,7 +28,6 @@ import Data.Function ((&))
...
@@ -29,7 +28,6 @@ import Data.Function ((&))
import
Data.Map
qualified
as
Map
import
Data.Map
qualified
as
Map
import
Data.Maybe
(
fromMaybe
)
import
Data.Maybe
(
fromMaybe
)
import
Network.HostName
import
Network.HostName
import
Numeric
(
showHex
,
readHex
)
import
Pipes
import
Pipes
import
Pipes.Prelude
qualified
as
P
import
Pipes.Prelude
qualified
as
P
import
Pipes.Safe
qualified
as
P
import
Pipes.Safe
qualified
as
P
...
@@ -298,9 +296,6 @@ qubesGetProperty name = parse <$> qubesAdminCall "admin.property.Get" [name]
...
@@ -298,9 +296,6 @@ qubesGetProperty name = parse <$> qubesAdminCall "admin.property.Get" [name]
splitOn
ch
=
fmap
BLC
.
tail
.
BLC
.
break
(
==
ch
)
splitOn
ch
=
fmap
BLC
.
tail
.
BLC
.
break
(
==
ch
)
(
isDefault
,
(
typeStr
,
value
))
=
splitOn
' '
reply
&
fmap
(
splitOn
' '
)
(
isDefault
,
(
typeStr
,
value
))
=
splitOn
' '
reply
&
fmap
(
splitOn
' '
)
qubesListPropertyNames
::
IO
[
BL
.
ByteString
]
qubesListPropertyNames
=
qubesAdminCallLines
"admin.property.List"
[]
qubesListProperties
::
IO
[(
BL
.
ByteString
,
QubesPropertyInfo
)]
qubesListProperties
::
IO
[(
BL
.
ByteString
,
QubesPropertyInfo
)]
qubesListProperties
=
qubesListLabelNames
>>=
mapM
(
toSndM
qubesGetProperty
)
qubesListProperties
=
qubesListLabelNames
>>=
mapM
(
toSndM
qubesGetProperty
)
where
where
...
@@ -323,33 +318,10 @@ qubesUsageOfDefaultPool = qubesGetDefaultPool >>= qubesGetPoolInfo >>= extract
...
@@ -323,33 +318,10 @@ qubesUsageOfDefaultPool = qubesGetDefaultPool >>= qubesGetPoolInfo >>= extract
tryReadProp
::
Read
a
=>
BL
.
ByteString
->
[(
BL
.
ByteString
,
BL
.
ByteString
)]
->
Maybe
a
tryReadProp
::
Read
a
=>
BL
.
ByteString
->
[(
BL
.
ByteString
,
BL
.
ByteString
)]
->
Maybe
a
tryReadProp
name
props
=
readMaybe
.
BLC
.
unpack
=<<
lookup
name
props
tryReadProp
name
props
=
readMaybe
.
BLC
.
unpack
=<<
lookup
name
props
newtype
QubesLabelColor
=
QubesLabelColor
{
fromQubesLabelColor
::
Int
}
deriving
(
Eq
,
Ord
)
instance
Show
QubesLabelColor
where
showsPrec
_
(
QubesLabelColor
x
)
=
\
s
->
"0x"
<>
pad
6
(
showHex
x
""
)
<>
s
where
pad
l
s
=
replicate
(
l
-
length
s
)
'0'
<>
s
instance
Read
QubesLabelColor
where
readsPrec
_
(
'0'
:
'x'
:
xs
)
=
do
let
(
num
,
remainder
)
=
splitAt
6
xs
guard
$
length
num
==
6
(
num'
,
[]
)
<-
readHex
num
[(
QubesLabelColor
num'
,
remainder
)]
readsPrec
_
_
=
[]
qubesGetLabelColor
::
BL
.
ByteString
->
IO
QubesLabelColor
qubesGetLabelColor
name
=
read
.
BLC
.
unpack
<$>
qubesAdminCall
"admin.label.Get"
[
name
]
qubesListLabelNames
::
IO
[
BL
.
ByteString
]
qubesListLabelNames
::
IO
[
BL
.
ByteString
]
qubesListLabelNames
=
qubesAdminCallLines
"admin.label.List"
[]
qubesListLabelNames
=
qubesAdminCallLines
"admin.label.List"
[]
qubesListLabels
::
IO
[(
BL
.
ByteString
,
QubesLabelColor
)]
qubesListLabels
=
qubesListLabelNames
>>=
mapM
(
toSndM
qubesGetLabelColor
)
where
toSndM
::
Applicative
m
=>
(
a
->
m
b
)
->
a
->
m
(
a
,
b
)
toSndM
f
x
=
sequenceA
(
x
,
f
x
)
qubesMonitorProperty
::
forall
m
.
MonadIO
m
qubesMonitorProperty
::
forall
m
.
MonadIO
m
=>
Producer
QubesEvent
m
()
->
BL
.
ByteString
->
Producer
QubesPropertyInfo
m
()
=>
Producer
QubesEvent
m
()
->
BL
.
ByteString
->
Producer
QubesPropertyInfo
m
()
qubesMonitorProperty
events
name
=
events
>->
P
.
filter
isRelevant
>->
fetchValue
qubesMonitorProperty
events
name
=
events
>->
P
.
filter
isRelevant
>->
fetchValue
...
...
This diff is collapsed.
Click to expand it.
qbar/src/QBar/Server.hs
+
0
−
3
View file @
b98f8c4f
...
@@ -30,9 +30,6 @@ import Pipes.Concurrent (Input, spawn, latest, toOutput, fromInput)
...
@@ -30,9 +30,6 @@ import Pipes.Concurrent (Input, spawn, latest, toOutput, fromInput)
import
Pipes.Prelude
qualified
as
PP
import
Pipes.Prelude
qualified
as
PP
import
System.IO
(
stdin
,
stdout
,
stderr
,
hFlush
)
import
System.IO
(
stdin
,
stdout
,
stderr
,
hFlush
)
data
ServerMode
=
Host
|
Mirror
data
ServerOutput
=
Sway
|
Headless
renderIndicators
::
[
Text
]
renderIndicators
::
[
Text
]
renderIndicators
=
[
"*"
]
<>
cycle
[
"/"
,
"-"
,
"
\\
"
,
"|"
]
renderIndicators
=
[
"*"
]
<>
cycle
[
"/"
,
"-"
,
"
\\
"
,
"|"
]
...
...
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