Commit Graph

529 Commits

Author SHA1 Message Date
Isaac Janzen a208c1b054
FIX: Reset results on query redirect (#236)
# Problem

When switching group reports it was possible to have the `results` from a previous run (of a query) pass over to the rendering of a different query.

# Fix

Set the controllers `results` to `null` when first rendering the query

https://user-images.githubusercontent.com/50783505/228050384-5231f004-1dc2-4867-8d57-9db7706bb65f.mov
2023-03-28 11:01:47 -05:00
David Battersby f589864ce1
FIX: Flaky test fix for Data Explorer Automated PM Feature (#235) 2023-03-27 15:57:33 +08:00
Alan Guo Xiang Tan 2c418e7484
DEV: Skip flaky test (#234) 2023-03-27 12:37:19 +11:00
David Battersby 705753216c
FEATURE: Allow data explorer query result to be sent as recurring PM (#233)
This feature enables admins to create reports automatically based on a recurring schedule.

It introduces a new automation script that includes the new email_group_user field added to discourse-automation, along with a query_id and query_params to pass in parameters to the existing data explorer query.

The output of the report will be sent via pm (as a markdown table) to the recipients entered within the automation script.

The automation (supports individual users, email addresses and groups).
2023-03-24 16:38:42 +08:00
Bianca Nenciu 206d937a78
DEV: Update plugin to match latest guidelines (#229)
This commit updates the plugin to the latest guidelines, as shown in
discourse-plugin-skeleton, which involves moving a lot of the code to
dedicated files, use proper namespaces, use the autoloader as much as
possible, etc.
2023-03-22 23:29:08 +02:00
Isaac Janzen 075a508e52
FIX: Special attributes not working (#232)
# Context
Data explorer gives you the ability to use special attributes such as 👇 

> SELECT TIMESTAMP 'yesterday' as reltime$time

# Problem
During the upgrade to ember octane these were neglected and did not work. This PR updates them to working condition.

# Additional
- Drop unused action of `saveDefaults`
2023-03-10 11:41:59 -06:00
Martin Brennan 389b8e15c9
DEV: Fix broken plugin specs because of bookmarkable changes (#231)
Followup to 360d0dde650704a0f01fd6d8b525e933b1d7fcf2,
this causes other plugin tests to fail because
`DiscoursePluginRegistry.reset!` is
a shotgun. We can use the more surgical version
`DiscoursePluginRegistry.reset_register!(:bookmarkables)`
instead.
2023-03-08 10:39:43 +08:00
Martin Brennan a684897468
DEV: Change bookmarkable registration to use new plugin API (#230)
Relies on core PR https://github.com/discourse/discourse/pull/20556
to be merged first.
2023-03-08 10:39:20 +10:00
Bianca Nenciu 0f6b30c2d8
Revert "DEV: Update plugin to match latest guidelines (#227)" (#228)
This reverts commit 9210cf6fa2.
2023-02-23 19:10:46 +02:00
Bianca Nenciu 9210cf6fa2
DEV: Update plugin to match latest guidelines (#227)
- Define extension modules
- Use different files instead of plugin.rb
- Make sure plugin is disabled according to the setting
2023-02-23 15:29:13 +02:00
Krzysztof Kotlarek 466d4bb00c
FIX: clear state when reports are changed (#226)
When show report page is left, results should be cleared to not interfere with next report.
2023-02-22 16:25:33 +11:00
Discourse Translator Bot d7a1b255fb
Update translations (#225) 2023-02-21 17:12:04 +01:00
Discourse Translator Bot c4d715b7c2
Update translations (#224) 2023-02-15 10:50:54 +01:00
Isaac Janzen 556d12ac50
FIX: Maintain editing state after saving query changes (#223)
In the widget version of the data-explorer we would maintain the `editing` state after saving query changes. This was lost in upgrade to glimmer. 

# Current State
https://user-images.githubusercontent.com/50783505/217622464-79adaab6-84ed-4b64-93ae-c889aa8fb1bd.mp4

# Updated State
https://user-images.githubusercontent.com/50783505/217623475-1998fab6-0b70-42d2-923d-574efb9d5601.mov

# Other Changes
- `createProperties` was added back to the `query` model as it is being utilized in the creation of a new data explorer query. This was accidentally removed and was causing errors when trying to create a new query.
- Add new-query test
2023-02-08 13:40:53 -06:00
Isaac Janzen 04b2177749
DEV: Upgrade `query` model to Octane (#221)
- Upgrade `query` model to Octane
- Update `assets/javascripts/discourse/templates/admin/plugins-explorer.hbs` to access values via `this.`
2023-02-07 12:44:38 -06:00
Isaac Janzen 29cfa6383c
DEV: Convert raw-hbs to view only components (#222)
- Convert raw.hbs files to co-located view only components
2023-02-07 12:26:47 -06:00
Isaac Janzen 332ae394e8
DEV: Upgrade `group-reports` to Octane (#218) 2023-02-06 11:20:03 -06:00
Canapin d6b94706a0
UX: Reduce the table height (#220)
Prevent the table to have a fixed 1000px height with the horizontal scrollbar at the bottom of a mostly blank section when we have only a few results.
This change doesn't interfere with the sticky header.
2023-02-06 18:05:17 +01:00
Isaac Janzen 5a65c15463
DEV: Upgrade admin-plugins-explorer to Octane (#219) 2023-02-06 10:21:58 -06:00
Discourse Translator Bot f51bc050a2
Update translations (#217) 2023-01-18 11:42:21 +01:00
Isaac Janzen 910b95bef8
FIX: Opening and closing of schema columns (#215)
Per: https://meta.discourse.org/t/cant-select-a-column-name-as-releasing-the-mouse-click-will-close-the-current-table-dropdown/250715/3

Fixed column toggling where columns should open and close when clicking column name, and not when clicking the column body.
2023-01-10 14:03:15 -06:00
Discourse Translator Bot 2b2e351331
Update translations (#214) 2023-01-10 20:54:37 +01:00
discoursebot e9f132b0d7
DEV: Update CI workflows (#216)
Co-authored-by: discoursebuild <build@discourse.org>
2023-01-10 18:11:40 +00:00
Isaac Janzen 4d26cf78f0
DEV: Upgrade `admin-plugins-explorer` to Octane (#209)
- Drop `explorer-container` and move its logic to `admin-plugin-explorer` container
- Convert resizing of the query edit pane from jquery -> draggable modifier
2023-01-05 09:27:10 -06:00
David Taylor b1df914549
DEV: Update eslint-config-discourse, use prettier for hbs (#212) 2023-01-04 13:36:14 +01:00
Isaac Janzen 27b30b5efb
FIX: Group reports downloads (#213)
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.
2022-12-30 10:26:14 -06:00
Isaac Janzen f5cd03a451
FIX: Downloading query results (#211)
We were not passing the correct value from the `query-results-wrapper` to the `query-result` component causing downloads to fail.
2022-12-29 14:47:18 -06:00
dependabot[bot] 974be7d591
Build(deps): Bump json5 from 2.2.1 to 2.2.2 (#210)
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v2.2.1...v2.2.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-29 12:22:49 -05:00
David Taylor 148d6c32a3
DEV: Introduce syntax_tree for ruby formatting (#208) 2022-12-29 13:31:29 +01:00
Isaac Janzen ac6b0467a1
DEV: Update params for group reports (#207)
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).
2022-12-28 09:50:55 -06:00
Isaac Janzen 3e7605d8a0
DEV: Update params to use previously ran values on reload (#206)
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
2022-12-27 12:10:29 -06:00
Isaac Janzen 85c88c5d80
DEV: Better handling of no results (#205)
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
2022-12-20 16:55:11 -06:00
Isaac Janzen 4c70cfa100
Upgrade `query-result` to Octane (#204)
* Upgrade query-result to Octane
2022-12-20 12:09:37 -06:00
Isaac Janzen cf365f7df2
Upgrade explorer-schema onetable/enum to Octane (#203)
* Upgrade explorer-schema onetable/enum to Octane
2022-12-20 10:30:43 -06:00
Isaac Janzen 147bfec207
Upgrade `data-explorer-bar-chart` to Octane (#201)
* Upgrade `data-explorer-bar-chart` to Octane
2022-12-16 11:52:00 -06:00
Isaac Janzen 7d1a9d487d
Upgrade `explorer-schema` to Octane (#202)
* Upgrade `explorer-schema` to Octane
2022-12-16 11:51:36 -06:00
Isaac Janzen 8028b9f16a
Upgrade `param-input` to Octane (#196)
* Convert `param-input` to glimmer components
2022-12-16 11:41:03 -06:00
Isaac Janzen bd602b02a0
Add test for category result (#200) 2022-12-15 11:35:18 -06:00
Isaac Janzen 9025646dc9
Hotfix category_id lookup (#199)
74dfc39530/assets/javascripts/discourse/components/query-row-content.js (L34-L35)

needed to pass the site object to 'lookup' parent functions and was erroring on category lookup.
2022-12-15 08:26:40 -06:00
Isaac Janzen 479d51faf0
Add followup test for displaying post in query results (#198) 2022-12-14 12:09:25 -06:00
Isaac Janzen 2934cc2129
Hotfix displaying posts (#197) 2022-12-14 09:06:36 -06:00
Isaac Janzen 74dfc39530
Upgrade query-row-content to Octane (#194)
* Upgrade query-row-content to octane
2022-12-13 09:21:01 -06:00
Isaac Janzen fea231f200
Upgrade share-report to Octane (#195)
* Upgrade share-report to Octane

* add requested changes
2022-12-13 08:49:39 -06:00
Discourse Translator Bot 467b6c8a91
Update translations (#193) 2022-11-29 15:36:46 +01:00
Sam 2313237a95
FIX: better handling of edge cases (#187)
- 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>
2022-11-18 07:09:50 +11:00
discoursebot 41a5e0a27a
DEV: Update CI workflows (#192)
Co-authored-by: discoursebuild <build@discourse.org>
2022-11-07 12:32:48 -06:00
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
Alan Guo Xiang Tan 4236689d27
FIX: Errors when running query due to PG template patterns or comments (#189)
Before this fix, the use of PG template patterns containing ":" or the
use of "?" in comments in the SQL will result in an error being raised
because `DB.param_encoder.encode` calls ActiveRecord's `sanitize_sql_array` which is
meant for SQL fragments and not an entire SQL string.

Instead we change data-explorer to use `MiniSql::InlineParamEncoder`
instead which takes into account of template patterns and does not trip
on `?` which is a special param encoding character used by ActiveRecord.
2022-10-10 09:03:37 +08:00
David Taylor 729e5a2add
DEV: Bump rubocop-discourse (#188)
* DEV: Bump rubocop-discourse

* Fix rubocop violations
2022-10-03 22:20:04 +02:00