-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Nu-1890] hide categories from a scenarios list and more scenario det…
…ails when only one category is available (#7183) * NU-1890 hide categories from a scenarios list and more scenario details when only one category is available
- Loading branch information
Showing
10 changed files
with
154 additions
and
70 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
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
30 changes: 6 additions & 24 deletions
30
designer/client/src/components/toolbars/scenarioDetails/CategoryDetails.tsx
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,37 @@ | ||
import { useEffect, useState } from "react"; | ||
import HttpService, { ProcessingMode, ScenarioParametersCombination } from "../http/HttpService"; | ||
import { useProcessFormDataOptions } from "./useProcessFormDataOptions"; | ||
|
||
interface Props { | ||
processCategory: string; | ||
processingMode: ProcessingMode; | ||
processEngine: string; | ||
} | ||
export const useGetAllCombinations = ({ processCategory, processingMode, processEngine }: Props) => { | ||
const [allCombinations, setAllCombinations] = useState<ScenarioParametersCombination[]>([]); | ||
const [engineSetupErrors, setEngineSetupErrors] = useState<Record<string, string[]>>({}); | ||
const [isAllCombinationsLoading, setIsAllCombinationsLoading] = useState<boolean>(false); | ||
|
||
const { isCategoryFieldVisible } = useProcessFormDataOptions({ | ||
allCombinations, | ||
value: { | ||
processCategory, | ||
processingMode, | ||
processEngine, | ||
}, | ||
}); | ||
|
||
useEffect(() => { | ||
setIsAllCombinationsLoading(true); | ||
HttpService.fetchScenarioParametersCombinations() | ||
.then((response) => { | ||
setAllCombinations(response.data.combinations); | ||
setEngineSetupErrors(response.data.engineSetupErrors); | ||
}) | ||
.finally(() => { | ||
setIsAllCombinationsLoading(false); | ||
}); | ||
}, []); | ||
|
||
return { allCombinations, isAllCombinationsLoading, isCategoryFieldVisible, engineSetupErrors }; | ||
}; |
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
Oops, something went wrong.