Skip to content

Commit 0e7e4d6

Browse files
committed
refactor: reorganize EmptyState exports and enhance AppStatusModal content rendering
- Moved GenericEmptyState and GenericFilterEmptyState exports to a new index file for better structure. - Updated AppStatusModal to utilize GenericEmptyState for improved content handling when app details are unavailable.
1 parent efc5c03 commit 0e7e4d6

File tree

3 files changed

+40
-25
lines changed

3 files changed

+40
-25
lines changed

src/Common/EmptyState/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default as GenericEmptyState } from './GenericEmptyState'
2+
export { default as GenericFilterEmptyState } from './GenericFilterEmptyState'

src/Common/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export * from './DevtronProgressing'
3333
export * from './Dialogs'
3434
export * from './DraggableWrapper'
3535
export * from './Drawer'
36-
export { default as GenericEmptyState } from './EmptyState/GenericEmptyState'
37-
export { default as GenericFilterEmptyState } from './EmptyState/GenericFilterEmptyState'
36+
export * from './EmptyState'
3837
export { default as ErrorScreenManager } from './ErrorScreenManager'
3938
export { default as ErrorScreenNotAuthorized } from './ErrorScreenNotAuthorized'
4039
export * from './GenericDescription'

src/Shared/Components/AppStatusModal/AppStatusModal.component.tsx

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import { Fragment, useEffect, useRef, useState } from 'react'
22

3+
import NoAppStatusImage from '@Images/no-artifact.webp'
34
import { abortPreviousRequests, getIsRequestAborted } from '@Common/API'
45
import { DISCORD_LINK } from '@Common/Constants'
56
import { Drawer } from '@Common/Drawer'
7+
import { GenericEmptyState } from '@Common/EmptyState'
68
import { stopPropagation, useAsync } from '@Common/Helper'
79
import { ComponentSizeType } from '@Shared/constants'
810

@@ -111,6 +113,40 @@ const AppStatusModal = ({
111113

112114
const filteredTitleSegments = (titleSegments || []).filter((segment) => !!segment)
113115

116+
const renderContent = () => {
117+
if (!appDetails?.resourceTree) {
118+
return <GenericEmptyState image={NoAppStatusImage} title="Application status is not available" />
119+
}
120+
121+
return (
122+
<>
123+
<AppStatusBody
124+
appDetails={appDetails}
125+
type={type}
126+
handleShowConfigDriftModal={handleShowConfigDriftModal}
127+
/>
128+
129+
{type === 'stack-manager' && (
130+
<div className="bg__primary flexbox dc__align-items-center dc__content-space dc__border-top py-16 px-20 fs-13 fw-6">
131+
<span className="fs-13 fw-6">Facing issues in installing integration?</span>
132+
133+
<Button
134+
dataTestId="chat-with-support-button"
135+
component={ButtonComponentType.anchor}
136+
anchorProps={{
137+
href: DISCORD_LINK,
138+
target: '_blank',
139+
rel: 'noreferrer noopener',
140+
}}
141+
startIcon={<Icon name="ic-chat-circle-dots" color={null} />}
142+
text="Chat with support"
143+
/>
144+
</div>
145+
)}
146+
</>
147+
)
148+
}
149+
114150
return (
115151
<Drawer position="right" width="1024px" onClose={handleClose} onEscape={handleClose}>
116152
<div
@@ -153,29 +189,7 @@ const AppStatusModal = ({
153189
reload: reloadInitialAppDetails,
154190
}}
155191
>
156-
<AppStatusBody
157-
appDetails={appDetails}
158-
type={type}
159-
handleShowConfigDriftModal={handleShowConfigDriftModal}
160-
/>
161-
162-
{type === 'stack-manager' && (
163-
<div className="bg__primary flexbox dc__align-items-center dc__content-space dc__border-top py-16 px-20 fs-13 fw-6">
164-
<span className="fs-13 fw-6">Facing issues in installing integration?</span>
165-
166-
<Button
167-
dataTestId="chat-with-support-button"
168-
component={ButtonComponentType.anchor}
169-
anchorProps={{
170-
href: DISCORD_LINK,
171-
target: '_blank',
172-
rel: 'noreferrer noopener',
173-
}}
174-
startIcon={<Icon name="ic-chat-circle-dots" color={null} />}
175-
text="Chat with support"
176-
/>
177-
</div>
178-
)}
192+
{renderContent()}
179193
</APIResponseHandler>
180194
</div>
181195
</div>

0 commit comments

Comments
 (0)