This is an automated email from the ASF dual-hosted git repository.

alexandrusoare pushed a commit to branch 
alexandrusoare/feat/report-failure-retry
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to 
refs/heads/alexandrusoare/feat/report-failure-retry by this push:
     new 446412d954c improve logic
446412d954c is described below

commit 446412d954c451f36e22571834f43f70ce194a02
Author: alexandrusoare <[email protected]>
AuthorDate: Mon Jul 27 16:35:00 2026 +0300

    improve logic
---
 .../src/features/alerts/AlertReportModal.test.tsx  |  10 +-
 .../src/features/alerts/AlertReportModal.tsx       | 198 +++++++++++----------
 2 files changed, 113 insertions(+), 95 deletions(-)

diff --git a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx 
b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
index 2374157a224..8a849fb0d79 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx
@@ -489,13 +489,13 @@ test('renders 5 sections for reports', () => {
   expect(sections.length).toBe(5);
 });
 
-test('renders 6 sections for alerts', () => {
+test('renders 5 sections for alerts', () => {
   render(<AlertReportModal {...generateMockedProps(false)} />, {
     useRedux: true,
   });
 
   const sections = screen.getAllByRole('tab');
-  expect(sections.length).toBe(6);
+  expect(sections.length).toBe(5);
 });
 
 // Validation
@@ -1475,16 +1475,16 @@ test('adding and removing dashboard filter rows', async 
() => {
 });
 
 test('alert shows condition section, report does not', () => {
-  // Alert has 6 sections (general, condition, content, schedule, 
notification, error handling)
+  // Alert has 5 sections (general, condition, content, schedule, notification)
   const { unmount } = render(
     <AlertReportModal {...generateMockedProps(false)} />,
     { useRedux: true },
   );
-  expect(screen.getAllByRole('tab')).toHaveLength(6);
+  expect(screen.getAllByRole('tab')).toHaveLength(5);
   expect(screen.getByTestId('alert-condition-panel')).toBeInTheDocument();
   unmount();
 
-  // Report has 5 sections, no condition panel
+  // Report has 5 sections (general, content, schedule, notification, error 
handling)
   render(<AlertReportModal {...generateMockedProps(true)} />, {
     useRedux: true,
   });
diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx 
b/superset-frontend/src/features/alerts/AlertReportModal.tsx
index 3ee0ee71750..1334fb24815 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx
@@ -2735,97 +2735,115 @@ const AlertReportModal: 
FunctionComponent<AlertReportModalProps> = ({
                 </>
               ),
             },
-            {
-              key: 'error-handling',
-              label: (
-                <CollapseLabelInModal
-                  title={t('Error handling')}
-                  subtitle={t('Configure retry behavior on delivery failure.')}
-                  testId="error-handling-panel"
-                />
-              ),
-              children: (
-                <div className="header-section">
-                  <StyledSwitchContainer
-                    css={css`
-                      margin-bottom: ${theme.sizeUnit * 4}px;
-                    `}
-                  >
-                    <Switch
-                      checked={!!currentAlert?.retry_on_failure}
-                      onChange={(checked: boolean) =>
-                        updateAlertState('retry_on_failure', checked)
-                      }
-                    />
-                    <div className="switch-label">{t('Enable Retries')}</div>
-                    <InfoTooltip
-                      tooltip={t(
-                        'Automatically retry sending the report when delivery 
fails.',
-                      )}
-                    />
-                  </StyledSwitchContainer>
-                  {currentAlert?.retry_on_failure && (
-                    <>
-                      <ModalFormField label={t('Maximum Retry Attempts')}>
-                        <InputNumber
-                          min={1}
-                          max={10}
-                          value={currentAlert?.retry_max_attempts ?? 3}
-                          onChange={(value: number | null) =>
-                            updateAlertState('retry_max_attempts', value ?? 3)
-                          }
-                        />
-                      </ModalFormField>
-                      <StyledSwitchContainer
-                        css={css`
-                          margin-bottom: ${theme.sizeUnit * 4}px;
-                        `}
-                      >
-                        <Switch
-                          checked={!!currentAlert?.send_failed_reports}
-                          onChange={(checked: boolean) =>
-                            updateAlertState('send_failed_reports', checked)
-                          }
-                        />
-                        <div className="switch-label">
-                          {t('Send Failed Reports')}
-                        </div>
-                        <InfoTooltip
-                          tooltip={t(
-                            'By default, recipients only receive reports when 
all charts successfully load. ' +
-                              'Enable this to send reports even when some 
charts fail to render.',
-                          )}
-                        />
-                      </StyledSwitchContainer>
-                      <ModalFormField label={t('Failure Notifications')}>
-                        <Checkbox
-                          checked={currentAlert?.retry_notify_owners ?? true}
-                          onChange={(e: CheckboxChangeEvent) =>
-                            updateAlertState(
-                              'retry_notify_owners',
-                              e.target.checked,
-                            )
-                          }
-                        >
-                          {t('Owners')}
-                        </Checkbox>
-                        <Checkbox
-                          checked={!!currentAlert?.retry_notify_recipients}
-                          onChange={(e: CheckboxChangeEvent) =>
-                            updateAlertState(
-                              'retry_notify_recipients',
-                              e.target.checked,
-                            )
-                          }
+            ...(isReport
+              ? [
+                  {
+                    key: 'error-handling',
+                    label: (
+                      <CollapseLabelInModal
+                        title={t('Error handling')}
+                        subtitle={t(
+                          'Configure retry behavior on delivery failure.',
+                        )}
+                        testId="error-handling-panel"
+                      />
+                    ),
+                    children: (
+                      <div className="header-section">
+                        <StyledSwitchContainer
+                          css={css`
+                            margin-bottom: ${theme.sizeUnit * 4}px;
+                          `}
                         >
-                          {t('Report Recipients')}
-                        </Checkbox>
-                      </ModalFormField>
-                    </>
-                  )}
-                </div>
-              ),
-            },
+                          <Switch
+                            checked={!!currentAlert?.retry_on_failure}
+                            onChange={(checked: boolean) =>
+                              updateAlertState('retry_on_failure', checked)
+                            }
+                          />
+                          <div className="switch-label">
+                            {t('Enable Retries')}
+                          </div>
+                          <InfoTooltip
+                            tooltip={t(
+                              'Automatically retry sending the report when 
delivery fails.',
+                            )}
+                          />
+                        </StyledSwitchContainer>
+                        {currentAlert?.retry_on_failure && (
+                          <>
+                            <ModalFormField label={t('Maximum Retry 
Attempts')}>
+                              <InputNumber
+                                min={1}
+                                max={10}
+                                value={currentAlert?.retry_max_attempts ?? 3}
+                                onChange={(value: number | null) =>
+                                  updateAlertState(
+                                    'retry_max_attempts',
+                                    value ?? 3,
+                                  )
+                                }
+                              />
+                            </ModalFormField>
+                            <StyledSwitchContainer
+                              css={css`
+                                margin-bottom: ${theme.sizeUnit * 4}px;
+                              `}
+                            >
+                              <Switch
+                                checked={!!currentAlert?.send_failed_reports}
+                                onChange={(checked: boolean) =>
+                                  updateAlertState(
+                                    'send_failed_reports',
+                                    checked,
+                                  )
+                                }
+                              />
+                              <div className="switch-label">
+                                {t('Send Failed Reports')}
+                              </div>
+                              <InfoTooltip
+                                tooltip={t(
+                                  'By default, recipients only receive reports 
when all charts successfully load. ' +
+                                    'Enable this to send reports even when 
some charts fail to render.',
+                                )}
+                              />
+                            </StyledSwitchContainer>
+                            <ModalFormField label={t('Failure Notifications')}>
+                              <Checkbox
+                                checked={
+                                  currentAlert?.retry_notify_owners ?? true
+                                }
+                                onChange={(e: CheckboxChangeEvent) =>
+                                  updateAlertState(
+                                    'retry_notify_owners',
+                                    e.target.checked,
+                                  )
+                                }
+                              >
+                                {t('Owners')}
+                              </Checkbox>
+                              <Checkbox
+                                checked={
+                                  !!currentAlert?.retry_notify_recipients
+                                }
+                                onChange={(e: CheckboxChangeEvent) =>
+                                  updateAlertState(
+                                    'retry_notify_recipients',
+                                    e.target.checked,
+                                  )
+                                }
+                              >
+                                {t('Report Recipients')}
+                              </Checkbox>
+                            </ModalFormField>
+                          </>
+                        )}
+                      </div>
+                    ),
+                  },
+                ]
+              : []),
           ]}
         />
       </div>

Reply via email to