@@ -398,6 +403,7 @@ function authChoiceContainer(data: Record, dispatch: Function) {
|
@@ -413,6 +419,7 @@ function authChoiceContainer(data: Record, dispatch: Function) {
|
@@ -503,7 +510,9 @@ function RecursRender(
case "int":
return (
+ {t(el)}
dispatch(
@@ -521,7 +530,9 @@ function RecursRender(
case "text":
return (
+ {t(el)}
dispatch(
@@ -539,7 +550,9 @@ function RecursRender(
case "PerlModule":
return (
+ {t(el)}
dispatch(
@@ -557,7 +570,9 @@ function RecursRender(
case "password":
return (
+ {t(el)}
dispatch(
@@ -575,7 +590,9 @@ function RecursRender(
case "intOrNull":
return (
+ {t(el)}
dispatch(
@@ -591,14 +608,27 @@ function RecursRender(
);
case "authChoiceContainer":
- return authChoiceContainer(
- config[el as keyof llngConfig] as Record,
- dispatch
+ return (
+ <>
+ {t(el)}
+ {authChoiceContainer(
+ config[el as keyof llngConfig] as Record,
+ dispatch
+ )}
+ >
);
case "cmbModuleContainer":
- return cmbModuleContainer(
- config[el as keyof llngConfig] as Record>,
- dispatch
+ return (
+ <>
+ {t(el)}{" "}
+ {cmbModuleContainer(
+ config[el as keyof llngConfig] as Record<
+ string,
+ Record
+ >,
+ dispatch
+ )}
+ >
);
case "select":
return (
@@ -665,35 +695,53 @@ function RecursRender(
);
case "keyTextContainer":
return (
-
-
-
- {t("keys")} |
- {t("values")} |
-
-
- |
-
-
- {TableVars(
- el,
- config[el as keyof llngConfig] as Record,
- el + "Table",
- console.log,
- console.log,
- console.log
- )}
-
+ <>
+ {t(el)}
+
+
+
+ {t("keys")} |
+ {t("values")} |
+
+
+ |
+
+
+ {TableVars(
+ el,
+ config[el as keyof llngConfig] as Record,
+ el + "Table",
+ dispatch,
+ delModuleOpt,
+ updateModuleOpt
+ )}
+
+ >
);
case "url":
return (
+ {t(el)}
+ dispatch(
+ updateModuleParams({
+ param: el as keyof llngConfig,
+ value: String(e.target.value),
+ })
+ )
+ }
/>
);
@@ -726,6 +774,7 @@ function RecursRender(
@@ -761,7 +810,7 @@ export function OptionRenderer({ selected }: { selected: string }) {
return (
{t(l)}
-
+
{nodeSelected ? RecursRender(nodeSelected, config, 0, dispatch) : ""}
diff --git a/src/components/managerComponents/URLLoader.tsx b/src/components/managerComponents/URLLoader.tsx
index 809ebdd..5ff6ba1 100644
--- a/src/components/managerComponents/URLLoader.tsx
+++ b/src/components/managerComponents/URLLoader.tsx
@@ -33,7 +33,6 @@ export function URLLoader({
setLoading(true);
setError(false);
const data = await getFromURL(url);
- console.log(data);
dispatch(
loadFunction({
name: appName ? appName : "",
diff --git a/src/dashboards/AuthParams.tsx b/src/dashboards/AuthParams.tsx
index 7d71ea5..cae5997 100644
--- a/src/dashboards/AuthParams.tsx
+++ b/src/dashboards/AuthParams.tsx
@@ -5,12 +5,17 @@ import { useAppDispatch, useAppSelector } from "../app/hooks";
import "./AuthParams.css";
import { useState } from "react";
import { OptionRenderer } from "../components/authParamOptions/OptionRenderer";
-import { updateAuthParams } from "../features/config/configSlice";
+import {
+ removeError,
+ setError,
+ updateAuthParams,
+} from "../features/config/configSlice";
export function AuthParams() {
const dispatch = useAppDispatch();
const authChoiceModules = useAppSelector(
(state) => state.config.data.config.authChoiceModules
);
+ const config = useAppSelector((state) => state.config);
const authModule = useAppSelector(
(state) => state.config.data.config.authentication
);
@@ -51,132 +56,139 @@ export function AuthParams() {
];
const [optionSelected, setOptionSelected] = useState(authModule);
-
- return (
-
+ try {
+ return (
- {t("authParams")}
-
-
-
-
- {t("authentication")}
-
-
-
-
- {t("userDB")}
-
-
-
-
-
- );
+ );
+ } catch (e) {
+ if (e instanceof Error) {
+ dispatch(setError(`${e.name} : ${e.message}`));
+ dispatch(removeError());
+ }
+ return {config.error.errorContent} ;
+ }
}
diff --git a/src/dashboards/Manager.tsx b/src/dashboards/Manager.tsx
index 9d9f744..4c9f1ab 100644
--- a/src/dashboards/Manager.tsx
+++ b/src/dashboards/Manager.tsx
@@ -37,7 +37,6 @@ export default function Manager() {
);
useEffect(() => {
- console.log(configNum, config.data.metadata.cfgNum);
if (!configPresent) {
setConfigPresent(true);
dispatch(
diff --git a/src/features/config/configSlice.ts b/src/features/config/configSlice.ts
index 4ea373e..a2aff03 100644
--- a/src/features/config/configSlice.ts
+++ b/src/features/config/configSlice.ts
@@ -876,6 +876,46 @@ const configSlice = createSlice({
}
}
},
+ newModuleOpt (
+ state: {
+ data: { config: llngConfig; metadata: MetaData };
+ },
+ action: PayloadAction
+ ) {
+ if (!state.data.config[action.payload]) {
+ state.data.config[action.payload] = {} as llngConfig[K];
+ }
+ if (typeof state.data.config[action.payload] === "object") {
+ (state.data.config[action.payload] as Record)["new"] =
+ "";
+ }
+ },
+ updateModuleOpt(
+ state: {
+ data: { config: llngConfig; metadata: MetaData };
+ },
+ action: PayloadAction<{ name: K; data: Record }>
+ ) {
+ if (!state.data.config[action.payload.name]) {
+ state.data.config[action.payload.name] = {} as llngConfig[K];
+ }
+ state.data.config[action.payload.name] = action.payload
+ .data as llngConfig[K];
+ },
+ delModuleOpt(
+ state: {
+ data: { config: llngConfig; metadata: MetaData };
+ },
+ action: PayloadAction<{ name: K; key: string }>
+ ) {
+ if (state.data.config[action.payload.name]) {
+ if (typeof state.data.config[action.payload.name] === "object") {
+ delete (
+ state.data.config[action.payload.name] as Record
+ )[action.payload.key];
+ }
+ }
+ },
},
extraReducers: (builder) => {
builder
@@ -979,5 +1019,8 @@ export const {
newChoiceOverParam,
delChoiceOverParam,
updateChoiceOverParam,
+ newModuleOpt,
+ delModuleOpt,
+ updateModuleOpt,
} = configSlice.actions;
export default configSlice.reducer;
|