-
Notifications
You must be signed in to change notification settings - Fork 271
feat(table): enable table filter and better typing #344
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need & ChartProps['formData']
?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 theBigNumberFormData
values take precedent.
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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 overall 👍
type: DatasourceType; | ||
columns: Column[]; | ||
metrics: QueryObjectMetric[]; | ||
description?: string; | ||
columnFormats?: { | ||
[key: string]: 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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add some inline comments instead.
compareLag?: string | number; | ||
yAxisFormat?: string; | ||
timeGrainSqla?: TimeGranularity; | ||
} & ChartProps['formData']; |
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.
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 theBigNumberFormData
values take precedent.
const { | ||
colorPicker, | ||
compareLag: compareLagInput, | ||
compareLag: compareLag_, |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
let value = val; | ||
if (typeof val === 'string') { | ||
// force UTC time zone if is an ISO timestamp without timezone | ||
// e.g. "2020-10-12T00:00:00" | ||
value = val.match(/T(\d{2}:){2}\d{2}$/) ? `${val}Z` : val; | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you set this above instead of coercing? let value: Date | number | null = val; ...
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.
Actually tried that, but ran into error when passing it to new Date
. Obviously new Date
doesn't accept null
s.
cursor: pointer; | ||
} | ||
.superset-legacy-chart-table td.dt-is-filter:hover { | ||
background-color: linen; |
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.
curious how these were chosen? should we get any design feedback?
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 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