282 Commits

Author SHA1 Message Date
Gary Pendergast
c13e79d21b
FIX: Query downloads were being passed an incorrect query object. (#359)
This is a follow-up to d726c4889e5c5d7726ed1035c37d0cd60a3bb3d6.

The previous change missed changing the name of the query object when passing it to QueryResultsWrapper, which resulted in the download links not working properly after a query was run.

This change fixes that bug, and includes an acceptance test to ensure it stays fixed during future work on this plugin.
2025-02-14 10:11:32 +11:00
Gary Pendergast
d726c4889e
DEV: Split the Query Listing and Query Editing code (#356)
The code for listing all of the defined queries is mixed together with the code for editing a single query. Notably, this results in large amounts of unnecessary data being loaded for the list view, which causes substantial rendering slowdowns.

To address this issue, we now only load the necessary data for the list view, and load the full data when it's actually needed (any endpoint that returns a single query). The primary changes that achieve this are:

- Create a new `QueryDetailsSerializer` serialiser, which includes all of the query info, and change the existing `QuerySerializer` serialiser to only include the necessary attributes of each query for generating a list of them all.
- Split the monolith `/plugins/explorer` route into `/plugins/explorer` for showing just the list of queries, and `/plugins/explorer/queries/:query_id`, for showing/editing/running a specific query.
2025-02-10 14:54:01 +11:00
David Taylor
bd6263e9b8
DEV: Bump dependencies and fix linting (#355) 2025-02-06 17:45:00 +01:00
Renato Atilio
2ba204a1de
FIX: boolean field default state mismatch (#353)
When reading an existing state from the params defaults or from URL params, the input elements weren't representing the right state for booleans and "3-state/null booleans".

internal /t/-/118495
2025-02-04 09:22:49 -03:00
David Taylor
5751283ec5
DEV: Colocate component templates (#350) 2025-01-09 13:26:13 +00:00
Ella E.
950246a946
UX: Apply admin table classes for consistent mobile styling on the recent queries page (#349)
* UX: Apply admin table classes for consistent mobile styling on the recent queries page

* DEV: Apply prettier
2024-12-23 08:41:46 -07:00
Kelv
256ef27b85
DEV: Update more deprecated Font Awesome icon names (#345) 2024-12-06 20:45:09 +01:00
Kelv
4c8b164127
DEV: Update deprecated Font Awesome icon names (#343) 2024-12-04 02:37:51 +01:00
David Taylor
e5d951c9a9
PERF: Remove dynamic use of <template> (#340)
Context: https://github.com/discourse/discourse/pull/29942
2024-11-26 19:10:23 +00:00
David Taylor
efb7f36a98
DEV: Update linting (#338) 2024-11-20 15:45:48 +01:00
David Taylor
e841ad40fa
DEV: Update eslint config (#336) 2024-11-19 11:20:51 +01:00
Martin Brennan
8d19a33250
FIX: Optionally linkify URL columns server-side (#330)
Followup da1c99ec2d272a4eac8586a8b61794e8b755619b

We already had the functionality to convert results like
this:

```
|blah_url|
|--------|
|3,https://test.com|
```

To a link clientside, so in the UI it looks like this:

```
<a href="https://test.com">3</a>
```

With the addition of the recurring report to post automation,
and the existing report to PM automation, we also need to be
able to do this server-side, so reports don't come out malformed
if they have these type of count + URL columns.
2024-10-14 16:33:13 +10:00
Linca
8a982beae9
UX: Automatically convert to lowercase in explorer-schema (#325)
* UX: Automatically convert to lowercase in explorer-schema

In the past, ExplorerSchema searches were case-sensitive, so if the
user's input method capitalized the first letter, it was likely that no
results would be found.

The new change allows you to enter uppercase letters, which will
automatically be converted to lowercase when searching.

meta topic: https://meta.discourse.org/t/can-the-data-explorer-search-input-be-converted-to-lower-case/323435
2024-09-02 12:02:36 +08:00
Jarek Radosz
f62d8cc8a2
DEV: Update tests (#323)
new imports, resolved deprecations, qunit-dom, strict assertions, fixed flakes, migrated the legacy component test, typos, gjs
2024-08-28 13:51:37 +02:00
Jarek Radosz
d31d89942e
DEV: Update ace-editor usage (#319)
AceEditor is now a glimmer component (see: https://github.com/discourse/discourse/pull/28492) and it follows the "data down, actions up" pattern.
2024-08-27 13:42:25 +02:00
锦心
68760cd3a5
UX: Rewrite date/time param-input using FormKit (#316)
This commit changes the date/time input (including `date`, `time`, and
`datetime` types) to the date/time input provided by FormKit.
2024-08-22 23:24:12 +08:00
锦心
24bd4ba099
UX: Use GroupChooser in group_id param input (#315)
This commit uses GroupChooser as the input for param input of type
group_id. Meanwhile, it improves invalid group validation and semantic
error prompts.
2024-08-22 17:46:12 +08:00
锦心
b47ba7ea60
DEV: Use Category's async method in param-input (#310)
This commit refactors the category id normalization of param-input to
use `Category.asyncFindBySlugPath`.

Now, the category id input will use an async query when the
default/initial value is category slug.

Co-authored-by: Natalie <1555215+nattsw@users.noreply.github.com>
2024-08-21 15:41:02 +08:00
锦心
6d179745ec
FIX: Empty param-inout form should reject submit (#309)
The `onSubmit` hook will only be triggered when the form is valid, so we
need to clear the contents of `serializedData` in advance in `submit`.
Otherwise, it may not throw a validation error.
2024-08-20 10:09:48 +08:00
锦心
5080ce9b1f
UX: Rewrite param-input using FormKit (#307)
What does this PR do?
=====================

This PR refactors param-input to use FormKit. FormKit is a structured
form tool in the core. After the rewrite, we will be able to get semantic 
parameter error prompts, etc.

meta link: https://meta.discourse.org/t/wishlist-param-dropdown-for-data-explorer-query/253883/28?u=lhc_fl
2024-08-20 09:42:50 +08:00
锦心
902b8c7913
UX: Using CategoryChooser for param param_input (#306)
This change changes the category selector to use CategoryChooser instead
of a bare text input to improve the user experience.

Related meta link: https://meta.discourse.org/t/wishlist-param-dropdown-for-data-explorer-query/253883/28
2024-08-13 16:03:26 +08:00
锦心
41dfa217ca
FIX: Wrong type in category_id param input (#304)
* FIX: Wrong type in category_id param input

We will dasherize category_id. The dasherize function accepts a string,
but we don't type-check it, so the default null may be passed in. This
will cause a type error and crash the front-end.
2024-08-05 20:11:16 +08:00
锦心
e0bfa66f5f
FIX: Create parameter input boxes after save (#303)
What does this fix?
===================

When creating a data explorer query that includes parameters, the
parameter input boxes don’t display until the page is refreshed.

After this commit, when the query is saved, the input boxes will appear.

ref: t/113297
2024-08-05 15:58:51 +08:00
锦心
6db96d6687
FEATURE: Add shortcut keys for save and execute for query editor (#299)
This is a very simple change that adds two shortcuts to the query editor
in Data Explorer: `ctrl+s` to save, and `ctrl+enter` to save and run the
query.

Related meta topic: https://meta.discourse.org/t/wishlist-ctrl-enter-to-run-the-data-explorer-query-im-editing/280564
2024-07-22 16:14:22 +08:00
锦心
6d975d7e90
FEATURE: Add Data Explorer Params to the URL for group queries (#298)
We have introduced a URL param mechanism for data explorer queries for administrators
in https://github.com/discourse/discourse-data-explorer/pull/128/
However, for data explorer queries in group page, URL params are not yet introduced.

This PR introduces this missing piece.

Related meta topic: https://meta.discourse.org/t/populate-data-explorer-params-with-url-params/169404/8
2024-07-05 17:49:18 +08:00
Osama Sayegh
7d99c621a9
FIX: Use correct label for column header (#297)
This commit changes the header for the first column of the queries table to have the correct label. Currently it says "Created by", but it should be "Query".
2024-07-02 00:13:04 +03:00
Martin Brennan
87d7958db8
FIX: Bookmarking group reports (#291)
Since 67a8080e33
in core, the functionality to bookmark a report from the group
Reports tab has been broken. This commit fixes the issue and adds
system spec coverage to prevent regression.
2024-05-22 09:18:09 +10:00
Jarek Radosz
9103fee7ab
DEV: Update htmlSafe import (#288) 2024-04-27 12:00:41 +02:00
Bianca Nenciu
d8d7bbb778
DEV: Prefer Category.findById over categoryById (#285)
Category.findById should be used over site.categoryById map because
that is an implementation detail that might be removed in the future.
2024-03-27 18:44:02 +02:00
Penar Musaraj
2f1044820c
FEATURE: Add group_list parameter type (#283)
This allows admins to select multiple groups from a dropdown list and
filter results using that parameter.
2024-03-12 12:06:01 -04:00
Martin Brennan
48a4038809
FEATURE: Allow topic URL without post number for post_id param (#275)
This commit allows base topic URLs (e.g. https://meta.discourse.org/t/hide-text-in-text-select-popup-menu-feedback/287656)
to be used by the post_id parameter type. We just assume in this case
that the post_id for the param is 1.
2024-01-16 15:09:05 +10:00
Jarek Radosz
31ebf69d81
DEV: Update linting (#276) 2024-01-15 11:17:19 +00:00
Isaac Janzen
70458df7cc
DEV: Convert ajax functions to async (#273) 2024-01-02 12:38:22 -07:00
Isaac Janzen
3dd5ad0f9c
DEV: Update modal to component API (#269)
<img width="622" alt="Screenshot 2023-12-06 at 12 10 09 PM" src="https://github.com/discourse/discourse-data-explorer/assets/50783505/5a6fb0b2-829c-4af3-93c9-91676b78ab59">
2023-12-07 11:49:35 -07:00
Natalie Tay
ac7df5e3d0
DEV: Use plugin name appropriately in warning (#270)
Use plugin name appropriately in warning
2023-12-07 16:09:06 +08:00
David Taylor
a6341627d0
DEV: Resolve transitionTo deprecation (#268) 2023-12-01 16:02:52 +00:00
Jarek Radosz
e067df0b43
DEV: Update linting (#267) 2023-12-01 16:47:54 +01:00
Martin Brennan
5776aa7fc9
FEATURE: Add JSON result type component (#260)
If a column is payload or contains _payload it will be assumed
it has JSON data in it, then we will show the truncated JSON in the
result column with a button to show the full-screen formatted
JSON using our full-screen code viewer. We also do the same if
the column is the `json` postgres data type.
2023-11-02 09:50:05 +10:00
Martin Brennan
b8b66ded0e
DEV: Use new bookmark modal (#252)
The new glimmer bookmark modal using d-modal is introduced
in:

https://github.com/discourse/discourse/pull/22532
2023-07-17 10:28:00 +10:00
Jordan Vidrine
b56065f989
FIX: Increase z-index of th element (#253) 2023-07-12 15:51:56 -05:00
Kris
6b9bb24880
DEV: update box-shadow definition (#248) 2023-06-15 10:17:45 -04:00
Isaac Janzen
c31d33a50c
DEV: Use angle bracket syntax (#246) 2023-05-26 14:27:40 -05:00
Canapin
6e8aeff437
UX: fix parameters inputs spacing (#245)
* UX: fix parameters inputs spacing

* trying to fix the linting errror 😬
2023-05-25 22:59:59 +02:00
Jan Cernik
2144e7b3ba
FIX: Show "false" and "0" in query result (#244) 2023-05-04 19:45:43 -03:00
Penar Musaraj
3907c49263
FIX: Reduce issues when debouncing schema search (#241)
Previously the debounced value was both setting the filter value and
updating the input's text value. This causes visible UI issues, because
the debounce updating the input's text value would sometimes reset it,
especially if/when typing quickly.

This PR also uses sticky positioning for the search form, so that it
stays visible even when scrolling the list of schema tables.
2023-04-18 10:33:25 -04:00
Joffrey JAFFEUX
97d60de92a
FIX: ensures explorer is using default values when provided (#240) 2023-04-17 09:06:27 -05:00
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
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
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