Commit Graph

88 Commits

Author SHA1 Message Date
ʈᵃᵢ
7b97764dbc [dashboard] New, list view (react) (#8845)
* adds dashboard listview component

* use new api

* use json over rison

* lint

* adds seperate dashboard list view

* edit and delete actions

* fix lint ignore

* fix common_bootstrap_payload is now a function

* fix license

* fix pylint

* isort

* fix tests

* lint

* lint ts

* fix js tests

* fix double import from bad rebase

* fix indent error

* lookup permissions

* generic permission lookup

* get tslint to pass

* adds js specs

* lint

* fix rebase

* lint

* lint again

* fix type errors preventing build

* adds more specs

* fix tslint error

* fix null check

* remove unecessary code

* use translations provided by api

* more translations

* linting

* fix spec

* i18n

* fix register order
2020-01-16 00:48:55 -05:00
Grace Guo
cd8aa92cbb [explore view] fix: Inline edit chart title cause unintended overwrite original query parameter (#8835)
* [explore view] fix: Inline edit chart title cause unintended overwrite original query parameter

* add more unit tests

* handle new slice case
2019-12-18 16:17:48 -08:00
Maxime Beauchemin
e127579fc8 fix: remove unused .js module (#8741)
* fix: remove unused .js module

* fix tests, remove more references

* lints
2019-12-04 16:51:05 -08:00
Erik Ritter
44d919c757 Prettify the frontend code (#8648)
* Add Prettier global configs

* Format js/jsx/ts/tsx/less files
2019-11-27 14:02:48 -08:00
Evan Rusackas
1b3e40feac Clickable checkbox labels (#8534)
* passing onClick prop to header with the existing onChange method.

* basic test checking that label click fires the onChange method.

* cleaning up stuff caught by linting.
2019-11-12 10:22:17 -08:00
Krist Wongsuphasawat
c566141f25 feat: read control panel configs from registry (#8173)
* feat: read control panel configs from registry

* fix: order imports

* fix: remove index.js and get items on-the-fly, remove extraOverrides

* fix: lint

* fix: unit tests

* fix: unit tests

* fix: lint

* fix: unit tests
2019-09-11 08:58:24 -07:00
Maxime Beauchemin
5e0c91ef49 fix: onSave datasource raises React error (#8049)
* fix: datasource save raises React error

* add test
2019-08-15 14:13:18 -07:00
Tom Hunter
b7b517a102 [fix] bug on FixedOrMetricControl component causing issues with deck.gl polygon height + deck.gl scatter radius controls (#7924)
* [WIP] bug fix for FixedOrMetricControl not rendering

* Updated value preview and type selection

* fix metric control not on setting polygon elevation data

* Updated layout of FoM comp

* linting fixes

* linting fix pt. 2

* linting fix pt. 3

* fix scatter tooltip to work with metric control

* Fixed tests
2019-07-29 16:53:52 -07:00
michellethomas
86fdceb236 Avoid removing custom sql adhoc metric when columns change (#7877)
* Avoid removing custom sql adhoc metric when columns change

* Add tests to confirm sql metric does not get removed
2019-07-16 16:23:12 -07:00
michellethomas
5864ddc079 Allowing withVerification to remove all options if none are valid (#7652) 2019-06-18 14:06:05 -07:00
michellethomas
47ba2ad394 Remove aggregates from metric options if datasource has no columns (#7586) 2019-05-24 11:10:35 -07:00
michellethomas
421183d3f4 Adding controls for verifying options (#7468)
* Creating withVerification HOC

* Updating to use componentDidMount and componentDidUpdate and adding propTypes

* Adding tests to withVerification

* Adding documentation to withVerification
2019-05-22 16:39:01 -07:00
Grace Guo
6b8bda6096 [dashboard] After update filter, trigger new queries when charts are visible (#7233)
* trigger query when chart is visible

* add integration test
2019-05-07 23:41:18 -07:00
Maxime Beauchemin
46579b1bd6 Refactor out controlUtils.js module + unit tests (#7350)
* [WiP]refactor out a controlUtils.js file

* unit tests

* add missing license

* Addressing comments
2019-04-30 11:45:06 -07:00
leakingoxide
f83b979342 Store last selected dashboard in sessionStorage (#7181)
* Store last selected dashboard in sessionStorage

* Fix tests
2019-04-24 14:43:13 -07:00
michellethomas
ba9523c7c4 Adding dropdown to DatasourceControl and ability to change datasource (#6816)
* Adding dropdown to DatasourceControl and ability to change datasource

* Style fixes

* Adding unit tests for datasource/get endpoint

* Fixing issue with dropdown overflow and style changes

* Fixing issues rebasing metadata button and fixing sort for datasource with no name
2019-02-20 14:32:33 -08:00
agrawaldevesh
fc4042a28b SelectControl hackery: Fixing freeform select and allowing group by and non group-by column selectors to take in arbitrary expressions including select-all semantics. (#6722)
Summary: We want to allow grouping by on expressions, including the
ability to select expressions (without group-by). The UI ain't good yet
.. it is not at the feature parity of say adhoc filters/metrics that
come with a nice text-box to edit the SQL. But
this suffices for my usecase for now.

(The UI would have to be redone ... but that would require some refactoring
to merge the AdhocFilter/Metric/Popover stuff such that it can be used
for this use case too.)

Also fixed a bug in the SelectControl freeForm selection.

Allow selecting all columns easily: Added a new Select-All special item
that users can select to make all the options in the selectable show
up.

The ability to group by arbitrary expressions is useful because now two
users don't need to create custom computed-fields for this.
2019-02-04 12:34:24 -08:00
Maxime Beauchemin
75322ab12c More ASF licenses (css + html/jinja) (#6711)
* More ASF licenses

* html

* removing from vendors
2019-01-17 22:39:00 -08:00
Maxime Beauchemin
1dd4d7a587 Apply ASF licenses throughout the code base (#5800)
* Add license headers

* reabased

* lint

* Removing licenses from vendors folder
2019-01-15 15:53:27 -08:00
Maxime Beauchemin
7e0e7c89ba Improving Filter Box (#6523)
* Improve Filter Box

* layout tweaks
2019-01-11 15:28:23 -08:00
Maxime Beauchemin
fe77b57581 [refactor] moving some datasource-related code to the frontend (#5769)
* [refactor] moving some datasource-related code to the frontend

* fix js tests

* fix tests

* fix test
2018-12-22 18:06:36 -08:00
Krist Wongsuphasawat
20e1ac6242 Update @superset-ui/colors (#6464)
* Update package version and update breaking changes for color

* update color function usage

* update dependency
2018-11-30 09:50:42 -08:00
Krist Wongsuphasawat
a7b52da6ce [reviewable] Integrate @superset-ui/{core,color,chart} modules (#6234)
* Add d3 micro packages

* Replace d3 imports with specific modules import

* Define d3 colors

* import specific d3 submodules instead of entire d3

* update function name

* move function location and fix small bug

* Move primary color to control

* remove colorscalefactory usage

* remove unused d3

* fix unit test

* fix color picker

* use @superset-ui/color

* update package version

* remove files that are extracted

* replace all references

* fix two files

* Revert some changes to split to another PR

* remove adaptor

* Address Christine's comment

* remove d3 v3 from calendar

* remove d3.scale.threshold

* Get rid of colorScalerFactory and revise hexToRGB

* fix color cleaning

* fix lint
2018-11-11 10:07:05 -08:00
Maxime Beauchemin
08cdb09714 [explore] raise attention to row_limit being reached (#6252)
* [explore] raise attention to row_limit being reached

* fix test
2018-11-05 08:31:44 -08:00
Krist Wongsuphasawat
02f0616025 Make VizTypeControl use metadata from plugin (#6235)
* Render vis type item using information from registry

* adjust style

* fix unit test

* Remove large thumbnails

* Update addSlice
2018-11-01 11:39:24 -07:00
Christine Chambers
5f1eaa49f2 [SIP-9] Introduce TypeScript (#6120)
* [SIP-9] Introduce TypeScript

- Introduce TypeScript and co to both source and tests
- Define alias for src directory in both webpack config and jest config so we can avoid using long relative paths like ../../src in both source and tests
- Type check feature flags system to prevent typos of flag names
- Change the feature flags system and the flags on window instead of populating them through the state tree. When introducing the first SCOPED_FILTER feature flag, it became too difficult to pipe the flags through the state initializers and layers of components and containers (the resulting code is hard to read and has a handful of methods taking an additional feature flag map parameter). Given that feature flags don't change throughout the life time of the app, it is better to leave them on window for easy access than piping them through the global state tree, which is meant to store the state of the app which changes frequently.
- Add a barebone filter panel that only shows when the SCOPED_FILTER feature flag is on

* Remove unnecessary dev-dependency on gl

* - Adding linting for TypeScript files via tslint.
- Fixing linting for Javascript files importing Typscript files
- Also fix linting for Javascript files that now leverage the webpack alias for the src directory

- up Typescript and type def versions

* Rename src directory's webpack alias from @ to src to be more explicit.
2018-10-23 22:33:51 -07:00
Krist Wongsuphasawat
b9257b2a09 [Refactor] Extend color scheme management to sequential schemes (#6150)
* refactor color scheme

* Update data structure

* Update color scheme files

* wip

* convert all sequential schemes

* Update how color schemes are managed. Extend it for sequential schemes

* extract color setup into separate file

* Update imports

* update imports

* Add new functions to Registry

* Update ColorSchemeManager to extends Registry and update unit tests

* Add test for Registry

* Rename ColorSchemeManager to ColorSchemeRegistry

* Fix unit tests

* Update API

* Fix imports

* Add label field

* Fix reference to colors

* update SequentialScheme contructor

* Fix controls

* rename manager to registry

* Split sequential schemes into multiple files

* update sequential color labels

* add values and valuesAsPromise()

* use .values()
2018-10-22 16:17:14 -07:00
Chris Williams
96228adda9 [superset-client][datasource editor] replace ajax with SupersetClient (#6134)
* [superset-client][datasource editor] replace ajax with SupersetClient

* [superset-client][datasource control] replace ajax with SupersetClient

* [superset-client][datasource editor] remove unused funcs in DatasourceControl

* [superset-client][data source control] lint, remove toasts

* [superset-client] fix DatasourceControl_spec

* [superset-client] remove unneeded functional setState calls
2018-10-19 11:41:11 -07:00
Chris Williams
e163dfe744 [SIP-4] replace SQL Lab ajax calls with SupersetClient (#5896)
* [superset-client] replace sqllab ajax calls with SupersetClient

* [superset-client][sqllab] replace more misc ajax calls

* [superset-client][tests] call setupSupersetClient() in test shim

* [superset-client] replace more sqllab ajax calls and fix tests

* [superset-client][tests] remove commented lines

* [sqllab][superset-client] fix eslint and tests, add better error handling tests.

* [superset-client] fix tests from rebase

* [cypress][sqllab][superset-client] fix

* [superset-client] use Promises not callbacks in getShortUrl calls

* [superset-client][short-url] don't stringify POST

* [superset-client][short-url][cypress] add data-test attribute for more reliable test

* [cypress] remove .only() call
2018-10-18 10:40:30 -07:00
Chris Williams
af0ffa44ab [SIP-4] replace explorer ajax calls with SupersetClient (#5869)
* [superset-client] initialize SupersetClient in app setup

* [core] replace explore ajax calls with SupersetClient

* [core] fix SupersetClient explore tests

* [core] remove _packages mistake directory

* remove unused files

* add yarn.lock

* always render modal

* [superset-client][jest] fix SaveModal_spec

* [lint] remove unnecessary AbortController global

* yarn.lock
2018-10-16 14:54:31 -07:00
Christine Chambers
9029701f24 [refactor] Migrate from Mocha+Chai to Jest (#6079)
* [refactor] Migrate from Mocha+Chai to Jest

This change migrates all the existing unit tests
- to Jest's global expect and matchers from chai's imported expect, asserts and matchers.
- to Jest's describe/test from mocha's describe/it

The majority of the mechanical changes to tests are achieved through running jest-codemods. The only two note-worthy manual tweaks:
1. Setting a testURL of http://localhost in jest config and adjusting a few tests to leverage this value instead of relying on about:blank.
2. Re-enabling ExploreChartPanel_spec which was previously commented out as we cannot have empty tests with nothing in it with Jest. :)

This change also removes dependencies to Mocha and Chai.

* Remove the test:one command as it now does the same thing as test.

* Fixing lint errors. The diff looks large but is large done through `yarn run lint --fix`

The only noteworthy change is the one in eslintrc for tests. The env has been updated from mocha to jest.

* Adding eslint-plugin-jest and further modify tests.

- One small fix in sqllab's Timer Spec for a test that is not using the spy it created for testing.
- Deletion of a duplicated test caught by eslint-plugin-jest.

* - Make istanbul coverage work with Jest.

- Remove dependency on stand-alone istanbul and babel-istanbul as they're built-into jest. Yes!

* Attempt to fix dynamic imports in tests.

* run sequentially and log heap usage

* - tweaking maxworkers for travis and specifying coverageDirectory for codecov

- remove dynamic import in shim.js now that it is set in babelrc for tests only.
2018-10-15 13:10:18 -07:00
Krist Wongsuphasawat
8fe6f12622 refer to default color scheme in colorpickercontrol instead of pointing to specific scheme (#6031) 2018-10-04 18:10:22 -07:00
Christine Chambers
604524b671 [feat] Feature flag system via config (#5960)
* [feat] Feature flag system via config

Adding a feature flag system that is driven by superset_config.py. This change includes:
- Server side changes to specify a dedicated FEATURE_FLAG dictionary for listing feature flags. E.g.
```
FEATURE_FLAGS = { 'SCOPED_FILTER': true }
```
- Pass the new feature flags to client via bootstrap-data
- Client side changes to inject feature flags into the redux state tree for dashboard, explore view and SqlLab
- Client side refactor/clean up so the feature flags can be properly tested. Also avoid modifying incoming bootstrap data when creating initial state for the redux state tree
- Re-enable tests that were previously disabled for ExploreViewContainer

* Fix lint errors.

* Remove the partial attempt to get reference to src working in tests (so we don't have to write ../../../src and such in tests). This will in a separate PR.
2018-10-01 11:47:06 -07:00
Maxime Beauchemin
73d1e4596d [explore] add "View samples" modal to action buttons (#5770)
* [explore] add "View samples" modal to action buttons

Also broke down the `View query` and `View results` as different
request so that viewing the query does not require fetching the results
anymore

* fix js tests

* lint
2018-09-20 13:51:39 -07:00
Chris Williams
b453cd2bf2 [lint] turn no-undef back on, set browser, cypress, and mocha env's (#5879)
* [lint] turn no-undef back on, set browser, cypress, and mocha env's, and fix issues

* [lint] fix undefined var in TimeTable.jsx
2018-09-13 14:45:24 -07:00
Krist Wongsuphasawat
f482a6cf99 Improve categorical color management (#5815)
* Create new classes for handling categorical colors

* verify to pass existing unit tests

* separate logic for forcing color and getting color

* replace getColorFromScheme with CategoricalColorManager

* organize static functions

* migrate to new function

* Remove ALL_COLOR_SCHEMES

* move sequential colors to another file

* extract categorical colors to separate file

* move airbnb and lyft colors to separate files

* fix missing toFunction()

* Rewrite to support local and global force items, plus namespacing.

* fix references

* revert nvd3

* update namespace api

* Update the visualizations

* update usage with static functions

* update unit test

* add unit test

* rename default namespace

* add unit test for color namespace

* add unit test for namespace

* start unit test for colorschememanager

* add unit tests for color scheme manager

* check returns for chaining

* complete unit test for the new classes

* fix color tests

* update unit tests

* update unit tests

* move color scheme registration to common

* update unit test

* rename sharedForcedColors to parentForcedColors

* remove import
2018-09-12 14:10:26 -07:00
Maxime Beauchemin
73db918fbe Upgrade to React==16.4.1 & Enzyme==3.3.0 (#5359)
* Bumping react==16.4.1 &  enzyme==3.3.0

The upgrade was pretty smooth except for a cryptic message coming
out of react-select around running multiple copies of React. It turns
out the `common` bundle had React and was conflicting with explore and
dashboard apps, only in 16.x. This somehow wasn't a problem in 15.x
outside of the wasted resources.

Running 16.4 should bring in all sorts of perf improvements and features
we've all been waiting for.

https://reactjs.org/blog/2017/09/26/react-v16.0.html

TODO: react-bootstrap-datetimepicker isn't compatible with React 16

* Trying to deprecate react-bootstrap-datetime

* Moving forward

* Reintroducing tests
2018-09-10 14:48:06 -07:00
Maxime Beauchemin
68ba63fcd9 Implement a React-based table editor (#5186)
* A React table editor

* addressing comments

* Fix SelectAsyncControl error on clear

* fix tests

* more corrections

* Removed <strong>
2018-08-06 15:30:13 -07:00
Maxime Beauchemin
51bd17d6f6 Improve URLs for Chart and Dashboard ModelViews (#5544)
* Improve URLs for Chart and Dashboard ModelViews

Prior to this, the ModelView for Chart and Dashboard would be
at `/slicemodelview/list/` and `/dashboardmodelview/list/`.

Now we have cleaner URLs at `/chart/list/` and `/dashboard/list/`

* Fix unrelated js lint

* addressing comments
2018-08-03 12:46:48 -07:00
Beto Dealmeida
c445ef8c43 Explore to SQL Lab (#5101)
* WIP

* Working version

* Clean code

* Fix lint

* Fix unit test; show only for sqla

* Working on UX

* Dropdown working 66%

* Working but needs CSS

* Fixed table

* Fix lint

* Fix unit test

* Fix languages path

* Fixes

* Fix Javascript lint
2018-07-16 15:00:48 -07:00
Chris Williams
19ac6e1231 get rid of global notify (#5355)
* [toasts] get rid of notify globals, refactor messageToasts for use by entire app

* [remove notify] use arrow func in ajax call

* fix lint + tests

* actually fix tests from messageToast refactor

* add 'test:one' npm script

* debugger

* [toasts] convert bootstrap flash messages to toasts in explore + sqllab

* [toasts][tests] import from right file
2018-07-12 11:50:25 -07:00
John Bodley
d483ed121c [adhoc-filters] Adding adhoc-filters to all viz types (#5206) 2018-06-18 15:43:18 -07:00
Maxime Beauchemin
d5ebc430c2 [explore] fix autocomplete on verbose names (#5204)
* [explore] fix autocomplete on verbose names

Currently when searching for metrics or groupbys, the autocomplete
search functionality only matches based on the metric_name, though in
some cases the verbose_name is displayed and disregarded for search
purposes.

Also another issue is that not all pre-defined metrics show up in the
drop down which is confusing. Users may have simple metrics for which
they setup a nice verbose name and/or description and expect to see
those in the dropdown.

This PR addresses it for metric and column-related dropdowns.

* Add unit test
2018-06-15 15:56:05 -07:00
Tamika Tannis
dc21e0dd78 URL shortner for dashboards (#4760)
* Added support for URLShortLinkButton to work for the dashboard case

* Fix lint errors and test

* Change references to 'slice' to 'chart'.

* Add unit tests to improve coverage

* Fixing lint errors

* Refactor to make URLShortLink more generic. Remove history modification code, redirect should be handling this.

* Remove history modification code, redirect should be handling this

* Generate a shorter link without the directory, and delegate default linked to the contents of window.location

* Fix lint errors

* Fix test_shortner test to check for new pattern

* Remove usage of addHistory to manipulate explore shortlink redirection

* Address build failure and using better practices for shortlink defaults

* Fixing alphabetical order

* More syntax mistakes

* Revert explore view history changes

* Fix use of component props, & rebase
2018-06-02 11:08:43 -07:00
Gabe Lyons
cc0942ac98 updating adhoc metric filtering (#5105) 2018-05-31 23:34:48 -07:00
Gabe Lyons
f3778c3c81 fixing LIKE constant name (#5110) 2018-05-31 11:34:51 -07:00
Gabe Lyons
a746fce383 expanding simple tab (#5032) 2018-05-21 16:22:40 -07:00
Gabe Lyons
7d5195aae3 expanding regex for automated columns (#4990) 2018-05-11 15:43:52 -07:00
Gabe Lyons
a8514b267b [Explore] Adding Adhoc Filters (#4909)
* adding custom expressions to adhoc metrics

* adjusted transitions and made the box expandable

* adding adhoc filters

* adjusted based on feedback
2018-05-10 10:41:10 -07:00
Maxime Beauchemin
17ae9ec3a8 Move a few JS files (#4841)
* Moving JS files

* Moving pointers

* lint
2018-04-24 13:35:55 -07:00