2021-10-07 06:53:58 +00:00
|
|
|
import React, { useRef, RefObject, useCallback } from "react";
|
|
|
|
|
import { connect, useDispatch } from "react-redux";
|
2019-10-25 05:35:20 +00:00
|
|
|
import { withRouter, RouteComponentProps } from "react-router";
|
|
|
|
|
import styled from "styled-components";
|
2019-11-25 05:07:27 +00:00
|
|
|
import { AppState } from "reducers";
|
|
|
|
|
import { ActionResponse } from "api/ActionAPI";
|
|
|
|
|
import { formatBytes } from "utils/helpers";
|
2019-11-22 17:04:40 +00:00
|
|
|
import { APIEditorRouteParams } from "constants/routes";
|
2019-12-11 15:14:38 +00:00
|
|
|
import LoadingOverlayScreen from "components/editorComponents/LoadingOverlayScreen";
|
2020-07-01 10:01:07 +00:00
|
|
|
import ReadOnlyEditor from "components/editorComponents/ReadOnlyEditor";
|
2020-01-30 13:23:04 +00:00
|
|
|
import { getActionResponses } from "selectors/entitiesSelector";
|
2020-04-14 12:34:14 +00:00
|
|
|
import { Colors } from "constants/Colors";
|
2020-06-04 13:49:22 +00:00
|
|
|
import _ from "lodash";
|
2021-06-09 12:45:41 +00:00
|
|
|
import {
|
|
|
|
|
CHECK_REQUEST_BODY,
|
|
|
|
|
createMessage,
|
|
|
|
|
DEBUGGER_ERRORS,
|
|
|
|
|
DEBUGGER_LOGS,
|
2021-07-07 03:46:16 +00:00
|
|
|
EMPTY_RESPONSE_FIRST_HALF,
|
|
|
|
|
EMPTY_RESPONSE_LAST_HALF,
|
2021-06-09 12:45:41 +00:00
|
|
|
INSPECT_ENTITY,
|
2022-02-11 18:08:46 +00:00
|
|
|
} from "@appsmith/constants/messages";
|
2021-04-23 13:50:55 +00:00
|
|
|
import Text, { TextType } from "components/ads/Text";
|
2021-09-09 15:10:22 +00:00
|
|
|
import { Text as BlueprintText } from "@blueprintjs/core";
|
2021-02-11 12:54:00 +00:00
|
|
|
import Icon from "components/ads/Icon";
|
|
|
|
|
import { Classes, Variant } from "components/ads/common";
|
|
|
|
|
import { EditorTheme } from "./CodeEditor/EditorConfig";
|
|
|
|
|
import Callout from "components/ads/Callout";
|
2021-04-23 13:50:55 +00:00
|
|
|
import DebuggerLogs from "./Debugger/DebuggerLogs";
|
|
|
|
|
import ErrorLogs from "./Debugger/Errors";
|
|
|
|
|
import Resizer, { ResizerCSS } from "./Debugger/Resizer";
|
|
|
|
|
import AnalyticsUtil from "utils/AnalyticsUtil";
|
|
|
|
|
import { DebugButton } from "./Debugger/DebugCTA";
|
2021-06-09 12:45:41 +00:00
|
|
|
import EntityDeps from "./Debugger/EntityDependecies";
|
2021-07-07 03:46:16 +00:00
|
|
|
import Button, { Size } from "components/ads/Button";
|
2021-10-07 06:53:58 +00:00
|
|
|
import EntityBottomTabs from "./EntityBottomTabs";
|
|
|
|
|
import { DEBUGGER_TAB_KEYS } from "./Debugger/helpers";
|
|
|
|
|
import { setCurrentTab } from "actions/debuggerActions";
|
2019-10-25 05:35:20 +00:00
|
|
|
|
2021-09-09 15:10:22 +00:00
|
|
|
type TextStyleProps = {
|
|
|
|
|
accent: "primary" | "secondary" | "error";
|
|
|
|
|
};
|
|
|
|
|
export const BaseText = styled(BlueprintText)<TextStyleProps>``;
|
|
|
|
|
|
2021-02-22 06:15:02 +00:00
|
|
|
const ResponseContainer = styled.div`
|
2021-04-23 13:50:55 +00:00
|
|
|
${ResizerCSS}
|
|
|
|
|
// Initial height of bottom tabs
|
2021-07-13 13:37:54 +00:00
|
|
|
height: ${(props) => props.theme.actionsBottomTabInitialHeight};
|
2021-05-10 13:28:38 +00:00
|
|
|
width: 100%;
|
2021-04-23 13:50:55 +00:00
|
|
|
// Minimum height of bottom tabs as it can be resized
|
|
|
|
|
min-height: 36px;
|
2021-02-11 12:54:00 +00:00
|
|
|
background-color: ${(props) => props.theme.colors.apiPane.responseBody.bg};
|
|
|
|
|
|
|
|
|
|
.react-tabs__tab-panel {
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
2019-10-25 05:35:20 +00:00
|
|
|
`;
|
|
|
|
|
const ResponseMetaInfo = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
${BaseText} {
|
|
|
|
|
color: #768896;
|
2021-02-11 12:54:00 +00:00
|
|
|
margin-left: ${(props) => props.theme.spaces[9]}px;
|
2019-10-25 05:35:20 +00:00
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
2020-12-08 09:24:36 +00:00
|
|
|
const ResponseMetaWrapper = styled.div`
|
|
|
|
|
align-items: center;
|
|
|
|
|
display: flex;
|
2021-02-11 12:54:00 +00:00
|
|
|
position: absolute;
|
|
|
|
|
right: ${(props) => props.theme.spaces[12]}px;
|
|
|
|
|
top: ${(props) => props.theme.spaces[4]}px;
|
2020-12-08 09:24:36 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-02-22 06:15:02 +00:00
|
|
|
const ResponseTabWrapper = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
height: 100%;
|
|
|
|
|
width: 100%;
|
2019-10-29 12:02:58 +00:00
|
|
|
`;
|
2019-10-25 05:35:20 +00:00
|
|
|
|
2021-10-07 06:53:58 +00:00
|
|
|
const TabbedViewWrapper = styled.div`
|
2021-09-02 18:26:30 +00:00
|
|
|
height: 100%;
|
2021-02-11 12:54:00 +00:00
|
|
|
|
|
|
|
|
&&& {
|
|
|
|
|
ul.react-tabs__tab-list {
|
|
|
|
|
padding: 0px ${(props) => props.theme.spaces[12]}px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-02 18:26:30 +00:00
|
|
|
& {
|
|
|
|
|
.react-tabs__tab-panel {
|
|
|
|
|
height: calc(100% - 32px);
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-02-11 12:54:00 +00:00
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const SectionDivider = styled.div`
|
|
|
|
|
height: 2px;
|
2020-06-23 03:58:42 +00:00
|
|
|
width: 100%;
|
2021-02-11 12:54:00 +00:00
|
|
|
background: ${(props) => props.theme.colors.apiPane.dividerBg};
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const Flex = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-left: 20px;
|
|
|
|
|
|
|
|
|
|
span:first-child {
|
|
|
|
|
margin-right: ${(props) => props.theme.spaces[1] + 1}px;
|
2020-06-23 03:58:42 +00:00
|
|
|
}
|
2020-05-30 02:39:18 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-02-11 12:54:00 +00:00
|
|
|
const NoResponseContainer = styled.div`
|
2021-09-02 18:26:30 +00:00
|
|
|
flex: 1;
|
2021-02-22 06:15:02 +00:00
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
flex-direction: column;
|
2021-02-11 12:54:00 +00:00
|
|
|
.${Classes.ICON} {
|
|
|
|
|
margin-right: 0px;
|
|
|
|
|
svg {
|
|
|
|
|
width: 150px;
|
|
|
|
|
height: 150px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.${Classes.TEXT} {
|
|
|
|
|
margin-top: ${(props) => props.theme.spaces[9]}px;
|
|
|
|
|
}
|
2020-06-12 03:54:12 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-02-11 12:54:00 +00:00
|
|
|
const FailedMessage = styled.div`
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2021-04-23 13:50:55 +00:00
|
|
|
margin-left: 5px;
|
2021-06-17 13:27:46 +00:00
|
|
|
|
|
|
|
|
.api-debugcta {
|
|
|
|
|
margin-top: 0px;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const StyledCallout = styled(Callout)`
|
|
|
|
|
.${Classes.TEXT} {
|
|
|
|
|
line-height: normal;
|
|
|
|
|
}
|
2020-06-23 03:58:42 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-07-07 03:46:16 +00:00
|
|
|
const InlineButton = styled(Button)`
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
margin: 0 4px;
|
|
|
|
|
`;
|
|
|
|
|
|
2021-07-09 17:01:50 +00:00
|
|
|
const HelpSection = styled.div`
|
2021-09-02 18:26:30 +00:00
|
|
|
padding-bottom: 5px;
|
|
|
|
|
padding-top: 10px;
|
2021-07-09 17:01:50 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-02-22 06:15:02 +00:00
|
|
|
interface ReduxStateProps {
|
|
|
|
|
responses: Record<string, ActionResponse | undefined>;
|
|
|
|
|
isRunning: Record<string, boolean>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Props = ReduxStateProps &
|
2021-04-23 13:50:55 +00:00
|
|
|
RouteComponentProps<APIEditorRouteParams> & {
|
|
|
|
|
theme?: EditorTheme;
|
|
|
|
|
apiName: string;
|
2021-07-07 03:46:16 +00:00
|
|
|
onRunClick: () => void;
|
2021-04-23 13:50:55 +00:00
|
|
|
};
|
2021-02-22 06:15:02 +00:00
|
|
|
|
|
|
|
|
export const EMPTY_RESPONSE: ActionResponse = {
|
|
|
|
|
statusCode: "",
|
|
|
|
|
duration: "",
|
|
|
|
|
body: {},
|
|
|
|
|
headers: {},
|
|
|
|
|
request: {
|
|
|
|
|
headers: {},
|
|
|
|
|
body: {},
|
|
|
|
|
httpMethod: "",
|
|
|
|
|
url: "",
|
|
|
|
|
},
|
|
|
|
|
size: "",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const StatusCodeText = styled(BaseText)<{ code: string }>`
|
|
|
|
|
color: ${(props) =>
|
|
|
|
|
props.code.startsWith("2") ? props.theme.colors.primaryOld : Colors.RED};
|
2022-01-10 16:43:04 +00:00
|
|
|
cursor: pointer;
|
|
|
|
|
width: 38px;
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
|
&:hover {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
2021-02-22 06:15:02 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-09-02 18:26:30 +00:00
|
|
|
const ResponseDataContainer = styled.div`
|
|
|
|
|
flex: 1;
|
|
|
|
|
overflow: auto;
|
|
|
|
|
display: flex;
|
2022-02-04 11:32:38 +00:00
|
|
|
margin-bottom: 10px;
|
2021-09-02 18:26:30 +00:00
|
|
|
flex-direction: column;
|
|
|
|
|
& .CodeEditorTarget {
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
|
|
|
|
`;
|
|
|
|
|
|
2021-04-28 10:28:39 +00:00
|
|
|
function ApiResponseView(props: Props) {
|
2019-11-22 17:04:40 +00:00
|
|
|
const {
|
|
|
|
|
match: {
|
|
|
|
|
params: { apiId },
|
|
|
|
|
},
|
|
|
|
|
responses,
|
|
|
|
|
} = props;
|
|
|
|
|
let response: ActionResponse = EMPTY_RESPONSE;
|
2019-12-11 15:14:38 +00:00
|
|
|
let isRunning = false;
|
2020-05-30 02:39:18 +00:00
|
|
|
let hasFailed = false;
|
2019-11-22 17:04:40 +00:00
|
|
|
if (apiId && apiId in responses) {
|
2020-01-30 13:23:04 +00:00
|
|
|
response = responses[apiId] || EMPTY_RESPONSE;
|
2020-06-03 05:40:48 +00:00
|
|
|
isRunning = props.isRunning[apiId];
|
2020-05-30 02:39:18 +00:00
|
|
|
hasFailed = response.statusCode ? response.statusCode[0] !== "2" : false;
|
2019-11-22 17:04:40 +00:00
|
|
|
}
|
2021-04-23 13:50:55 +00:00
|
|
|
const panelRef: RefObject<HTMLDivElement> = useRef(null);
|
2021-10-04 08:01:46 +00:00
|
|
|
const dispatch = useDispatch();
|
2020-05-30 02:39:18 +00:00
|
|
|
|
2021-04-23 13:50:55 +00:00
|
|
|
const onDebugClick = useCallback(() => {
|
|
|
|
|
AnalyticsUtil.logEvent("OPEN_DEBUGGER", {
|
|
|
|
|
source: "API",
|
|
|
|
|
});
|
2021-10-07 06:53:58 +00:00
|
|
|
dispatch(setCurrentTab(DEBUGGER_TAB_KEYS.ERROR_TAB));
|
2021-04-23 13:50:55 +00:00
|
|
|
}, []);
|
|
|
|
|
|
2021-07-26 10:59:15 +00:00
|
|
|
const onRunClick = () => {
|
|
|
|
|
props.onRunClick();
|
|
|
|
|
AnalyticsUtil.logEvent("RESPONSE_TAB_RUN_ACTION_CLICK", {
|
|
|
|
|
source: "API_PANE",
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-09 17:01:50 +00:00
|
|
|
const messages = response?.messages;
|
2022-02-04 11:32:38 +00:00
|
|
|
let responseHeaders;
|
|
|
|
|
|
|
|
|
|
// if no headers are present in the response, use the default body text.
|
|
|
|
|
if (response.headers) {
|
|
|
|
|
responseHeaders = response.headers;
|
|
|
|
|
} else {
|
|
|
|
|
responseHeaders = {}; // if the response headers is empty show an empty object.
|
|
|
|
|
}
|
2021-09-02 18:26:30 +00:00
|
|
|
|
2020-05-22 03:43:01 +00:00
|
|
|
const tabs = [
|
|
|
|
|
{
|
|
|
|
|
key: "body",
|
2022-02-04 11:32:38 +00:00
|
|
|
title: "Body",
|
2020-05-22 03:43:01 +00:00
|
|
|
panelComponent: (
|
2021-02-22 06:15:02 +00:00
|
|
|
<ResponseTabWrapper>
|
2021-09-02 18:26:30 +00:00
|
|
|
{Array.isArray(messages) && messages.length > 0 && (
|
2021-07-09 17:01:50 +00:00
|
|
|
<HelpSection>
|
|
|
|
|
{messages.map((msg, i) => (
|
|
|
|
|
<Callout fill key={i} text={msg} variant={Variant.warning} />
|
|
|
|
|
))}
|
|
|
|
|
</HelpSection>
|
|
|
|
|
)}
|
2021-06-17 13:27:46 +00:00
|
|
|
{hasFailed && !isRunning && (
|
|
|
|
|
<StyledCallout
|
2021-04-28 10:28:39 +00:00
|
|
|
fill
|
|
|
|
|
label={
|
|
|
|
|
<FailedMessage>
|
2021-06-17 13:27:46 +00:00
|
|
|
<DebugButton
|
|
|
|
|
className="api-debugcta"
|
|
|
|
|
onClick={onDebugClick}
|
|
|
|
|
/>
|
2021-04-28 10:28:39 +00:00
|
|
|
</FailedMessage>
|
|
|
|
|
}
|
|
|
|
|
text={createMessage(CHECK_REQUEST_BODY)}
|
|
|
|
|
variant={Variant.danger}
|
|
|
|
|
/>
|
2021-02-11 12:54:00 +00:00
|
|
|
)}
|
2021-09-02 18:26:30 +00:00
|
|
|
<ResponseDataContainer>
|
|
|
|
|
{_.isEmpty(response.statusCode) ? (
|
|
|
|
|
<NoResponseContainer>
|
|
|
|
|
<Icon name="no-response" />
|
|
|
|
|
<Text type={TextType.P1}>
|
|
|
|
|
{EMPTY_RESPONSE_FIRST_HALF()}
|
|
|
|
|
<InlineButton
|
|
|
|
|
isLoading={isRunning}
|
|
|
|
|
onClick={onRunClick}
|
|
|
|
|
size={Size.medium}
|
|
|
|
|
tag="button"
|
|
|
|
|
text="Run"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
{EMPTY_RESPONSE_LAST_HALF()}
|
|
|
|
|
</Text>
|
|
|
|
|
</NoResponseContainer>
|
|
|
|
|
) : (
|
|
|
|
|
<ReadOnlyEditor
|
|
|
|
|
folding
|
|
|
|
|
height={"100%"}
|
|
|
|
|
input={{
|
|
|
|
|
value: response.body
|
|
|
|
|
? JSON.stringify(response.body, null, 2)
|
|
|
|
|
: "",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</ResponseDataContainer>
|
2021-02-22 06:15:02 +00:00
|
|
|
</ResponseTabWrapper>
|
2020-05-22 03:43:01 +00:00
|
|
|
),
|
|
|
|
|
},
|
2022-02-04 11:32:38 +00:00
|
|
|
{
|
|
|
|
|
key: "headers",
|
|
|
|
|
title: "Headers",
|
|
|
|
|
panelComponent: (
|
|
|
|
|
<ResponseTabWrapper>
|
|
|
|
|
{hasFailed && !isRunning && (
|
|
|
|
|
<StyledCallout
|
|
|
|
|
fill
|
|
|
|
|
label={
|
|
|
|
|
<FailedMessage>
|
|
|
|
|
<DebugButton
|
|
|
|
|
className="api-debugcta"
|
|
|
|
|
onClick={onDebugClick}
|
|
|
|
|
/>
|
|
|
|
|
</FailedMessage>
|
|
|
|
|
}
|
|
|
|
|
text={createMessage(CHECK_REQUEST_BODY)}
|
|
|
|
|
variant={Variant.danger}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
<ResponseDataContainer>
|
|
|
|
|
{_.isEmpty(response.statusCode) ? (
|
|
|
|
|
<NoResponseContainer>
|
|
|
|
|
<Icon name="no-response" />
|
|
|
|
|
<Text type={TextType.P1}>
|
|
|
|
|
{EMPTY_RESPONSE_FIRST_HALF()}
|
|
|
|
|
<InlineButton
|
|
|
|
|
isLoading={isRunning}
|
|
|
|
|
onClick={onRunClick}
|
|
|
|
|
size={Size.medium}
|
|
|
|
|
tag="button"
|
|
|
|
|
text="Run"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
{EMPTY_RESPONSE_LAST_HALF()}
|
|
|
|
|
</Text>
|
|
|
|
|
</NoResponseContainer>
|
|
|
|
|
) : (
|
|
|
|
|
<ReadOnlyEditor
|
|
|
|
|
folding
|
|
|
|
|
height={"100%"}
|
|
|
|
|
input={{
|
|
|
|
|
value: response.body
|
|
|
|
|
? JSON.stringify(responseHeaders, null, 2)
|
|
|
|
|
: "",
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</ResponseDataContainer>
|
|
|
|
|
</ResponseTabWrapper>
|
|
|
|
|
),
|
|
|
|
|
},
|
2020-05-22 03:43:01 +00:00
|
|
|
{
|
2021-10-07 06:53:58 +00:00
|
|
|
key: DEBUGGER_TAB_KEYS.ERROR_TAB,
|
2021-06-09 12:45:41 +00:00
|
|
|
title: createMessage(DEBUGGER_ERRORS),
|
2021-04-23 13:50:55 +00:00
|
|
|
panelComponent: <ErrorLogs />,
|
|
|
|
|
},
|
|
|
|
|
{
|
2021-10-07 06:53:58 +00:00
|
|
|
key: DEBUGGER_TAB_KEYS.LOGS_TAB,
|
2021-06-09 12:45:41 +00:00
|
|
|
title: createMessage(DEBUGGER_LOGS),
|
2021-04-23 13:50:55 +00:00
|
|
|
panelComponent: <DebuggerLogs searchQuery={props.apiName} />,
|
2020-05-22 03:43:01 +00:00
|
|
|
},
|
2021-06-09 12:45:41 +00:00
|
|
|
{
|
2021-10-07 06:53:58 +00:00
|
|
|
key: DEBUGGER_TAB_KEYS.INSPECT_TAB,
|
2021-06-09 12:45:41 +00:00
|
|
|
title: createMessage(INSPECT_ENTITY),
|
|
|
|
|
panelComponent: <EntityDeps />,
|
|
|
|
|
},
|
2020-05-22 03:43:01 +00:00
|
|
|
];
|
|
|
|
|
|
2019-10-25 05:35:20 +00:00
|
|
|
return (
|
2021-04-23 13:50:55 +00:00
|
|
|
<ResponseContainer ref={panelRef}>
|
|
|
|
|
<Resizer panelRef={panelRef} />
|
2021-02-11 12:54:00 +00:00
|
|
|
<SectionDivider />
|
2019-12-11 15:14:38 +00:00
|
|
|
{isRunning && (
|
2021-02-11 12:54:00 +00:00
|
|
|
<LoadingOverlayScreen theme={props.theme}>
|
|
|
|
|
Sending Request
|
|
|
|
|
</LoadingOverlayScreen>
|
2019-12-11 15:14:38 +00:00
|
|
|
)}
|
2021-10-07 06:53:58 +00:00
|
|
|
<TabbedViewWrapper>
|
2020-12-08 09:24:36 +00:00
|
|
|
{response.statusCode && (
|
|
|
|
|
<ResponseMetaWrapper>
|
|
|
|
|
{response.statusCode && (
|
2021-02-11 12:54:00 +00:00
|
|
|
<Flex>
|
|
|
|
|
<Text type={TextType.P3}>Status: </Text>
|
|
|
|
|
<StatusCodeText
|
|
|
|
|
accent="secondary"
|
|
|
|
|
code={response.statusCode.toString()}
|
|
|
|
|
>
|
|
|
|
|
{response.statusCode}
|
|
|
|
|
</StatusCodeText>
|
|
|
|
|
</Flex>
|
2020-12-08 09:24:36 +00:00
|
|
|
)}
|
|
|
|
|
<ResponseMetaInfo>
|
|
|
|
|
{response.duration && (
|
2021-02-11 12:54:00 +00:00
|
|
|
<Flex>
|
|
|
|
|
<Text type={TextType.P3}>Time: </Text>
|
|
|
|
|
<Text type={TextType.H5}>{response.duration} ms</Text>
|
|
|
|
|
</Flex>
|
2020-12-08 09:24:36 +00:00
|
|
|
)}
|
|
|
|
|
{response.size && (
|
2021-02-11 12:54:00 +00:00
|
|
|
<Flex>
|
|
|
|
|
<Text type={TextType.P3}>Size: </Text>
|
|
|
|
|
<Text type={TextType.H5}>
|
|
|
|
|
{formatBytes(parseInt(response.size))}
|
|
|
|
|
</Text>
|
|
|
|
|
</Flex>
|
2020-12-08 09:24:36 +00:00
|
|
|
)}
|
2021-04-29 05:59:38 +00:00
|
|
|
{!_.isEmpty(response.body) && Array.isArray(response.body) && (
|
|
|
|
|
<Flex>
|
|
|
|
|
<Text type={TextType.P3}>Result: </Text>
|
|
|
|
|
<Text type={TextType.H5}>
|
|
|
|
|
{`${response.body.length} Record${
|
|
|
|
|
response.body.length > 1 ? "s" : ""
|
|
|
|
|
}`}
|
|
|
|
|
</Text>
|
|
|
|
|
</Flex>
|
|
|
|
|
)}
|
2020-12-08 09:24:36 +00:00
|
|
|
</ResponseMetaInfo>
|
|
|
|
|
</ResponseMetaWrapper>
|
|
|
|
|
)}
|
2021-10-07 06:53:58 +00:00
|
|
|
<EntityBottomTabs defaultIndex={0} tabs={tabs} />
|
2020-06-12 03:54:12 +00:00
|
|
|
</TabbedViewWrapper>
|
2021-02-22 06:15:02 +00:00
|
|
|
</ResponseContainer>
|
2019-10-25 05:35:20 +00:00
|
|
|
);
|
2021-04-28 10:28:39 +00:00
|
|
|
}
|
2019-10-25 05:35:20 +00:00
|
|
|
|
2020-05-22 03:43:01 +00:00
|
|
|
const mapStateToProps = (state: AppState): ReduxStateProps => {
|
|
|
|
|
return {
|
|
|
|
|
responses: getActionResponses(state),
|
2020-06-03 05:40:48 +00:00
|
|
|
isRunning: state.ui.apiPane.isRunning,
|
2020-05-22 03:43:01 +00:00
|
|
|
};
|
|
|
|
|
};
|
2019-10-25 05:35:20 +00:00
|
|
|
|
|
|
|
|
export default connect(mapStateToProps)(withRouter(ApiResponseView));
|