-
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.
HPCC-31258 Initial File structure and page layout creation
This is to create the initial design of Sasha in Cloud. Feature availability to come as it is created. Signed-off-by: Kunal Aswani <[email protected]>
- Loading branch information
1 parent
2371a21
commit cb8019d
Showing
4 changed files
with
95 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import React, { useState } from "react"; | ||
|
||
interface SashaProps {} | ||
|
||
export const Sasha: React.FunctionComponent<SashaProps> = ({ }) => { | ||
const [selectedOption, setSelectedOption] = useState(""); | ||
const [wuid, setWuid] = useState(""); | ||
const [result, setResult] = useState(""); | ||
|
||
const handleOptionChange = (e: React.ChangeEvent<HTMLSelectElement>) => { | ||
setSelectedOption(e.target.value); | ||
}; | ||
|
||
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => { | ||
e.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>No data available</div>; | ||
|
||
return ( | ||
<div> | ||
<form onSubmit={handleSubmit}> | ||
<select value={selectedOption} onChange={handleOptionChange}> | ||
<option value="">Select an option</option> | ||
<option value="getVersion">Get Version</option> | ||
<option value="getLastServerMessage">Get Last Server Message</option> | ||
<option value="restoreECLWorkUnit">Restore ECL Workunit</option> | ||
<option value="restoreDFUWorkUnit">Restore DFU Workunit</option> | ||
<option value="archiveECLWorkUnit">Archive ECL Workunit</option> | ||
<option value="archiveDFUWorkUnit">Archive DFU Workunit</option> | ||
<option value="backupECLWorkUnit">Backup ECL Workunit</option> | ||
<option value="backupDFUWorkUnit">Backup DFU Workunit</option> | ||
</select> | ||
{["restoreECLWorkUnit", "restoreDFUWorkUnit", "archiveECLWorkUnit", "archiveDFUWorkUnit", "backupECLWorkUnit", "backupDFUWorkUnit"].includes(selectedOption) && ( | ||
<div> | ||
<label>Work Unit ID:</label> | ||
<input | ||
type="text" | ||
value={wuid} | ||
onChange={(e) => setWuid(e.target.value)} | ||
/> | ||
</div> | ||
)} | ||
<button type="submit">Submit</button> | ||
{/* Render defaultValue when result is empty */} | ||
{defaultValue} | ||
{/* Render result when available */} | ||
{result && <div>Result: {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