Files
nebula.js/commands/serve/web/components/Hub/SelectEngine/SelectEngine.jsx
Ahmad Mirzaei 7506aa28f4 fix(cli-serve): OAuth instance cache issue (#1492)
* fix: client id cache issue

* fix: clean cached auth state when deauthorizing

* chore: move auth routes into specific router module

* chore: update redirect link for OAuth in connection guid

* feat: error page for old /login/callback url
2024-03-04 14:41:29 +01:00

46 lines
1.4 KiB
JavaScript

import React, { useState, useEffect } from 'react';
import { Help } from '@nebula.js/ui/icons';
import IconButton from '@mui/material/IconButton';
import Grid from '@mui/material/Grid';
import Typography from '@mui/material/Typography';
import ConnectionGuid from './ConnectionGuid';
import ConnectionHistory from './ConnectionHistory';
import ConnectionOptions from './ConnectionOptions';
import { ContentWrapper } from '../styles';
import { useRootContext } from '../../../contexts/RootContext';
import { useDeauthorizePrevOAuthInstance } from '../../../hooks';
const SelectEngine = () => {
const { cachedConnectionsData } = useRootContext();
const [showGuid, setShowGuid] = useState(false);
useDeauthorizePrevOAuthInstance();
useEffect(() => {
setShowGuid(!cachedConnectionsData.cachedConnections.length);
}, [cachedConnectionsData.cachedConnections.length]);
return (
<ContentWrapper>
<Grid container>
<Grid item xs>
<Typography variant="h5" gutterBottom>
Connect to an engine
</Typography>
</Grid>
<Grid item>
<IconButton onClick={() => setShowGuid(!showGuid)} size="small">
<Help />
</IconButton>
</Grid>
</Grid>
<ConnectionHistory />
<ConnectionOptions />
<ConnectionGuid showGuid={showGuid} />
</ContentWrapper>
);
};
export default SelectEngine;