[Bug] Unable to edit mail list of existing alert & reports
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
- Go To "Alerts & Reports"
- Click on edit button of some already existing Alert/Report
- 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
- [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [X] 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.
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.
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.
@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
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.
I believe this is a duplicate of https://github.com/apache/superset/issues/28149 which was fixed in https://github.com/apache/superset/pull/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.