-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Anton Gilgur <[email protected]>
- Loading branch information
Anton Gilgur
authored
Oct 23, 2023
1 parent
7f2ac5c
commit 12c9aa2
Showing
12 changed files
with
53 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,30 @@ | ||
import {Page} from 'argo-ui'; | ||
import * as React from 'react'; | ||
import SwaggerUI from 'swagger-ui-react'; | ||
import 'swagger-ui-react/swagger-ui.css'; | ||
import {uiUrl} from '../../shared/base'; | ||
import {Loading} from '../../shared/components/loading'; | ||
import {useCollectEvent} from '../../shared/components/use-collect-event'; | ||
|
||
export const ApiDocs = () => { | ||
useCollectEvent('openedApiDocs'); | ||
return ( | ||
<Page title='Swagger'> | ||
<div className='argo-container'> | ||
<SwaggerUI url={uiUrl('assets/openapi-spec/swagger.json')} defaultModelExpandDepth={0} /> | ||
<SuspenseSwaggerUI url={uiUrl('assets/openapi-spec/swagger.json')} defaultModelExpandDepth={0} /> | ||
</div> | ||
</Page> | ||
); | ||
}; | ||
|
||
// lazy load SwaggerUI as it is infrequently used and imports very large components (which can be split into a separate bundle) | ||
const LazySwaggerUI = React.lazy(() => { | ||
import('swagger-ui-react/swagger-ui.css'); | ||
return import('swagger-ui-react'); | ||
}); | ||
|
||
function SuspenseSwaggerUI(props: any) { | ||
return ( | ||
<React.Suspense fallback={<Loading />}> | ||
<LazySwaggerUI {...props} /> | ||
</React.Suspense> | ||
); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,20 @@ | ||
import * as React from 'react'; | ||
import {Route, RouteComponentProps, Switch} from 'react-router'; | ||
import {Reports} from './reports'; | ||
import {Loading} from '../../shared/components/loading'; | ||
|
||
export const ReportsContainer = (props: RouteComponentProps<any>) => ( | ||
<Switch> | ||
<Route exact={true} path={`${props.match.path}/:namespace?`} component={Reports} /> | ||
<Route exact={true} path={`${props.match.path}/:namespace?`} component={SuspenseReports} /> | ||
</Switch> | ||
); | ||
|
||
// lazy load Reports as it is infrequently used and imports large Chart components (which can be split into a separate bundle) | ||
const LazyReports = React.lazy(() => import('./reports')); | ||
|
||
function SuspenseReports(props: RouteComponentProps<any>) { | ||
return ( | ||
<React.Suspense fallback={<Loading />}> | ||
<LazyReports {...props} /> | ||
</React.Suspense> | ||
); | ||
} |
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