Commit Graph

258 Commits

Author SHA1 Message Date
Martin Brennan bf1a79c9ad
FIX: Click not opening query (#191)
Due to recent core changes for Ember in
0221855ba7
and 952b033165
the correct way of calling these actions must be observed,
otherwise clicking on a query did nothing.

This commit fixes the click and also makes scrollTop
work with the new {{on X}} Ember syntax.
2022-10-28 14:56:01 +10:00
Penar Musaraj 0deecbe2ae
DEV: Replace bootbox alert dialogs (#190) 2022-10-18 14:13:00 -04:00
Frank 82ec10d844
FIX: fixed the blueing of the bookmark icon (#186) 2022-08-19 00:07:35 +08:00
Constanza 272e9dd760
UX: Making the headers of the query results table sticky (#182) 2022-07-06 19:08:37 -04:00
Jarek Radosz 07e009e862
DEV: Update linting setup and fix issues (#179) 2022-06-17 15:01:34 +02:00
Isaac Janzen 780232c902
DEV: Remove use of run-loop-and-computed-dot-access (#178)
Context: https://deprecations.emberjs.com/v3.x/#toc_deprecated-run-loop-and-computed-dot-access
2022-06-17 14:18:36 +02:00
Frank 45b6e7eb4f
FEATURE: Bookmarkable QueryGroups. (#177)
Adds the ability for non-Admin users to bookmark Queries from inside Group > Reports > Query view.
2022-06-14 23:07:02 +08:00
Isaac Janzen 92bdea38b2
DEV: Remove 'htmlSafe' string prototype extensions (#176)
Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
2022-06-01 11:42:50 -05:00
Gerhard Schlager 65a112c8d2
FIX: Edit button shouldn't be visible for seeded queries (#174) 2022-05-17 18:05:05 +02:00
Isaac Janzen 01f52dc5c5
DEV: Remove 'dasherize' string prototype extensions (#173)
Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
2022-05-13 12:43:37 -05:00
Isaac Janzen d5e11a2c65
DEV: Remove 'capitalize' string prototype extensions (#172)
Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
2022-05-13 12:33:38 -05:00
Martin Brennan 50e9242d61
FIX: Use new properties for pick-files-button (#167)
Companion commit to core discourse/discourse#16375
2022-04-06 12:48:02 +10:00
Jarek Radosz 86cda5f213
DEV: Lose the es6 suffix (#165) 2022-03-05 17:21:01 +01:00
David Taylor 2a17f49f66 DEV: Bump eslint-config-discourse and correct violations 2022-01-26 14:44:10 +00:00
Bianca Nenciu c6dd79c805
FIX: Do not stringify null parameters (#151)
Sometimes the query page did not load if one of the query was null
because it called null.toString() and raised an exception.
2022-01-17 13:45:40 +02:00
Andrei Prigorshnev 58cfe737f7
DEV: migrate routes to the new @action pattern (#149) 2022-01-06 15:16:51 +04:00
Jarek Radosz 3ce778ec6d
DEV: Fix `store:main` deprecation (#145) 2021-11-24 15:28:12 +01:00
Guhyoun Nam 286b5b5fe7
FEATURE: Add Data Explorer Params to the URL on run (#128)
Co-authored-by: Mark VanLandingham <markvanlan@gmail.com>
2021-09-14 10:10:16 -05:00
Penar Musaraj 0c9005513a
UX: Fix button alignment following core changes (#137) 2021-09-14 09:44:32 -04:00
Andrei Prigorshnev 4a98cc8af8
FEATURE: get rid of the import a query modal (#127)
This is the new version of #126. Now the pick-files-button moved to core. To import a query into Data Explorer, you need to push the button and then deal with the import modal. Instead, we want just to be triggering a system file picker directly. This PR makes it happen.
2021-08-20 14:26:48 +04:00
Andrei Prigorshnev e85aab4b33
FIX: the back button (#130)
Back button wasn't working when running in Ember CLI. This PR fixes it by doing the transition to the same route but without URL parameter properly. This works in both our environments (legacy-3.12.0, and ember-cli-3.15.0).
2021-08-11 14:13:39 +04:00
Jarek Radosz cf2735162a
DEV: Fix template linting issues (#124)
* Update test
* Remove the empty line in table
2021-07-05 23:15:57 +02:00
David Taylor 4354e1b766
DEV: Resolve some template linting issues (#123)
Some larger issues still remain, but this is a good first step
2021-07-02 16:35:50 +01:00
Andrei Prigorshnev 814ec14636
FIX: add missing string (#121) 2021-07-02 14:22:40 +04:00
Mark VanLandingham f3b2011ae1
FIX: Translation of column headers in query table (#122) 2021-07-01 08:58:45 -05:00
Penar Musaraj 4091cd7a04
DEV: Remove SCSS color vars fallbacks (#116) 2021-05-12 16:24:12 -04:00
Andrei Prigorshnev 782dc09d96
UX: Add a help modal dialog (#109) 2021-04-15 19:17:07 +04:00
David Taylor 216dff3ed9
DEV: Improve logic for showing/hiding the reports tab in group screens (#107)
Previously this was adding an extra AJAX request to check if the group had any queries available. Now a boolean is included in the group serializer, so there is no need for the extra request.

Removing this ajax request will also stop other plugin JS integration tests from failing when the data-explorer plugin is installed.

This commit also fixes the HTML markup of the tab, so that it doesn't have a <ul> nested inside the existing <ul>. Also adds an icon for good measure.
2021-04-08 17:47:44 +01:00
David Taylor 563251d608
DEV: Remove String.endsWith polyfill (#106)
Discourse no longer supports internet explorer. This function is supported natively on all browsers Discourse currently targets.
2021-04-08 17:46:43 +01:00
Grayden 82cb3ac2fe
Allow admins to see the group reports nav item (#101)
Previously, the report tab would appear only if the user was a member of the group. With this change, admins can see the reports in any group.
2021-04-08 15:50:49 +01:00
Osama Sayegh 8ef3fa38d6
Revert "Revert "DEV: Migrate from {{user-selector}} to {{email-group-user-chooser}} (#94)" (#102)" (#103)
Follow-up to https://github.com/discourse/discourse-data-explorer/pull/102. This is essentially a revert of that PR, the only difference is that the `.discourse-compatibility` file now pins the plugin to 60ffd4bc4d for sites ≤ `2.7.0.beta3`.
2021-03-06 20:16:49 +03:00
Osama Sayegh 60ffd4bc4d
Revert "DEV: Migrate from {{user-selector}} to {{email-group-user-chooser}} (#94)" (#102)
The reverted commit pinned the plugin version on stable because the changes in that commit aren't compatible with stable. However, the version that we pinned the plugin to has a bug on stable and 50e62d84e8 fixes that bug. So we need to temporarily revert 5e24556b24 to unpin the plugin and I'll create another PR to undo this revert and re-pin the plugin version to this commit for sites on stable.

Meta topic: https://meta.discourse.org/t/data-explorer-editing-broken-on-stable/181274/11?u=osama.
2021-03-06 14:48:58 +03:00
Joffrey JAFFEUX 69f1e5d13b
DEV: uses discourse-common/lib/raw-templates (#98) 2021-02-24 19:49:26 +01:00
Roman Rizzi 50e62d84e8
FIX: Use Ember's debounce on stable. (#96)
We need to wrap the new debounce function inside a try block to avoid throwing a "module not found" exception.
2021-02-22 12:55:11 -03:00
Andrew Prigorshnev 4f33c22344
FEATURE: Add a graph report to query results (#93) 2021-02-18 12:06:22 +01:00
Kris 3151fde1e7
UX: allow horizontal overflow scroll, fix button (#95) 2021-02-18 10:36:37 +01:00
Osama Sayegh 5e24556b24
DEV: Migrate from {{user-selector}} to {{email-group-user-chooser}} (#94) 2021-02-16 13:37:30 +03:00
Andrew Prigorshnev 9d86b8b653
FIX: Show badge names in query results (#92)
* FIX: Show badge names in query results
2021-02-12 10:01:16 +01:00
Joffrey JAFFEUX 8ab94e334c
DEV: prettier 2.2.1 (#89) 2021-01-27 10:38:56 +01:00
Roman Rizzi c6a11d9280
DEV: Use the new discourseDebounce function wrapper. (#85)
We recently merged a Discourse core's PR to replace usages of Ember's debounce and discourseDebounce with a new debounce wrapper. The new wrapper works exactly like Ember's debounce but internally calls "run" when called in test mode.

This PR replaces all usages of other debounce functions with the new wrapper and fallbacks to Ember's debounce for backward-compatibility.
2021-01-05 13:09:21 -03:00
Kane York 4506cf6a11
FIX: Use standard error handling for requests, special-case moderators (#84)
By removing the catch and letting the error propagate to the top-level error handler, we can receive more detailed error reports including exactly which request failed.

The assumption that any request failure is a permissions error is replaced by an explicit client-side check before making any requests.
2020-12-07 15:13:14 -08:00
tshenry f1785326a8
FIX: Permitted groups should display on group query access picker (#77)
The toString() that was introduced in 80ffc45 was preventing any actively permitted groups from displaying in the group picker when entering a query page.
2020-10-19 12:03:03 -07:00
jjaffeux e0e639e70f Revert "DEV: enforces no-var (#74)"
This reverts commit 94c1ef21c8.
2020-10-13 15:40:56 +02:00
Joffrey JAFFEUX 94c1ef21c8
DEV: enforces no-var (#74) 2020-10-13 15:17:33 +02:00
tshenry 88f9d7176a
UX: Make group report index styling more consistent with core (#72) 2020-10-09 13:22:16 +11:00
Martin Brennan 26ccc36b5b
FIX: Resolve yarn lint complaint 2020-10-07 14:08:26 +10:00
Martin Brennan a4665c27e8
Revert "Import getURL to fix deprecation warnings (#52)"
This reverts commit d643cf742e.

A previous change was already made in this repo to import getURL,
this causes a double import which breaks the build.
2020-10-07 13:13:38 +10:00
Mark VanLandingham d643cf742e
Import getURL to fix deprecation warnings (#52) 2020-10-07 12:58:52 +11:00
Ricky Chon 80ffc4582f
UI: Don't show 'everyone' group for query access (#59)
* Query access for 'everyone' does not work, but trust level 0 does,
and it works the same
2020-10-07 12:56:51 +11:00
Joffrey JAFFEUX 685b5a45c1
FIX: the filtered array was not being used (#69) 2020-09-23 09:53:14 -04:00
jjaffeux 6205bb8569 DEV: linting 2020-09-22 17:11:41 +02:00
Joffrey JAFFEUX e0a3ad12a6
DEV: apply coding standards (#66) 2020-09-04 13:23:11 +02:00
Krzysztof Kotlarek fe0806eb2a
FEATURE: introduce data-explorer tables (#61)
Instead of using `PluginStoreRow` we should use plugin-specific models like `DataExplorer::Query` and `DataExplorer::QueryGroup`
2020-08-27 10:29:57 +10:00
Rishabh fe420931ba
FIX: Use updated routes to link user profiles (#60)
FIX links to user profiles from the old route `/users/` to the new route `/u/`.
2020-08-18 11:31:05 +02:00
AndreaHabib 8bdfd845db
UI: Fixed missing text above query list for sorting (#58)
* changed directory-toggle to table-header-toggle which fixed the issue
2020-08-11 12:17:36 -05:00
Penar Musaraj 5a99501d88
DEV: Use CSS custom properties for colors in SCSS
Prepares the plugin for an upcoming change in core while maintaining
backwards compatiblity.
2020-08-03 21:21:23 -04:00
Ricky Chon dcfb92d7f8
FEATURE: Add ability to soft delete (hide) queries and revert deletion with rake tasks (#54)
* FEATURE: Add hide button (toggleable) for all queries (frontend only)

* Switches between hide/unhide on click
* Works almost like the delete button, but toggles between the query's
hidden attribute instead
* So far this is only a frontend feature, the backend implementation
still needs work

* Revert "FEATURE: Add hide button (toggleable) for all queries (frontend only)"

This reverts commit a8771d2ad5.

REVERT: Remove button that hides queries (frontend)

* Prepare for migration of old frontend logic to backend
* We are going to reuse the existing delete button, but change its
backend logic to enable soft deletion. From the user's perspective
nothing will change, but any deletion mistakes can be reverted.

* DEV: Hide user queries upon deletion, but keep them in store

* Creating a new query will set its hidden attribute to false by
default
* Deleting a user-made query will not delete it from the store, but
set its hidden attribute to true
* User queries will not be indexed if they are hidden
* Undeleting a query will unhide it, and will be indexed
* Updating a hidden query will unhide it, and will be indexed

* SPEC: Add spec for hidden/deleted queries

* Hidden queries should not be shown

* FEATURE: Add ability to delete/hide system queries

* System queries are now able to be deleted from view, but will remain
in the backend for retrieval, if necessary

* FEATURE/DEV: Add rake commands for query soft deletion

* query:list_hidden - Shows a list of hidden queries
* query:hide_all[only_default] - Hides all queries, w/ boolean arg to
hide only default ones
* query:unhide[id] - Unhides a query by id
* query:unhide_all[exclude_default] - Unhides all hidden queries,
w/ boolean arg to exclude default ones

* Remove rails loggers

* UX/DEV: Update query rake tasks to be more user friendly

* Split query:hide_all[only_default] into two tasks:
    * query:hide_all - Hides all queries
    * query:hide_all:only_default - Hide only default queries
* Split query:unhide_all[exclude_default] into two tasks:
    * query:unhide_all - Unhides all hidden queries
    * query:unhide_all:exclude_default - Unhides all non-default
    queries
* Rename file to match task name

* UX: query:unhide can accept multiple arguments

* Example: rake query:unhide[-5,-6,-7,3,5,6,-13,-14,-10]

* UX: Update query rake tasks to output cleaner messages

* Remove unneeded comment

* DEV: Keep only necessary rake tasks, use more specific naming

* UX/DEV: Add rake task for hard deletion, better console logs

* User is able to hard delete a query only if it is hidden, otherwise
output a message stating so
* Add commented examples above each task
* Add rainbow support for more readable console logs
* Successful messages will display green, failures display red,
additional info displays yellow
* Separate multiple queries with spaces instead of lines

* DEV: Remove rainbow colorizing in console logs

* Rainbow is a dependency of rubocop and it may go away in the future
* Rainbow is only used for dev and test environments

* DEV: Add Rails engine to enable rake tasks to be loaded at runtime

* DEV: Favor require - load files only if they are not already loaded

* SPEC: Add tests for data_explorer[id] rake command

* Test if a single query is hidden correctly
    * Expect length of query list to not be modified
    * Expect array of hidden queries to have exactly 1 element
    * Expect that one element to have the same ID as the one invoked to
    be hidden
* Test if multiple queries are hidden correctly
    * Expect length of query list to not be modified
    * Expect array of hidden queries to have the number of elements
    equal to the number invoked to be hidden
    * Expect the elements to have the same ID as the ones invoked to be
    hidden
* Test if a query exists in PluginStore
    * Expect query list to be empty

* DEV: Clear pre-existing tasks before redefining

* This prevents double invocation when user invokes the task once

* SPEC: Add tests for unhide_query rake task

* Test if a single query unhides correctly
    * Expect length of query list to not be modified
    * Expect array of hidden queries to have exactly 1 element after
    unhiding 1 of 2 queries
    * Expect remaining element to be hidden
* Test if multiple queries unhide correctly
    * Expect length of query list to not be modified
    * Expect array of hidden queries to have exactly 1 element after
    unhiding 3 of 4 queries
    * Expect remaining element to be hidden
* Test if a query exists in PluginStore
    * Expect query list to not be modified

* SPEC: Add tests for hard_delete rake task

* Test if a single query hard deletes correctly
    * Expect length of query list to be shorter by 1
    * Expect array of hidden queries to have exactly 1 element after
    hard deleting 1 of 2 queries
    * Expect 1 remaining hidden element
* Test if multiple queries hard delete correctly
    * Expect length of query list to be shorter by 3 after hard deleting
    3 of 4 queries
    * Expect array of hidden queries to have exactly 1 element after
    hard deleting 3 of 4 queries
    * Expect 1 remaining hidden element
* Test if a query exists in PluginStore
    * Expect hidden query list to not be modified
* Test if a query is not hidden
    * Expect query list to not be modified

* UX: Favor newline char in place of puts for logs

* Condensed console logs to output newline char instead of another puts
statement (reduces number of lines used significantly)
2020-07-29 16:50:24 +10:00
Robin Ward 0c1a9aa4bc FIX: deprecations 2020-07-06 15:25:19 -04:00
tshenry f04422244d
FIX: missing default params group reports (#50) 2020-06-05 09:56:53 -07:00
tshenry 0dcaa990b4
UX: minor share report popup improvements (#49) 2020-06-03 16:39:12 -07:00
Robin Ward 492d189c6e DEV: Discourse.Route is deprecated 2020-05-12 14:41:26 -04:00
Joffrey JAFFEUX 9297885629
FIX: ensures backward compat with previous findRawTemplate (#48)
To my knowledge we don't implement `requirejs.defined` so I rely on the __DISCOURSE_RAW_TEMPLATES constant which has been introduced in the commit where we moved from discourse/lib/raw-template to discourse-common/lib/raw-templates.
2020-05-06 15:20:37 +02:00
Penar Musaraj 277346b097 DEV: Find/replace deprecated decorators 2020-02-19 11:57:59 -05:00
Joffrey JAFFEUX df9e21911e FIX: makes group selector works with sk2 (#46) 2020-02-10 08:37:20 +01:00
Sam Saffron 7e21634987 lint file 2020-01-13 10:43:30 +11:00
Blake Erickson 6707072ef1 FIX: Remove buffered-render reference
Buffered-render has been removed from core, so this change allows us to
keep the same functionality without using the render buffer.
2020-01-11 06:04:14 -07:00
Blake Erickson d2ac25857f FIX: Remove component file
This file is no longer necessary.

Follow up to: 45fbba08fc
2020-01-10 18:34:24 -07:00
Blake Erickson 45fbba08fc DEV: Remove buffered render code
The render buffer code is being removed from core, so we need to remove
it's usage from this plugin. This change is a refactor only and should
not break any functionality.
2020-01-10 16:20:40 -07:00
Penar Musaraj 86516dadbb DEV: replace "warning" icons with "exclamation-triangle" 2020-01-06 12:52:27 -05:00
Mark VanLandingham d811b0c7a3 FIX: Use i18n for allow groups label (#44) 2020-01-06 12:08:35 +01:00
tshenry 02f4277f3d UX: Improve info popup overflow
Some of the longer variable names were overflowing. This commit is a follow-up to: https://github.com/discourse/discourse-data-explorer/pull/45
2019-12-09 09:02:32 -08:00
Penar Musaraj f1d463ecb0 DEV: Respect radix rule in eslint-config-discourse 1.0.6 2019-11-18 10:08:15 -05:00
Justin DiRose 48f0e2b982
FIX: Return all groups instead of truncated list (#42) 2019-11-14 12:39:55 -06:00
Penar Musaraj e8e32e27e0 Fix Prettier 2019-10-28 21:34:08 -04:00
Mark VanLandingham 960c126cc9 Remove unused variables in shart-report 2019-10-28 16:13:43 -05:00
Mark VanLandingham 446e6bf29c
FEATURE: Popup to copy shareable links to reports (#41)
* FEATURE: Popup to copy shareable links to reports

* Only show created_at if it is non-empty

* remove unneeded dependencies in share-report

* Use Discourse.BaseUrl and i18n some text
2019-10-28 14:32:09 -05:00
Joffrey JAFFEUX aa9a3a8ce5
minor code cleaning (#40) 2019-10-16 12:43:35 +02:00
Joffrey JAFFEUX 096ad2d62c
FIX: do not allow to create groups from group selection (#38) 2019-10-16 12:43:23 +02:00
Joffrey JAFFEUX 4196321e41
FIX: ensures group_ids are not "" or nil (#39) 2019-10-16 12:43:10 +02:00
Mark VanLandingham 7193d11ee6 FIX: ability to import an exported query (#37) 2019-09-17 16:20:33 +10:00
Joffrey JAFFEUX 844f96d146 FIX: ensures user has groups 2019-09-16 11:35:45 -07:00
Robin Ward b8c96afe83 FIX: Allow admins to access data explorer if no groups list is present 2019-09-11 15:13:27 -04:00
Joffrey JAFFEUX e9e309e271 minor linting 2019-09-11 10:52:40 -05:00
Joffrey JAFFEUX 8b989b2cf2 linting 2019-09-11 10:38:31 -05:00
Joffrey JAFFEUX a3ae064654 linting 2019-09-11 10:30:39 -05:00
Mark VanLandingham 30fe9289b8 Allow groups to access queries (#36)
* [WIP] group ids saving on new reports

* Add groups to default queries, and added tab connector

* group_ids set to empty array for default queries

* group reports route (in & and) action

* [WIP] created group reports show route/controller

* Find correct query in show route

* Removed empty array for group_ids in query file

* Add report show view, where users can run queries

* Removed unneeded commas from queries.rb

* Allow non-admin group members to access reports

* query-result component dynamic download url based on location

* Removed accidental changes, and corrected tab size

* Group members can add params to queries

* Specs for new QueryController actions

* remove "Inlude query plan" from group reports

* Run prettier

* return and return -> return render

Co-Authored-By: Robin Ward <robin.ward@gmail.com>

* [WIP] changes from review

* Remove weird [-1] group_ids logic, for a simply check for [] in query update action

* Added integration tests for group report access

* Using guardian for securing endpoints, and much improved specs

* Update assets/javascripts/discourse/components/group-reports-nav-item.js.es6

Co-Authored-By: Robin Ward <robin.ward@gmail.com>
2019-09-11 10:09:41 -04:00
Joffrey JAFFEUX 677722d676 FIX: prevents egression mutating read only object 2019-07-25 07:50:31 +02:00
Joffrey JAFFEUX 8f0bd298b1 fixes prettier 2019-07-16 13:15:27 +02:00
Joffrey JAFFEUX b9169ec28e
REFACTOR: old patterns, deprecations and dead code (#35) 2019-07-16 12:46:32 +02:00
Penar Musaraj ed2e0b8c13 Run Prettier 2019-06-14 13:27:41 -04:00
Penar Musaraj 300c862244 Fix eslint 2019-06-14 12:29:06 -04:00
Sam Saffron 29862defaa FEATURE: add support for _url to link to a url
This new feature means that if you name a column `xyz_url` then the return
value will be treated as a URL.

If you would like to name the link use the format `name,https://cnn.com`
2019-05-13 14:44:51 +10:00
Osama Sayegh 859021bb3c
UX: make SQL editor resizable (#33) 2019-04-07 09:05:43 +03:00
Rishabh 0ed53f7c5e DEV: Remove debug statement in explorer-container.js 2019-02-05 16:42:07 +05:30
Rishabh 6a69daf39a UX: Clean up button styles for query pages
- Add a "play" glyph for the Run & SaveRun buttons
- ensure that there's only one primary button on the page i.e. Run
- Remove btn-danger from discard button
- remove redundant button class from create button
- Improve redundant copy by removing the word "Query"
2019-02-05 14:21:52 +05:30
Rishabh 13ab013df2 FIX: Ensure that all query information persists after delete/un-delete operations
https://meta.discourse.org/t/data-explorer-created-by-missing/107195
2019-01-28 12:30:17 +05:30
Rishabh a285a38e9c FIX: Allow the Data Explorer API to set LIMIT to "ALL"
Fixes a bug that prevented returning unlimited rows.

Example request:
{{base_url}}/admin/plugins/explorer/queries/6/run?api_key={{api_key}}&api_username={{api_username}}&limit=ALL

From the PostgreSQL docs: "LIMIT ALL" is treated as no limit
https://www.postgresql.org/docs/current/static/sql-select.html#SQL-LIMIT
2019-01-23 16:18:06 +05:30
Rishabh a96bfdf6d5 DEV: Remove ESLint warnings 🚨 2019-01-22 17:19:01 +05:30
Rishabh 8720c2cd5c DEV: Replace hardcoded result limit with a module constant 2019-01-21 14:21:53 +05:30
Rishabh f1b33cc64e UX: Make the 'or' text in json-file-uploader smaller than the modal title 2019-01-09 15:24:06 +05:30