Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit c079b9a

Browse files
nvollrothjofaul
andauthored
feat: usage information in selection view (#942)
* Added the count of Usages to Selection View * Removed unused imports * style: apply automatic fixes of linters Co-authored-by: nvollroth <[email protected]> Co-authored-by: jofaul <[email protected]>
1 parent 92c93dc commit c079b9a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

api-editor/gui/src/features/packageData/selectionView/ParameterView.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ export const ParameterView: React.FC<ParameterViewProps> = function ({ pythonPar
4848
</Stack>
4949
)}
5050

51+
{parameterUsages && (
52+
<Stack spacing={4}>
53+
<Heading as="h4" size="md">
54+
Usages
55+
</Heading>
56+
<UsageSum parameterUsages={parameterUsages} />
57+
</Stack>
58+
)}
59+
5160
{parameterUsages && (
5261
<Stack spacing={4}>
5362
<Heading as="h4" size="md">
@@ -141,3 +150,13 @@ const isStringifiedLiteral = function (value: string): boolean {
141150
}
142151
return !Number.isNaN(Number.parseFloat(value));
143152
};
153+
154+
const UsageSum: React.FC<CustomBarChartProps> = function ({ parameterUsages }) {
155+
let usage = 0;
156+
157+
parameterUsages.forEach((value) => {
158+
usage += value;
159+
});
160+
161+
return <ChakraText paddingLeft={4}>{usage}</ChakraText>;
162+
};

0 commit comments

Comments
 (0)