Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #1210 #1026 ui for developer/client side standalone #1304

Merged
merged 8 commits into from
May 22, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat #1210: fix review comments
undefined committed May 20, 2020

Verified

This commit was signed with the committer’s verified signature.
pdabelf5 Paul Abel
commit e509fc1462d49c45baaace9c074856fdbea47929
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ import React from 'react'
import { DeveloperAppDetailState } from '@/reducers/developer'
import { Aside, ManageApp, renderListedStatus } from '../aside'
import { shallow } from 'enzyme'
import toJson from 'enzyme-to-json'
import { integrationTypesStub } from '@/sagas/__stubs__/integration-types'
import { appDetailDataStub } from '@/sagas/__stubs__/app-detail'
import { DesktopIntegrationTypeModel } from '@reapit/foundations-ts-definitions'
@@ -15,13 +14,11 @@ jest.mock('react-router', () => ({
describe('Aside', () => {
test('Aside - should match snapshot', () => {
expect(
toJson(
shallow(
<Aside
appDetailState={appDetailDataStub as DeveloperAppDetailState}
desktopIntegrationTypes={integrationTypesStub.data as DesktopIntegrationTypeModel[]}
/>,
),
shallow(
<Aside
appDetailState={appDetailDataStub as DeveloperAppDetailState}
desktopIntegrationTypes={integrationTypesStub.data as DesktopIntegrationTypeModel[]}
/>,
),
).toMatchSnapshot()
})
@@ -43,14 +40,8 @@ describe('Aside', () => {

test('ManageApp - should match snapshot', () => {
expect(
toJson(
shallow(
<ManageApp
id="test"
pendingRevisions={false}
appDetailState={appDetailDataStub as DeveloperAppDetailState}
/>,
),
shallow(
<ManageApp id="test" pendingRevisions={false} appDetailState={appDetailDataStub as DeveloperAppDetailState} />,
),
).toMatchSnapshot()
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { GET_ALL_PAGE_SIZE } from '@/constants/paginator'
import { InstallationModel } from '@reapit/foundations-ts-definitions'
import { installationsStub } from '@/sagas/__stubs__/installations'
import { shallow, mount } from 'enzyme'
@@ -65,7 +66,7 @@ describe('AppContent', () => {
appInstallationsRequestData({
appId: [appId],
pageNumber: 1,
pageSize: 15,
pageSize: GET_ALL_PAGE_SIZE,
isInstalled: true,
developerId: [developerId],
}),
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react'
import { GET_ALL_PAGE_SIZE } from '@/constants/paginator'
import { appInstallationsRequestData } from '@/actions/app-installations'
import { selectDeveloperId } from '@/selector'
import developerAppDetailStyles from '@/styles/pages/developer-app-detail.scss?mod'
@@ -67,7 +68,7 @@ export const handleUninstallSuccess = ({ handleAfterClose, setUninstallApp, deve
appInstallationsRequestData({
appId: [appId],
pageNumber: 1,
pageSize: 15,
pageSize: GET_ALL_PAGE_SIZE,
isInstalled: true,
developerId: [developerId],
}),
@@ -83,6 +84,7 @@ const AppContent: React.FC<AppContentProps> = ({ appDetailData }) => {

const [uninstallApp, setUninstallApp] = React.useState<InstallationModel>()
const columns = generateColumns(handleUninstall(setUninstallApp))()
const isVisibleUninstallModal = Boolean(uninstallApp)

/**
* 0 = icon
@@ -92,7 +94,7 @@ const AppContent: React.FC<AppContentProps> = ({ appDetailData }) => {

return (
<div className={clientAppDetailStyles.appContentContainer}>
<Modal visible={Boolean(uninstallApp)}>
<Modal visible={isVisibleUninstallModal}>
duong-se marked this conversation as resolved.
Show resolved Hide resolved
<ConfirmUninstall
isSetAppDetailStaleAfterUninstallSuccess={false}
appName={name}
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ import appDetailStyles from '@/styles/blocks/app-detail.scss?mod'
import developerAppDetailStyles from '@/styles/pages/developer-app-detail.scss?mod'
import { RenderWithHeader } from './app-detail/render-with-header'
import { Button } from '@reapit/elements'
import { BooleanToYesNo } from '@/utils/boolean-to-yes-no'
import { convertBooleanToYesNoString } from '@/utils/boolean-to-yes-no-string'
import { renderCategory, renderDesktopIntegrationTypes } from '../client-app-detail/app-content'
import { DesktopIntegrationTypeModel } from '@reapit/foundations-ts-definitions'
/* eslint-disable max-len */
@@ -105,8 +105,8 @@ export const Aside: React.FC<AsideProps> = ({ desktopIntegrationTypes, appDetail
<div className={developerAppDetailStyles.headerWithoutMargin}>
{renderDesktopIntegrationTypes(desktopIntegrationTypes)}
</div>
<RenderWithHeader header="Private App">{BooleanToYesNo(Boolean(limitToClientIds))}</RenderWithHeader>
<RenderWithHeader header="Direct API">{BooleanToYesNo(Boolean(isDirectApi))}</RenderWithHeader>
<RenderWithHeader header="Private App">{convertBooleanToYesNoString(Boolean(limitToClientIds))}</RenderWithHeader>
<RenderWithHeader header="Direct API">{convertBooleanToYesNoString(Boolean(isDirectApi))}</RenderWithHeader>
<RenderWithHeader header="Status">{renderListedStatus(Boolean(isListed))}</RenderWithHeader>
<ManageApp appDetailState={appDetailState} id={id} pendingRevisions={Boolean(pendingRevisions)} />
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { convertBooleanToYesNoString } from '../boolean-to-yes-no-string'
describe('convertBooleanToYesNoString', () => {
it('should return Yes when input true', () => {
expect(convertBooleanToYesNoString(true)).toBe('Yes')
})
it('should return No when input fasle', () => {
expect(convertBooleanToYesNoString(false)).toBe('No')
})
})

This file was deleted.

7 changes: 7 additions & 0 deletions packages/marketplace/src/utils/boolean-to-yes-no-string.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const convertBooleanToYesNoString: (value: boolean) => string = value => {
if (value) {
return 'Yes'
}

return 'No'
}
7 changes: 0 additions & 7 deletions packages/marketplace/src/utils/boolean-to-yes-no.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions packages/marketplace/src/utils/route-dispatcher.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AdminDevManagementRequestDataValues } from './../actions/admin-dev-management'
import { GET_ALL_PAGE_SIZE } from '@/constants/paginator'
import { selectDeveloperId } from '@/selector'
import { appDetailRequestData } from './../actions/app-detail'
import { RouteValue, StringMap } from '../types/core'
import Routes from '../constants/routes'
import { GET_ALL_PAGE_SIZE } from '../constants/paginator'
import store from '../core/store'
import { clientFetchAppSummary, clientFetchAppDetail } from '../actions/client'
import { myAppsRequestData } from '../actions/my-apps'
@@ -78,7 +78,7 @@ const routeDispatcher = async (route: RouteValue, params?: StringMap, search?: s
appInstallationsRequestData({
appId: [id],
pageNumber: 1,
pageSize: 15,
pageSize: GET_ALL_PAGE_SIZE,
isInstalled: true,
developerId: [developerId],
}),