forked from apache/superset
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: is_select with UNION (apache#25290) (cherry picked from commit bb002d6) * fix: Add explicit ON DELETE CASCADE for dashboard_roles (apache#25320) (cherry picked from commit d54e827) * fix(chart): Supporting custom SQL as temporal x-axis column with filter (apache#25126) Co-authored-by: Kamil Gabryjelski <kamil.gabryjelski@gmail.com> * fix: Use RLS clause instead of ID for cache key (apache#25229) (cherry picked from commit fba66c6) * fix: Improve the reliability of alerts & reports (apache#25239) (cherry picked from commit f672d5d) * fix: DashboardRoles cascade operation (apache#25349) (cherry picked from commit a971a28) * fix: datetime with timezone excel export (apache#25318) Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com> (cherry picked from commit 5ebcd2a) * fix: Workaround for Cypress ECONNRESET error (apache#25399) (cherry picked from commit d76ff39) * fix(sqllab): invalid persisted tab state (apache#25308) (apache#25398) * fix: Rename on_delete parameter to ondelete (apache#25424) (cherry picked from commit 893b45f) * fix: preventing save button from flickering in SQL Lab (apache#25106) (cherry picked from commit 296ff17) * fix: chart import (apache#25425) (cherry picked from commit a4d8f36) * fix: swagger UI CSP error (apache#25368) (cherry picked from commit 1716b9f) * fix: smarter date formatter (apache#25404) (cherry picked from commit f0080f9) * fix(sqllab): invalid start date (apache#25437) * fix(nativeFilters): Speed up native filters by removing unnecessary rerenders (apache#25282) Co-authored-by: JUST.in DO IT <justin.park@airbnb.com> (cherry picked from commit a0eeb4d) * fix(SqlLab): make icon placement even (apache#25372) (cherry picked from commit 11b49a6) * fix: Duplicate items when pasting into Select (apache#25447) (cherry picked from commit 7cf96cd) * fix: update the SQLAlchemy model definition at json column for Log table (apache#25445) (cherry picked from commit e83a76a) * fix(helm chart): set chart appVersion to 3.0.0 (apache#25373) * fix(mysql): handle string typed decimal results (apache#24241) (cherry picked from commit 7eab59a) * fix: Styles not loading because of faulty CSP setting (apache#25468) (cherry picked from commit 0cebffd) * fix(sqllab): error with lazy_gettext for tab titles (apache#25469) (cherry picked from commit ddde178) * fix: Address Mypy issue which is causing CI to fail (apache#25494) (cherry picked from commit 36ed617) * chore: Adds 3.0.1 CHANGELOG * fix: Unable to sync columns when database or dataset name contains `+` (apache#25390) (cherry picked from commit dbe0838) * fix(sqllab): Broken query containing 'children' (apache#25490) (cherry picked from commit b92957e) * chore: Expand error detail on screencapture (apache#25519) (cherry picked from commit ba541e8) * fix: tags permissions error message (apache#25516) (cherry picked from commit 50b0816) * fix: Apply normalization to all dttm columns (apache#25147) (cherry picked from commit 58fcd29) * fix: REST API CSRF exempt list (apache#25590) (cherry picked from commit 549abb5) * fix(RLS): Fix Info Tooltip + Button Alignment on RLS Modal (apache#25400) (cherry picked from commit a6d0e6f) * fix: thubmnails loading - Talisman default config (apache#25486) (cherry picked from commit 52f631a) * fix(Presto): catch DatabaseError when testing Presto views (apache#25559) Co-authored-by: Rui Zhao <zhaorui@dropbox.com> (cherry picked from commit be3714e) * fix(Charts): Set max row limit + removed the option to use an empty row limit value (apache#25579) (cherry picked from commit f556ef5) * fix(window): unavailable localStorage and sessionStorage (apache#25599) * fix: finestTemporalGrainFormatter (apache#25618) (cherry picked from commit 62bffaf) * fix: revert fix(sqllab): Force trino client async execution (apache#24859) (apache#25541) (cherry picked from commit e56e0de) * chore: Updates 3.0.1 CHANGELOG * fix(sqllab): Mistitled for new tab after rename (apache#25523) (cherry picked from commit a520124) * fix(sqllab): template validation error within comments (apache#25626) (cherry picked from commit b370c66) * fix: avoid 500 errors with SQLLAB_BACKEND_PERSISTENCE (apache#25553) (cherry picked from commit 99f79f5) * fix(import): Make sure query context is overwritten for overwriting imports (apache#25493) (cherry picked from commit a0a0d80) * fix: permalink save/overwrites in explore (apache#25112) Co-authored-by: Elizabeth Thompson <eschutho@gmail.com> (cherry picked from commit e58a3ab) * fix(header navlinks): link navlinks to path prefix (apache#25495) (cherry picked from commit 51c56dd) * fix: improve upload ZIP file validation (apache#25658) * fix: warning of nth-child (apache#23638) (cherry picked from commit 16cc089) * fix(dremio): Fixes issue with Dremio SQL generation for Charts with Series Limit (apache#25657) (cherry picked from commit be82657) --------- Co-authored-by: Beto Dealmeida <roberto@dealmeida.net> Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com> Co-authored-by: Zef Lin <zef@preset.io> Co-authored-by: Kamil Gabryjelski <kamil.gabryjelski@gmail.com> Co-authored-by: Jack Fragassi <jfragassi98@gmail.com> Co-authored-by: Michael S. Molina <70410625+michael-s-molina@users.noreply.github.com> Co-authored-by: JUST.in DO IT <justin.park@airbnb.com> Co-authored-by: Jack <41238731+fisjac@users.noreply.github.com> Co-authored-by: Daniel Vaz Gaspar <danielvazgaspar@gmail.com> Co-authored-by: Stepan <66589759+Always-prog@users.noreply.github.com> Co-authored-by: Corbin Bullard <corbindbullard@gmail.com> Co-authored-by: Gyuil Han <cnabro91@gmail.com> Co-authored-by: Celalettin Calis <celalettin1286@gmail.com> Co-authored-by: Ville Brofeldt <33317356+villebro@users.noreply.github.com> Co-authored-by: ʈᵃᵢ <tdupreetan@gmail.com> Co-authored-by: Michael S. Molina <michael.s.molina@gmail.com> Co-authored-by: mapledan <mapledan829@gmail.com> Co-authored-by: Igor Khrol <khroliz@gmail.com> Co-authored-by: Rui Zhao <105950525+zhaorui2022@users.noreply.github.com> Co-authored-by: Fabien <18534166+frassinier@users.noreply.github.com> Co-authored-by: Hugh A. Miles II <hughmil3s@gmail.com> Co-authored-by: OskarNS <soerensen.oskar@gmail.com>
- Loading branch information
1 parent
76cb043
commit 53bb43b
Showing
106 changed files
with
1,677 additions
and
451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
...frontend/packages/superset-ui-core/src/time-format/formatters/finestTemporalGrain.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0, | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import finestTemporalGrain from './finestTemporalGrain'; | ||
|
||
test('finestTemporalGrain', () => { | ||
const monthFormatter = finestTemporalGrain([ | ||
new Date('2003-01-01 00:00:00Z').getTime(), | ||
new Date('2003-02-01 00:00:00Z').getTime(), | ||
]); | ||
expect(monthFormatter(new Date('2003-01-01 00:00:00Z').getTime())).toBe( | ||
'2003-01-01', | ||
); | ||
expect(monthFormatter(new Date('2003-02-01 00:00:00Z').getTime())).toBe( | ||
'2003-02-01', | ||
); | ||
|
||
const yearFormatter = finestTemporalGrain([ | ||
new Date('2003-01-01 00:00:00Z').getTime(), | ||
new Date('2004-01-01 00:00:00Z').getTime(), | ||
]); | ||
expect(yearFormatter(new Date('2003-01-01 00:00:00Z').getTime())).toBe( | ||
'2003', | ||
); | ||
expect(yearFormatter(new Date('2004-01-01 00:00:00Z').getTime())).toBe( | ||
'2004', | ||
); | ||
|
||
const milliSecondFormatter = finestTemporalGrain([ | ||
new Date('2003-01-01 00:00:00Z').getTime(), | ||
new Date('2003-04-05 06:07:08.123Z').getTime(), | ||
]); | ||
expect(milliSecondFormatter(new Date('2003-01-01 00:00:00Z').getTime())).toBe( | ||
'2003-01-01 00:00:00.000', | ||
); | ||
|
||
const localTimeFormatter = finestTemporalGrain( | ||
[ | ||
new Date('2003-01-01 00:00:00Z').getTime(), | ||
new Date('2003-02-01 00:00:00Z').getTime(), | ||
], | ||
true, | ||
); | ||
expect(localTimeFormatter(new Date('2003-01-01 00:00:00Z').getTime())).toBe( | ||
'2002-12-31 19:00', | ||
); | ||
}); |
80 changes: 80 additions & 0 deletions
80
...rset-frontend/packages/superset-ui-core/src/time-format/formatters/finestTemporalGrain.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { utcFormat, timeFormat } from 'd3-time-format'; | ||
import { utcUtils, localTimeUtils } from '../utils/d3Time'; | ||
import TimeFormatter from '../TimeFormatter'; | ||
|
||
/* | ||
* A formatter that examines all the values, and uses the finest temporal grain. | ||
*/ | ||
export default function finestTemporalGrain( | ||
values: any[], | ||
useLocalTime = false, | ||
) { | ||
const format = useLocalTime ? timeFormat : utcFormat; | ||
|
||
const formatMillisecond = format('%Y-%m-%d %H:%M:%S.%L'); | ||
const formatSecond = format('%Y-%m-%d %H:%M:%S'); | ||
const formatMinute = format('%Y-%m-%d %H:%M'); | ||
const formatHour = format('%Y-%m-%d %H:%M'); | ||
const formatDay = format('%Y-%m-%d'); | ||
const formatMonth = format('%Y-%m-%d'); | ||
const formatYear = format('%Y'); | ||
|
||
const { | ||
hasMillisecond, | ||
hasSecond, | ||
hasMinute, | ||
hasHour, | ||
isNotFirstDayOfMonth, | ||
isNotFirstMonth, | ||
} = useLocalTime ? localTimeUtils : utcUtils; | ||
|
||
let formatFunc = formatYear; | ||
values.forEach((value: any) => { | ||
if (formatFunc === formatYear && isNotFirstMonth(value)) { | ||
formatFunc = formatMonth; | ||
} | ||
if (formatFunc === formatMonth && isNotFirstDayOfMonth(value)) { | ||
formatFunc = formatDay; | ||
} | ||
if (formatFunc === formatDay && hasHour(value)) { | ||
formatFunc = formatHour; | ||
} | ||
if (formatFunc === formatHour && hasMinute(value)) { | ||
formatFunc = formatMinute; | ||
} | ||
if (formatFunc === formatMinute && hasSecond(value)) { | ||
formatFunc = formatSecond; | ||
} | ||
if (formatFunc === formatSecond && hasMillisecond(value)) { | ||
formatFunc = formatMillisecond; | ||
} | ||
}); | ||
|
||
return new TimeFormatter({ | ||
description: | ||
'Use the finest grain in an array of dates to format all dates in the array', | ||
formatFunc, | ||
id: 'finest_temporal_grain', | ||
label: 'Format temporal columns with the finest grain', | ||
useLocalTime, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
superset-frontend/packages/superset-ui-core/src/validator/validateMaxValue.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { t } from '../translation'; | ||
|
||
export default function validateMaxValue(v: unknown, max: Number) { | ||
if (Number(v) > +max) { | ||
return t('Value cannot exceed %s', max); | ||
} | ||
return false; | ||
} |
38 changes: 38 additions & 0 deletions
38
superset-frontend/packages/superset-ui-core/test/validator/validateMaxValue.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import { validateMaxValue } from '@superset-ui/core'; | ||
import './setup'; | ||
|
||
describe('validateInteger()', () => { | ||
it('returns the warning message if invalid', () => { | ||
expect(validateMaxValue(10.1, 10)).toBeTruthy(); | ||
expect(validateMaxValue(1, 0)).toBeTruthy(); | ||
expect(validateMaxValue('2', 1)).toBeTruthy(); | ||
}); | ||
it('returns false if the input is valid', () => { | ||
expect(validateMaxValue(0, 1)).toBeFalsy(); | ||
expect(validateMaxValue(10, 10)).toBeFalsy(); | ||
expect(validateMaxValue(undefined, 1)).toBeFalsy(); | ||
expect(validateMaxValue(NaN, NaN)).toBeFalsy(); | ||
expect(validateMaxValue(null, 1)).toBeFalsy(); | ||
expect(validateMaxValue('1', 1)).toBeFalsy(); | ||
expect(validateMaxValue('a', 1)).toBeFalsy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.