-
Notifications
You must be signed in to change notification settings - Fork 225
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
feat: UI for adding alerts for dashboard tiles #562
base: v2
Are you sure you want to change the base?
Conversation
ernestii
commented
Jan 20, 2025
•
edited
Loading
edited
🦋 Changeset detectedLatest commit: 6616f30 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
a813a05
to
9aa649b
Compare
9aa649b
to
67ee87d
Compare
21dcf30
to
a90737e
Compare
6dda29e
to
052e209
Compare
a90737e
to
a41f979
Compare
052e209
to
e7e9885
Compare
await Alert.find({ | ||
dashboard: { $in: _dashboards.map(d => d._id) }, | ||
source: 'tile', | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double check we want to select all fields from the alert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, I think all data is fine, we need full channel
to populate the form
...d, | ||
tiles: d.tiles.map(t => ({ | ||
...t, | ||
config: { ...t.config, alert: alertsByTileId[t.id]?.[0] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason we want to add alert
field to config
instead of adding it to the top level?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the reason what that it's easier to integrate alert form into Edit Chart form, since we can use same react-hook-form controller (it uses SavedChartConfig schema)
// Create related alerts | ||
for (const tile of dashboard.tiles) { | ||
if (!tile.config.alert) { | ||
await Alert.findOneAndUpdate( | ||
{ | ||
dashboard: newDashboard._id, | ||
tileId: tile.id, | ||
source: 'tile', | ||
team: teamId, | ||
}, | ||
{ ...tile.config.alert }, | ||
{ new: true, upsert: true }, | ||
); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm...maybe we don't want to create an alert here (SRP). I wonder if we should fire a request at the modal level instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm kinda on the fence... i think this implementation is more convenient in terms of API, as it prevents partial failure scenario on FE + easier to build forms (as long as tile.config.alert
is always consistent with Alert type)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lmk if we should implement it the way we did in the v1
a41f979
to
74934e8
Compare
74934e8
to
4a7a5d4
Compare
aac87a6
to
0d4adc2
Compare
rebased and added |
4a7a5d4
to
85002c3
Compare
0d4adc2
to
b54104b
Compare
b54104b
to
464adef
Compare
464adef
to
9880cb2
Compare
9880cb2
to
ae2dbdf
Compare
f0c8364
to
6616f30
Compare