Skip to content

Commit

Permalink
[#8]fully functionning auth param
Browse files Browse the repository at this point in the history
  • Loading branch information
Eriikah committed May 17, 2024
1 parent 184cc98 commit 889a059
Show file tree
Hide file tree
Showing 5 changed files with 256 additions and 154 deletions.
105 changes: 77 additions & 28 deletions src/components/authParamOptions/OptionRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,17 @@ import {
delChoiceParam,
delCombOverParam,
delCombParam,
delModuleOpt,
newChoiceOverParam,
newChoiceParam,
newCombOverParam,
newCombParam,
newModuleOpt,
updateChoiceOverParam,
updateChoiceParam,
updateCombOverParam,
updateCombParam,
updateModuleOpt,
updateModuleParams,
} from "../../features/config/configSlice";
function updateComb(
Expand Down Expand Up @@ -161,6 +164,7 @@ function cmbModuleContainer(
<tr>
<td>
<TextField
size="small"
type="text"
placeholder={t(key)}
value={key}
Expand Down Expand Up @@ -308,6 +312,7 @@ function authChoiceContainer(data: Record<string, string>, dispatch: Function) {
<tr>
<td>
<TextField
size="small"
type="text"
value={key}
onChange={(e) =>
Expand Down Expand Up @@ -398,6 +403,7 @@ function authChoiceContainer(data: Record<string, string>, dispatch: Function) {
</td>
<td>
<TextField
size="small"
type="url"
value={url}
onChange={() =>
Expand All @@ -413,6 +419,7 @@ function authChoiceContainer(data: Record<string, string>, dispatch: Function) {
</td>
<td>
<TextField
size="small"
type="text"
value={cond}
onChange={() =>
Expand Down Expand Up @@ -503,7 +510,9 @@ function RecursRender(
case "int":
return (
<ul>
<strong className="title3">{t(el)}</strong>
<TextField
size="small"
type="number"
onChange={(e) =>
dispatch(
Expand All @@ -521,7 +530,9 @@ function RecursRender(
case "text":
return (
<ul>
<strong className="title3">{t(el)}</strong>
<TextField
size="small"
type="text"
onChange={(e) =>
dispatch(
Expand All @@ -539,7 +550,9 @@ function RecursRender(
case "PerlModule":
return (
<ul>
<strong className="title3">{t(el)}</strong>
<TextField
size="small"
type="text"
onChange={(e) =>
dispatch(
Expand All @@ -557,7 +570,9 @@ function RecursRender(
case "password":
return (
<ul>
<strong className="title3">{t(el)}</strong>
<TextField
size="small"
type="password"
onChange={(e) =>
dispatch(
Expand All @@ -575,7 +590,9 @@ function RecursRender(
case "intOrNull":
return (
<ul>
<strong className="title3">{t(el)}</strong>
<TextField
size="small"
type="number"
onChange={(e) =>
dispatch(
Expand All @@ -591,14 +608,27 @@ function RecursRender(
</ul>
);
case "authChoiceContainer":
return authChoiceContainer(
config[el as keyof llngConfig] as Record<string, string>,
dispatch
return (
<>
<strong className="title3">{t(el)}</strong>
{authChoiceContainer(
config[el as keyof llngConfig] as Record<string, string>,
dispatch
)}
</>
);
case "cmbModuleContainer":
return cmbModuleContainer(
config[el as keyof llngConfig] as Record<string, Record<string, any>>,
dispatch
return (
<>
<strong className="title3">{t(el)}</strong>{" "}
{cmbModuleContainer(
config[el as keyof llngConfig] as Record<
string,
Record<string, any>
>,
dispatch
)}
</>
);
case "select":
return (
Expand Down Expand Up @@ -665,35 +695,53 @@ function RecursRender(
);
case "keyTextContainer":
return (
<table id={el + "table"}>
<thead>
<tr>
<th>{t("keys")}</th>
<th>{t("values")}</th>
<th>
<Button className="plus">
<AddCircleIcon color="success" />
</Button>
</th>
</tr>
</thead>
{TableVars(
el,
config[el as keyof llngConfig] as Record<string, string>,
el + "Table",
console.log,
console.log,
console.log
)}
</table>
<>
<strong className="title3">{t(el)}</strong>
<table id={el + "Table"}>
<thead>
<tr>
<th>{t("keys")}</th>
<th>{t("values")}</th>
<th>
<Button
className="plus"
onClick={() =>
dispatch(newModuleOpt(el as keyof llngConfig))
}
>
<AddCircleIcon color="success" />
</Button>
</th>
</tr>
</thead>
{TableVars(
el,
config[el as keyof llngConfig] as Record<string, string>,
el + "Table",
dispatch,
delModuleOpt,
updateModuleOpt
)}
</table>
</>
);
case "url":
return (
<ul>
<strong className="title3">{t(el)}</strong>
<TextField
size="small"
type="url"
placeholder={t(el)}
value={config[el as keyof llngConfig]}
onChange={(e) =>
dispatch(
updateModuleParams({
param: el as keyof llngConfig,
value: String(e.target.value),
})
)
}
/>
</ul>
);
Expand Down Expand Up @@ -726,6 +774,7 @@ function RecursRender(
</RadioGroup>
</FormControl>
<TextField
size="small"
type="url"
value={config[el as keyof llngConfig]}
onChange={(e) =>
Expand Down Expand Up @@ -761,7 +810,7 @@ export function OptionRenderer({ selected }: { selected: string }) {
return (
<div>
<strong className="title2">{t(l)}</strong>
<div>
<div className="appDesc">
{nodeSelected ? RecursRender(nodeSelected, config, 0, dispatch) : ""}
</div>
</div>
Expand Down
1 change: 0 additions & 1 deletion src/components/managerComponents/URLLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export function URLLoader({
setLoading(true);
setError(false);
const data = await getFromURL(url);
console.log(data);
dispatch(
loadFunction({
name: appName ? appName : "",
Expand Down
Loading

0 comments on commit 889a059

Please sign in to comment.