-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Radial Chart to extensibility (#2966)
* first implementaion * small fixes * add docs * adjust radial chart * improve docs * remove unneded property * improve docs * Apply suggestions from code review Co-authored-by: Natalia Sitko <[email protected]> * fix docs fmt --------- Co-authored-by: Natalia Sitko <[email protected]>
- Loading branch information
1 parent
91b3cbf
commit 2f499d7
Showing
6 changed files
with
96 additions
and
2 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,51 @@ | ||
import { Card, CardHeader } from '@ui5/webcomponents-react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { UI5RadialChart } from 'shared/components/UI5RadialChart/UI5RadialChart'; | ||
import { useJsonata } from '../hooks/useJsonata'; | ||
|
||
export const RadialChart = ({ structure, value, originalResource }) => { | ||
const { t } = useTranslation(); | ||
const jsonata = useJsonata({ | ||
resource: originalResource, | ||
value, | ||
}); | ||
let err; | ||
let maxValue; | ||
|
||
[maxValue, err] = jsonata(structure.maxValue, { | ||
resource: originalResource, | ||
}); | ||
if (err) { | ||
return t('extensibility.configuration-error', { | ||
error: err.message, | ||
}); | ||
} | ||
|
||
let additionalInfo; | ||
[additionalInfo, err] = jsonata(structure.additionalInfo, { | ||
resource: originalResource, | ||
}); | ||
if (err) { | ||
return t('extensibility.configuration-error', { | ||
error: err.message, | ||
}); | ||
} | ||
|
||
return ( | ||
<div className={'item-wrapper tall'}> | ||
<Card | ||
className="radial-chart-card" | ||
header={<CardHeader titleText={t(structure?.name)} />} | ||
> | ||
<UI5RadialChart | ||
color={structure.color} | ||
value={value} | ||
max={maxValue ? maxValue : structure?.maxValue} | ||
additionalInfo={ | ||
additionalInfo ? additionalInfo : structure?.additionalInfo | ||
} | ||
/> | ||
</Card> | ||
</div> | ||
); | ||
}; |
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