Views¶
A view is a named set of filters over assets that keeps itself current (#2505). It stores the filters, not the assets: opening it lists what matches at that moment, so an asset saved after the view was made appears in it without anyone editing the view.
What a view filters by¶
A view combines the filters the asset listing has with some it adds:
| Filter | Matches |
|---|---|
| Scope | mine, shared or all (the default) of the assets the person opening the view can open |
| Query | Ranks and filters by relevance, as asset search does |
| Tags | Assets carrying every tag named |
| Authors | Assets owned by any address named |
| Status | draft, published, deprecated, or none for assets without one |
| Verified | Assets carrying an unexpired verification |
| Content types | Assets of any type named |
| Collection | Assets in a collection, when the person opening the view can open that collection |
| Created and updated | A date range on either (from is inclusive, to is exclusive) |
| Built from | The connection and the table, API operation or path, or GraphQL field an asset's provenance names |
A view also keeps a sort (updated_at, created_at, name or size_bytes, ascending or descending; newest updated first by default) and a layout: grid, table, a board by status or a board by tag.
Built from reads the sources recorded from each asset's provenance: the tables a statement read, the operation and path an API call addressed, the top-level fields a GraphQL document invoked. A table matches as written or by its trailing parts, so orders, sales.orders and hive.sales.orders all find an asset built from hive.sales.orders. Sources are recorded as an asset is saved and as captures are appended; assets saved before views existed are filled in by a background pass.
The same further filters are query parameters on the asset listing (GET /api/v1/portal/assets), asset search (GET /api/v1/portal/assets/search) and the asset facets: content_types, collection, created_from, created_to, updated_from, updated_to, source_connection and source_target.
Who sees what¶
A view is run for the person opening it, under the same rule as the asset listing. Sharing a view shares its definition and grants nothing else: two people opening one view each see the matching assets they can open, and every count, including a board's columns, counts only those. An asset that matches the filters but is shared with nobody stays its owner's.
The definition itself, filter values included, is visible to everyone the view is shared with.
Sharing a view¶
A view belongs to its owner. The owner, or an administrator, shares it with:
- a person, by user id or address;
- a persona: everyone whose roles resolve to it when they open the view;
- everyone signed in, except people whose persona is external. A guest gets a view only through a share to their persona or address.
Each share is viewer (read and run the view) or editor (also change its name, description, filters, sort and layout). Only the owner or an administrator shares, stops sharing or deletes a view. A guest is always a viewer, whatever the share says, and creates no views. A persona that withholds sharing shares no views either. Sharing the same audience again replaces its permission.
Views can be starred and appear in Favorites and Recent like assets and collections, while they are still shared with you.
In the portal¶
Views is a tab beside Assets and Collections. Mine lists your views with who each is shared with; Shared with me lists the views others shared with you, their owner and whether you can edit them. New view opens the filters; on the Assets tab, Save as view saves the filters you are looking at. Opening a view runs it in its layout: a grid, a table, or a board by status or by tag with a count on each column. Edit filters changes the definition for an owner or editor; a viewer sees the filters read-only and can Duplicate the view to make their own. Share names a person, a persona or everyone signed in, as viewer or editor. A view whose collection you cannot open says so instead of listing assets.
Routes¶
| Route | What it does |
|---|---|
GET /api/v1/portal/views |
Your views and the ones shared with you, each with your permission; your own views also carry their active shares |
POST /api/v1/portal/views |
Save a view |
GET /api/v1/portal/views/{id} |
A view's definition |
PATCH /api/v1/portal/views/{id} |
Change it (owner, editor or administrator) |
DELETE /api/v1/portal/views/{id} |
Delete it (owner or administrator) |
GET /api/v1/portal/views/{id}/run |
Its assets for you, with limit (default 50, at most 200) and offset, and counts per status and per tag |
GET, POST /api/v1/portal/views/{id}/shares |
List and add shares (owner or administrator) |
DELETE /api/v1/portal/views/{id}/shares/{shareId} |
Stop a share (owner or administrator) |
From an agent¶
manage_asset lists and runs views for the caller: list_views returns the views they can open, and run_view (view_id, limit, offset) returns the same rows and counts the portal shows that person for the view.