Skip to content

Commit

Permalink
Merge pull request #143 from mercedes-benz/VULCAN-941/GrayedOutButton
Browse files Browse the repository at this point in the history
Fix for automatic reset view rups package link
  • Loading branch information
brahmprakashMishra authored Nov 5, 2024
2 parents c83982e + 6060e21 commit e41142f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/chart/table/TableChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ export const NeoTableChart = (props: ChartProps) => {
}

const { records } = props;
const isApiSpecEnabled = props.settings?.apiSpec && props.settings?.apiSpec.apiEnabled;

const generateSafeColumnKey = (key) => {
return key != 'id' ? key : `${key} `;
Expand Down Expand Up @@ -346,6 +347,12 @@ export const NeoTableChart = (props: ChartProps) => {
props.updateReportSetting('apiSpec', { ...props.settings?.apiSpec, response: null });
};

useEffect(() => {
if (isApiSpecEnabled) {
handleResetApiResponse();
}
}, [records]);

const apiCallButton = () => (
<Stack direction='row' spacing={2} justifyContent='flex-end' marginRight={2}>
<Button variant='outlined' size='small' onClick={handleApiCall} disabled={isApiLoading}>
Expand All @@ -361,9 +368,6 @@ export const NeoTableChart = (props: ChartProps) => {
{isApiLoading ? 'Loading...' : props.settings?.viewResponseButtonName || 'view response'}
</Button>
)}
<IconButton clean={true} grouped={true} aria-label={'Reset'} onClick={handleResetApiResponse}>
<ArrowPathIconOutline aria-label={'Reset'} />
</IconButton>
{props.settings?.apiSpec.response ? (
<Popover
id={id}
Expand Down Expand Up @@ -391,8 +395,6 @@ export const NeoTableChart = (props: ChartProps) => {
</Stack>
);

const isApiSpecEnabled = props.settings?.apiSpec && props.settings?.apiSpec.apiEnabled;

const tableStyle: any = isApiSpecEnabled
? { marginTop: 10, height: '90%', width: '100%', position: 'relative' }
: { height: '100%', width: '100%', position: 'relative' };
Expand Down

0 comments on commit e41142f

Please sign in to comment.