You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/01/27 14:40:02 UTC
[GitHub] [superset] zhaoyongjie opened a new pull request #12793: fix(explore): time picker can not be switched between now and specific
zhaoyongjie opened a new pull request #12793:
URL: https://github.com/apache/superset/pull/12793
### SUMMARY
<!--- Describe the change below, including rationale and design decisions -->
fix time picker can not be switched between "now" and "specific".
closes: https://github.com/apache/superset/issues/12780
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### fixed
https://user-images.githubusercontent.com/2016594/106006571-53d7c800-60f0-11eb-8c90-cef3aa216846.mp4
### TEST PLAN
<!--- What steps should be taken to verify the changes -->
1. open new timepicker
2. switch to custom frame
3. select "now"(or "midnight") for start(or "end")
4. able to switch to "specific date/time"
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [x] Has associated issue: https://github.com/apache/superset/issues/12780
- [ ] Changes UI
- [ ] Requires DB Migration.
- [ ] Confirm DB Migration upgrade and downgrade tested.
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (152f7c2) into [master](https://codecov.io/gh/apache/superset/commit/ab741d7218398353310e0ea0d1b1b296ee79b5fa?el=desc) (ab741d7) will **decrease** coverage by `3.50%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.89% 63.38% -3.51%
==========================================
Files 1021 488 -533
Lines 50015 30140 -19875
Branches 4907 0 -4907
==========================================
- Hits 33456 19105 -14351
+ Misses 16434 11035 -5399
+ Partials 125 0 -125
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `?` | |
| python | `63.38% <ø> (-0.71%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
| [superset/views/database/views.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2Uvdmlld3MucHk=) | `62.50% <0.00%> (-25.07%)` | :arrow_down: |
| [superset/utils/cache.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdXRpbHMvY2FjaGUucHk=) | `76.34% <0.00%> (-8.77%)` | :arrow_down: |
| [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `83.67% <0.00%> (-8.17%)` | :arrow_down: |
| [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
| [superset/sql\_validators/base.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvYmFzZS5weQ==) | `93.33% <0.00%> (-6.67%)` | :arrow_down: |
| [superset/db\_engine\_specs/base.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2Jhc2UucHk=) | `79.59% <0.00%> (-6.38%)` | :arrow_down: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `82.25% <0.00%> (-6.28%)` | :arrow_down: |
| [superset/db\_engine\_specs/sqlite.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3NxbGl0ZS5weQ==) | `90.62% <0.00%> (-6.25%)` | :arrow_down: |
| [superset/views/database/forms.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvZm9ybXMucHk=) | `83.33% <0.00%> (-5.56%)` | :arrow_down: |
| ... and [547 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [ab741d7...152f7c2](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] villebro commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
villebro commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565505979
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts
##########
@@ -183,31 +197,27 @@ export const customTimeRangeEncode = (customRange: CustomRangeType): string => {
} = { ...customRange };
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
- const since = sinceMode === 'specific' ? sinceDatetime : sinceMode;
- const until = untilMode === 'specific' ? untilDatetime : untilMode;
+ const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
Review comment:
I guess this comes down to personal preference (these lines are easier to read as one-liners, but the linter wants to break them up). I've personally come to appreciate uniformity over legibility. I'd vote for removing the `eslint-disable-line`s here and fixing the linting errors.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (8142a86) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `15.95%`.
> The diff coverage is `16.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
===========================================
- Coverage 66.86% 50.91% -15.96%
===========================================
Files 1022 477 -545
Lines 50107 17161 -32946
Branches 5193 4440 -753
===========================================
- Hits 33506 8738 -24768
+ Misses 16470 8423 -8047
+ Partials 131 0 -131
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `50.91% <16.66%> (-0.01%)` | :arrow_down: |
| javascript | `?` | |
| python | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `32.55% <ø> (-6.73%)` | :arrow_down: |
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `43.24% <16.66%> (-4.59%)` | :arrow_down: |
| [...uperset-frontend/src/dashboard/util/dnd-reorder.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2RuZC1yZW9yZGVyLmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...rset-frontend/src/dashboard/util/getEmptyLayout.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEVtcHR5TGF5b3V0Lmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/resizable/ResizableHandle.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL3Jlc2l6YWJsZS9SZXNpemFibGVIYW5kbGUuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/nativeFilters/ScopingTree.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvU2NvcGluZ1RyZWUudHN4) | `6.25% <0.00%> (-93.75%)` | :arrow_down: |
| [.../src/dashboard/util/getFilterScopeFromNodesTree.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEZpbHRlclNjb3BlRnJvbU5vZGVzVHJlZS5qcw==) | `0.00% <0.00%> (-93.48%)` | :arrow_down: |
| [...set-frontend/src/views/CRUD/alert/ExecutionLog.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvYWxlcnQvRXhlY3V0aW9uTG9nLnRzeA==) | `11.76% <0.00%> (-88.24%)` | :arrow_down: |
| [...src/dashboard/components/gridComponents/Header.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0hlYWRlci5qc3g=) | `10.52% <0.00%> (-86.85%)` | :arrow_down: |
| ... and [879 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...8142a86](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `3.84%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 63.02% -3.85%
==========================================
Files 1022 1021 -1
Lines 50107 50059 -48
Branches 5193 5190 -3
==========================================
- Hits 33506 31548 -1958
- Misses 16470 18297 +1827
- Partials 131 214 +83
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `63.69% <ø> (-0.16%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `89.74% <85.71%> (+41.91%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `14.28% <100.00%> (-25.00%)` | :arrow_down: |
| [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvQXBwLmpzeA==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/dashboard/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/reducers/index.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvcmVkdWNlcnMvaW5kZXguanM=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/dashboard/containers/Dashboard.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL0Rhc2hib2FyZC5qc3g=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/filters/components/Select/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2ZpbHRlcnMvY29tcG9uZW50cy9TZWxlY3QvdHlwZXMudHM=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...t-frontend/src/dashboard/containers/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL1NsaWNlQWRkZXIuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [199 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] adam-stasiak commented on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
adam-stasiak commented on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768385152
Tested manually works fine 🟢
Tested on chrome,safari,firefox - ok
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `3.87%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 62.99% -3.88%
==========================================
Files 1022 1021 -1
Lines 50107 50059 -48
Branches 5193 5190 -3
==========================================
- Hits 33506 31534 -1972
- Misses 16470 18311 +1841
- Partials 131 214 +83
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `63.64% <ø> (-0.20%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `89.74% <85.71%> (+41.91%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `14.28% <100.00%> (-25.00%)` | :arrow_down: |
| [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvQXBwLmpzeA==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/dashboard/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/reducers/index.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvcmVkdWNlcnMvaW5kZXguanM=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/dashboard/containers/Dashboard.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL0Rhc2hib2FyZC5qc3g=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/filters/components/Select/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2ZpbHRlcnMvY29tcG9uZW50cy9TZWxlY3QvdHlwZXMudHM=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...t-frontend/src/dashboard/containers/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL1NsaWNlQWRkZXIuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [203 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565837313
##########
File path: superset-frontend/spec/javascripts/explore/components/DateFilterControl/utils_spec.ts
##########
@@ -0,0 +1,339 @@
+/**
+ * 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 {
+ customTimeRangeEncode,
+ customTimeRangeDecode,
+} from 'src/explore/components/controls/DateFilterControl/utils';
+
+describe('Custom TimeRange', () => {
+ describe('customTimeRangeEncode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('2) specific : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('2021-01-20T00:00:00 : 2021-01-27T00:00:00');
+ });
+
+ it('3) specific : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ '2021-01-20T00:00:00 : DATEADD(DATETIME("2021-01-20T00:00:00"), 7, day)',
+ );
+ });
+
+ it('4) now : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'now',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('now : DATEADD(DATETIME("now"), 7, day)');
+ });
+
+ it('5) today : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'today',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('today : DATEADD(DATETIME("today"), 7, day)');
+ });
+
+ it('6) relative : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('7) relative : now', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'now',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("now"), -7, day) : now');
+ });
+
+ it('8) relative : today', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'today',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("today"), -7, day) : today');
+ });
+
+ it('9) relative : relative (now)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("now"), -7, day) : DATEADD(DATETIME("now"), 7, day)',
+ );
+ });
+
+ it('10) relative : relative (date/time)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'specific',
+ anchorValue: '2021-01-27T00:00:00',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
+ );
+ });
+ });
+
+ describe('customTimeRangeDecode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeDecode(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ ),
+ ).toEqual({
+ customRange: {
+ sinceDatetime: '2021-01-20T00:00:00',
Review comment:

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565779827
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts
##########
@@ -183,31 +197,27 @@ export const customTimeRangeEncode = (customRange: CustomRangeType): string => {
} = { ...customRange };
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
- const since = sinceMode === 'specific' ? sinceDatetime : sinceMode;
- const until = untilMode === 'specific' ? untilDatetime : untilMode;
+ const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
Review comment:
glad to follow to linting rules and make the change, however, I still believe breaking the lines is unnecessary. It makes it harder to read this code, especially in the case where we want to compare since and until side by side.
but I am still willing to follow everyone's conventions.
### ⇓ disable linting
```ts
...
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
const until = untilMode === 'specific' ? dttmToString(untilDatetime) : untilMode; // eslint-disable-line
return `${since} : ${until}`;
}
// specific : relative
if (SPECIFIC_MODE.includes(sinceMode) && untilMode === 'relative') {
const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
const until = `DATEADD(DATETIME("${since}"), ${untilGrainValue}, ${untilGrain})`; // eslint-disable-line
return `${since} : ${until}`;
}
// relative : specific
if (sinceMode === 'relative' && SPECIFIC_MODE.includes(untilMode)) {
const until = untilMode === 'specific' ? dttmToString(untilDatetime) : untilMode; // eslint-disable-line
const since = `DATEADD(DATETIME("${until}"), ${-Math.abs(sinceGrainValue)}, ${sinceGrain})`; // eslint-disable-line
return `${since} : ${until}`;
}
// relative : relative
const since = `DATEADD(DATETIME("${anchorValue}"), ${-Math.abs(sinceGrainValue)}, ${sinceGrain})`; // eslint-disable-line
const until = `DATEADD(DATETIME("${anchorValue}"), ${untilGrainValue}, ${untilGrain})`;
return `${since} : ${until}`;
...
```
### ⇓ enable linting
```ts
...
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
const since =
sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode;
const until =
untilMode === 'specific' ? dttmToString(untilDatetime) : untilMode;
return `${since} : ${until}`;
}
// specific : relative
if (SPECIFIC_MODE.includes(sinceMode) && untilMode === 'relative') {
const since =
sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode;
const until = `DATEADD(DATETIME("${since}"), ${untilGrainValue}, ${untilGrain})`;
return `${since} : ${until}`;
}
// relative : specific
if (sinceMode === 'relative' && SPECIFIC_MODE.includes(untilMode)) {
const until =
untilMode === 'specific' ? dttmToString(untilDatetime) : untilMode;
const since = `DATEADD(DATETIME("${until}"), ${-Math.abs(
sinceGrainValue,
)}, ${sinceGrain})`;
return `${since} : ${until}`;
}
// relative : relative
const since = `DATEADD(DATETIME("${anchorValue}"), ${-Math.abs(
sinceGrainValue,
)}, ${sinceGrain})`;
const until = `DATEADD(DATETIME("${anchorValue}"), ${untilGrainValue}, ${untilGrain})`;
return `${since} : ${until}`;
...
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565367179
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts
##########
@@ -183,31 +197,27 @@ export const customTimeRangeEncode = (customRange: CustomRangeType): string => {
} = { ...customRange };
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
- const since = sinceMode === 'specific' ? sinceDatetime : sinceMode;
- const until = untilMode === 'specific' ? untilDatetime : untilMode;
+ const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
Review comment:
from "now/midnight" switch to "specific", "since" requires materialization from "now" to "YYYY-mm-ddThh:mm:ss".
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] ktmud commented on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
ktmud commented on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768793230
BTW, I found this line: https://github.com/apache/superset/blob/6731cd0be6852c890a5e856e79470d08eb760437/superset-frontend/src/explore/components/controls/DateFilterControl/types.ts#L60
could probably be updated to
```
untilMode: DateTimeModeType;
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] etr2460 commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
etr2460 commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565485422
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts
##########
@@ -183,31 +197,27 @@ export const customTimeRangeEncode = (customRange: CustomRangeType): string => {
} = { ...customRange };
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
- const since = sinceMode === 'specific' ? sinceDatetime : sinceMode;
- const until = untilMode === 'specific' ? untilDatetime : untilMode;
+ const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
Review comment:
Why do all of these lines have `eslint-disable-line` on them? Can we either not introduce linting errors, or only disable the specific rule that's failing here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768858223
> BTW, I found this line:
>
> https://github.com/apache/superset/blob/6731cd0be6852c890a5e856e79470d08eb760437/superset-frontend/src/explore/components/controls/DateFilterControl/types.ts#L60
>
> could probably be updated to
>
> ```
> untilMode: DateTimeModeType;
> ```
thanks for pointing this out. I will fix it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565849840
##########
File path: superset-frontend/spec/javascripts/explore/components/DateFilterControl/utils_spec.ts
##########
@@ -0,0 +1,339 @@
+/**
+ * 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 {
+ customTimeRangeEncode,
+ customTimeRangeDecode,
+} from 'src/explore/components/controls/DateFilterControl/utils';
+
+describe('Custom TimeRange', () => {
+ describe('customTimeRangeEncode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('2) specific : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('2021-01-20T00:00:00 : 2021-01-27T00:00:00');
+ });
+
+ it('3) specific : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ '2021-01-20T00:00:00 : DATEADD(DATETIME("2021-01-20T00:00:00"), 7, day)',
+ );
+ });
+
+ it('4) now : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'now',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('now : DATEADD(DATETIME("now"), 7, day)');
+ });
+
+ it('5) today : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'today',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('today : DATEADD(DATETIME("today"), 7, day)');
+ });
+
+ it('6) relative : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('7) relative : now', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'now',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("now"), -7, day) : now');
+ });
+
+ it('8) relative : today', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'today',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("today"), -7, day) : today');
+ });
+
+ it('9) relative : relative (now)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("now"), -7, day) : DATEADD(DATETIME("now"), 7, day)',
+ );
+ });
+
+ it('10) relative : relative (date/time)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'specific',
+ anchorValue: '2021-01-27T00:00:00',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
+ );
+ });
+ });
+
+ describe('customTimeRangeDecode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeDecode(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ ),
+ ).toEqual({
+ customRange: {
+ sinceDatetime: '2021-01-20T00:00:00',
Review comment:
`sinceDatetime` set to `2021-01-27T00:00:00` just to be more consistent in CustomFrame.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `0.01%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 66.85% -0.02%
==========================================
Files 1022 1021 -1
Lines 50107 50095 -12
Branches 5193 5190 -3
==========================================
- Hits 33506 33492 -14
+ Misses 16470 16469 -1
- Partials 131 134 +3
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `50.86% <16.66%> (-0.05%)` | :arrow_down: |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `63.72% <ø> (-0.12%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `93.58% <85.71%> (+45.76%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `40.81% <100.00%> (+1.53%)` | :arrow_up: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `81.38% <0.00%> (-7.15%)` | :arrow_down: |
| [...frontend/src/explore/components/OptionControls.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9PcHRpb25Db250cm9scy50c3g=) | `74.07% <0.00%> (-2.12%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `80.70% <0.00%> (-1.76%)` | :arrow_down: |
| [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `92.06% <0.00%> (-1.59%)` | :arrow_down: |
| [superset/models/core.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2NvcmUucHk=) | `88.04% <0.00%> (-0.55%)` | :arrow_down: |
| [...tend/src/dashboard/components/DashboardBuilder.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL0Rhc2hib2FyZEJ1aWxkZXIuanN4) | `85.89% <0.00%> (-0.53%)` | :arrow_down: |
| [superset-frontend/src/explore/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvQXBwLmpzeA==) | `100.00% <0.00%> (ø)` | |
| ... and [6 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io commented on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (7d5f826) into [master](https://codecov.io/gh/apache/superset/commit/ab741d7218398353310e0ea0d1b1b296ee79b5fa?el=desc) (ab741d7) will **decrease** coverage by `3.48%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.89% 63.40% -3.49%
==========================================
Files 1021 488 -533
Lines 50015 30115 -19900
Branches 4907 0 -4907
==========================================
- Hits 33456 19095 -14361
+ Misses 16434 11020 -5414
+ Partials 125 0 -125
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `?` | |
| python | `63.40% <ø> (-0.69%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-85.72%)` | :arrow_down: |
| [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
| [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `73.84% <0.00%> (-17.31%)` | :arrow_down: |
| [superset/databases/commands/create.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `83.67% <0.00%> (-8.17%)` | :arrow_down: |
| [superset/databases/commands/update.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `85.71% <0.00%> (-8.17%)` | :arrow_down: |
| [superset/connectors/sqla/models.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvY29ubmVjdG9ycy9zcWxhL21vZGVscy5weQ==) | `84.31% <0.00%> (-6.28%)` | :arrow_down: |
| [superset/db\_engine\_specs/sqlite.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3NxbGl0ZS5weQ==) | `90.62% <0.00%> (-6.25%)` | :arrow_down: |
| [superset/databases/commands/test\_connection.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGF0YWJhc2VzL2NvbW1hbmRzL3Rlc3RfY29ubmVjdGlvbi5weQ==) | `84.78% <0.00%> (-4.35%)` | :arrow_down: |
| [superset/utils/celery.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdXRpbHMvY2VsZXJ5LnB5) | `96.42% <0.00%> (-3.58%)` | :arrow_down: |
| [superset/models/core.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2NvcmUucHk=) | `85.59% <0.00%> (-3.27%)` | :arrow_down: |
| ... and [541 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [ab741d7...7d5f826](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] ktmud commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
ktmud commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565823446
##########
File path: superset-frontend/spec/javascripts/explore/components/DateFilterControl/utils_spec.ts
##########
@@ -0,0 +1,339 @@
+/**
+ * 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 {
+ customTimeRangeEncode,
+ customTimeRangeDecode,
+} from 'src/explore/components/controls/DateFilterControl/utils';
+
+describe('Custom TimeRange', () => {
+ describe('customTimeRangeEncode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('2) specific : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('2021-01-20T00:00:00 : 2021-01-27T00:00:00');
+ });
+
+ it('3) specific : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ '2021-01-20T00:00:00 : DATEADD(DATETIME("2021-01-20T00:00:00"), 7, day)',
+ );
+ });
+
+ it('4) now : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'now',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('now : DATEADD(DATETIME("now"), 7, day)');
+ });
+
+ it('5) today : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'today',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('today : DATEADD(DATETIME("today"), 7, day)');
+ });
+
+ it('6) relative : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('7) relative : now', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'now',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("now"), -7, day) : now');
+ });
+
+ it('8) relative : today', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'today',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("today"), -7, day) : today');
+ });
+
+ it('9) relative : relative (now)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("now"), -7, day) : DATEADD(DATETIME("now"), 7, day)',
+ );
+ });
+
+ it('10) relative : relative (date/time)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'specific',
+ anchorValue: '2021-01-27T00:00:00',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
+ );
+ });
+ });
+
+ describe('customTimeRangeDecode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeDecode(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ ),
+ ).toEqual({
+ customRange: {
+ sinceDatetime: '2021-01-20T00:00:00',
Review comment:
I'm not sure I fully understand the purpose of the `customTimeRangeDecode` function. It is supposed to apply the `dateadd` and `datetime` functions? However, [according to the code](https://github.com/apache/superset/blob/5d816a6e75a77c426b8ce3e5a3bf3a00043439b8/superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts#L118), this `sinceDatetime` seems to always return `7_DAYS_AGO` when the input format is `relative : specific`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (3c5e024) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `3.14%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 63.72% -3.15%
==========================================
Files 1022 488 -534
Lines 50107 30145 -19962
Branches 5193 0 -5193
==========================================
- Hits 33506 19210 -14296
+ Misses 16470 10935 -5535
+ Partials 131 0 -131
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `?` | |
| python | `63.72% <ø> (-0.12%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `81.38% <0.00%> (-7.15%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `80.70% <0.00%> (-1.76%)` | :arrow_down: |
| [superset/models/core.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2NvcmUucHk=) | `88.04% <0.00%> (-0.55%)` | :arrow_down: |
| [...ntend/src/components/FacePile/FacePile.stories.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvRmFjZVBpbGUvRmFjZVBpbGUuc3Rvcmllcy50c3g=) | | |
| [...end/src/dashboard/util/findFirstParentContainer.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2ZpbmRGaXJzdFBhcmVudENvbnRhaW5lci5qcw==) | | |
| [.../controls/MetricControl/AdhocMetricEditPopover.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9NZXRyaWNDb250cm9sL0FkaG9jTWV0cmljRWRpdFBvcG92ZXIuanN4) | | |
| [superset-frontend/src/views/CRUD/hooks.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvaG9va3MudHM=) | | |
| [...erset-frontend/src/common/hooks/useChangeEffect.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbW1vbi9ob29rcy91c2VDaGFuZ2VFZmZlY3QudHM=) | | |
| [...d/src/dashboard/components/gridComponents/Tabs.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL1RhYnMuanN4) | | |
| [superset-frontend/src/components/OmniContainer.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvT21uaUNvbnRhaW5lci5qc3g=) | | |
| ... and [524 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...8142a86](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] ktmud commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
ktmud commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565842785
##########
File path: superset-frontend/spec/javascripts/explore/components/DateFilterControl/utils_spec.ts
##########
@@ -0,0 +1,339 @@
+/**
+ * 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 {
+ customTimeRangeEncode,
+ customTimeRangeDecode,
+} from 'src/explore/components/controls/DateFilterControl/utils';
+
+describe('Custom TimeRange', () => {
+ describe('customTimeRangeEncode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('2) specific : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('2021-01-20T00:00:00 : 2021-01-27T00:00:00');
+ });
+
+ it('3) specific : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ '2021-01-20T00:00:00 : DATEADD(DATETIME("2021-01-20T00:00:00"), 7, day)',
+ );
+ });
+
+ it('4) now : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'now',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('now : DATEADD(DATETIME("now"), 7, day)');
+ });
+
+ it('5) today : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'today',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('today : DATEADD(DATETIME("today"), 7, day)');
+ });
+
+ it('6) relative : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('7) relative : now', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'now',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("now"), -7, day) : now');
+ });
+
+ it('8) relative : today', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'today',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("today"), -7, day) : today');
+ });
+
+ it('9) relative : relative (now)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("now"), -7, day) : DATEADD(DATETIME("now"), 7, day)',
+ );
+ });
+
+ it('10) relative : relative (date/time)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'specific',
+ anchorValue: '2021-01-27T00:00:00',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
+ );
+ });
+ });
+
+ describe('customTimeRangeDecode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeDecode(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ ),
+ ).toEqual({
+ customRange: {
+ sinceDatetime: '2021-01-20T00:00:00',
Review comment:
Then shouldn't `sinceDatetime` be set to `2021-01-27T00:00:00` here, just to be more consistent with what is set in the input values?
Do you also do decode/encode when switching between non-advanced modes (i.e. modes that doesn't allow free text)? Not sure how feasible it is, but gut feeling tells me that it might be easier and cleaner to use he same config object internally for all frames and only do decode/encode when the time picker needs to communicate with the outside world.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768758148
> LGTM, but I'd prefer to reformat according to the linter's preference.
I removed `eslint-disable-line` and fix this linting issue.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `3.82%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 63.04% -3.83%
==========================================
Files 1022 1021 -1
Lines 50107 50074 -33
Branches 5193 5190 -3
==========================================
- Hits 33506 31567 -1939
- Misses 16470 18293 +1823
- Partials 131 214 +83
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `63.72% <ø> (-0.12%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `89.74% <85.71%> (+41.91%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `14.28% <100.00%> (-25.00%)` | :arrow_down: |
| [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvQXBwLmpzeA==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/dashboard/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/reducers/index.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvcmVkdWNlcnMvaW5kZXguanM=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/dashboard/containers/Dashboard.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL0Rhc2hib2FyZC5qc3g=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/filters/components/Select/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2ZpbHRlcnMvY29tcG9uZW50cy9TZWxlY3QvdHlwZXMudHM=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...t-frontend/src/dashboard/containers/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL1NsaWNlQWRkZXIuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [188 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **increase** coverage by `0.13%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
+ Coverage 66.86% 67.00% +0.13%
==========================================
Files 1022 1021 -1
Lines 50107 50095 -12
Branches 5193 5190 -3
==========================================
+ Hits 33506 33568 +62
+ Misses 16470 16393 -77
- Partials 131 134 +3
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `50.86% <16.66%> (-0.05%)` | :arrow_down: |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `63.97% <ø> (+0.13%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `93.58% <85.71%> (+45.76%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `40.81% <100.00%> (+1.53%)` | :arrow_up: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `82.25% <0.00%> (-6.28%)` | :arrow_down: |
| [...frontend/src/explore/components/OptionControls.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9PcHRpb25Db250cm9scy50c3g=) | `74.07% <0.00%> (-2.12%)` | :arrow_down: |
| [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `92.06% <0.00%> (-1.59%)` | :arrow_down: |
| [...tend/src/dashboard/components/DashboardBuilder.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL0Rhc2hib2FyZEJ1aWxkZXIuanN4) | `85.89% <0.00%> (-0.53%)` | :arrow_down: |
| [superset/models/core.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2NvcmUucHk=) | `88.58% <0.00%> (ø)` | |
| [superset-frontend/src/explore/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvQXBwLmpzeA==) | `100.00% <0.00%> (ø)` | |
| [superset-frontend/src/dashboard/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9BcHAuanN4) | `100.00% <0.00%> (ø)` | |
| ... and [7 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `0.01%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 66.85% -0.02%
==========================================
Files 1022 1021 -1
Lines 50107 50095 -12
Branches 5193 5190 -3
==========================================
- Hits 33506 33492 -14
+ Misses 16470 16469 -1
- Partials 131 134 +3
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `50.86% <16.66%> (-0.05%)` | :arrow_down: |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `63.72% <ø> (-0.12%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `93.58% <85.71%> (+45.76%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `40.81% <100.00%> (+1.53%)` | :arrow_up: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `81.38% <0.00%> (-7.15%)` | :arrow_down: |
| [...frontend/src/explore/components/OptionControls.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9PcHRpb25Db250cm9scy50c3g=) | `74.07% <0.00%> (-2.12%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `80.70% <0.00%> (-1.76%)` | :arrow_down: |
| [...set-frontend/src/dashboard/util/getDropPosition.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldERyb3BQb3NpdGlvbi5qcw==) | `92.06% <0.00%> (-1.59%)` | :arrow_down: |
| [superset/models/core.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvbW9kZWxzL2NvcmUucHk=) | `88.04% <0.00%> (-0.55%)` | :arrow_down: |
| [...tend/src/dashboard/components/DashboardBuilder.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL0Rhc2hib2FyZEJ1aWxkZXIuanN4) | `85.89% <0.00%> (-0.53%)` | :arrow_down: |
| [superset-frontend/src/explore/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvQXBwLmpzeA==) | `100.00% <0.00%> (ø)` | |
| ... and [6 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (8142a86) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `8.01%`.
> The diff coverage is `16.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 58.85% -8.02%
==========================================
Files 1022 965 -57
Lines 50107 47304 -2803
Branches 5193 4440 -753
==========================================
- Hits 33506 27841 -5665
- Misses 16470 19463 +2993
+ Partials 131 0 -131
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `50.91% <16.66%> (-0.01%)` | :arrow_down: |
| javascript | `?` | |
| python | `63.37% <ø> (-0.48%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `32.55% <ø> (-6.73%)` | :arrow_down: |
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `43.24% <16.66%> (-4.59%)` | :arrow_down: |
| [...uperset-frontend/src/dashboard/util/dnd-reorder.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2RuZC1yZW9yZGVyLmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...rset-frontend/src/dashboard/util/getEmptyLayout.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEVtcHR5TGF5b3V0Lmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/resizable/ResizableHandle.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL3Jlc2l6YWJsZS9SZXNpemFibGVIYW5kbGUuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/nativeFilters/ScopingTree.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvU2NvcGluZ1RyZWUudHN4) | `6.25% <0.00%> (-93.75%)` | :arrow_down: |
| [.../src/dashboard/util/getFilterScopeFromNodesTree.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEZpbHRlclNjb3BlRnJvbU5vZGVzVHJlZS5qcw==) | `0.00% <0.00%> (-93.48%)` | :arrow_down: |
| [...set-frontend/src/views/CRUD/alert/ExecutionLog.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvYWxlcnQvRXhlY3V0aW9uTG9nLnRzeA==) | `11.76% <0.00%> (-88.24%)` | :arrow_down: |
| [...src/dashboard/components/gridComponents/Header.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0hlYWRlci5qc3g=) | `10.52% <0.00%> (-86.85%)` | :arrow_down: |
| ... and [414 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...8142a86](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] ktmud commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
ktmud commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565863097
##########
File path: superset-frontend/spec/javascripts/explore/components/DateFilterControl/utils_spec.ts
##########
@@ -0,0 +1,339 @@
+/**
+ * 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 {
+ customTimeRangeEncode,
+ customTimeRangeDecode,
+} from 'src/explore/components/controls/DateFilterControl/utils';
+
+describe('Custom TimeRange', () => {
+ describe('customTimeRangeEncode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('2) specific : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('2021-01-20T00:00:00 : 2021-01-27T00:00:00');
+ });
+
+ it('3) specific : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ '2021-01-20T00:00:00 : DATEADD(DATETIME("2021-01-20T00:00:00"), 7, day)',
+ );
+ });
+
+ it('4) now : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'now',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('now : DATEADD(DATETIME("now"), 7, day)');
+ });
+
+ it('5) today : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'today',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('today : DATEADD(DATETIME("today"), 7, day)');
+ });
+
+ it('6) relative : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('7) relative : now', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'now',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("now"), -7, day) : now');
+ });
+
+ it('8) relative : today', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'today',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("today"), -7, day) : today');
+ });
+
+ it('9) relative : relative (now)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("now"), -7, day) : DATEADD(DATETIME("now"), 7, day)',
+ );
+ });
+
+ it('10) relative : relative (date/time)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'specific',
+ anchorValue: '2021-01-27T00:00:00',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
+ );
+ });
+ });
+
+ describe('customTimeRangeDecode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeDecode(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ ),
+ ).toEqual({
+ customRange: {
+ sinceDatetime: '2021-01-20T00:00:00',
Review comment:
Thanks for the explanation.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `1.12%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 65.74% -1.13%
==========================================
Files 1022 1021 -1
Lines 50107 50094 -13
Branches 5193 5190 -3
==========================================
- Hits 33506 32933 -573
- Misses 16470 17004 +534
- Partials 131 157 +26
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `46.63% <16.66%> (-4.29%)` | :arrow_down: |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `63.72% <ø> (-0.12%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `93.58% <85.71%> (+45.76%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `40.81% <100.00%> (+1.53%)` | :arrow_up: |
| [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/dashboard/actions/dashboardInfo.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9hY3Rpb25zL2Rhc2hib2FyZEluZm8uanM=) | `33.33% <0.00%> (-66.67%)` | :arrow_down: |
| [...et-frontend/src/dashboard/components/SaveModal.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL1NhdmVNb2RhbC50c3g=) | `19.23% <0.00%> (-61.54%)` | :arrow_down: |
| [...ontend/src/dashboard/util/serializeFilterScopes.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL3NlcmlhbGl6ZUZpbHRlclNjb3Blcy5qcw==) | `40.00% <0.00%> (-60.00%)` | :arrow_down: |
| [...rc/explore/components/controls/AnnotationLayer.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9Bbm5vdGF0aW9uTGF5ZXIuanN4) | `2.34% <0.00%> (-48.83%)` | :arrow_down: |
| [...hboard/components/filterscope/FilterScopeModal.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2ZpbHRlcnNjb3BlL0ZpbHRlclNjb3BlTW9kYWwudHN4) | `31.25% <0.00%> (-43.75%)` | :arrow_down: |
| [...ore/components/controls/AnnotationLayerControl.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9Bbm5vdGF0aW9uTGF5ZXJDb250cm9sLmpzeA==) | `42.85% <0.00%> (-38.58%)` | :arrow_down: |
| ... and [70 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] ktmud commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
ktmud commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565811586
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts
##########
@@ -60,6 +61,19 @@ const defaultCustomRange: CustomRangeType = {
};
const SPECIFIC_MODE = ['specific', 'today', 'now'];
+export const dttmToMoment = (dttm: string): Moment => {
+ if (dttm === 'now') {
+ return moment().utc().startOf('second');
+ }
+ if (dttm === 'today') {
+ return moment().utc().startOf('day');
+ }
+ return moment(dttm);
+};
+
+export const dttmToString = (dttm: string): string =>
+ dttmToMoment(dttm).format(MOMENT_FORMAT);
+
export const customTimeRangeDecode = (
Review comment:
Style nit: can we break `utils.ts` into separate files under a `utils` folder? These functions are complex enough to warrant a separate file.
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts
##########
@@ -183,31 +197,27 @@ export const customTimeRangeEncode = (customRange: CustomRangeType): string => {
} = { ...customRange };
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
- const since = sinceMode === 'specific' ? sinceDatetime : sinceMode;
- const until = untilMode === 'specific' ? untilDatetime : untilMode;
+ const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
Review comment:
```ts
export const customTimeRangeEncode = (customRange: CustomRangeType): string => {
const {
sinceDatetime,
sinceMode,
sinceGrain,
sinceGrainValue,
untilDatetime,
untilMode,
untilGrain,
untilGrainValue,
anchorValue,
} = { ...customRange };
let since: string = sinceMode;
let until: string = untilMode;
if (since === 'specific') {
since = dttmToString(sinceDatetime);
}
if (until === 'specific') {
until = dttmToString(untilDatetime);
}
if (since === 'relative' && until === 'relative') {
since = `DATEADD(DATETIME("${anchorValue}"), ${-Math.abs(
sinceGrainValue,
)}, ${sinceGrain})`;
until = `DATEADD(DATETIME("${anchorValue}"), ${untilGrainValue}, ${untilGrain})`;
}
if (since === 'relative') {
since = `DATEADD(DATETIME("${until}"), ${-Math.abs(
sinceGrainValue,
)}, ${sinceGrain})`;
}
if (until === 'relative') {
until = `DATEADD(DATETIME("${since}"), ${untilGrainValue}, ${untilGrain})`;
}
return `${since} : ${until}`;
};
```
@zhaoyongjie would this be cleaner? It passes all your test cases.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565361964
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/frame/CustomFrame.tsx
##########
@@ -36,23 +36,17 @@ import {
MOMENT_FORMAT,
MIDNIGHT,
} from '../constants';
-import { customTimeRangeDecode, customTimeRangeEncode } from '../utils';
+import {
+ customTimeRangeDecode,
+ customTimeRangeEncode,
+ dttmToMoment,
+} from '../utils';
import {
CustomRangeKey,
SelectOptionType,
FrameComponentProps,
} from '../types';
-const dttmToMoment = (dttm: string): Moment => {
Review comment:
move these to utils.js
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565849323
##########
File path: superset-frontend/spec/javascripts/explore/components/DateFilterControl/utils_spec.ts
##########
@@ -0,0 +1,339 @@
+/**
+ * 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 {
+ customTimeRangeEncode,
+ customTimeRangeDecode,
+} from 'src/explore/components/controls/DateFilterControl/utils';
+
+describe('Custom TimeRange', () => {
+ describe('customTimeRangeEncode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('2) specific : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('2021-01-20T00:00:00 : 2021-01-27T00:00:00');
+ });
+
+ it('3) specific : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ '2021-01-20T00:00:00 : DATEADD(DATETIME("2021-01-20T00:00:00"), 7, day)',
+ );
+ });
+
+ it('4) now : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'now',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('now : DATEADD(DATETIME("now"), 7, day)');
+ });
+
+ it('5) today : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'today',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('today : DATEADD(DATETIME("today"), 7, day)');
+ });
+
+ it('6) relative : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('7) relative : now', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'now',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("now"), -7, day) : now');
+ });
+
+ it('8) relative : today', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'today',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("today"), -7, day) : today');
+ });
+
+ it('9) relative : relative (now)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("now"), -7, day) : DATEADD(DATETIME("now"), 7, day)',
+ );
+ });
+
+ it('10) relative : relative (date/time)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'specific',
+ anchorValue: '2021-01-27T00:00:00',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
+ );
+ });
+ });
+
+ describe('customTimeRangeDecode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeDecode(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ ),
+ ).toEqual({
+ customRange: {
+ sinceDatetime: '2021-01-20T00:00:00',
Review comment:
- `customTimeRangeEncode` is used only in the CustomFrame.
- `customTimeRangeDecode` is used in 2 places: CustomFrame and guessFrame function in DateFilterControl.
customTimeRangeDecode can determine whether an expression can be used in CustomFrame.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `0.09%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 66.77% -0.10%
==========================================
Files 1022 1021 -1
Lines 50107 50095 -12
Branches 5193 5190 -3
==========================================
- Hits 33506 33449 -57
- Misses 16470 16508 +38
- Partials 131 138 +7
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `50.49% <16.66%> (-0.43%)` | :arrow_down: |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `63.72% <ø> (-0.12%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `93.58% <85.71%> (+45.76%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `40.81% <100.00%> (+1.53%)` | :arrow_up: |
| [...et-frontend/src/SqlLab/reducers/getInitialState.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9yZWR1Y2Vycy9nZXRJbml0aWFsU3RhdGUuanM=) | `33.33% <0.00%> (-16.67%)` | :arrow_down: |
| [superset-frontend/src/reduxUtils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3JlZHV4VXRpbHMudHM=) | `70.88% <0.00%> (-8.87%)` | :arrow_down: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `81.38% <0.00%> (-7.15%)` | :arrow_down: |
| [...rontend/src/SqlLab/components/TabbedSqlEditors.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1RhYmJlZFNxbEVkaXRvcnMuanN4) | `76.58% <0.00%> (-5.07%)` | :arrow_down: |
| [superset-frontend/src/SqlLab/actions/sqlLab.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9hY3Rpb25zL3NxbExhYi5qcw==) | `60.08% <0.00%> (-3.83%)` | :arrow_down: |
| [...frontend/src/explore/components/OptionControls.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9PcHRpb25Db250cm9scy50c3g=) | `74.07% <0.00%> (-2.12%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `80.70% <0.00%> (-1.76%)` | :arrow_down: |
| ... and [11 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (8142a86) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `8.01%`.
> The diff coverage is `16.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 58.85% -8.02%
==========================================
Files 1022 965 -57
Lines 50107 47306 -2801
Branches 5193 4440 -753
==========================================
- Hits 33506 27843 -5663
- Misses 16470 19463 +2993
+ Partials 131 0 -131
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `50.91% <16.66%> (-0.01%)` | :arrow_down: |
| javascript | `?` | |
| python | `63.37% <ø> (-0.47%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `32.55% <ø> (-6.73%)` | :arrow_down: |
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `43.24% <16.66%> (-4.59%)` | :arrow_down: |
| [...uperset-frontend/src/dashboard/util/dnd-reorder.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2RuZC1yZW9yZGVyLmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...rset-frontend/src/dashboard/util/getEmptyLayout.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEVtcHR5TGF5b3V0Lmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/resizable/ResizableHandle.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL3Jlc2l6YWJsZS9SZXNpemFibGVIYW5kbGUuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/nativeFilters/ScopingTree.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL25hdGl2ZUZpbHRlcnMvU2NvcGluZ1RyZWUudHN4) | `6.25% <0.00%> (-93.75%)` | :arrow_down: |
| [.../src/dashboard/util/getFilterScopeFromNodesTree.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEZpbHRlclNjb3BlRnJvbU5vZGVzVHJlZS5qcw==) | `0.00% <0.00%> (-93.48%)` | :arrow_down: |
| [...set-frontend/src/views/CRUD/alert/ExecutionLog.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvYWxlcnQvRXhlY3V0aW9uTG9nLnRzeA==) | `11.76% <0.00%> (-88.24%)` | :arrow_down: |
| [...src/dashboard/components/gridComponents/Header.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0hlYWRlci5qc3g=) | `10.52% <0.00%> (-86.85%)` | :arrow_down: |
| ... and [414 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...8142a86](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (a67906d) into [master](https://codecov.io/gh/apache/superset/commit/34549cb5b7afee9fb0a7e4b9330dfdf0ce081719?el=desc) (34549cb) will **decrease** coverage by `4.86%`.
> The diff coverage is `86.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.86% 62.00% -4.87%
==========================================
Files 1022 533 -489
Lines 50107 19929 -30178
Branches 5193 5190 -3
==========================================
- Hits 33506 12357 -21149
+ Misses 16470 7358 -9112
- Partials 131 214 +83
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `62.00% <86.66%> (+0.26%)` | :arrow_up: |
| python | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...ore/components/controls/DateFilterControl/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC90eXBlcy50cw==) | `100.00% <ø> (ø)` | |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `89.74% <85.71%> (+41.91%)` | :arrow_up: |
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `14.28% <100.00%> (-25.00%)` | :arrow_down: |
| [superset-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvQXBwLmpzeA==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/dashboard/App.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9BcHAuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [superset-frontend/src/explore/reducers/index.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvcmVkdWNlcnMvaW5kZXguanM=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/dashboard/containers/Dashboard.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL0Rhc2hib2FyZC5qc3g=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...et-frontend/src/filters/components/Select/types.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2ZpbHRlcnMvY29tcG9uZW50cy9TZWxlY3QvdHlwZXMudHM=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...t-frontend/src/dashboard/containers/SliceAdder.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL1NsaWNlQWRkZXIuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| ... and [673 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [34549cb...a67906d](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] etr2460 commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
etr2460 commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565506963
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts
##########
@@ -183,31 +197,27 @@ export const customTimeRangeEncode = (customRange: CustomRangeType): string => {
} = { ...customRange };
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
- const since = sinceMode === 'specific' ? sinceDatetime : sinceMode;
- const until = untilMode === 'specific' ? untilDatetime : untilMode;
+ const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
Review comment:
oh yeah, if it's only formatting, then 100% let's follow the linter. @zhaoyongjie mind updating?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768401380
Thanks for the quick testing
On Wed, Jan 27, 2021 at 11:58 PM adam-stasiak-polidea <
notifications@github.com> wrote:
> Tested manually works fine 🟢
> Tested on chrome,safari,firefox - ok
>
> —
> You are receiving this because you authored the thread.
>
>
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/superset/pull/12793#issuecomment-768385152>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAPMKUTF2DIZNQNTVRU6KJTS4AZ2HANCNFSM4WVL4BOQ>
> .
>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (2745c21) into [master](https://codecov.io/gh/apache/superset/commit/ab741d7218398353310e0ea0d1b1b296ee79b5fa?el=desc) (ab741d7) will **decrease** coverage by `7.86%`.
> The diff coverage is `16.66%`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.89% 59.02% -7.87%
==========================================
Files 1021 965 -56
Lines 50015 47260 -2755
Branches 4907 4423 -484
==========================================
- Hits 33456 27896 -5560
- Misses 16434 19364 +2930
+ Partials 125 0 -125
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `50.87% <16.66%> (-0.06%)` | :arrow_down: |
| javascript | `?` | |
| python | `63.66% <ø> (-0.44%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...s/controls/DateFilterControl/frame/CustomFrame.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC9mcmFtZS9DdXN0b21GcmFtZS50c3g=) | `32.55% <ø> (-6.73%)` | :arrow_down: |
| [...ore/components/controls/DateFilterControl/utils.ts](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2V4cGxvcmUvY29tcG9uZW50cy9jb250cm9scy9EYXRlRmlsdGVyQ29udHJvbC91dGlscy50cw==) | `43.24% <16.66%> (-4.59%)` | :arrow_down: |
| [...uperset-frontend/src/dashboard/util/dnd-reorder.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2RuZC1yZW9yZGVyLmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...rset-frontend/src/dashboard/util/getEmptyLayout.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEVtcHR5TGF5b3V0Lmpz) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [...dashboard/components/resizable/ResizableHandle.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL3Jlc2l6YWJsZS9SZXNpemFibGVIYW5kbGUuanN4) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
| [.../src/dashboard/util/getFilterScopeFromNodesTree.js](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC91dGlsL2dldEZpbHRlclNjb3BlRnJvbU5vZGVzVHJlZS5qcw==) | `0.00% <0.00%> (-93.48%)` | :arrow_down: |
| [...set-frontend/src/views/CRUD/alert/ExecutionLog.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL0NSVUQvYWxlcnQvRXhlY3V0aW9uTG9nLnRzeA==) | `11.76% <0.00%> (-88.24%)` | :arrow_down: |
| [...src/dashboard/components/gridComponents/Header.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0hlYWRlci5qc3g=) | `10.52% <0.00%> (-86.85%)` | :arrow_down: |
| [superset-frontend/src/components/IconTooltip.tsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2NvbXBvbmVudHMvSWNvblRvb2x0aXAudHN4) | `13.33% <0.00%> (-86.67%)` | :arrow_down: |
| [...rc/dashboard/components/gridComponents/Divider.jsx](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0RpdmlkZXIuanN4) | `13.33% <0.00%> (-86.67%)` | :arrow_down: |
| ... and [418 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [ab741d7...2745c21](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] codecov-io edited a comment on pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #12793:
URL: https://github.com/apache/superset/pull/12793#issuecomment-768415927
# [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=h1) Report
> Merging [#12793](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=desc) (2745c21) into [master](https://codecov.io/gh/apache/superset/commit/ab741d7218398353310e0ea0d1b1b296ee79b5fa?el=desc) (ab741d7) will **decrease** coverage by `3.23%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #12793 +/- ##
==========================================
- Coverage 66.89% 63.66% -3.24%
==========================================
Files 1021 488 -533
Lines 50015 30125 -19890
Branches 4907 0 -4907
==========================================
- Hits 33456 19178 -14278
+ Misses 16434 10947 -5487
+ Partials 125 0 -125
```
| Flag | Coverage Δ | |
|---|---|---|
| cypress | `?` | |
| javascript | `?` | |
| python | `63.66% <ø> (-0.44%)` | :arrow_down: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [superset/db\_engines/hive.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lcy9oaXZlLnB5) | `0.00% <0.00%> (-85.72%)` | :arrow_down: |
| [superset/sql\_validators/postgres.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvc3FsX3ZhbGlkYXRvcnMvcG9zdGdyZXMucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
| [superset/db\_engine\_specs/hive.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL2hpdmUucHk=) | `73.84% <0.00%> (-17.31%)` | :arrow_down: |
| [superset/utils/cache.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdXRpbHMvY2FjaGUucHk=) | `76.34% <0.00%> (-8.77%)` | :arrow_down: |
| [superset/db\_engine\_specs/presto.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3ByZXN0by5weQ==) | `81.38% <0.00%> (-7.15%)` | :arrow_down: |
| [superset/db\_engine\_specs/sqlite.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3NxbGl0ZS5weQ==) | `90.62% <0.00%> (-6.25%)` | :arrow_down: |
| [superset/utils/celery.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdXRpbHMvY2VsZXJ5LnB5) | `96.42% <0.00%> (-3.58%)` | :arrow_down: |
| [superset/db\_engine\_specs/postgres.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3Bvc3RncmVzLnB5) | `93.42% <0.00%> (-2.64%)` | :arrow_down: |
| [superset/views/database/mixins.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvdmlld3MvZGF0YWJhc2UvbWl4aW5zLnB5) | `80.70% <0.00%> (-1.76%)` | :arrow_down: |
| [superset/result\_set.py](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree#diff-c3VwZXJzZXQvcmVzdWx0X3NldC5weQ==) | `96.69% <0.00%> (-1.66%)` | :arrow_down: |
| ... and [547 more](https://codecov.io/gh/apache/superset/pull/12793/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=footer). Last update [ab741d7...2745c21](https://codecov.io/gh/apache/superset/pull/12793?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie merged pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie merged pull request #12793:
URL: https://github.com/apache/superset/pull/12793
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565779827
##########
File path: superset-frontend/src/explore/components/controls/DateFilterControl/utils.ts
##########
@@ -183,31 +197,27 @@ export const customTimeRangeEncode = (customRange: CustomRangeType): string => {
} = { ...customRange };
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
- const since = sinceMode === 'specific' ? sinceDatetime : sinceMode;
- const until = untilMode === 'specific' ? untilDatetime : untilMode;
+ const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
Review comment:
glad to follow to linting rules and make the change, however, I still believe breaking the lines is unnecessary. It makes it harder to read this code, especially in the case where we want to compare since and until side by side.
but I am still willing to follow everyone's conventions.
### ⇓ disable linting
```
...
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
const until = untilMode === 'specific' ? dttmToString(untilDatetime) : untilMode; // eslint-disable-line
return `${since} : ${until}`;
}
// specific : relative
if (SPECIFIC_MODE.includes(sinceMode) && untilMode === 'relative') {
const since = sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode; // eslint-disable-line
const until = `DATEADD(DATETIME("${since}"), ${untilGrainValue}, ${untilGrain})`; // eslint-disable-line
return `${since} : ${until}`;
}
// relative : specific
if (sinceMode === 'relative' && SPECIFIC_MODE.includes(untilMode)) {
const until = untilMode === 'specific' ? dttmToString(untilDatetime) : untilMode; // eslint-disable-line
const since = `DATEADD(DATETIME("${until}"), ${-Math.abs(sinceGrainValue)}, ${sinceGrain})`; // eslint-disable-line
return `${since} : ${until}`;
}
// relative : relative
const since = `DATEADD(DATETIME("${anchorValue}"), ${-Math.abs(sinceGrainValue)}, ${sinceGrain})`; // eslint-disable-line
const until = `DATEADD(DATETIME("${anchorValue}"), ${untilGrainValue}, ${untilGrain})`;
return `${since} : ${until}`;
...
```
### ⇓ enable linting
```
...
// specific : specific
if (SPECIFIC_MODE.includes(sinceMode) && SPECIFIC_MODE.includes(untilMode)) {
const since =
sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode;
const until =
untilMode === 'specific' ? dttmToString(untilDatetime) : untilMode;
return `${since} : ${until}`;
}
// specific : relative
if (SPECIFIC_MODE.includes(sinceMode) && untilMode === 'relative') {
const since =
sinceMode === 'specific' ? dttmToString(sinceDatetime) : sinceMode;
const until = `DATEADD(DATETIME("${since}"), ${untilGrainValue}, ${untilGrain})`;
return `${since} : ${until}`;
}
// relative : specific
if (sinceMode === 'relative' && SPECIFIC_MODE.includes(untilMode)) {
const until =
untilMode === 'specific' ? dttmToString(untilDatetime) : untilMode;
const since = `DATEADD(DATETIME("${until}"), ${-Math.abs(
sinceGrainValue,
)}, ${sinceGrain})`;
return `${since} : ${until}`;
}
// relative : relative
const since = `DATEADD(DATETIME("${anchorValue}"), ${-Math.abs(
sinceGrainValue,
)}, ${sinceGrain})`;
const until = `DATEADD(DATETIME("${anchorValue}"), ${untilGrainValue}, ${untilGrain})`;
return `${since} : ${until}`;
...
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
[GitHub] [superset] zhaoyongjie commented on a change in pull request #12793: fix(explore): time picker can not be switched between now and specific
Posted by GitBox <gi...@apache.org>.
zhaoyongjie commented on a change in pull request #12793:
URL: https://github.com/apache/superset/pull/12793#discussion_r565837313
##########
File path: superset-frontend/spec/javascripts/explore/components/DateFilterControl/utils_spec.ts
##########
@@ -0,0 +1,339 @@
+/**
+ * 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 {
+ customTimeRangeEncode,
+ customTimeRangeDecode,
+} from 'src/explore/components/controls/DateFilterControl/utils';
+
+describe('Custom TimeRange', () => {
+ describe('customTimeRangeEncode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('2) specific : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('2021-01-20T00:00:00 : 2021-01-27T00:00:00');
+ });
+
+ it('3) specific : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'specific',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ '2021-01-20T00:00:00 : DATEADD(DATETIME("2021-01-20T00:00:00"), 7, day)',
+ );
+ });
+
+ it('4) now : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'now',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('now : DATEADD(DATETIME("now"), 7, day)');
+ });
+
+ it('5) today : relative', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'today',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('today : DATEADD(DATETIME("today"), 7, day)');
+ });
+
+ it('6) relative : specific', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'specific',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ );
+ });
+
+ it('7) relative : now', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'now',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("now"), -7, day) : now');
+ });
+
+ it('8) relative : today', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'today',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual('DATEADD(DATETIME("today"), -7, day) : today');
+ });
+
+ it('9) relative : relative (now)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'now',
+ anchorValue: 'now',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("now"), -7, day) : DATEADD(DATETIME("now"), 7, day)',
+ );
+ });
+
+ it('10) relative : relative (date/time)', () => {
+ expect(
+ customTimeRangeEncode({
+ sinceDatetime: '2021-01-20T00:00:00',
+ sinceMode: 'relative',
+ sinceGrain: 'day',
+ sinceGrainValue: -7,
+ untilDatetime: '2021-01-27T00:00:00',
+ untilMode: 'relative',
+ untilGrain: 'day',
+ untilGrainValue: 7,
+ anchorMode: 'specific',
+ anchorValue: '2021-01-27T00:00:00',
+ }),
+ ).toEqual(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : DATEADD(DATETIME("2021-01-27T00:00:00"), 7, day)',
+ );
+ });
+ });
+
+ describe('customTimeRangeDecode', () => {
+ it('1) default value', () => {
+ expect(
+ customTimeRangeDecode(
+ 'DATEADD(DATETIME("2021-01-27T00:00:00"), -7, day) : 2021-01-27T00:00:00',
+ ),
+ ).toEqual({
+ customRange: {
+ sinceDatetime: '2021-01-20T00:00:00',
Review comment:

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org