Merge branch 'fix/api-scroll' into 'release'

Fixing api Scroll.

See merge request theappsmith/internal-tools-client!689
This commit is contained in:
Satbir Singh 2020-06-12 03:54:12 +00:00
commit f606b0989e
7 changed files with 36 additions and 17 deletions

View File

@ -9,7 +9,8 @@ const TabsWrapper = styled.div<{ overflow?: boolean }>`
height: 100%; height: 100%;
} }
.react-tabs__tab-panel { .react-tabs__tab-panel {
height: 100%; height: calc(100% - 46px);
overflow: scroll;
} }
.react-tabs__tab-list { .react-tabs__tab-list {
border-bottom-color: #d0d7dd; border-bottom-color: #d0d7dd;

View File

@ -103,6 +103,10 @@ const FailedMessageContainer = styled.div`
align-items: center; align-items: center;
`; `;
const TabbedViewWrapper = styled.div`
height: calc(100% - 30px);
`;
const ApiResponseView = (props: Props) => { const ApiResponseView = (props: Props) => {
const { const {
match: { match: {
@ -143,7 +147,7 @@ const ApiResponseView = (props: Props) => {
? JSON.stringify(response.body, null, 2) ? JSON.stringify(response.body, null, 2)
: "", : "",
}} }}
height={700} height={"100%"}
/> />
</> </>
), ),
@ -163,12 +167,12 @@ const ApiResponseView = (props: Props) => {
title: "Request Body", title: "Request Body",
panelComponent: ( panelComponent: (
<CodeEditor <CodeEditor
height={"100%"}
input={{ input={{
value: _.isObject(response.requestBody) value: _.isObject(response.requestBody)
? JSON.stringify(response.requestBody, null, 2) ? JSON.stringify(response.requestBody, null, 2)
: response.requestBody || "", : response.requestBody || "",
}} }}
height={700}
/> />
), ),
}, },
@ -203,12 +207,14 @@ const ApiResponseView = (props: Props) => {
</ResponseMetaInfo> </ResponseMetaInfo>
</React.Fragment> </React.Fragment>
</FormRow> </FormRow>
<BaseTabbedView <TabbedViewWrapper>
overflow <BaseTabbedView
tabs={tabs} overflow
selectedIndex={selectedIndex} tabs={tabs}
setSelectedIndex={setSelectedIndex} selectedIndex={selectedIndex}
/> setSelectedIndex={setSelectedIndex}
/>
</TabbedViewWrapper>
</ResponseWrapper> </ResponseWrapper>
); );
}; };

View File

@ -6,9 +6,13 @@ import "codemirror/theme/monokai.css";
require("codemirror/mode/javascript/javascript"); require("codemirror/mode/javascript/javascript");
const Wrapper = styled.div<{ height: number }>` const Wrapper = styled.div<{ height: number | string }>`
height: ${props => props.height}px; height: ${props =>
typeof props.height === "number" ? props.height + "px" : props.height};
color: white; color: white;
.CodeMirror {
height: 100%;
}
`; `;
interface Props { interface Props {
@ -16,7 +20,7 @@ interface Props {
value: string; value: string;
onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void; onChange?: (event: ChangeEvent<HTMLTextAreaElement>) => void;
}; };
height: number; height: number | string;
} }
class CodeEditor extends React.Component<Props> { class CodeEditor extends React.Component<Props> {
@ -35,7 +39,6 @@ class CodeEditor extends React.Component<Props> {
lineNumbers: true, lineNumbers: true,
lineWrapping: true, lineWrapping: true,
}); });
this.editor.setSize(null, this.props.height);
} }
} }

View File

@ -74,7 +74,7 @@ const DatasourceWrapper = styled.div`
const SecondaryWrapper = styled.div` const SecondaryWrapper = styled.div`
display: flex; display: flex;
height: 100%; height: calc(100% - 120px);
border-top: 1px solid #d0d7dd; border-top: 1px solid #d0d7dd;
margin-top: 15px; margin-top: 15px;
`; `;

View File

@ -29,6 +29,10 @@ const PostbodyContainer = styled.div`
const JSONEditorFieldWrapper = styled.div` const JSONEditorFieldWrapper = styled.div`
margin: 5px; margin: 5px;
.CodeMirror {
height: auto;
min-height: 300px;
}
`; `;
export interface RapidApiAction { export interface RapidApiAction {
editable: boolean; editable: boolean;
@ -110,7 +114,6 @@ const PostBodyData = (props: Props) => {
<DynamicTextField <DynamicTextField
name="actionConfiguration.body" name="actionConfiguration.body"
expected={FIELD_VALUES.API_ACTION.body} expected={FIELD_VALUES.API_ACTION.body}
height={300}
showLineNumbers showLineNumbers
allowTabIndent allowTabIndent
singleLine={false} singleLine={false}

View File

@ -55,7 +55,7 @@ const MainConfiguration = styled.div`
const SecondaryWrapper = styled.div` const SecondaryWrapper = styled.div`
display: flex; display: flex;
height: 100%; height: calc(100% - 120px);
border-top: 1px solid #d0d7dd; border-top: 1px solid #d0d7dd;
margin-top: 10px; margin-top: 10px;
`; `;
@ -163,7 +163,12 @@ const RapidApiEditorForm: React.FC<Props> = (props: Props) => {
// } // }
return ( return (
<Form onSubmit={handleSubmit}> <Form
onSubmit={handleSubmit}
style={{
height: "100%",
}}
>
<MainConfiguration> <MainConfiguration>
<FormRow> <FormRow>
<DynamicTextField <DynamicTextField

View File

@ -188,6 +188,7 @@ class ApiEditor extends React.Component<Props> {
<div <div
style={{ style={{
position: "relative", position: "relative",
height: "100%",
}} }}
> >
{apiId ? ( {apiId ? (