We were not passing the correct arguments through in the group reports template causing the download url to default to an admin route. This made downloads unavailable to non-admin users. Fixed by passing the correct values through.
During the upgrade to Octane group reports did not have the necessary 'updateParams' function added to have the param input changes bubble up to the parent. This PR adds the missing function as well as a small test to check that params can be inputted as expected (inserting a param would error previously).
After running a query with a non-default query param (inserting the new param into the url) we want to have the same params available after reloading the page. To do this we need to pass the updated params back up to the parent due to Octane's one direction data stream. I went over this with @pmusaraj and we both agreed this was extremely difficult to test due to needing to reload the page in a test, so we opted to move forward without one. A system test could be helpful in this case... I will investigate in a follow up PR.
- Move param-input tests to a dedicated file
When there were no query results it would throw an error due to `this.resultCount` always passing as it is in the format of
```
"INTEGER - results returned"
```
so we need to grab the first index of the string and check if the integer is great than 0
- Require query name is present
- Ensure all routes are treated by default as .json, so errors flow correctly
- Remove superflous save/cancel controls from group settings
- Remove group control when item is destroyed
- Disable editing of query when it is deleted
Co-authored-by: Osama Sayegh <asooomaasoooma90@gmail.com>
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.
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.
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).
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.
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.
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.
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.
The toString() that was introduced in 80ffc45 was preventing any actively permitted groups from displaying in the group picker when entering a query page.
* 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)
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.
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.
* 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