Commit Graph

96 Commits

Author SHA1 Message Date
Rafael Wendel
c8df7a1c8a
Add jsx/a11y eslint plugin (#5439)
* build: install eslint jsx/a11y

* chore: add ESlint rules for jsx/a11y

* bug: add exceptions
2021-03-24 18:50:21 -03:00
Rafael Wendel
c865293aaa
Revert "Updated axios (#5371)" (#5385)
This reverts commit 49536de1ed.
2021-02-02 17:59:53 -03:00
Rafael Wendel
49536de1ed
Updated axios (#5371) 2021-01-28 14:48:36 -03:00
dependabot[bot]
2f1394a6f4
Bump axios from 0.19.0 to 0.21.1 (#5366)
Bumps [axios](https://github.com/axios/axios) from 0.19.0 to 0.21.1.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v0.21.1/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.19.0...v0.21.1)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-01-25 21:49:32 -03:00
Elad Ossadon
c290864ccd
Convert viz-lib to TypeScript (#5310)
Co-authored-by: ts-migrate <>
2020-12-15 18:21:37 -08:00
Elad Ossadon
18ee5343aa
Sync date format from settings with clientConfig (#5299) 2020-12-10 11:16:31 -08:00
Elad Ossadon
aab11dc79b
Add React Fast Refresh + Hot Module Reloading (#5291) 2020-12-07 11:46:46 -08:00
Gabriel Dutra
fa7ecca485
Frontend updates from internal fork (#5259)
* DynamicComponent for QuerySourceAlerts

* General Settings updates

* Dynamic Date[Range] updates

* EmptyState updates

* Query and SchemaBrowser updates

* Adjust page headers and add disablePublish

* Policy updates

* Separate Home FavoritesList component

* Update FormatQuery

* Autolimit frontend fixes

* Misc updates

* Keep registering of QuerySourceDropdown

* Undo changes in DynamicComponent

* Change sql-formatter package.json syntax

* Allow opening help trigger in new tab

* Don't run npm commands as root in Dockerfile

* Cypress: Remove extra execute query
2020-11-10 14:59:15 +02:00
Rafael Wendel
12f71925c2
Multiselect dropdown slowness (fix) (#5221)
* created util to estimate reasonable width for dropdown

* removed unused import

* improved calculation of item percentile

* added getItemOfPercentileLength to relevant spots

* added getItemOfPercentileLength to relevant spots

* Added missing import

* created custom select element

* added check for property path

* removed uses of percentile util

* gave up on getting element reference

* finished testing Select component

* removed unused imports

* removed older uses of Option component

* added canvas calculation

* removed minWidth from Select

* improved calculation

* added fallbacks

* added estimated offset

* removed leftovers 😅

* replaced to percentiles to max value

* switched to memo and renamed component

* proper useMemo syntax

* Update client/app/components/Select.tsx

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>

* created custom restrictive types

* added quick const

* fixed style

* fixed generics

* added pos absolute to fix percy

* removed custom select from ParameterMappingInput

* applied prettier

* Revert "added pos absolute to fix percy"

This reverts commit 4daf1d4bef9edf93cd9bb1f404bd022472ff17a2.

* Pin Percy version to 0.24.3

* Update client/app/components/ParameterMappingInput.jsx

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>

* renamed Select.jsx to SelectWithVirtualScroll

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>
2020-11-03 21:50:39 +02:00
Alexander Rusanov
ff008a076b
Updated Cypress to v5.3 and fixed e2e tests (#5199)
* Upgraded Cypress to v5.3 and fixed e2e tests

* Updated cypress image

* Fixed failing tests

* Updated NODE_VERSION in netlify

* Update client/cypress/integration/visualizations/choropleth_spec.js

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>

* fixed test in choropleth

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>
2020-10-06 16:06:47 -03:00
Gabriel Dutra
f4dcb2918a
Move Cypress to dev dependencies (#3991)
* Test Cypress on package list

* Skip Puppeteer Chromium as well

* Put back missing npm install on netlify.toml

* Netlify: move env vars to build.environment

* Remove cypress:install script

* Update Cypress dockerfile

* Copy package-lock.json to Cypress dockerfile
2020-09-29 09:51:28 +03:00
Gabriel Dutra
c821cab4cb
Generate Code Coverage report for Cypress (#5137) 2020-09-28 21:43:04 -03:00
Omer Lachish
6b811c5245
Refresh CSRF tokens (#5177)
* expire CSRF tokens after 6 hours

* use axios' built-in cookie to header copy mechanism

* add axios-auth-refresh

* retry CSRF-related 400 errors by refreshing the cookie

* export the auth refresh interceptor to support ejecting it if neccessary

* reject the original request if it's unrelated to CSRF
2020-09-21 23:21:14 +03:00
Gabriel Dutra
a31196aef8
Upgrade Ant Design to v4 (#5068) 2020-08-25 14:24:15 -03:00
Omer Lachish
5afd0554d0
Add support for CSRF tokens (#5055)
* add flask-wtf

* add CSRF tokens to all static forms

* add CSRF tokens to all axios requests

* disable CSRF validation in unit tests

* support CSRF-protected requests in *most* cypress tests

* don't enfroce CSRF checks by default

* avoid CSRF enforcement in unit tests

* remove redundant spread

* some camel casing hiccups

* always yield the CSRF cookie, but avoid enforcing it if CSRF toggle is off

* Restyled by prettier (#5056)

Co-authored-by: Restyled.io <commits@restyled.io>

* set a CSRF header only if cookie is present

* enforce CSRF in CI

* install lodash directly for Cypress

* install request-cookies directly for Cypress. We should probably start loading package.json deps

* enable CSRF support when logout and login happen within the same spec

Co-authored-by: restyled-io[bot] <32688539+restyled-io[bot]@users.noreply.github.com>
Co-authored-by: Restyled.io <commits@restyled.io>
2020-08-09 15:47:00 +03:00
simonschneider-db
48924de700
Add TypeScript support (#5027)
* TASK Add typescript dependencies to package.json

* TASK Add typescript to build process and npm scripts and TASK Move example components to typescript and add an example definition file.

* TASK Move back to ts-loader instead of babel typescript preset

* FIX Remove unnecessary changes

* FIX Explicitly mention tsconfig file in webpack.config.js to avoid `error while parsing tsconfig.json, The 'files' list in config file 'tsconfig.json' is empty`
See (https://github.com/TypeStrong/ts-loader/issues/405#issuecomment-330108362)

* FIX Move tsconfig to client subdirectory to make it accessible in docker container (only webpack.config.js is copied over from root folder in Dockerfile)

* TASK Move from ts-loader to babel to reduce compatibility issues between ES6/7 and typescript compilation.

* TASK Add types for classnames, hoist-non-react-statics and lodash. Fix default export of DashboardList and run prettier on eslintrc

* Run npm install

* Trigger tests

* Run npm install 2

* Trigger tests
2020-07-16 23:05:44 +03:00
Gabriel Dutra
461f98bbfc
Update Ace Editor version (#5041) 2020-07-14 10:02:33 -03:00
Levko Kravets
9c0450c84e
Explicitly sort routes to reduce a chance of conflicts (#5020)
* Explicitly sort routes to reduce (avoid at all?) a chance of conflicts

* Sort routes by params count
2020-07-03 21:11:39 +03:00
Gabriel Dutra
a37b7babbf
Remove pace-progress (#4990) 2020-06-28 15:27:48 -03:00
Arik Fraimovich
d036df0ca1
V9 changelog (in master) (#4967)
* V9 Changelog: Initial Draft from Jesse

* V9 Changelog: Add later updates

* Adjust title spacing

* Apply Jesse's suggestions

Co-authored-by: Jesse <jesse@whitehouse.dev>

* provide an explanation on how to switch from Celery to RQ when upgrading to v9

* Update CHANGELOG.md

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>

* Add contributor names

* Update version.

* Update CHANGELOG

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>
Co-authored-by: Jesse <jesse@whitehouse.dev>
Co-authored-by: Omer Lachish <omer@rauchy.net>
2020-06-11 12:33:36 +03:00
Gabriel Dutra
ce6bc2d64a
Update antd to v3.26.17 (#4913)
* Update antd to v3.26.17

* Remove custom bg color for danger button

* Update ScheduleDialog snapshot
2020-05-24 22:28:39 +03:00
Gabriel Dutra
fc246aafc4
Separate visualizations into their own package (#4837)
* Add visualizations project settings

* Move visualizations to redash-visualizations

* Delete shared components

* Remove antd from deps

* Remove p-r-5 from table utils

* Remove visualization deps from package.json

* Rename package and change its version

* Test preinstall script

* Update Dockerfile build for frontend

* Test adding dockerignore

* Update jest tests

* Add step for jest tests

* Include viz-lib on dev commands

* User prettier v1 for now

* Delete unused libs on the app

* Add readme draft (to be finished)

* Add getOptions to Editor

* Add required libraries and finish basic example

* Bump version
2020-05-06 10:49:15 +03:00
Levko Kravets
51b573230f
Upgrade Plotly (#4752)
* Upgrade Plotly

* Fixes to Plotly wrapper

* Decrease plot margins

* Adjust plot margins
2020-04-06 13:35:39 +03:00
Gabriel Dutra
e0312fb717
Mobile experience improvements (#4694)
* Allow touch action on dashboard grid

* Deactivate touch when resizing widgets

* Disable touch interactions on Plotly

* Update Plotly and use dragmode: false

* Remove autoFocus from ItemsList search

* Fix spacing for queries and dashboard favorites

* Make sure admin pages don't go over 100% width
2020-03-04 12:55:51 +02:00
Levko Kravets
c5f14e5538
Use main react-grid-layout package instead of fork (#4687) 2020-02-26 21:20:30 +02:00
Levko Kravets
a682265e13
Migrate router and <app-view> to React (#4525)
* Migrate router and <app-view> to React: skeleton

* Update layout on route change

* Start moving page routes from angular to react

* Move page routes to react except of public dashboard and visualization embed)

* Move public dashboard and visualization embed routes to React

* Replace $route/$routeParams usages

* Some cleanup

* Replace AngularJS $location service with implementation based on history library

* Minor fix to how ApplicationView handles route change

* Explicitly use global layout for each page instead of handling related stuff in ApplicationArea component

* Error handling

* Remove AngularJS and related dependencies

* Move Parameter factory method to a separate file

* Fix CSS (replace custom components with classes)

* Fix: keep other url parts when updating location partially; refine code

* Fix tests

* Make router work in multi-org mode (respect <base> tag)

* Optimzation: don't resolve route if path didn't change

* Fix search input in header; error handling improvement (handle more errors in pages; global error handler for unhandled errors; dialog dismiss 'unhandled rejection' errors)

* Fix page keys; fix navigateTo calls (third parameter not available)

* Use relative links

* Router: ignore location REPLACE events, resolve only on PUSH/POP

* Fix tests

* Remove unused jQuery reference

* Show error from backend when creating Destination

* Remove route.resolve where not necessary (used constant values)

* New Query page: keep state on saving, reload when creating another new query

* Use currentRoute.key instead of hard-coded keys for page components

* Tidy up Router

* Tidy up location service

* Fix tests

* Don't add parameters changes to browser's history

* Fix test (improved fix)

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>
2020-01-20 20:56:37 +02:00
Levko Kravets
ebcec85c0c Tags filter doesn't work because of wrong query params format (#4563)
* getredash/redash#4557 Tags filter doesn't work because of wrong query params format

* Fix tests
2020-01-20 12:49:17 +02:00
Gabriel Dutra
375ffd3250
Migrate services and replace $http with axios (#4497) 2020-01-12 22:25:26 -03:00
Gabriel Dutra
76f0dcb085 Replace angular-sanitize with DOMPurify (#4502)
* Switch angular-sanitize package with dompurify

* Replace $sanitize with DOMPurify.sanitize

Co-authored-by: Arik Fraimovich <arik@arikfr.com>
2020-01-08 10:56:11 +02:00
Gabriel Dutra
99c276fc9a Migrate Query pages to React (#4429)
* Migrate Query Source View page to React: skeleton

* Sync QueryView and QuerySource (#4430)

* Migrate schema browser to react (#4432)

* Restyle code with Prettier

* Migrate Query page to React: Save changes (#4452)

* Migrate query source to React: Set of updates (#4457)

* Migrate Query page to React: Visualization Tabs (#4453)

Co-Authored-By: Levko Kravets <levko.ne@gmail.com>

* Migrate Query Source page to React: Visualizations area (#4463)

* Migrate Query page to React: Delete visualization button (#4461)

* Migrate Query Source page to React: Visualization actions (#4467)

* Migrate Query pages to React: Execute query hook (#4470)

* Migrate Query Source page to React: Editor area (#4468)

* Migrate Query Source page to React: metadata, schedule and description blocks (#4476)

* Migrate Query page to React: Cancel query execution (#4496)

* Migrate Query Source page to React: refine code (#4499)

* Migrate Query Source page to React: alerts (#4504)

* Migrate Query Source page to React: unsaved changes alert (#4505)

* Migrate Query Source to React: resizable areas (v2) (#4503)

* Migrate Query page to React: Query View (#4455)

Co-authored-by: Levko Kravets <levko.ne@gmail.com>

* Switch React and Angular versions of pages (until Angular version removed)

* Migrate Query pages to React: fix permissions (#4506)

* Migrate Query Source page to React: don't reload when saving new query (#4507)

* Migrate Query pages to React: fix tests (#4509)

* Use skipParametersDirtyFlag in executeQuery

* Fix: cannot fork query from Query View page

* Optimize query editor: handle query text changes faster

* Revert "Optimize query editor: handle query text changes faster"

This reverts commit 2934e53be63f16a9b523d927a86849ded85359e6.

* Reduce debounced time to 100

* Migrate Query pages to React: cleanup (#4512)

* Migrate Query pages to React: cleanup

* Further cleanup

* Remove unused dependencies

* Fix embed pages

* Attempt to fix flaky test

* Cleanup: explicitly register the last Angular component

* Move contents of /filters folder to /lib

* Remove unnecessary import

* Remove cy.wait from Parameters spec

Co-authored-by: Gabriel Dutra <nesk.frz@gmail.com>

Co-authored-by: Levko Kravets <levko.ne@gmail.com>
2020-01-06 20:51:45 +02:00
Arik Fraimovich
81b14a58ef
Remove Husky (#4435) 2019-12-11 14:49:57 +02:00
Arik Fraimovich
1b9b3032ca
Change eslint configuration and fix resulting issues (#4423)
* Remove app/service/query-string (unused) and its dependency.

* Fix usage of mixed operators.

* eslint --fix fixes for missing dependencies for react hooks

* Fix: useCallback dependency passed to $http's .catch.

* Satisfy react/no-direct-mutation-state.

* Fix no-mixed-operators violations.

* Move the decision of whether to render Custom chart one level up to make sure hooks are called in the same order.

* Fix: name was undefined. It wasn't detected before because there is such global.

* Simplify eslint config and switch to creat-react-app's eslint base.

* Add prettier config.

* Make sure eslint doesn't conflict with prettier

* A few updates post eslint (#4425)

* Prettier command in package.json
2019-12-11 12:00:46 +02:00
Arik Fraimovich
4d1b359713
Remove unused npm dependencies (#4380)
* Remove ui-ace.

* Remove ui-sortable.

* Remove angular-base64-upload.

* Remove angular-messages.

* Remove jquery-ui.

* Update package-lock.json.
2019-11-21 12:18:33 +02:00
Levko Kravets
c00410768c Migrate Cohort visualization to React (#4270)
* Migrate Cohort to React: Editor

* Extract prepareData and getOptions to own files

* Refine CohortRenderer Angular component (js, less, prepareData) for easier migration

* Migrate Cohort to React: Renderer

* Migrate Cornelius to React: styles

* Migrate Cohort to React: Cornelius library

* Cornelius: add licence info; remove unused style

* Cornelius: use numeral to format numbers; revisit styles

* Cornelius: use moment to format date labels

* Cornelius: use chroma for cell backgrounds; update options; update proptypes; minor fixes

* Tidy up

* Tests
2019-11-13 14:39:08 +02:00
Levko Kravets
0659ef1079
Add "use-debounce" dependency (#4268) 2019-10-19 22:28:57 +03:00
Levko Kravets
a8af968d70
Sortable component (#4199) 2019-09-30 19:12:27 +03:00
Arik Fraimovich
d636b29ba9
Update version (#4167) 2019-09-22 13:23:56 +03:00
Gabriel Dutra
fd435d2182 Migrate Pivot Table visualization to React (#4133)
* npm install react-pivottable

* Initiate Pivot Table Migration

* Update renderer with editor options

* Clean up

* Remove old pivottable from package.json

* Test Percy Snapshot with Pivot Table in a Dashboard

* Tmp: use cy.wait to make sure dashboard is loaded

* Clean up Percy snapshot test

* Small improvements
- cy.all with multiple args
- add controls to pivot valid options

* Watch for options in the Renderer
2019-09-22 10:46:03 +03:00
Gabriel Dutra
a1f11cb8d9 Migrate Parameters component to React (#4006)
* Start Parameters Migration

* Add dirtyCount

* Use workaround with setState

* Apply Changes

* Add EditSettingsDialog

* Add Cmd/Ctrl + Enter behavior

* Remove isApplying

* Delete Angular version of parameters

* Update tests

* Remove angular stuff

* Update jest

* Drag placeholder

* Update events

* Use old button styling and move css

* Reviewing code

* Add parameter rearrange test

* Add Parameter Settings title change test

* Update Parameter Settings button styling

* Move parameter url logic back to Parameters

* Disable url update when query is new

* Styling changes (#4019)

* Ran's title width styling

* Update drag test

* Improve sizing for Number inputs

Co-Authored-By: Ran Byron <ranbena@gmail.com>

* Fix issue with dragged parameter wrapping

Co-Authored-By: Ran Byron <ranbena@gmail.com>

* Don't reevaluate dirtyParamCount

* Allow multiple values :)

* Fix parameter alignments

* Fix Select width on search

* Update client/app/components/Parameters.less

Co-Authored-By: Ran Byron <ranbena@gmail.com>

* Humanize param.name

* Make sure angular updates Execute disabled status
2019-08-18 11:27:20 +03:00
Levko Kravets
9eabf89771 getredash/redash#4031 Counter visualization: formatting not applied to target value (#4035) 2019-08-04 15:22:53 +03:00
Gabriel Dutra
cd4daf8823 Add Dynamic Values to Date and Date Range Parameters (#3904)
* Draft for Date Dynamic values

* Use value with prefix instead of specific attr

* Fix not possible to select static value

* Update antd version

* Cleanup and DateRangeParameter

* Dynamic DateTimeRange

* Add Dynamic options to Date Parameters

* UI refinements

* Add getDynamicValue function

* Add 'This' options and prevent text clipping

* Make allowClear available

* Update ScheduleDialog snapshot

* Add some protections and separate Date/DateRange

* Accept null values on date or daterange parameters

* Handle undefined values on Moment propType

* Move export to end of files

* Remove Today/Now option

* Update with Apply Changes

* Show name instead of value for dynamic values

* Add comment about supporting useCurrentDateTime

* Cypress Tests: Date Parameters

* Cypress Tests: Date Range Parameters

* Don't put null params in the url

* Add workaround comments to Cypress tests

Co-Authored-By: Ran Byron <ranbena@gmail.com>

* Fix Dynamic Value as default for global parameters

* Update Back to Static Value

* Add isValid to value on Date and DateRange inputs

* CR suggestions

* Fix Back to Static Value for Dates

* Update Dynamic Value Styling

* Fix failing Date tests

* Fix selectedDynamicValue

* Parameter spec: Remove date range clickThrough

* Add transition

* Fix failing Cypress tests

* Back with 'width: auto'

* Check value is valid on Back to Static value

* CR

* Update Date Range width
2019-07-26 22:40:13 +03:00
Omer Lachish
c1f4147807 Avoid committing it.only (#3995)
* remove it.only, left by mistake

* use no-only-tests

* 'off' should be used instead of 'none'

* Dedup jest/only rule

* always error for .only
2019-07-19 18:30:38 +03:00
Arik Fraimovich
45a3b72730
Update fsevents to v1.2.9 (#3950) 2019-07-04 15:43:43 +03:00
Arik Fraimovich
27c64b42ac
Add keyboard shortcut for format query (Ctrl/Cmd+Shift+F) (#3911)
* Add keyboard shortcut for format query

* Added to button tooltip
2019-06-18 14:10:05 +03:00
Arik Fraimovich
a9588eac79
Update version to 8.0.0-beta. (#3869) 2019-06-02 14:37:16 +03:00
Ran Byron
606cf12e74 Dashboard grid React migration #1 (#3722)
* Dashboard grid React migration

* Updated tests

* Fixes comments

* One col layout

* Tests unskipped

* Test fixes

* Test fix

* AutoHeight feature

* Kebab-cased

* Get rid of lazyInjector

* Replace react-grid-layout with patched fork to fix performance issues

* Fix issue with initial layout when page has a scrollbar

* Decrease polling interval (500ms is too slow)

* Rename file to match it's contents

* Added some notes and very minor fixes

* Fix Remove widget button (should be visible only in editing mode); fix widget actions menu

* Fixed missing grid markings

* Enhanced resize handle

* Updated placeholder color

* Render DashboardGrid only when dashboard is loaded
2019-05-16 15:43:46 +03:00
Levko Kravets
9a4433bf68
Migrate visualizations registry/renderer/editor to React (#3493) 2019-04-30 16:34:00 +03:00
Omer Lachish
9fcf510ffd
add package.json after including qs (#3695) 2019-04-10 11:25:56 +03:00
Ran Byron
b5d97e25b7 Browser support config (#3609)
* Browser support config

* Removed some offending code

* Added unsupported html page and redirect for IE

* Typo in regex

* Made html page static

* Added redirect script to multi_org

* Moved static html page to client/app
2019-03-27 17:47:12 +02:00
Arik Fraimovich
fd42091f87 Add Lint step to CircleCI (#3642) 2019-03-26 16:40:26 +02:00