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

Web Actions Tab: Add fallback for non-typed endpoints #888

Merged
merged 1 commit into from Apr 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 27 additions & 14 deletions misk/web/tabs/web-actions/src/components/RequestFormComponent.tsx
Expand Up @@ -251,18 +251,31 @@ export const RequestFormComponent = (
props: { action: IWebActionInternal; tag: string } & IState & IDispatchProps
) => {
const { requestType, types } = props.action
const { fields } = types[requestType]
return (
<div>
{fields.map((field: IFieldTypeMetadata) => (
<RequestFormFields
{...props}
field={field}
id={0}
nestPath={"/"}
types={types}
/>
))}
</div>
)
if (requestType && types && types[requestType] && types[requestType].fields) {
const { fields } = types[requestType]
return (
<div>
{fields.map((field: IFieldTypeMetadata) => (
<RequestFormFields
{...props}
field={field}
id={0}
nestPath={"/"}
types={types}
/>
))}
</div>
)
} else {
const { tag } = props
return (
<TextArea
fill={true}
onChange={onChangeFnCall(props.simpleFormInput, `${tag}::Body`)}
placeholder={
"Request Body (JSON or Text).\nDrag bottom right corner of text area input to expand."
}
/>
)
}
}
4 changes: 2 additions & 2 deletions misk/web/tabs/web-actions/src/ducks/webActions.ts
Expand Up @@ -254,12 +254,12 @@ function* handleMetadata() {
? "All"
: "None"
const allowedRoles =
action.allowedRoles.length > 0
action.allowedRoles && action.allowedRoles.length > 0
? action.allowedRoles.join(", ")
: emptyAllowedArrayValue

const allowedServices =
action.allowedServices.length > 0
action.allowedServices && action.allowedServices.length > 0
? action.allowedServices.join(", ")
: emptyAllowedArrayValue

Expand Down