-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19327 from GordonSmith/HPCC-33060-BACKPORT_ECLWAT…
…CH_MASTER HPCC-33060 Backport master prior to refactor Reviewed-By: Jeremy Clements <[email protected]> Merged-by: Gavin Halliday <[email protected]>
- Loading branch information
Showing
29 changed files
with
1,063 additions
and
34 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,84 @@ | ||
import * as React from "react"; | ||
import { DefaultButton, DetailsList, DetailsListLayoutMode, IColumn } from "@fluentui/react"; | ||
import { SizeMe } from "react-sizeme"; | ||
import { csvParse } from "d3-dsv"; | ||
import { DaliService } from "@hpcc-js/comms"; | ||
import { scopedLogger } from "@hpcc-js/util"; | ||
import { TableGroup } from "./forms/Groups"; | ||
import { useConfirm } from "../hooks/confirm"; | ||
import nlsHPCC from "src/nlsHPCC"; | ||
import { HolyGrail } from "../layouts/HolyGrail"; | ||
|
||
const logger = scopedLogger("src-react/components/DaliSDSUnlock.tsx"); | ||
|
||
const myDaliService = new DaliService({ baseUrl: "" }); | ||
|
||
interface DaliSDSUnlockProps { | ||
} | ||
|
||
export const DaliSDSUnlock: React.FunctionComponent<DaliSDSUnlockProps> = ({ | ||
|
||
}) => { | ||
|
||
const [columns, setColumns] = React.useState<IColumn[]>([]); | ||
const [items, setItems] = React.useState<any[]>([]); | ||
const [connectionId, setConnectionId] = React.useState<string>(""); | ||
const [close, setClose] = React.useState(false); | ||
|
||
const [DaliPromptConfirm, setDaliPromptConfirm] = useConfirm({ | ||
title: nlsHPCC.DaliAdmin, | ||
message: nlsHPCC.DaliPromptConfirm, | ||
onSubmit: React.useCallback(() => { | ||
myDaliService.UnlockSDSLock({ ConnectionID: connectionId, Close: close }).then(response => { | ||
const data = csvParse(response.Result); | ||
setColumns(data.columns.map((col, idx) => { | ||
return { | ||
key: col, | ||
name: col, | ||
fieldName: col, | ||
minWidth: 100 | ||
}; | ||
})); | ||
setItems(data); | ||
}).catch(err => logger.error(err)); | ||
}, [connectionId, close]) | ||
}); | ||
|
||
const onSubmit = React.useCallback(() => { | ||
setDaliPromptConfirm(true); | ||
}, [setDaliPromptConfirm]); | ||
|
||
return <HolyGrail | ||
header={<span><TableGroup fields={{ | ||
"ConnectionID": {label: nlsHPCC.ConnectionID, type: "string", value: connectionId}, | ||
"Close": { label: nlsHPCC.Close, type: "checkbox", value: close }, | ||
}} onChange={(id, value) => { | ||
switch (id) { | ||
case "ConnectionID": | ||
setConnectionId(value); | ||
break; | ||
case "Close": | ||
setClose(value); | ||
break; | ||
default: | ||
logger.debug(`${id}: ${value}`); | ||
} | ||
}} /><DefaultButton onClick={onSubmit} text={nlsHPCC.Submit} /></span>} | ||
main={<SizeMe monitorHeight>{({ size }) => { | ||
const height = `${size.height}px`; | ||
return <div style={{ position: "relative", width: "100%", height: "100%" }}> | ||
<div style={{ position: "absolute", width: "100%", height: `${size.height}px` }}> | ||
<DetailsList compact={true} | ||
items={items} | ||
columns={columns} | ||
setKey="key" | ||
layoutMode={DetailsListLayoutMode.justified} | ||
selectionPreservedOnEmptyClick={true} | ||
styles={{ root: { height, minHeight: height, maxHeight: height } }} | ||
/> | ||
<DaliPromptConfirm /> | ||
</div> | ||
</div>; | ||
}}</SizeMe>} | ||
/>; | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import * as React from "react"; | ||
import { Dropdown, TextField, PrimaryButton } from "@fluentui/react"; | ||
import nlsHPCC from "src/nlsHPCC"; | ||
|
||
interface SashaProps {} | ||
|
||
export const Sasha: React.FunctionComponent<SashaProps> = ({ }) => { | ||
const [selectedOption, setSelectedOption] = React.useState(""); | ||
const [wuid, setWuid] = React.useState(""); | ||
const [result, setResult] = React.useState(""); | ||
|
||
const handleOptionChange = (event: React.FormEvent<HTMLDivElement>, option: any) => { | ||
setSelectedOption(option.key); | ||
}; | ||
|
||
const handleSubmit = (event: React.FormEvent<HTMLFormElement>) => { | ||
event.preventDefault(); | ||
// Perform action based on selected option | ||
switch (selectedOption) { | ||
case "getVersion": | ||
// Implement getVersion function call | ||
break; | ||
case "getLastServerMessage": | ||
// Implement getLastServerMessage function call | ||
break; | ||
case "restoreECLWorkUnit": | ||
// Implement restoreECLWorkUnit function call | ||
break; | ||
case "restoreDFUWorkUnit": | ||
// Implement restoreDFUWorkUnit function call | ||
break; | ||
case "archiveECLWorkUnit": | ||
// Implement archiveECLWorkUnit function call | ||
break; | ||
case "archiveDFUWorkUnit": | ||
// Implement archiveDFUWorkUnit function call | ||
break; | ||
case "backupECLWorkUnit": | ||
// Implement backupECLWorkUnit function call | ||
break; | ||
case "backupDFUWorkUnit": | ||
// Implement backupDFUWorkUnit function call | ||
break; | ||
default: | ||
console.log("Invalid option selected"); | ||
} | ||
// Reset form | ||
setSelectedOption(""); | ||
setWuid(""); | ||
setResult(""); | ||
}; | ||
|
||
// Conditional rendering for default value | ||
const defaultValue = result ? null : <div>{nlsHPCC.noDataMessage}</div>; | ||
|
||
return ( | ||
<div> | ||
<form onSubmit={handleSubmit}> | ||
<Dropdown | ||
placeholder={nlsHPCC.SelectAnOption} | ||
selectedKey={selectedOption} | ||
onChange={handleOptionChange} | ||
options={[ | ||
{ key: "", text: nlsHPCC.SelectAnOption }, | ||
{ key: "getVersion", text: nlsHPCC.GetVersion }, | ||
{ key: "getLastServerMessage", text: nlsHPCC.GetLastServerMessage }, | ||
{ key: "restoreECLWorkUnit", text: nlsHPCC.RestoreECLWorkunit }, | ||
{ key: "restoreDFUWorkUnit", text: nlsHPCC.RestoreDFUWorkunit }, | ||
{ key: "archiveECLWorkUnit", text: nlsHPCC.ArchiveECLWorkunit }, | ||
{ key: "archiveDFUWorkUnit", text: nlsHPCC.ArchiveDFUWorkunit }, | ||
{ key: "backupECLWorkUnit", text: nlsHPCC.BackupECLWorkunit }, | ||
{ key: "backupDFUWorkUnit", text: nlsHPCC.BackupDFUWorkunit } | ||
]} | ||
styles={{ dropdown: { width: 400 } }} | ||
/> | ||
{["restoreECLWorkUnit", "restoreDFUWorkUnit", "archiveECLWorkUnit", "archiveDFUWorkUnit", "backupECLWorkUnit", "backupDFUWorkUnit"].includes(selectedOption) && ( | ||
<div> | ||
<TextField | ||
label= {nlsHPCC.WUID} | ||
value={wuid} | ||
onChange={(event: React.FormEvent<HTMLInputElement>, newValue?: string) => setWuid(newValue || "")} | ||
styles={{ fieldGroup: { width: 400 } }} | ||
/> | ||
</div> | ||
)} | ||
<PrimaryButton type="submit" >{nlsHPCC.Submit}</PrimaryButton> | ||
{/* Render defaultValue when result is empty */} | ||
{defaultValue} | ||
{/* Render result when available */} | ||
{result && <div>{nlsHPCC.Results}: {result}</div>} | ||
</form> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Sasha; |
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
Oops, something went wrong.