feat(table): enable table filter and better typing#344
feat(table): enable table filter and better typing#344ktmud merged 3 commits intoapache-superset:masterfrom
Conversation
|
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/superset/superset-ui/fq9g998vh |
906912a to
79fdd3c
Compare
Codecov Report
@@ Coverage Diff @@
## master #344 +/- ##
==========================================
- Coverage 26.35% 26.25% -0.10%
==========================================
Files 192 192
Lines 5256 5287 +31
Branches 459 473 +14
==========================================
+ Hits 1385 1388 +3
- Misses 3842 3864 +22
- Partials 29 35 +6
Continue to review full report at Codecov.
|
79fdd3c to
d80da80
Compare
…344) Bumps [@airbnb/config-typescript](https://github.com/airbnb/nimbus) from 2.2.2 to 2.2.3. - [Release notes](https://github.com/airbnb/nimbus/releases) - [Changelog](https://github.com/airbnb/nimbus/blob/master/CHANGELOG.md) - [Commits](https://github.com/airbnb/nimbus/compare/@airbnb/config-typescript@2.2.2...@airbnb/config-typescript@2.2.3) Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
| compareLag?: string | number; | ||
| yAxisFormat?: string; | ||
| timeGrainSqla?: TimeGranularity; | ||
| } & ChartProps['formData']; |
There was a problem hiding this comment.
Does it need & ChartProps['formData']?
There was a problem hiding this comment.
Thought it was more semantically correct to include it. Can probably drop since we've been exhaustive listing all the fields. Actually, it'd be easier to just do this because some shared properties are indeed useful to keep in ChartProps and it doesn't make sense to exhaustively list them for every chart type.
There was a problem hiding this comment.
two questions:
- should it be
Partial<ChartProps['formData']>? or all of them? - are there duplicate keys in
ChartProps['formData']? I'm not sure order of override for TS, just wanted to make sure if there are duplicates that theBigNumberFormDatavalues take precedent.
There was a problem hiding this comment.
Actually, it'd be easier to just do this because some shared properties are indeed useful to keep in ChartProps and it doesn't make sense to exhaustively list them for every chart type.
Strike again. formData and queryData are basically PlainObject, which accepts any key with any values. Partial or not it doesn't make any difference, at least for now. I was thinking & ChartProps.
@williaster thanks for the reminder about overrides. I should have placed ChartProps['formData'] at the front.
There was a problem hiding this comment.
I think I'm going to avoid Partial as it makes all properties optional, which is probably not what we want in this case.
d80da80 to
c33963f
Compare
c33963f to
becf76d
Compare
becf76d to
dac787a
Compare
dac787a to
0c2d5e3
Compare
0c2d5e3 to
87f3440
Compare
| metrics: QueryObjectMetric[]; | ||
| description?: string; | ||
| columnFormats?: { | ||
| [key: string]: string; |
There was a problem hiding this comment.
could we be any more specific about what key is here + verboseMap below? like name or id or something?
There was a problem hiding this comment.
I always thought it's good to be generic in indexable types so that new TypeScript users don't confuse it with an actual property name.
There was a problem hiding this comment.
I'll add some inline comments instead.
| compareLag?: string | number; | ||
| yAxisFormat?: string; | ||
| timeGrainSqla?: TimeGranularity; | ||
| } & ChartProps['formData']; |
There was a problem hiding this comment.
two questions:
- should it be
Partial<ChartProps['formData']>? or all of them? - are there duplicate keys in
ChartProps['formData']? I'm not sure order of override for TS, just wanted to make sure if there are duplicates that theBigNumberFormDatavalues take precedent.
| const { | ||
| colorPicker, | ||
| compareLag: compareLagInput, | ||
| compareLag: compareLag_, |
There was a problem hiding this comment.
readability nit – I think compareLagInput is a clearer name, not sure what _ means tho I guess it's used a few places here
There was a problem hiding this comment.
I use dangling "_" for arguments that will be immediately overridden by simple argument processing. It indicates a sense of temporariness and keeps the variable names clean.
| value = new Date(value); | ||
| } | ||
| return formatTimestamp(value) as string; | ||
| return formatTimestamp(value as Date | number | null) as string; |
There was a problem hiding this comment.
can you set this above instead of coercing? let value: Date | number | null = val; ...
There was a problem hiding this comment.
Actually tried that, but ran into error when passing it to new Date. Obviously new Date doesn't accept nulls.
| cursor: pointer; | ||
| } | ||
| .superset-legacy-chart-table td.dt-is-filter:hover { | ||
| background-color: linen; |
There was a problem hiding this comment.
curious how these were chosen? should we get any design feedback?
There was a problem hiding this comment.
The original color is:
background-color: lighten(desaturate(@brand-primary, 50%), 50%);
apache/superset@cbf38ff#diff-9479060a8cb28b444d0ce7f5df0a33ccL577
Which translates to #bce9e5. I just picked a named color that is close to it and does not look bad. Wanted to use the original color, but it kind of looked too dark to me.
This will probably eventually become customizable with the introduction of the superset-ui/style package.

🏆 Enhancements
🐛 Bug Fix