Make data explorer available to moderators

This is looking great! :clap:

Can you confirm params are working as well?

5 Likes

Yes, they show up in the UI if the query takes params

5 Likes

I was wrong; params are not currently working. I will look into that today.

The adapter for queries is an admin adapter, so non-admin users cannot access the query store. I added endpoints that non-admins can hit to get the query JSON, but it looks like that JSON is not being converted into Query models (of course, how would they be), and so the params logic is not being run. I am assuming I need a non-admin adapter for queries?

2 Likes

I see an issue in screenshot #3: you may want to bring back the “save without running” button, now that there’s meaningful non-query data to be saved.


Ah, didn’t spot that you had imported the green confirm button as well.

3 Likes

The green confirm button saves without running, and I would think that having the “Save Changes and Run” button should do exactly that.
Are you saying that the “Save Changes and Run” behavior should change, and not run the query?

3 Likes

Group members can now run queries that take params!

I am not able to run the specs (with bundle exec rspec), and thus have not written any tests for the new actions I created. Can anyone point me to what I am missing? The error message is uninitialized constant DataExplorer

4 Likes

Try LOAD_PLUGINS=1 RAILS_ENV=test bundle exec rspec

5 Likes

Yep, that does it. Thanks!

5 Likes

Note I usually just use bin/rake autospec it does that automatically, all you need to do is save plugin.rb or something.

5 Likes

@sam ,

What do you think about the Include query plan? checkbox for group reports?

It seems like something that group members would not need to have access to, and should be removed. Is that a correct assumption?

5 Likes

Agree this is info they don’t really need

6 Likes

This has been removed, and the PR is ready for review.

2 specs fail, but they fail on master as well. I could look into fixing those in this PR if it would be appreciated :man_shrugging:

5 Likes

Absolutely welcome!! We will be reviewing it shortly, thanks for the awesome work.

3 Likes

I’m trying to use this feature, and it seems the groups that I add to the form do not persist, i.e. there’s no way to save the form.

Here’s a screenshot of the Query I’d like to share with moderators.

I add a group like this:

And when I refresh the page, the group has disappeared:

Editing and “saving” the query before refreshing has no effect on this either. Also, I tried sharing other queries, including some of the system defaults, to no avail.

1 Like

Just an update – I’ve got another site that this is working for so it seems site specific.

Regardless, I found a workaround if the UI is broken for you as well, you can add a group to the query via the API with a POST request to https://example.com/admin/plugins/explorer/queries/<query_id>.

Set your headers, use an api key for an admin user

  • Api-Username
  • Api-Key
  • Content-Type – application/json

Set your request body

  • query[group_ids][] – comma separated string of group ids to allow access to this query
1 Like

Will have a look today or Monday

6 Likes

Not urgent,
Thanks @joffreyjaffeux!

1 Like

This should be fixed by:

https://github.com/discourse/discourse-data-explorer/commit/df9e21911e6ee3145d56b25f377218f59df0e471

Thanks for report.

7 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.