Feature #33296

Load default custom queries when running redmine:load_default_data rake task

Added by Go MAEDA about 1 month ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Filters
Target version:4.2.0
Resolution:Fixed

Description

redmine:load_default_data loads various kinds of default data such as roles, permissions, issue statuses, trackers, workflows, and enumerations, to a fresh installation of Redmine. These default data will save users time and allow them to learn how to configure Redmine.

I think it would be great if the rake task also creates default queries for the reasons as follows:

  • Users can easily learn about the query feature. Currently, it is a bit difficult for beginners to find the feature. "Save" button is the only way to find it
  • Providing some typical queries by default is convenient for many users

The attached patch improves redmine:load_default_data rake task to add four queries by default. The queries are "Issues assigned to me", "Reported issues", "Updated issues", and "Watched issues", equivalent to blocks available on My page.

This idea came to me when I tried using Jira. There are some queries such as "My open issues" and "Reported by me" in a fresh Jira project.

default-queries.png (92.8 KB) Go MAEDA, 2020-04-16 13:29

jira-default-queries.png (66.3 KB) Go MAEDA, 2020-04-16 13:36

load_default_query.patch Magnifier (2.98 KB) Go MAEDA, 2020-04-16 13:38

load_default_query.patch Magnifier (3.66 KB) Go MAEDA, 2020-04-18 09:39

load_default_query.patch Magnifier (4 KB) Go MAEDA, 2020-04-19 06:20

Associated revisions

Revision 19731
Added by Go MAEDA about 1 month ago

Load default custom queries when running redmine:load_default_data rake task (#33296).

Patch by Go MAEDA.

Revision 19733
Added by Go MAEDA about 1 month ago

Fix test failures due to r19731 (#33296).

History

#1 Updated by Mischa The Evil about 1 month ago

+1 for the integration of this proposal. A few notes nevertheless:
  • Wouldn't such default custom queries be useful also for the other Query subclasses?
  • Regarding your comment that "[...] Currently, it is a bit difficult for beginners to find the feature. "Save" button is the only way to find it [...]": what about the documentation? It may be rudimentary, but it is clearly explained in RedmineIssueList#Applying-and-saving-filters that filters can be saved. I agree though that this is not (yet) the case for Query subclasses other than IssueQuery.
  • On a more general note: I wouldn't suggest to run redmine:load_default_data while provisioning a new Redmine instance in a (corporate) production environment in the first place, but this depends heavily on the scale of the deployment and the kind of environment it's deployed in, so, YMMV.

#2 Updated by Marius BALTEANU about 1 month ago

  • Target version set to Candidate for next major release

Nice idea.

Maybe it's a good idea to add some default queries on a fresh install and not only as default data?

#3 Updated by Go MAEDA about 1 month ago

Updated the patch. Now the rake task adds project queries and time entry queries.

#4 Updated by Mischa The Evil about 1 month ago

I'll combine my response on two notes:

Marius BALTEANU wrote in #note-2:

Maybe it's a good idea to add some default queries on a fresh install and not only as default data?

Do you mean via (a) Rails migration(s) or somehow programatically?

Go MAEDA wrote in #note-3:

Updated the patch. Now the rake task adds project queries and time entry queries.

The patch file seems to miss the time entry queries changes.

#5 Updated by Marius BALTEANU about 1 month ago

Mischa The Evil wrote:

I'll combine my response on two notes:

Marius BALTEANU wrote in #note-2:

Maybe it's a good idea to add some default queries on a fresh install and not only as default data?

Do you mean via (a) Rails migration(s) or somehow programatically?

Yes, via a migration that should run only when the queries table has no entries. But it's just an idea :)

#6 Updated by Go MAEDA about 1 month ago

Mischa The Evil wrote:

Go MAEDA wrote in #note-3:

Updated the patch. Now the rake task adds project queries and time entry queries.

The patch file seems to miss the time entry queries changes.

Sorry, here is the latest patch.

#7 Updated by Go MAEDA about 1 month ago

Marius BALTEANU wrote:

Marius BALTEANU wrote in #note-2:

Maybe it's a good idea to add some default queries on a fresh install and not only as default data?

Do you mean via (a) Rails migration(s) or somehow programatically?

Yes, via a migration that should run only when the queries table has no entries. But it's just an idea :)

Since only JPL can add new migrations, I think the way will take a longer time to be implemented. On the other hand, updating lib/redmine/default_data/loader.rb is much easier to implement.

#8 Updated by Marius BALTEANU about 1 month ago

  • Target version changed from Candidate for next major release to 4.2.0

Let’s do it then.

#9 Updated by Go MAEDA about 1 month ago

  • Subject changed from Load default issue queries when runnning redmine:load_default_data rake task to Load default custom queries when runnning redmine:load_default_data rake task
  • Category changed from Issues list to Filters

#10 Updated by Jean-Philippe Lang about 1 month ago

I confirm that this should not be done in migrations. It's generally a bad idea to use models in migrations and we should avoid this whenever it's possible.

#11 Updated by Go MAEDA about 1 month ago

  • Subject changed from Load default custom queries when runnning redmine:load_default_data rake task to Load default custom queries when running redmine:load_default_data rake task
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the patch.

#12 Updated by Go MAEDA about 1 month ago

  • Status changed from New to Closed

#13 Updated by Go MAEDA about 1 month ago

  • Status changed from Closed to Reopened

r19731 caused test failures.

#14 Updated by Go MAEDA about 1 month ago

  • Status changed from Reopened to Closed

Go MAEDA wrote:

r19731 caused test failures.

Fixed in r19733.

Also available in: Atom PDF