Skip to content

Commit ed4cc0b

Browse files
authored
fix: correct history items order and request body updates (#3822)
1 parent 76c9866 commit ed4cc0b

File tree

14 files changed

+195
-192
lines changed

14 files changed

+195
-192
lines changed

src/app/services/actions/query-action-creator-util.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -215,25 +215,23 @@ export const parseResponse = async (response: ResponseBody): Promise<ResponseBod
215215
const headers = getHeaders(response);
216216
const contentType = getContentType(headers);
217217

218-
try {
219-
switch (contentType) {
220-
case 'application/json': {
221-
const text = await response.text();
222-
return tryParseJson(text);
223-
}
224-
case 'application/xml':
225-
case 'text/html':
226-
case 'text/csv':
227-
case 'text/plain':
228-
return await response.text();
229-
default:
230-
if (response.status === 204) {
231-
return '';
232-
}
233-
return await response.text();
234-
}
235-
} catch {
236-
return '';
218+
switch (true) {
219+
case contentType.includes('application/json'): {
220+
const text = await response.text();
221+
return tryParseJson(text);
222+
}
223+
224+
case contentType.includes('application/xml'):
225+
case contentType.includes('text/html'):
226+
case contentType.includes('text/csv'):
227+
case contentType.includes('text/plain'):
228+
return await response.text();
229+
230+
case contentType.startsWith('image/'):
231+
return response;
232+
233+
default:
234+
return response;
237235
}
238236
};
239237

src/app/views/common/monaco/Monaco.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ const Monaco = ({ body, onChange, language, readOnly, extraInfoElement, isVisibl
6868
<div id=' monaco-editor' className={styles.container}>
6969
{extraInfoElement}
7070
<Editor
71+
key={formattedBody}
7172
language={language || 'json'}
7273
width='100%'
7374
height='100%'

src/app/views/layout/Layout.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,11 @@ export const Layout = (props: LayoutProps) => {
7171
}, [mobileScreen]);
7272

7373

74-
const handleOnEditorChange = (value?: string) => {
75-
setSampleBody(value!);
74+
const handleOnEditorChange = (value: string | undefined) => {
75+
dispatch(setSampleQuery({
76+
...sampleQuery,
77+
sampleBody: value
78+
}));
7679
};
7780

7881
const handleToggleSelect = (toggled: boolean) => {

src/app/views/query-runner/request/Request.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
MoreHorizontalRegular } from '@fluentui/react-icons';
3333

3434
interface IRequestProps {
35-
handleOnEditorChange: () => void;
35+
handleOnEditorChange: (value: string | undefined) => void;
3636
sampleQuery: IQuery;
3737
}
3838

src/app/views/sidebar/Sidebar.styles.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const useSidebarStyles = makeStyles({
2323
flexGrow: 1,
2424
overflowY: 'auto',
2525
padding: '5px',
26-
maxHeight: 'calc(100vh - 100px)'
26+
maxHeight: 'calc(100vh - 400px)'
2727
},
2828
searchBox: {
2929
width: '100%',

src/app/views/sidebar/history/History.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ const formatDate = (date: Date) => {
9191

9292
const today = formatDate(new Date());
9393
const yesterdaysDate = new Date();
94-
const yesterday = formatDate(yesterdaysDate);
9594
yesterdaysDate.setDate(yesterdaysDate.getDate() - 1);
95+
const yesterday = formatDate(yesterdaysDate);
9696

9797
const handleDownloadHistoryGroup = (
9898
event: React.MouseEvent<HTMLButtonElement>, value: string,

src/app/views/sidebar/resource-explorer/collection/APICollection.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const APICollection: React.FC<PopupsComponent<APICollection>> = (props) => {
7474
}
7575

7676
const columns = [
77-
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
77+
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 800, isResizable: true },
7878
{ key: 'scope', name: 'Scope', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
7979
];
8080

@@ -272,10 +272,12 @@ const APICollection: React.FC<PopupsComponent<APICollection>> = (props) => {
272272
/>
273273

274274
{items && items.length > 0 ?
275-
(<Paths
276-
resources={items}
277-
columns={columns}
278-
/>
275+
(<div style={{height
276+
: '80vh'
277+
}}><Paths
278+
resources={items}
279+
columns={columns}
280+
/></div>
279281
) :
280282
(
281283
<Label className={labelStyles.labelStyle}>

src/app/views/sidebar/resource-explorer/collection/CommonCollectionsPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const useStyles = makeStyles({
2323
drawerFooter: {
2424
display: 'flex',
2525
justifyContent: 'flex-start',
26-
position: 'sticky',
26+
position: 'fixed',
2727
bottom: 0,
2828
width: '100%',
2929
gap: tokens.spacingHorizontalXXXL,

src/app/views/sidebar/resource-explorer/collection/EditCollectionPanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const EditCollectionPanel: React.FC<EditCollectionPanelProps> = ({ closePopup })
2828
const items = collections && collections.length > 0 ? collections.find(k => k.isDefault)!.paths : [];
2929

3030
const columns = [
31-
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
31+
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 800, isResizable: true },
3232
{ key: 'scope', name: 'Scope', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
3333
];
3434

src/app/views/sidebar/resource-explorer/collection/EditScopePanel.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const EditScopePanel: React.FC<EditScopePanelProps> = ({ closePopup }) => {
5656
}, [selectedItems]);
5757

5858
const columns = [
59-
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 1100, isResizable: true },
59+
{ key: 'url', name: 'URL', fieldName: 'url', minWidth: 300, maxWidth: 800, isResizable: true },
6060
{ key: 'scope', name: 'Scope', fieldName: 'scope', minWidth: 150, maxWidth: 200, isResizable: true }
6161
];
6262

0 commit comments

Comments
 (0)