-
Notifications
You must be signed in to change notification settings - Fork 426
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: allow select tabs for scheduled delivery #11266
feat: allow select tabs for scheduled delivery #11266
Conversation
👷 Deploy request for peaceful-bassi-cbf284 pending review.Visit the deploys page to approve it
|
@Shifan-Gu do you have the link to the ticket that this PR relates to? |
@hamzahc1 The dev work for this ticket started before I finished speccing the milestone, so there is no spec for this. I can reopen the ticket. The solution was agreed over a figma file. If I can get a render environment, I'll be able to test this and make sure everything works as expected. All other changes in the future link to well-specced tickets. this is just an exception! |
@PriPatel |
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 checkbox should be selected by default.
- Change
Dashboard Tabs
toTabs
- !IMPORTANT : If i dont have multiple dashboard tabs, I should not see this option in the form at all. Right now, this is affecting users who don't have multiple tabs and it is confusing
- This should also affect the delivery if the user has 'image' selected. Right now it only affects .csvs
* [ ] The checkbox should be selected by default. * [ ] Change `Dashboard Tabs` to `Tabs` * [ ] !IMPORTANT : If i dont have multiple dashboard tabs, I should not see this option in the form at all. Right now, this is affecting users who don't have multiple tabs and it is confusing Thank you for the comments! @PriPatel, i will update it. |
…cheduled-delivery
…livery' into feat/select-tabs-in-scheduled-delivery
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 think we can improve the types on db, replace jsonb with string[].
The rest looks good, once the types are fixed I'll test this on render
packages/backend/src/database/migrations/20240822143117_add_scheduler_selected_tabs_column.ts
Outdated
Show resolved
Hide resolved
}${ | ||
selectedTabs | ||
? `?selectedTabs=${encodeURI( | ||
JSON.stringify(selectedTabs), |
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.
you don't need to do stringify if you use text[] in db
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 removed the stringify call in the model layer, but keep this call because it seems a straightforward way to encode the string array and decode it at the endpoint.
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.
Ok, that works, another option is to pass an array using the query parameter multiple times like.
?selectedTabs=tab0&selectedTabs=tab1...
Both ways are accepted
@@ -235,13 240,39 @@ const SchedulerForm: FC<Props> = ({ | |||
isThresholdAlert, | |||
itemsMap, | |||
}) => { | |||
const isDashboard = resource && resource.type === 'dashboard'; | |||
const isDashboardTabsEnabled = useFeatureFlagEnabled( |
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.
👍 nice
? getFormValuesFromScheduler({ | ||
...savedSchedulerData, | ||
...(isDashboardScheduler(savedSchedulerData) && { | ||
selectedTabs: isDashboardTabsAvailable |
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.
we can probably extract all this logic in a variable outside the method call, just for readability.
size="xs" | ||
label="Include all tabs" | ||
labelPosition="right" | ||
checked={allTabsSelected} |
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.
this should be enabled by default, right ?
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.
yes, but this is not done by setting a default value for "allTabsSelected", but instead by setting initial the form value "selectedTabs" to include all the tabs, then dynamically derive the value from this form value.
…at/select-tabs-in-scheduled-delivery
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 code look ok, but when I was testing, I found some issues.
CSV export
- not selecting any tab in the csv export, sends an email with nothing in it. Ideally we should prevent the scheduler from being created in the first place... This is a minor bug , which means we could merge this PR without this, and create a separate issue to fix it later.
Image export
- It seems the tab filter is not working, if I try to filter a tab, it always shows me everything. I tested /minimal and hte parameter seems to work, perhaps we are not passing the paramenter correctly inside the headless browser.
- selecting
no tabs
simply returns all tabs, I believe this is related with the previous point, where we don't do any filtering. Similar to the CSV UI, we should not allow the scheduler to be created.
I also tested this without tabs, and it works as expected, so it doesn't break dashboards without tabs 👍 that's great.
@@ -317,6 323,10 @@ export class SchedulerModel { | |||
: null, | |||
notification_frequency: | |||
scheduler.notificationFrequency || null, | |||
selected_tabs: | |||
'selectedTabs' in scheduler && scheduler.selectedTabs | |||
? (scheduler.selectedTabs as string[]) |
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.
is this casting needed here ?
Hi @rephus thanks for the testing work! I have some issue with my local env to reproduce the issue, so haven't figure out the root cause for the issue. but i have a question for you is that, are you using standalone scheduler deployment to test this change? |
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.
Nice work
# [0.1274.0](0.1273.5...0.1274.0) (2024-09-26) ### Features * allow select tabs for scheduled delivery ([#11266](#11266)) ([55587b8](55587b8))
🎉 This PR is included in version 0.1274.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
* feat: allow select tabs for scheduled delivery * support image option * handle delete tabs * handle delete tabs * change selected tabs db type * fix image export issue
# [0.1274.0](lightdash/lightdash@0.1273.5...0.1274.0) (2024-09-26) ### Features * allow select tabs for scheduled delivery ([lightdash#11266](lightdash#11266)) ([55587b8](lightdash@55587b8))
Closes:
Description:
This change allows user to select the tabs of the contents which they want include in the scheduled delivery.
UX:
When include all checkbox is selected, select tabs dropdown would be disabled and scheduled delivery will include all tabs.
When include all checkbox is not selected, then user can select the tabs they want include in the scheduled delivery
Then scheduled delivery will filter content based on the tabs selected.
Reviewer actions