Skip to content

Commit 5ad58a7

Browse files
committed
Merge branch 'feat/release-v2' of github.com:devtron-labs/devtron-fe-common-lib into feat/rollout-status
2 parents 5ddcae1 + 6c2a055 commit 5ad58a7

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/Shared/Components/APIResponseHandler/APIResponseHandler.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ErrorScreenNotAuthorized, GenericEmptyState, Progressing, Reload } from '../../../Common'
1+
import { ErrorScreenManager, ErrorScreenNotAuthorized, GenericEmptyState, Progressing, Reload } from '../../../Common'
22
import { GenericSectionErrorState } from '../GenericSectionErrorState'
33
import { NOT_FOUND_DEFAULT_TEXT } from './constants'
44
import { APIResponseHandlerProps } from './types'
@@ -12,6 +12,7 @@ const APIResponseHandler = ({
1212
notFoundText,
1313
reloadProps,
1414
genericSectionErrorProps,
15+
errorScreenManagerProps,
1516
children,
1617
}: APIResponseHandlerProps) => {
1718
// keeping it above loading since, not expected to send a call if not authorized
@@ -30,7 +31,10 @@ const APIResponseHandler = ({
3031
return <GenericSectionErrorState {...genericSectionErrorProps} />
3132
}
3233

33-
// TODO: Can extend ErrorScreenNotFound
34+
if (errorScreenManagerProps) {
35+
return <ErrorScreenManager {...errorScreenManagerProps} />
36+
}
37+
3438
if (error?.code === 404) {
3539
return (
3640
<GenericEmptyState

src/Shared/Components/APIResponseHandler/types.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import { ReactNode } from 'react'
2-
import { GenericEmptyStateType, ProgressingProps, ReloadType, ServerErrors } from '../../../Common'
2+
import {
3+
ErrorScreenManagerProps,
4+
GenericEmptyStateType,
5+
ProgressingProps,
6+
ReloadType,
7+
ServerErrors,
8+
} from '../../../Common'
39
import { GenericSectionErrorStateProps } from '../GenericSectionErrorState/types'
410

511
export interface EmptyPageTextType {
@@ -38,9 +44,14 @@ export interface APIResponseHandlerProps {
3844
*/
3945
reloadProps?: ReloadType
4046
/**
41-
* If given, would show this component instead of default Error component
47+
* If given, would show GenericSectionErrorState instead of default Reload component
4248
*/
4349
genericSectionErrorProps?: GenericSectionErrorStateProps
50+
/**
51+
* If given, would show ErrorScreenManager component instead of Reload component
52+
* Priority of error states are: genericSectionErrorProps > errorScreenManagerProps > Reload component
53+
*/
54+
errorScreenManagerProps?: ErrorScreenManagerProps
4455
/**
4556
* If no Error and no Loading, would load this component
4657
*/

0 commit comments

Comments
 (0)