Comments (6)
I'd like to help on this.
@jezdez Do you agree with @wlach that we could restrict the button to only working for queries that are made using these data sources? How could I programmatically check the data source in the extension?
https://sql.telemetry.mozilla.org/queries/65817/source
from redash-iodide.
@openjck Ah I hadn't seen that query yet, that should be fairly easy to query in the backend and provide an API endpoint to check.
Basically the flow would be:
- when the query page loads we should hide the button by default
- send a POST request to a new API endpoint with the query ID
- get the data source group of the query's data source using the provided query ID and check if it's a configured "allowed data source group" (e.g. the default group as used in Will's query)
- depending on the boolean result of the data source group check in (3), show or keep hiding the button
The same step as (3) needs to happen when submitting the notebook to Iodide, so writing the check in a separate function would simplify the code.
I'd be happy to provide the database query if you want.
from redash-iodide.
Thanks for those helpful steps, @jezdez. I'm working on this issue again after a break.
I appreciate your offer to help with the SQL query. I may need that help. I was playing around in Redash and came up with this:
SELECT group_id FROM data_source_groups
LEFT JOIN queries ON queries.data_source_id = data_source_groups.data_source_id
WHERE queries.id=<provided_query_id>;
Does that look correct to you? I notice it returns multiple rows. Is that because each data source can be associated with multiple groups?
I was thinking the new API endpoint could return an array of group IDs, something like this:
{
"groupIDs": [
1,
2,
3,
4
]
}
and the JavaScript could show the button if group 2
(default) is included in that array. Does that sound about right?
from redash-iodide.
Also, can you say more about what the default group (ID: 2
) is used for? Do all employees have access to data associated with the default group?
from redash-iodide.
Note to self: It looks like all_groups_for_query_ids
does what my SQL query does. That certainly makes things easier!
from redash-iodide.
I think this is done. I'm going to send up a PR tomorrow after testing it with fresh eyes.
from redash-iodide.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redash-iodide.