Skip to content

Commit

Permalink
fix: #1554 app name missing on delete modal (#1583)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pham Hai Duong authored Jun 8, 2020
1 parent e49a036 commit 6cdf68f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ exports[`Aside Aside - should match snapshot 1`] = `
},
}
}
id="9b6fd5f7-2c15-483d-b925-01b650538e52"
pendingRevisions={false}
/>
</div>
Expand Down Expand Up @@ -218,7 +217,6 @@ exports[`Aside ManageApp - should match snapshot 1`] = `
},
}
}
id="test"
pendingRevisions={false}
>
<Component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,7 @@ describe('Aside', () => {
mount(
<Provider store={store}>
<MemoryRouter initialEntries={[{ pathname: Routes.DEVELOPER_APP_DETAIL, key: 'developerAppDetailRoute' }]}>
<ManageApp
id="test"
pendingRevisions={false}
appDetailState={appDetailDataStub as DeveloperAppDetailState}
/>
<ManageApp pendingRevisions={false} appDetailState={appDetailDataStub as DeveloperAppDetailState} />
</MemoryRouter>
</Provider>,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const AppContent: React.FC<AppContentProps> = ({ appDetailState }) => {
{isMobile && (
<>
<RenderWithHeader header="Status">{renderListedStatus(Boolean(isListed))}</RenderWithHeader>
<ManageApp appDetailState={appDetailState} id={id} pendingRevisions={Boolean(pendingRevisions)} />
<ManageApp appDetailState={appDetailState} pendingRevisions={Boolean(pendingRevisions)} />
</>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ interface AsideProps {
interface ManageAppProps {
pendingRevisions: boolean
appDetailState: DeveloperAppDetailState
id: string
}

export const onCancelSuccess = ({
Expand Down Expand Up @@ -89,7 +88,8 @@ export const onBackToAppsButtonClick = (history: History) => {
}
}

export const ManageApp: React.FC<ManageAppProps> = ({ pendingRevisions, id, appDetailState }) => {
export const ManageApp: React.FC<ManageAppProps> = ({ pendingRevisions, appDetailState }) => {
const id = appDetailState?.data?.id || ''
const [isDeleteModalOpen, setIsDeleteModalOpen] = React.useState(false)
const [isAppRevisionComparisionModalOpen, setIsAppRevisionComparisionModalOpen] = React.useState(false)

Expand All @@ -101,8 +101,8 @@ export const ManageApp: React.FC<ManageAppProps> = ({ pendingRevisions, id, appD
<RenderWithHeader header="Manage App">
{isDeleteModalOpen && (
<AppDelete
appId={id || ''}
appName={name || ''}
appId={appDetailState?.data?.id || ''}
appName={appDetailState?.data?.name || ''}
afterClose={onAppDeleteModalAfterClose(setIsDeleteModalOpen)}
visible={isDeleteModalOpen}
onDeleteSuccess={onDeleteSuccess(history)}
Expand Down Expand Up @@ -167,7 +167,7 @@ export const Aside: React.FC<AsideProps> = ({ desktopIntegrationTypes, appDetail
const history = useHistory()
const { isMobile } = useReactResponsive()
const { data } = appDetailState
const { isDirectApi, category, isListed, pendingRevisions, id = '', limitToClientIds = [] } = data as AppDetailModel
const { isDirectApi, category, isListed, pendingRevisions, limitToClientIds = [] } = data as AppDetailModel

return (
<div className={asideContainerClasses}>
Expand All @@ -190,7 +190,7 @@ export const Aside: React.FC<AsideProps> = ({ desktopIntegrationTypes, appDetail
{!isMobile && (
<>
<RenderWithHeader header="Status">{renderListedStatus(Boolean(isListed))}</RenderWithHeader>
<ManageApp appDetailState={appDetailState} id={id} pendingRevisions={Boolean(pendingRevisions)} />
<ManageApp appDetailState={appDetailState} pendingRevisions={Boolean(pendingRevisions)} />
</>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import { Loader, FormSection, Button } from '@reapit/elements'
import AppHeader from '@/components/ui/developer-app-detail/app-header'
import AppContent from './app-detail/app-content/app-content'
import DeveloperAppDetailButtonGroup from '@/components/ui/developer-app-detail/developer-app-detail-button-group'

import AppDelete from '@/components/ui/app-delete'
import AppInstallations from '@/components/ui/app-installations/app-installations-modal'

import routes from '@/constants/routes'
Expand Down Expand Up @@ -82,7 +80,6 @@ export const onBackToAppsButtonClick = (history: History) => {

const DeveloperAppDetail: React.FC<DeveloperAppDetailProps> = () => {
const history = useHistory()
const [isDeleteModalOpen, setIsDeleteModalOpen] = React.useState(false)
const [isInstallationsModalOpen, setIsInstallationsModalOpen] = React.useState(false)
const [isAppRevisionComparisionModalOpen, setIsAppRevisionComparisionModalOpen] = React.useState(false)
const { isMobile } = useReactResponsive()
Expand Down Expand Up @@ -119,15 +116,6 @@ const DeveloperAppDetail: React.FC<DeveloperAppDetailProps> = () => {
</FormSection>
)}
</div>
{isDeleteModalOpen && (
<AppDelete
appId={id}
appName={name}
afterClose={closeDeleteAppModal(setIsDeleteModalOpen)}
visible={isDeleteModalOpen}
onDeleteSuccess={handleOnDeleteAppSuccess(history)}
/>
)}

{isInstallationsModalOpen && (
<AppInstallations
Expand Down

0 comments on commit 6cdf68f

Please sign in to comment.