-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(connect): Improve remote connections handling (closes #906)
Signed-off-by: Grzegorz Grzybek <[email protected]>
- Loading branch information
Showing
18 changed files
with
246 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React, { useEffect, useState } from 'react' | ||
import { connectService } from '@hawtiosrc/plugins/shared/connect-service' | ||
import { PluggedIcon, UnpluggedIcon } from '@patternfly/react-icons' | ||
|
||
/** | ||
* Component to be displayed in HawtioHeaderToolbar for remote connection tabs | ||
* @constructor | ||
*/ | ||
export const ConnectionStatus: React.FunctionComponent = () => { | ||
const [reachable, setReachable] = useState(false) | ||
|
||
const connectionId = connectService.getCurrentConnectionId() | ||
const connectionName = connectService.getCurrentConnectionName() | ||
|
||
useEffect(() => { | ||
const check = async () => { | ||
const connection = await connectService.getCurrentConnection() | ||
if (connection) { | ||
connectService.checkReachable(connection).then(result => setReachable(result)) | ||
} | ||
} | ||
check() // initial fire | ||
const timer = setInterval(check, 20000) | ||
return () => clearInterval(timer) | ||
}, [connectionId]) | ||
|
||
return ( | ||
<> | ||
{reachable ? <PluggedIcon color='green' /> : <UnpluggedIcon color='red' />} | ||
{connectionName ? connectionName : ''} | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.