mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
core: agent stats (#1650)
This commit is contained in:
committed by
GitHub
parent
e48452ccff
commit
74245d3f2b
@@ -280,6 +280,8 @@ data ChatCommand
|
||||
| QuitChat
|
||||
| ShowVersion
|
||||
| DebugLocks
|
||||
| GetAgentStats
|
||||
| ResetAgentStats
|
||||
deriving (Show)
|
||||
|
||||
data ChatResponse
|
||||
@@ -411,6 +413,7 @@ data ChatResponse
|
||||
| CRContactConnectionDeleted {connection :: PendingContactConnection}
|
||||
| CRSQLResult {rows :: [Text]}
|
||||
| CRDebugLocks {chatLockName :: Maybe String, agentLocks :: AgentLocks}
|
||||
| CRAgentStats {agentStats :: [[String]]}
|
||||
| CRMessageError {severity :: Text, errorMessage :: Text}
|
||||
| CRChatCmdError {chatError :: ChatError}
|
||||
| CRChatError {chatError :: ChatError}
|
||||
|
||||
@@ -129,6 +129,7 @@ mobileChatOpts =
|
||||
chatCmd = "",
|
||||
chatCmdDelay = 3,
|
||||
chatServerPort = Nothing,
|
||||
optFilesFolder = Nothing,
|
||||
allowInstantFiles = True,
|
||||
maintenance = True
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ data ChatOpts = ChatOpts
|
||||
chatCmd :: String,
|
||||
chatCmdDelay :: Int,
|
||||
chatServerPort :: Maybe String,
|
||||
optFilesFolder :: Maybe FilePath,
|
||||
allowInstantFiles :: Bool,
|
||||
maintenance :: Bool
|
||||
}
|
||||
@@ -127,9 +128,16 @@ chatOpts appDir defaultDbFileName = do
|
||||
<> help "Run chat server on specified port"
|
||||
<> value Nothing
|
||||
)
|
||||
optFilesFolder <-
|
||||
optional $
|
||||
strOption
|
||||
( long "files-folder"
|
||||
<> metavar "FOLDER"
|
||||
<> help "Folder to use for sent and received files"
|
||||
)
|
||||
allowInstantFiles <-
|
||||
switch
|
||||
( long "--allow-instant-files"
|
||||
( long "allow-instant-files"
|
||||
<> short 'f'
|
||||
<> help "Send and receive instant files without acceptance"
|
||||
)
|
||||
@@ -151,6 +159,7 @@ chatOpts appDir defaultDbFileName = do
|
||||
chatCmd,
|
||||
chatCmdDelay,
|
||||
chatServerPort,
|
||||
optFilesFolder,
|
||||
allowInstantFiles,
|
||||
maintenance
|
||||
}
|
||||
|
||||
@@ -216,6 +216,7 @@ responseToView user_ testView liveItems ts = \case
|
||||
[ maybe "no chat lock" (("chat lock: " <>) . plain) chatLockName,
|
||||
plain $ "agent locks: " <> LB.unpack (J.encode agentLocks)
|
||||
]
|
||||
CRAgentStats stats -> map (plain . intercalate ",") stats
|
||||
CRMessageError prefix err -> [plain prefix <> ": " <> plain err]
|
||||
CRChatError e -> viewChatError e
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user