Skip to content

Commit

Permalink
[CLD-587] Update submit or update app flow following back-end update (#…
Browse files Browse the repository at this point in the history
…241)

* [CLD-587] Update submit or update app flow following back-end update

* Update show client secret

* [CLD-587] Update foundations-ts-definitions
  • Loading branch information
trankhacvy authored Jan 6, 2020
1 parent 29de233 commit 8aef449
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@babel/preset-env": "^7.7.7",
"@cypress/webpack-preprocessor": "^4.1.1",
"@reapit/config-manager": "^1.1.0",
"@reapit/foundations-ts-definitions": "latest",
"@reapit/foundations-ts-definitions": "^0.0.6",
"@redux-saga/testing-utils": "^1.0.5",
"@types/diff": "^4.0.2",
"@types/enzyme": "~3.9.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ exports[`DeveloperSubmitApp should match submit revision form snapshot 1`] = `
<Formik
initialValues={
Object {
"authFlow": undefined,
"categoryId": "",
"description": "enim facilisis gravida neque convallis a cras semper auctor neque vitae tempus quam pellentesque nec nam aliquam sem et tortor consequat id porta nibh venenatis cras sed felis eget velit aliquet sagittis id consectetur purus ut faucibus pulvinar elementum integer enim neque volutpat ac tincidunt vitae semper quis lectus nulla at volutpat diam ut venenatis tellus in metus vulputate eu scelerisque felis imperdiet proin fermentum leo vel orci porta non pulvinar neque laoreet suspendisse interdum co",
"developerId": undefined,
Expand Down
5 changes: 5 additions & 0 deletions src/components/pages/developer-submit-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const generateInitialValues = (appDetail: AppDetailModel | null, develope
if (appDetail) {
const {
category,
authFlow,
description,
developerId,
homePage,
Expand All @@ -110,6 +111,7 @@ export const generateInitialValues = (appDetail: AppDetailModel | null, develope
initialValues = {
name,
categoryId: category?.id || '',
authFlow,
description,
developerId,
homePage,
Expand Down Expand Up @@ -162,6 +164,9 @@ export const handleSubmitApp = ({
if (!appId) {
submitApp(appModel, actions, setSubmitError)
} else {
if (appModel.authFlow) {
delete appModel.authFlow
}
submitRevision(appId, appModel)
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/components/ui/app-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import styles from '@/styles/blocks/app-detail.scss?mod'
import appCardStyles from '@/styles/blocks/app-card.scss?mod'
import { FaCheck, FaTimes } from 'react-icons/fa'
import AppAuthenticationDetail from './app-authentication-detail'
import AuthFlow from '@/constants/app-auth-flow'

export interface AppDetailModalInnerProps {
data: AppDetailModel
Expand Down Expand Up @@ -60,7 +61,8 @@ export const AppDetail: React.FunctionComponent<AppDetailProps> = ({
installedOn,
scopes = [],
isListed,
isDirectApi
isDirectApi,
authFlow
} = data
const icon = media.filter(({ type }) => type === 'icon')[0]
const carouselImages = media.filter(({ type }) => type === 'image')
Expand Down Expand Up @@ -121,8 +123,7 @@ export const AppDetail: React.FunctionComponent<AppDetailProps> = ({
{isListed ? <FaCheck className={styles.isListed} /> : <FaTimes className={styles.notListed} />}
</div>
)}
{id && <AppAuthenticationDetail appId={id} />}

{authFlow === AuthFlow.CLIENT_SECRET && id && <AppAuthenticationDetail appId={id} />}
{carouselImages.length > 0 && (
<div className={carouselStyles.container}>
<Slider {...settings}>
Expand Down
6 changes: 6 additions & 0 deletions src/constants/app-auth-flow.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const authFlows = {
USER_SESSION: 'authorisationCode',
CLIENT_SECRET: 'clientCredentials'
}

export default authFlows
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1013,10 +1013,10 @@
react-icons "^3.7.0"
react-table "7.0.0-alpha.35"

"@reapit/foundations-ts-definitions@latest":
version "0.0.4"
resolved "https://registry.yarnpkg.com/@reapit/foundations-ts-definitions/-/foundations-ts-definitions-0.0.4.tgz#d469eda53eab4419b6a5e711afbfc0f4b976d22f"
integrity sha512-FNy1wt5s10I1jWaUdeVzsakM59okGEMKimG+iXjfLuCWIs1sG7Pj5vTvkoGgq9nm5vyfcEQgN9M7i4Tw7ABmCQ==
"@reapit/foundations-ts-definitions@^0.0.6":
version "0.0.6"
resolved "https://registry.yarnpkg.com/@reapit/foundations-ts-definitions/-/foundations-ts-definitions-0.0.6.tgz#a3302ddda84d1ce0e2b253cf44f4dc19cb3c4118"
integrity sha512-lQXijcow6kwAJeCqLzvnl7Fyj6ZtlM1OBKGosfIaU2Nc0i6NNGHjOT1VT8f3SF///ChcG7hHHhOSNYgvO06bOQ==

"@redux-saga/core@^1.1.3":
version "1.1.3"
Expand Down

0 comments on commit 8aef449

Please sign in to comment.