-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update node dependencies Scripting 2024-12-19 (#276)
* PewRL fixes and updates (#274) * Endpoint modal initially open w/o useEffect, removed devkey option * Clear URL button added * Clear URL button, query params, request body * Replaced console.error with log() * Update node dependencies 2024-12-19 (#275) * Added back in the ec2-metadata-service call to getInstanceId * Updated version and dependencies - Updated lockfile to latest - Updated Mocha to v11 * Updated Next.js to 15.1 * Fixed timeout issue in unit tests by only calling metadata service in AWS --------- Co-authored-by: blonde-mike <[email protected]>
- Loading branch information
1 parent
714334d
commit 3c18cae
Showing
14 changed files
with
2,326 additions
and
1,724 deletions.
There are no files selected for viewing
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
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
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
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
68 changes: 68 additions & 0 deletions
68
guide/results-viewer-react/src/components/YamlUrls/QueryParamsView.tsx
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,68 @@ | ||
import { PewPewHeader, PewPewQueryParam } from "../../util/yamlwriter"; | ||
import { PewPewQueryParamStringType } from "."; | ||
import React from "react"; | ||
|
||
export interface QueryParamsViewProps { | ||
id: string; | ||
queryParamList: PewPewQueryParam[]; | ||
removeParam: (param: PewPewQueryParam) => void; | ||
changeParam: (paramIndex: number, type: PewPewQueryParamStringType, value: string) => void; | ||
addParam: () => void; | ||
} | ||
|
||
function QueryParamsView ({ id, queryParamList, removeParam, changeParam, addParam }: QueryParamsViewProps): JSX.Element { | ||
const styles: Record<string, React.CSSProperties> = { | ||
headersDisplay: { | ||
marginTop: "10px", | ||
maxHeight: "300px", | ||
overflow: "auto" | ||
}, | ||
gridContainer: { | ||
display: "grid", | ||
gap: "10px" | ||
}, | ||
gridHeader: { | ||
display: "grid", | ||
gridTemplateColumns: "auto 1fr 2fr", | ||
gap: "10px", | ||
fontWeight: "bold", | ||
height: "20px" | ||
}, | ||
gridRows: { | ||
display: "grid", | ||
gridTemplateColumns: "auto 1fr 2fr", | ||
gap: "10px", | ||
alignItems: "stretch" | ||
}, | ||
input: { | ||
boxSizing: "border-box" | ||
}, | ||
button: { | ||
boxSizing: "border-box", | ||
whiteSpace: "nowrap" | ||
} | ||
}; | ||
return ( | ||
<React.Fragment> | ||
<div style={styles.headersDisplay}> | ||
<div style={styles.gridContainer}> | ||
<div style={styles.gridHeader}> | ||
<span><button name={id} onClick={() => addParam()}>+</button></span> | ||
<span>Name</span> | ||
<span>Value</span> | ||
</div> | ||
{queryParamList.length === 0 && <span>No Query Params yet, click "+" to create one</span>} | ||
{queryParamList.map((param: PewPewHeader, index: number) => ( | ||
<div key={index} style={styles.gridRows}> | ||
<button style={styles.button} onClick={() => removeParam(param)}>X</button> | ||
<input style={styles.input} id={`urlHeaderKey@${index}`} name={id} value={param.name} onChange={(event) => changeParam(index, "name", event.target.value)} /> | ||
<input style={styles.input} id={`urlHeaderValue@${index}`} name={id} value={param.value} onChange={(event) => changeParam(index, "value", event.target.value)} /> | ||
</div> | ||
))} | ||
</div> | ||
</div> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
export default QueryParamsView; |
46 changes: 46 additions & 0 deletions
46
guide/results-viewer-react/src/components/YamlUrls/RequestBodyView.tsx
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 { LogLevel, log } from "../../util/log"; | ||
import React from "react"; | ||
|
||
export interface RequestBodyViewProps { | ||
requestBody: object | undefined; | ||
updateRequestBody: (newRequestBody: object) => void; | ||
} | ||
|
||
function RequestBodyView ({ requestBody, updateRequestBody }: RequestBodyViewProps): JSX.Element { | ||
const [requestBodyInEdit, setRequestBodyInEdit] = React.useState<string>(JSON.stringify(requestBody, null, 2).replace(/\\n/g, "\n").replace(/^"|"$/g, "")); | ||
|
||
const requestBodyDisplayStyle: React.CSSProperties = { | ||
fontFamily: "monospace", | ||
width: "100%", | ||
height: "270px", | ||
overflow: "auto", | ||
border: "1px solid #ccc", | ||
padding: "10px", | ||
backgroundColor: "#2e3438", | ||
resize: "none", | ||
tabSize: 2, | ||
boxSizing: "border-box" | ||
}; | ||
|
||
const handleEditorInput = (event: React.ChangeEvent<HTMLTextAreaElement>) => { | ||
const newRequestBody = event.target.value; | ||
setRequestBodyInEdit(newRequestBody); | ||
try { | ||
updateRequestBody(JSON.parse(newRequestBody)); | ||
} catch (error) { | ||
log("Invalid JSON", LogLevel.WARN, error); | ||
} | ||
}; | ||
|
||
return ( | ||
<React.Fragment> | ||
<textarea | ||
value={requestBodyInEdit} | ||
onChange={handleEditorInput} | ||
style={requestBodyDisplayStyle} | ||
/> | ||
</React.Fragment> | ||
); | ||
} | ||
|
||
export default RequestBodyView; |
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
Oops, something went wrong.