mirror of
https://github.com/apache/superset.git
synced 2026-05-11 19:05:24 +00:00
feat(matrixify): replace single toggle with separate horizontal/vertical layout controls (#35067)
Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Mehmet Salih Yavuz <salih.yavuz@proton.me>
This commit is contained in:
committed by
GitHub
parent
3e554674ff
commit
ad3eff9e90
@@ -640,6 +640,7 @@ function ExploreViewContainer(props) {
|
||||
}
|
||||
|
||||
const errorMessage = useMemo(() => {
|
||||
// Include all controls with validation errors (for button disabling)
|
||||
const controlsWithErrors = Object.values(props.controls).filter(
|
||||
control =>
|
||||
control.validationErrors && control.validationErrors.length > 0,
|
||||
@@ -679,11 +680,62 @@ function ExploreViewContainer(props) {
|
||||
return errorMessage;
|
||||
}, [props.controls]);
|
||||
|
||||
// Error message for Data tab only (excludes matrixify controls)
|
||||
const dataTabErrorMessage = useMemo(() => {
|
||||
const controlsWithErrors = Object.values(props.controls).filter(
|
||||
control =>
|
||||
control.validationErrors &&
|
||||
control.validationErrors.length > 0 &&
|
||||
control.tabOverride !== 'matrixify', // Exclude matrixify controls from Data tab
|
||||
);
|
||||
if (controlsWithErrors.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const errorMessages = controlsWithErrors.map(
|
||||
control => control.validationErrors,
|
||||
);
|
||||
const uniqueErrorMessages = [...new Set(errorMessages.flat())];
|
||||
|
||||
const errors = uniqueErrorMessages
|
||||
.map(message => {
|
||||
const matchingLabels = controlsWithErrors
|
||||
.filter(control => control.validationErrors?.includes(message))
|
||||
.map(control =>
|
||||
typeof control.label === 'function'
|
||||
? control.label(props.exploreState)
|
||||
: control.label,
|
||||
);
|
||||
return [matchingLabels, message];
|
||||
})
|
||||
.map(([labels, message]) => (
|
||||
<div key={message}>
|
||||
{labels.length > 1 ? t('Controls labeled ') : t('Control labeled ')}
|
||||
<strong>{` ${labels.join(', ')}`}</strong>
|
||||
<span>: {message}</span>
|
||||
</div>
|
||||
));
|
||||
|
||||
let dataTabErrorMessage;
|
||||
if (errors.length > 0) {
|
||||
dataTabErrorMessage = (
|
||||
<div
|
||||
css={css`
|
||||
text-align: 'left';
|
||||
`}
|
||||
>
|
||||
{errors}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return dataTabErrorMessage;
|
||||
}, [props.controls]);
|
||||
|
||||
function renderChartContainer() {
|
||||
return (
|
||||
<ExploreChartPanel
|
||||
{...props}
|
||||
errorMessage={errorMessage}
|
||||
errorMessage={dataTabErrorMessage}
|
||||
chartIsStale={chartIsStale}
|
||||
onQuery={onQuery}
|
||||
/>
|
||||
@@ -829,7 +881,8 @@ function ExploreViewContainer(props) {
|
||||
onQuery={onQuery}
|
||||
onStop={onStop}
|
||||
canStopQuery={props.can_add || props.can_overwrite}
|
||||
errorMessage={errorMessage}
|
||||
errorMessage={dataTabErrorMessage}
|
||||
buttonErrorMessage={errorMessage}
|
||||
chartIsStale={chartIsStale}
|
||||
/>
|
||||
</Resizable>
|
||||
|
||||
Reference in New Issue
Block a user