Skip to content

Latest commit

 

History

History
90 lines (53 loc) · 8.09 KB

routing.md

File metadata and controls

90 lines (53 loc) · 8.09 KB

Routing

In this article, we will consider in which cases the Datagrok platform retains the state in which it was before refreshing the browser page. Routing allows you to quickly share something by simply copying a URL and sending it to another person to whom you want to show a particular view, project, application, etc. We will find out which actions Datagrok can perform under the hood as the user goes to a specific URL (for example, executing a query with given parameters).

Entity browsers

Entity browsers are special platform views that display a set of certain entities to the user. Each such browser is available by a URL.

The platform has browsers for the following entities:

Entity Browser URL
Projects https://public.datagrok.ai/projects
Files https://public.datagrok.ai/files
Queries https://public.datagrok.ai/queries
Scripts https://public.datagrok.ai/scripts
Functions https://public.datagrok.ai/functions
Applications https://public.datagrok.ai/apps
Models https://public.datagrok.ai/models
Notebooks https://public.datagrok.ai/notebooks
Users https://public.datagrok.ai/users
Groups https://public.datagrok.ai/groups
Connections https://public.datagrok.ai/connections
Jobs https://public.datagrok.ai/jobs
Packages https://public.datagrok.ai/packages
Repositories https://public.datagrok.ai/repositories
Layouts https://public.datagrok.ai/view_layouts

Projects

A project uploaded to the server can be opened via a direct URL. If a project has more than one table view, you can pass the name of a specific view to the URL so that you can see it after opening. Links to projects are generated according to the following rule:

https://public.datagrok.ai/p/{project.namespace}.{project.name}/{tableView.name}

Example: https://public.datagrok.ai/p/demo.pic50/desc_canvas_aug30

The above link will open the https://public.datagrok.ai/p/demo.pic50/desc_canvas_aug30 view from the pic50 project, which belongs to the demo namespace. Notice that it is not necessary to include a table view in the project URL. If not specified, the first view from the project will open.

Files

A file share for which the user has access is available by the link. You should specify the file share name and the namespace in which it exists in the URL, for example, https://public.datagrok.ai/files/demo.testjobs.files.demofiles.

The above link will open a view for the demofiles file share. Since the platform supports nesting of namespaces, there can be more than one namespace in a URL. Our example has several namespaces separated by periods: demo, testjobs, and files. This means that every next namespace can be reached from the previous one (in practice, this is possible when one project is nested within another).

Here is an example of a link to a file share with one namespace: https://public.datagrok.ai/files/skalkin.datagrokdata. In this case, the namespace is a personal project of the user who created this file share.

File share URLs support directory nesting. With its help, you can easily get to subdirectories of any nesting depth. For example: https://public.datagrok.ai/files/demo.testjobs.files.demofiles/chem/zbb. After following the link above, you will see the zbb folder, which exists inside the chem folder in the demofiles file share.

Queries

Datagrok supports execution of saved queries via URL. For example, after following the link https://public.datagrok.ai/q/Demo.Northwind.Products, the query Products will be executed and we will see the table that has just been created as a query result.

The link to a data query, in addition to its name, must also contain the corresponding data connection name and the namespace (or several nested namespaces).

Parameterized queries can be executed as well. In this case, query parameters are passed directly in the URL. For example:

https://public.datagrok.ai/q/Demo.CoffeeCompany.StoresInState?state=NY

Opening the above link triggers the StoresInState query execution, with the state parameter value equal to NY. Once completed, it will output the resulting table.

Applications

Remarkably, routing works for applications. They are shipped as part of a package and used by developers as a means to extend the Datagrok platform. An application link has the following form:

https://public.datagrok.ai/apps/{package.name}/{application.name}

The application name can be omitted, in which case it follows the same rule as for views, that is, the first application found in a package is launched. For example, the following link https://public.datagrok.ai/apps/UsageAnalysis points to the main view of the first application in the UsageAnalysis package.

Since Datagrok provides very flexible development tools, each application can define its own routing rules. Let's illustrate this on a demo application Discovery (https://public.datagrok.ai/apps/Discovery). After opening this application, we will see the Cars table and the URL will look like this: https://public.datagrok.ai/apps/Discovery/cars/All.

Discovery App All

If we move the mouse cursor to the left screen side, a panel will appear where we can select a filter by car manufacturer:

Discovery App Filter

We can see that the URL changed after the filter was applied. If we now follow this URL https://public.datagrok.ai/apps/Discovery/cars/Honda, we will go back to the filtered table. You can find the source code of this application in our public package repository and see how it works for yourself.

See also: