Skip to content

Commit 639e916

Browse files
committed
address review comments
1 parent 8f30836 commit 639e916

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

portal-ui/src/screens/Console/Configurations/ConfigurationPanels/ConfigurationOptions.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ import ExportConfigButton from "./ExportConfigButton";
3737
import ImportConfigButton from "./ImportConfigButton";
3838
import { Box } from "@mui/material";
3939
import HelpMenu from "../../HelpMenu";
40-
import { setHelpName } from "../../../../systemSlice";
40+
import { setErrorSnackMessage, setHelpName } from "../../../../systemSlice";
4141
import { useAppDispatch } from "../../../../store";
4242
import { api } from "../../../../api";
4343
import { IElement } from "../types";
44+
import { errorToHandler } from "../../../../api/errors";
4445

4546
interface IConfigurationOptions {
4647
classes: any;
@@ -66,17 +67,18 @@ const getRoutePath = (path: string) => {
6667
return `${IAM_PAGES.SETTINGS}/${path}`;
6768
};
6869

69-
//region would not be part of config subsystem list.
70+
// region is not part of config subsystem list.
7071
const NON_SUB_SYS_CONFIG_ITEMS = ["region"];
71-
const IGNORED_CONFIG_SUB_SYS = ["cache"]; //cahe config is un supported.
72+
const IGNORED_CONFIG_SUB_SYS = ["cache"]; // cache config is not supported.
7273

7374
const ConfigurationOptions = ({ classes }: IConfigurationOptions) => {
7475
const { pathname = "" } = useLocation();
76+
const dispatch = useAppDispatch();
7577

7678
const [configSubSysList, setConfigSubSysList] = useState<string[]>([]);
7779
const fetchConfigSubSysList = useCallback(async () => {
7880
api.configs
79-
.listConfig() //get all available config subsystems.
81+
.listConfig() // get a list of available config subsystems.
8082
.then((res) => {
8183
if (res && res?.data && res?.data?.configurations) {
8284
const confSubSysList = (res?.data?.configurations || []).reduce(
@@ -92,14 +94,13 @@ const ConfigurationOptions = ({ classes }: IConfigurationOptions) => {
9294
setConfigSubSysList(confSubSysList);
9395
}
9496
})
95-
.catch(() => {
96-
console.log("Error in retrieving config subsystem list.");
97+
.catch((err) => {
98+
dispatch(setErrorSnackMessage(errorToHandler(err)));
9799
});
98-
}, []);
100+
}, [dispatch]);
99101

100102
let selConfigTab = pathname.substring(pathname.lastIndexOf("/") + 1);
101103
selConfigTab = selConfigTab === "settings" ? "region" : selConfigTab;
102-
const dispatch = useAppDispatch();
103104
useEffect(() => {
104105
fetchConfigSubSysList();
105106
dispatch(setHelpName("settings_Region"));

0 commit comments

Comments
 (0)