-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-13804]: Create a workflow in YBA to enable monitoring of univer…
…ses by TS service Summary: Create a workflow in YBA to enable monitoring of universes by TS service Test Plan: Please refer to the video {F177155} Reviewers: jmak, amalyshev Reviewed By: amalyshev Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D34808
- Loading branch information
1 parent
0303740
commit 85941de
Showing
33 changed files
with
1,252 additions
and
300 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
92 changes: 92 additions & 0 deletions
92
managed/ui/src/components/universes/TroubleshootUniverse/TroubleshootUniverse.tsx
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,92 @@ | ||
import { | ||
TroubleshootAdvisor, | ||
TroubleshootAPI, | ||
QUERY_KEY, | ||
AttachUniverse | ||
} from '@yugabytedb/troubleshoot-ui'; | ||
import { AppName } from '../../../redesign/features/Troubleshooting/TroubleshootingDashboard'; | ||
import { useQuery } from 'react-query'; | ||
import { useState } from 'react'; | ||
import { YBErrorIndicator, YBLoading } from '../../common/indicators'; | ||
import { Box, makeStyles } from '@material-ui/core'; | ||
import { useSelector } from 'react-redux'; | ||
import { api, QUERY_KEY as TOKEN_KEY } from '../../../redesign/utils/api'; | ||
import { IN_DEVELOPMENT_MODE, ROOT_URL } from '../../../config'; | ||
|
||
interface TroubleshootUniverseProps { | ||
universeUuid: string; | ||
appName: AppName; | ||
timezone: string; | ||
} | ||
|
||
const useStyles = makeStyles((theme) => ({ | ||
register: { | ||
cursor: 'pointer' | ||
} | ||
})); | ||
|
||
export const TroubleshootUniverse = ({ | ||
universeUuid, | ||
appName, | ||
timezone | ||
}: TroubleshootUniverseProps) => { | ||
const helperClasses = useStyles(); | ||
const [showAttachUniverseDialog, setShowAttachUniverseDialog] = useState<boolean>(false); | ||
const baseUrl = ROOT_URL.split('/api/'); | ||
const { currentCustomer } = useSelector((state: any) => state.customer); | ||
|
||
const sessionInfo = useQuery(TOKEN_KEY.getSessionInfo, () => api.getSessionInfo()); | ||
const troubleshootingUniverseMetadata = useQuery(QUERY_KEY.fetchUniverseMetadataList, () => | ||
TroubleshootAPI.fetchUniverseMetadataList() | ||
); | ||
|
||
if (troubleshootingUniverseMetadata.isError) { | ||
return <YBErrorIndicator />; | ||
} | ||
if ( | ||
troubleshootingUniverseMetadata.isLoading || | ||
(troubleshootingUniverseMetadata.isIdle && troubleshootingUniverseMetadata.data === undefined) | ||
) { | ||
return <YBLoading />; | ||
} | ||
|
||
const currentUniverseMetadata = troubleshootingUniverseMetadata?.data?.find( | ||
(metadata) => metadata.id === universeUuid | ||
); | ||
|
||
const onAttachUniverseButtonClick = () => { | ||
troubleshootingUniverseMetadata.refetch(); | ||
setShowAttachUniverseDialog(true); | ||
}; | ||
|
||
const onAttachUniverseDialogClose = () => { | ||
troubleshootingUniverseMetadata.refetch(); | ||
setShowAttachUniverseDialog(false); | ||
}; | ||
|
||
const onAttachUniverse = () => { | ||
onAttachUniverseButtonClick(); | ||
}; | ||
|
||
return currentUniverseMetadata ? ( | ||
<TroubleshootAdvisor universeUuid={universeUuid} appName={appName} timezone={timezone} /> | ||
) : ( | ||
<Box> | ||
{'Universe is currently not registered to the troubleshooting service,'} | ||
<a onClick={onAttachUniverse} className={helperClasses.register}> | ||
{' please register here'} | ||
</a> | ||
{showAttachUniverseDialog && ( | ||
<AttachUniverse | ||
universeUuid={universeUuid} | ||
customerUuid={currentCustomer.data.uuid} | ||
baseUrl={baseUrl[0]} | ||
apiToken={sessionInfo?.data?.apiToken} | ||
open={showAttachUniverseDialog} | ||
onClose={onAttachUniverseDialogClose} | ||
isDevMode={IN_DEVELOPMENT_MODE} | ||
/> | ||
)} | ||
</Box> | ||
); | ||
}; |
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.