-
Notifications
You must be signed in to change notification settings - Fork 13.9k
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: Adds plugin-chart-handlebars #17903
feat: Adds plugin-chart-handlebars #17903
Conversation
This is so cool.. |
Thanks @jdbranham so much for bringing in this PR from |
Codecov Report
@@ Coverage Diff @@
## master #17903 +/- ##
==========================================
- Coverage 66.47% 66.03% -0.45%
==========================================
Files 1681 1713 +32
Lines 64467 67651 +3184
Branches 6607 7655 +1048
==========================================
+ Hits 42856 44672 +1816
- Misses 19917 21084 +1167
- Partials 1694 1895 +201
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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.
@jdbranham I absolutely ❤️LOVE❤️ this plugin! First review pass along with a few comments - if you wish I can push some commits to the PR, e.g. resolve the conflicts and apply those proposed changes. Let me know how you want to proceed!
...rset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx
Outdated
Show resolved
Hide resolved
...rset-frontend/plugins/plugin-chart-handlebars/src/components/Handlebars/HandlebarsViewer.tsx
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/handlebarTemplate.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/handlebarTemplate.tsx
Outdated
Show resolved
Hide resolved
}), | ||
}; | ||
|
||
export const HandlebarsTemplateControlSetItem: ControlSetItem = { |
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.
nit, I would probably make this camelCase instead of PascalCase:
export const HandlebarsTemplateControlSetItem: ControlSetItem = { | |
export const handlebarsTemplateControlSetItem: ControlSetItem = { |
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.
If we make it camelCase, it would be different then the other ControlSetItems 🤔
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; since they instantiate the ControlSetItem
type, I consider naming them like regular JS variables (camelCase) more appropriate than PascalCase
. So I would recommend changing the case on all of these, as it's the common convention throughout the other control definitions.
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.
@jdbranham here is an example of instances of ControlSetItem
in another plugin which are camelCase: https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx
superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/style.tsx
Outdated
Show resolved
Hide resolved
superset-frontend/plugins/plugin-chart-handlebars/src/plugin/controls/style.tsx
Outdated
Show resolved
Hide resolved
type: 'DndMetricSelect', | ||
}; | ||
|
||
export const PercentMetricsControlSetItem: ControlSetItem = { |
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 convention has been to make all these camelCase, as they've really just variables (making them PascalCase makes it appear as if they're types/interfaces/classes/React components)
}), | ||
}; | ||
|
||
export const HandlebarsTemplateControlSetItem: ControlSetItem = { |
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.
@jdbranham here is an example of instances of ControlSetItem
in another plugin which are camelCase: https://github.com/apache/superset/blob/master/superset-frontend/plugins/plugin-chart-echarts/src/controls.tsx
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 has gotten conflicted again 🙁 Tested and it works really nicely now - after this is rebased and you've had the opportunity to check my last comment about camelCasing the controls then I think this should be good to go!
@jdbranham would love to try this plugin - could you fix the conflicts? |
@jdbranham I've fixed the conflicts and outstanding review comments, but I'm unable to push to your PR (I assume the branch is protected). I'd really love for this plugin to be merged in time for the 2.0 cut, so please let me know if I can help get this merged. |
That's great @villebro - I've been too swamped to get back to it 😓 I should be able to check a box on this PR to allow superset maintainers the ability to push to the fork branch, but I don't see it. |
@villebro I just added you to my organization instead. That should work! |
Awesome @jdbranham ! ❤️ |
@jdbranham hmm I'm still unable to push to the PR. But I created this temporary branch if you want to merge it into your branch: https://github.com/apache/superset/tree/jb/feat-plugin-handlebars . After that it should be good to be merged. |
Is it possible to include this in 1.5? |
Jb/feat plugin handlebars
Thanks @villebro - we're merged up! |
@jdbranham @raags if we can get this merged today I'm def gonna include it in 1.5! |
Adds missing propeties in test formData
@jdbranham there's a few minor lint issues, here's the diff which should fix the remaining errors: diff --git a/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/buildQuery.test.ts b/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/buildQuery.test.ts
index d7c0457dfa..ec0eb1bae2 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/buildQuery.test.ts
+++ b/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/buildQuery.test.ts
@@ -7,8 +7,8 @@ describe('Handlebars buildQuery', () => {
granularitySqla: 'ds',
groupby: ['foo'],
viz_type: 'my_chart',
- width: '500px',
- height: '500px'
+ width: 500,
+ height: 500,
};
it('should build groupby with series in form data', () => {
diff --git a/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/transformProps.test.ts b/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/transformProps.test.ts
index f24d2c29f4..b5dc643529 100644
--- a/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/transformProps.test.ts
+++ b/superset-frontend/plugins/plugin-chart-handlebars/test/plugin/transformProps.test.ts
@@ -9,8 +9,9 @@ describe('Handlebars tranformProps', () => {
granularitySqla: 'ds',
metric: 'sum__num',
groupby: ['name'],
- width: '500px',
- height: '500px'
+ width: 500,
+ height: 500,
+ viz_type: 'handlebars',
};
const chartProps = new ChartProps<QueryFormData>({
formData, |
@jdbranham I'm probably going to cut 1.5.0rc4 in ~20 hours, so if you can push this last change in before then, I'll include this in 1.5.0 🚀 |
hope I made it in time! My local config probably needs work - since these linting error should've been caught when I ran the tests 🤔 |
Thanks @jdbranham! Fingers crossed! 🤞 |
@jdbranham oh no, those widths and heights needed to be numbers (not strings), so the linter is still failing 😢 |
It's strange because when I run the tests locally the result is different than GHA 😢 |
I must have a problem with my environment. The tests in GHA show the exact opposite when I run locally. Maybe I'm missing something silly, but I don't see |
revert the viz_type change. it was in the wrong place.
My old homie @jdbranham I'm going to checkout this PR and see if I can reproduce to fix the issue. It's such a great feature. Can you share a bit of info about your environment? I'm guessing you won't see this today or be at your computer but knowing you... |
@MarcusSorealheis ! - I didn't know you were contributor. You're involved in all the cool stuff! =) It's Friday night - what else is there to do 😅
|
@jdbranham I tried to open a PR against your fork, but it got really messy (probably due to GH choking on too many forks). But this commit should fix the licence header CI issues + fix the unit test: bc3ee85 |
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.
LGTM, finally! 😄👍🚀
* adds: plugin chart handlebars * adds: handlebars plugin to main presets * update: npm install * chore: lint * adds: dateFormat handlebars helper * deletes: unused props * chore: linting plugin-chart-handlebars * docs: chart-plugin-handlebars * adds: moment to peer deps * update: use error handling * update: inline config, adds renderTrigger * update: inline config, adds renderTrigger * camelCase controls * (plugins-chart-handlebars) adds: missing props Adds missing propeties in test formData * (plugin-chart-handlebars) fixes test * (plugin-handlebars-chart) use numbers for size * (feature-handlebars-chart) fix viz_type * (plugin-handlebars-chart) revert revert the viz_type change. it was in the wrong place. * fix test and add license headers Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
* adds: plugin chart handlebars * adds: handlebars plugin to main presets * update: npm install * chore: lint * adds: dateFormat handlebars helper * deletes: unused props * chore: linting plugin-chart-handlebars * docs: chart-plugin-handlebars * adds: moment to peer deps * update: use error handling * update: inline config, adds renderTrigger * update: inline config, adds renderTrigger * camelCase controls * (plugins-chart-handlebars) adds: missing props Adds missing propeties in test formData * (plugin-chart-handlebars) fixes test * (plugin-handlebars-chart) use numbers for size * (feature-handlebars-chart) fix viz_type * (plugin-handlebars-chart) revert revert the viz_type change. it was in the wrong place. * fix test and add license headers Co-authored-by: Ville Brofeldt <ville.v.brofeldt@gmail.com>
Adds a new plugin, that renders the data payload
by applying a customizable handlebars template
Reopening PR from old repo -
apache-superset/superset-ui#1390
💔 Breaking Changes - None
🏆 Enhancements - New Handlebars plugin
📜 Documentation - slim 😅
Markup -
Markdown -