Commit Graph

584 Commits

Author SHA1 Message Date
David Taylor bdff229ca0
DEV: Update linting (#341) 2024-11-28 15:51:12 +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 b2ce8183c1
DEV: Update linting (#339) 2024-11-20 18:53:05 +01:00
David Taylor efb7f36a98
DEV: Update linting (#338) 2024-11-20 15:45:48 +01:00
dependabot[bot] 3a58ba6b47
Build(deps): Bump cross-spawn from 7.0.3 to 7.0.6 (#337)
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-19 10:47:40 +00:00
David Taylor e841ad40fa
DEV: Update eslint config (#336) 2024-11-19 11:20:51 +01:00
dependabot[bot] f289194701
Build(deps-dev): Bump rexml from 3.3.6 to 3.3.9 (#335)
Bumps [rexml](https://github.com/ruby/rexml) from 3.3.6 to 3.3.9.
- [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.3.6...v3.3.9)

---
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-10-28 20:37:34 +01:00
Gabriel Grubba 66ea40fe3d
DEV: Update plugin annotations (#334) 2024-10-25 09:42:37 +01:00
Jarek Radosz e1db1b0fe2
DEV: Remove deprecated use_redis_snapshotting (#333) 2024-10-21 15:27:37 +02:00
Discourse Translator Bot 88f18b8acd
Update translations (#332) 2024-10-16 17:51:57 +09:00
Kelv d4f5257395
DEV: Switch to use pnpm (#331) 2024-10-14 13:39:24 +02:00
Martin Brennan 8d19a33250
FIX: Optionally linkify URL columns server-side (#330)
Followup da1c99ec2d

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
Bianca Nenciu b43d82d5d6
DEV: Fix mismatched column types (#329)
The primary key is usually a bigint column, but the foreign key columns
are usually of integer type. This can lead to issues when joining these
columns due to mismatched types and different value ranges.
2024-10-10 16:29:37 +03:00
Martin Brennan da1c99ec2d
FEATURE: Add script to post report results in a topic regularly (#328)
This script is similar to the existing one that schedules
report results to to be sent to a PM on a regular basis,
but instead takes a topic ID and posts to that. This way
people can have report results sent to a public topic regularly
too and not have to deal with PM recipients and so on.
2024-10-10 16:09:09 +10:00
Linca d3064661cb
DEV: Add missing `freeze_time` in report_generator_spec (#327)
We are missing two `freeze_time`s in the spec, which makes these two
tests flaky tests.

ref: t/138542
2024-09-18 09:09:07 +08:00
Jarek Radosz 9132153ae6
DEV: Fix spec regressions caused by test-prof change (#326)
The change in question: e6a3483c9a
2024-09-08 21:22:27 +02:00
Discourse Translator Bot 3f96352a43
Update translations (#320) 2024-09-02 18:00:01 +02: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
dependabot[bot] 978431da02
Build(deps): Bump micromatch from 4.0.5 to 4.0.8 (#324)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.5...4.0.8)

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

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-01 12:41:37 +02:00
dependabot[bot] 81e2843426
Build(deps-dev): Bump rexml from 3.3.3 to 3.3.6 (#317)
Bumps [rexml](https://github.com/ruby/rexml) from 3.3.3 to 3.3.6.
- [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.3.3...v3.3.6)

---
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-09-01 12:31:50 +02: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 ba9ead855e
DEV: Fix autoloading (#322)
A follow-up to e23c31195b

Fixes errors like:
```
NameError:
       uninitialized constant DiscourseDataExplorer::ValidationError
     # ./plugins/discourse-data-explorer/spec/lib/parameter_spec.rb:15:in `block (3 levels) in <main>'
```
2024-08-28 10:11:08 +02:00
Linca e23c31195b
DEV: Use Rails autoloading (#321)
This commit enables Rails autoloading for Data Explorer. See:

https://meta.discourse.org/t/structuring-a-plugin-for-rails-autoloading/256092
2024-08-28 11:36:44 +08: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
锦心 cbae98f6ed
FEATURE: Allows CSV file result to be attached in automated PMs (#318)
This commit adds an optional setting that allows to attach query results
in CSV format as a file to PMs sent by Data Explorer's automation
scripts.

meta topic: https://meta.discourse.org/t/turn-data-explorer-query-results-into-csv-to-attach-to-discourse-automated-emails/267529

Co-authored-by: Drenmi <drenmi@gmail.com>
2024-08-27 11:41:12 +08: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
锦心 1d991c6192
FIX: fix double validation (#314)
The old float validation had several bugs. It will recognize strings
like "a1.2" and "3.4b" as valid doubles, but will not recognize integers
like "1234" as doubles. Also, since an empty string is not falsy in Ruby,
it will recognize "Inf" as -Infinity.

This commit fixes these issues
2024-08-21 15:39:56 +08:00
锦心 6bf3ac7426
FIX: Fix `user_id` validation (#312)
Validation of `user_id` parameter will throw a 500 error because
`User.find_by_username_or_email` does not throw
`ActiveRecord::RecordNotFound`, but silently returns `nil`.
This results in a `NoMethodError` in `object.id` on the next line
2024-08-21 12:03:29 +08:00
锦心 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