Commit Graph

554 Commits

Author SHA1 Message Date
锦心 760667d744
FIX: Param should be displayed when the default value is invalid (#313)
What's the problem?
===================

TL;DR: When the user enters an incorrect default value, its
corresponding param-input will disappear

When creating a parameter from SQL, we perform cast_to_ruby, which means
that if the default value given by the user is invalid, the entire
parameter will not be added to the param_list of the query.
This behavior is very confusing, and users will not understand why an
incorrect initial value will cause the param-input to disappear.

What's the fix?
================

The cast_to_ruby process is canceled in create_from_sql, so that
param-input with incorrect default value will still be displayed.
We have a simple validation process on the front end, which is enough to
prompt whether some default inputs are incorrect.
2024-08-21 12:03:11 +08:00
Discourse Translator Bot b6c45800b3
Update translations (#311) 2024-08-20 17:54:06 +02: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
锦心 b063db4ba4
FIX: Use with_deleted only in topic and post (#308)
We used `with_deleted` incorrectly in the code. This method does not exist
on `User`, `Badge`, and `Group`. This will cause an error when entering a
numeric id in these three parameter input, forcing the user to enter the
name/username of these inputs.

See https://github.com/discourse/discourse-data-explorer/pull/307#issuecomment-2291017256
2024-08-15 20:01:53 +08:00
Discourse Translator Bot 6425462b15
Update translations (#305) 2024-08-13 16:31:20 +02: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
dependabot[bot] dd05e35e0f
Build(deps-dev): Bump rexml from 3.2.8 to 3.3.3 (#302)
Bumps [rexml](https://github.com/ruby/rexml) from 3.2.8 to 3.3.3.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.2.8...v3.3.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-05 13:13:55 +02: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
Natalie Tay 6aca7f1ae4
DEV: Pin plugin for Discourse < 3.4.0.beta1-dev (#301) 2024-08-02 17:05:41 +08:00
Discourse Translator Bot 2d0dc39767
Update translations (#300) 2024-07-31 00:14:15 +02: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
Robert 6e986c008c
FEATURE: add instant run-off voting export query (#294) 2024-07-17 14:45:40 +02: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
Jan Cernik 489aacf156
DEV: Use the `only` option when returning groups as json (#296) 2024-06-26 16:43:11 -03:00
dependabot[bot] e8beeca5c5
Build(deps): Bump braces from 3.0.2 to 3.0.3 (#295)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/braces/compare/3.0.2...3.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-16 22:30:36 +02:00
Discourse Translator Bot f9299d8ee1
Update translations (#293) 2024-05-31 12:27:21 +02:00
Loïc Guitaut c19fca4060
DEV: Update rubocop-discourse to version 3.8.0 (#292) 2024-05-28 11:16:14 +02: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
dependabot[bot] 901caf4a63
Build(deps-dev): Bump rexml from 3.2.6 to 3.2.8 (#290)
Bumps [rexml](https://github.com/ruby/rexml) from 3.2.6 to 3.2.8.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.2.6...v3.2.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-16 23:54:32 +02:00
Osama Sayegh 7f7d930559
DEV: Rename `Jobs::DiscourseAutomationTracker` -> `Jobs::DiscourseAutomation::Tracker` (#289)
The class is renamed in https://github.com/discourse/discourse/pull/26860.
2024-05-06 23:12:48 +03:00
Jarek Radosz 9103fee7ab
DEV: Update htmlSafe import (#288) 2024-04-27 12:00:41 +02:00
Discourse Translator Bot f214591721
Update translations (#287) 2024-04-23 16:22:23 +02:00
Natalie Tay b9d875cc3e
FEATURE: Add ability to skip sending the PM if there are no results (#286) 2024-04-18 21:40:28 +08: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
David Battersby cde34fb316
FIX: send single report PM to groups (#284)
The main change here is that we now send a single PM to a group rather than individual PMs to each group member.

This change also adds email recipients correctly as target_emails since support was added within Discourse Automation.
2024-03-27 17:40:26 +08: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
Selase Krakani 0e301bef74
DEV: Pin plugin for Discourse < 3.3.0.beta1-dev (#279) 2024-02-29 13:51:04 -07:00
Loïc Guitaut abe51c2aba
DEV: Fix new Rubocop offenses (#282) 2024-02-29 18:15:57 +01:00
Martin Brennan f09e631636
DEV: Adapt to core bookmark changes (#280)
* Added can_see_bookmarkable? methods to BaseBookmarkable, implement
  that in QueryGroupBookmarkable
* Update spec to check that Notification for reminder has
  bookmarkable_id and bookmarkable_type

c.f. https://github.com/discourse/discourse/pull/25905
2024-02-29 09:11:40 +10:00
Martin Brennan 94e29e2143
DEV: Skip spec (#281)
Will reinstate after https://github.com/discourse/discourse/pull/25905
which is failing because of this spec not being compatible
with the changes.
2024-02-28 13:29:01 +10:00
Discourse Translator Bot ebe71a7a13
Update translations (#278) 2024-01-30 17:03:30 +01:00
Discourse Translator Bot 208ee6af55
Update translations (#277) 2024-01-23 18:29:29 +01: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
Natalie Tay 66c54a35cd
FIX: Continue to send the PM to others when there is a group or user that does not exist (#274)
Don't error out  when there is a group or user that does not exist
and also allow admins to be sent
2024-01-03 14:05:03 +08:00
Isaac Janzen 70458df7cc
DEV: Convert ajax functions to async (#273) 2024-01-02 12:38:22 -07:00
Jarek Radosz 2a596e3fd9
DEV: Update linting (#272) 2023-12-29 14:19:56 -07:00
Natalie Tay 9bd70192b6
UX: Warn in /logs when PM is not sent (#271) 2023-12-11 11:08:08 +08: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
Renato Atilio 840caa3987
DEV: add leading slash to `visit` in test (#266) 2023-11-23 16:34:09 -03:00
Jarek Radosz e468cf8ab0
DEV: Update `visit` paths in tests (#265)
Omitting `/` prefix was incorrect and could break in the future (see: https://github.com/discourse/discourse/pull/24445)
2023-11-21 22:23:35 +01:00
Kris f83e6a1967
DEV: fix test for new category badge structure (#263) 2023-11-13 10:46:40 -05:00
TheJammiestDodger 9f841a4c6f
FIX: Update 'Largest Uploads' queries to use the upload_references table (#261)
The post_uploads table has been deprecated. This commit updates the 'Top 50 Largest Uploads' query to use the new upload_references table instead.
2023-11-13 09:53:33 +00:00
Martin Brennan fbe2a37e0c
Update metadata on plugin.rb (#262)
Co-authored-by: AlexDev <104522507+alexdevlaeminck@users.noreply.github.com>
2023-11-08 11:26:51 -08:00