Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Unable to edit mail list of existing alert & reports #28709

Closed
3 tasks done
pankajsoni22 opened this issue May 27, 2024 · 5 comments
Closed
3 tasks done

[Bug] Unable to edit mail list of existing alert & reports #28709

pankajsoni22 opened this issue May 27, 2024 · 5 comments
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature

Comments

@pankajsoni22
Copy link
Contributor

Bug description

When we create alert or report and want to sent to receivers using their mail id, it is working fine, we can create alerts and report successfully.

BUT

If we want to add more recipients and try to edit and add more mail to alerts or reports it is not possible. looks like after saving alert/report the mail list edit area becomes read-only.

How to reproduce the bug

  1. Go To "Alerts & Reports"
  2. Click on edit button of some already existing Alert/Report
  3. Try to remove or add mail, you won't be able to do so.

Screenshots/recordings

No response

Superset version

4.0.1

Python version

I don't know

Node version

I don't know

Browser

Chrome

Additional context

I'm using superset 4.0.1-dev version

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added the alert-reports Namespace | Anything related to the Alert & Reports feature label May 27, 2024
Copy link

dosubot bot commented May 27, 2024

Hello, @pankajsoni22! 👋 I'm here to help you with any bugs, questions, or contributions you have regarding the repository.

To resolve the issue in Superset version 4.0.1-dev where you are unable to edit the mail list of existing alerts and reports because the mail list edit area becomes read-only after saving, you need to ensure that the NotificationMethod component allows for updates to the notification settings. The provided code already includes the necessary logic to handle updates to the notification settings.

Here is the relevant part of the code that handles the update of notification settings:

const updateNotificationSetting = (
    index: number,
    setting: NotificationSetting,
  ) => {
    const settings: NotificationSetting[] = [...notificationSettings];
    settings[index] = setting;

    // if you've changed notification method -> remove trailing methods
    if (notificationSettings[index].method !== setting.method) {
      notificationSettings[index] = setting;

      setNotificationSettings(
        notificationSettings.filter((_, idx) => idx <= index),
      );

      if (notificationSettings.length - 1 > index) {
        setNotificationAddState('active');
      }

      if (setting.method !== undefined && notificationAddState !== 'hidden') {
        setNotificationAddState('active');
      }
    } else {
      setNotificationSettings(settings);
    }
  };

This function updates the notification settings when a change is made. Ensure that this function is correctly called when the notification settings are updated in the NotificationMethod component.

Additionally, ensure that the NotificationMethod component is correctly passing the updated settings back to the parent component:

<NotificationMethod
  setting={notificationSetting}
  index={i}
  key={`NotificationMethod-${i}`}
  onUpdate={updateNotificationSetting}
  onRemove={removeNotificationSetting}
  onInputChange={onInputChange}
  email_subject={currentAlert?.email_subject || ''}
  defaultSubject={emailSubject || ''}
  setErrorSubject={handleErrorUpdate}
/>

If the issue persists, verify that the state updates are correctly propagated and that there are no other parts of the code that might be causing the mail list edit area to become read-only [1].

Details

About Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

@aibunny
Copy link

aibunny commented May 27, 2024

I also experienced a similar issue it looks like a frontend issue since the Add button is not activated when I have satified all the requirements to create an alert.
Untitled

@aibunny
Copy link

aibunny commented May 27, 2024

@pankajsoni22 could share the configs you used for the email alerts I am not able to setup mine I keep getting report schedule refusing to compute

@mitchgreen
Copy link

mitchgreen commented May 29, 2024

I too am having this same issue, where the "Add" button in the report edit dialog box is not activated even when I have satisfied all the requirements to create an alert.

@sfirke
Copy link
Member

sfirke commented May 29, 2024

I believe this is a duplicate of #28149 which was fixed in #28409. The next release -- either 4.1.0 or 4.0.2 -- should have this fix incorporated.

If you believe this is different than the issue I linked, please feel free to comment and I'll reopen.

@sfirke sfirke closed this as completed May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature
Projects
None yet
Development

No branches or pull requests

4 participants