Commit Graph

205 Commits

Author SHA1 Message Date
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
Joffrey JAFFEUX 0d655221f4 FIX: ensures filteredContent is recomputed when sortBy changes (#30) 2018-12-28 14:58:28 +05:30
Joffrey JAFFEUX 2b6357f8b4
FIX: ember 3 support 2018-12-16 15:22:23 +01:00
Rishabh 0af2453c23 FEATURE: Make searching case-insensitive 2018-11-16 16:13:40 +05:30
Penar Musaraj 061322e53a Finalize FA5 fixes 2018-11-15 11:12:32 -05:00
Penar Musaraj d05fb698d6 FA5 icon fix 2018-11-08 11:37:23 -05:00
Rishabh Nambiar 47f8de9c35 FIX: Show schema info tooltips inline 2018-11-08 12:04:04 +05:30
Rishabh 344f6e357d
FEATURE: Replace combo-box with search filter (#28)
* FEATURE: Replace combo-box with search filter
* Delete unused listname property and css fixes
* Use ES6 syntax and `@computed` decorator
2018-11-02 18:11:20 +05:30
Rishabh Nambiar 9dcba5c6e7 FEATURE: Allow clickable post titles in Data Explorer result view using post_id 2018-10-23 16:17:46 +05:30
Rishabh Nambiar 9d7db064af run Prettier 2018-10-10 17:31:14 +05:30
Rishabh b352e747c7
FEATURE: Ship default queries with the Data Explorer
Load default queries from queries.rb and save when run.
Each time a query is run, it picks up changes from queries.rb.
2018-10-10 16:59:13 +05:30
Rishabh Nambiar f876cf66f1 Increase result limit from 250 to 1000 2018-09-18 11:24:37 +05:30
Rishabh Nambiar 316923f190 FEATURE: Show the number of results after running a query (limit 250) 2018-09-18 11:15:31 +05:30
Rishabh Nambiar 68059b540e UX: Style improvements in query edit & result view 2018-09-12 18:58:54 +05:30
Rishabh Nambiar 90c2be7f82 FIX: Remove inconsistent row-highlight from the recent queries list 2018-09-12 16:38:08 +05:30
Rishabh Nambiar 1ea20132a0 FIX: Remove an unnecessary Handlebars condition 2018-09-12 14:53:29 +05:30
Rishabh Nambiar dc91b7d0cd FIX: Remove useless no_query_hook text and move create & import buttons to top right 2018-09-07 16:06:23 +05:30
Kris 6904e516ae Removing br tags so an empty description doesn't add space 2018-09-05 13:33:06 -04:00
Kris a8742f4c64 UX: Minor style improvements and consistency 2018-09-04 14:53:12 -04:00
Rishabh Nambiar a518ac58fc FIX: Restrict clickable area to the size of heading-toggle 2018-09-04 21:52:44 +05:30
Rishabh Nambiar 9e27d0b8d3 FIX: Update stylesheet to use indented sass syntax 2018-09-03 00:27:44 +05:30
Rishabh Nambiar 5edb8ea7f8 UX: Make Explorer UI similar to User Activity and Groups pages 2018-08-31 23:41:33 +05:30
Rishabh Nambiar 5a75b6c1e1 FIX: Fix ESLint issues and use d-icon instead of <i> tags 2018-08-30 21:35:43 +05:30
Rishabh Nambiar d5d933c2a8 FEATURE: Sort queries by names, last_run_at by clicking table headers 2018-08-30 17:32:52 +05:30
Rishabh Nambiar 80f97d9514 UX: Force refresh model to update last_run_at after a query is run 2018-08-30 14:13:40 +05:30
Rishabh Nambiar 3bdf624ced UX: Improve padding while editing a query and text-field width consistency 2018-08-29 13:21:02 +05:30
Rishabh Nambiar 0673b68a58 FIX: Make entire row clickable 2018-08-28 12:39:33 +05:30
Rishabh Nambiar 6a57f6536d FIX: Render creation date instead of run date if query was never run 2018-08-28 12:14:43 +05:30
Rishabh Nambiar 1fc73a211a FIX: Improved username alignment 2018-08-28 12:00:25 +05:30
Rishabh Nambiar 1b68847d21 FEATURE: Sort queries by last_run_at as default 2018-08-27 20:10:25 +05:30
Rishabh Nambiar feb8a1ce0f FIX: Don't save placeholder text only if description is empty 2018-08-25 23:02:43 +05:30
Rishabh Nambiar 2f0400a7e0 FIX: Don't save placeholder text if description is empty 2018-08-24 12:43:18 +05:30
Rishabh 71845a3d87
Merge pull request #17 from discourse/fix_default_description_text
FIX: Remove bad default query description and add placeholder instead
2018-08-20 14:05:05 +05:30
Rishabh Nambiar 7647b1597f FIX: Use predefined SCSS colors instead of hardcoded colors 2018-08-20 11:32:41 +05:30
Arpit Jalan 4af28311ab hide controls on query page 2018-08-19 16:28:24 +05:30
Rishabh Nambiar 42b6dbbae2 FIX: Remove bad default query description and add placeholder instead 2018-08-19 10:24:53 +05:30
Rishabh Nambiar 86a4957bd1 FIX: Ensure that back button always redirects to index page 2018-08-17 15:30:07 +05:30
Rishabh Nambiar a64ef6c6c7 Added button to go back to query list after visiting a query 2018-08-16 23:14:07 +05:30
Rishabh Nambiar 83b1fcb54b Added User.find() & fixed scroll history bug 2018-08-14 17:38:08 +05:30
Rishabh Nambiar 6e806cc1df Added clickable rows, default query sorting by id and clickable usernames 2018-08-14 17:38:08 +05:30
Rishabh Nambiar e341d5a6fa List all previous queries on Data Explorer homepage 2018-08-14 17:38:08 +05:30
Régis Hanol 7c94f98436 FIX: prevent creation of query with an empty name 2018-05-09 22:23:56 +02:00
Régis Hanol aca7b188f6 UX: better blank state (create vs select a query) 2018-05-09 22:23:49 +02:00
Kris 7077a646c0 Hide none state from dropdown 2018-05-09 15:49:43 -04:00
Kris 41106fed61 class fix 2018-05-09 14:06:39 -04:00
Kris c6f0284529 Adding placeholder for none state 2018-05-09 14:04:14 -04:00
Guo Xiang Tan bcdff915dc Make eslint happy. 2017-08-02 18:05:33 +09:00
Robin Ward e68813e6dc FIX: You don't need to require the route map, it's automatically found 2017-07-05 14:16:40 -04:00
Robin Ward d82109b00b FIX: Adds back removed component 2017-05-11 12:45:15 -04:00
Arpit Jalan 0d6af9d920 FIX: importing query was broken 2017-04-04 14:07:07 +05:30
Robin Ward 4b3e5d547d FIX: Support raw templates in the latest discourse releases 2016-12-27 11:47:50 -05:00
Robin Ward e2ee693f64 This file should be removed 2016-12-01 13:56:09 -05:00
Robin Ward 91815c9f00 FIX: Remove Deprecated Views 2016-12-01 13:54:21 -05:00
Robin Ward 0d62ad73d4 FIX: Don't have CPs perform sets 2016-11-24 15:31:05 -05:00