-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added basic grid for inspector * Got vertical sizing to work for header tabs * Cleaned up headers tab * Parameters tab * Added body tab * Refactoring app.tsx into smaller components * Cleaning up styles for Sanitizer component * Fix build
- Loading branch information
Showing
16 changed files
with
680 additions
and
139 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { InspectorEntry } from "../components/TraceInspector/TraceInspector"; | ||
import { UberBatchRequest, UberBatchResponse } from "../sanitizer/models/batchRequest"; | ||
import { Entry, NameValueKeyPair } from "../sanitizer/models/harFile"; | ||
import { isBatchRequest } from "../sanitizer/requestRules/armBatchResponseRule"; | ||
|
||
const convertBatchHeadersToHeaders = (batchHeaders: { [id: string]: string }) => { | ||
const headers: NameValueKeyPair[] = []; | ||
for (const key of Object.keys(batchHeaders)) { | ||
headers.push({ | ||
name: key, | ||
value: batchHeaders[key] | ||
}); | ||
} | ||
|
||
return headers; | ||
} | ||
|
||
export const convertBatchEntryToEntries = (entry: Entry, entries: InspectorEntry[]) => { | ||
if (isBatchRequest(entry.request) && entry.request.postData) { | ||
const uberBatchRequest: UberBatchRequest = JSON.parse(entry.request?.postData.text); | ||
const uberBatchResponse: UberBatchResponse = JSON.parse(entry.response.content.text); | ||
|
||
for (let i = 0; i < uberBatchRequest.requests.length; i++) { | ||
const batchRequest = uberBatchRequest.requests[i]; | ||
const batchResponse = uberBatchResponse.responses[i]; | ||
let url = batchRequest.url; | ||
if(url.startsWith('http')){ | ||
const parsedUrl = new URL(url); | ||
url = url.split(parsedUrl.origin)[1]; // keep path + query string | ||
} | ||
|
||
const newEntry: InspectorEntry = { | ||
request: { | ||
method: batchRequest.httpMethod, | ||
url: url, | ||
headers: convertBatchHeadersToHeaders(batchRequest.requestHeaderDetails), | ||
queryString: [], | ||
cookies: [], | ||
postData: { | ||
mimeType: 'application/json', | ||
text: JSON.stringify(batchRequest.content) | ||
} | ||
}, | ||
response: { | ||
status: batchResponse.httpStatusCode, | ||
statusText: '', | ||
headers: convertBatchHeadersToHeaders(batchResponse.headers), | ||
cookies: [], | ||
content: { | ||
mimeType: 'application/json', | ||
text: JSON.stringify(batchResponse.content) | ||
}, | ||
_transferSize: batchResponse.contentLength | ||
}, | ||
time: 0, | ||
isBatchChildEntry: true | ||
} | ||
|
||
entries.push(newEntry); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { Stack, Text } from "@fluentui/react"; | ||
import { NameValueKeyPair } from "../sanitizer/models/harFile"; | ||
|
||
export interface NameValueListProps{ | ||
nameValuePairs: NameValueKeyPair[]; | ||
} | ||
|
||
const getNameValueContainerStyle = (): React.CSSProperties =>{ | ||
return { | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
whiteSpace: 'nowrap' | ||
}; | ||
} | ||
|
||
const lineHeight = '25px' | ||
const getNameStyle =(): React.CSSProperties =>{ | ||
return { | ||
minWidth: '150px', | ||
overflow: 'hidden', | ||
textOverflow: 'ellipsis', | ||
whiteSpace: 'nowrap', | ||
lineHeight: lineHeight, | ||
marginRight: '5px' | ||
} | ||
} | ||
|
||
const getValueStyle = (): React.CSSProperties =>{ | ||
return { lineHeight: lineHeight }; | ||
} | ||
|
||
export const NameValueList = (props: NameValueListProps) => { | ||
const { nameValuePairs} = props; | ||
|
||
const componentList = []; | ||
for (let i = 0; i < nameValuePairs.length; i++) { | ||
const nameValueComponent = <Stack horizontal key={i} style={getNameValueContainerStyle()}> | ||
<Text style={getNameStyle()}>{nameValuePairs[i].name}</Text> | ||
<Text style={getValueStyle()}>{nameValuePairs[i].value}</Text> | ||
</Stack> | ||
|
||
componentList.push(nameValueComponent); | ||
} | ||
|
||
return <>{componentList}</>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { ICheckboxStyles, IStackStyles } from "@fluentui/react"; | ||
|
||
const checkboxWidth = 300; | ||
|
||
export const checkboxStyle: ICheckboxStyles = { | ||
label: { | ||
width: `${checkboxWidth}px` | ||
} | ||
} | ||
|
||
export const layoutStackStyle: React.CSSProperties = { | ||
marginTop: '300px' | ||
} | ||
|
||
|
||
export const containerStyle: React.CSSProperties = { | ||
border: '1px solid lightgray', | ||
padding: '50px 130px', | ||
borderRadius: '10px' | ||
} | ||
|
||
export const radioButtonStackStyle: IStackStyles = { | ||
root: { | ||
width: `${checkboxWidth * 2 + 20}px`, | ||
marginTop: '20px' | ||
}, | ||
}; |
Oops, something went wrong.