@protobase/cli 0.94.25 → 0.94.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/package.js +1 -1
- package/dist/config/merge-config.js +8 -1
- package/package.json +8 -8
- package/skills/protobase/references/features/files-and-images.md +2 -0
- package/skills/protobase/references/reference/config/files.md +12 -1
- package/skills/protobase/references/reference/config.md +1 -0
- package/skills/protobase/references/reference/files.md +18 -0
- package/skills/protobase/references/reference/layouts.md +1 -1
- package/skills/protobase/references/reference/plugins.md +32 -0
- package/skills/protobase/references/reference/ui-config.md +3 -3
package/dist/cli/package.js
CHANGED
|
@@ -24,11 +24,18 @@ const mergedFiles = (sources) => {
|
|
|
24
24
|
label
|
|
25
25
|
})));
|
|
26
26
|
checkUnique("The file provider", providers);
|
|
27
|
+
const types = all.flatMap(({ files, label }) => Object.entries(files.types ?? {}).map(([name, value]) => ({
|
|
28
|
+
name,
|
|
29
|
+
value,
|
|
30
|
+
label
|
|
31
|
+
})));
|
|
32
|
+
checkUnique("The file type", types);
|
|
27
33
|
const trustedHosts = [...new Set(all.flatMap(({ files }) => files.trustedHosts ?? []))];
|
|
28
|
-
const { providers: _, trustedHosts: __, ...rest } = lastSet(all.map(({ files }) => files));
|
|
34
|
+
const { providers: _, trustedHosts: __, types: ___, ...rest } = lastSet(all.map(({ files }) => files));
|
|
29
35
|
return {
|
|
30
36
|
...rest,
|
|
31
37
|
...providers.length > 0 && { providers: Object.fromEntries(providers.map(({ name, value }) => [name, value])) },
|
|
38
|
+
...types.length > 0 && { types: Object.fromEntries(types.map(({ name, value }) => [name, value])) },
|
|
32
39
|
...trustedHosts.length > 0 && { trustedHosts }
|
|
33
40
|
};
|
|
34
41
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.94.
|
|
3
|
+
"version": "0.94.27",
|
|
4
4
|
"description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.94.
|
|
47
|
-
"@protobase/layout": "0.94.
|
|
48
|
-
"@protobase/query": "0.94.
|
|
49
|
-
"@protobase/schema": "0.94.
|
|
50
|
-
"@protobase/server": "0.94.
|
|
51
|
-
"@protobase/ui": "0.94.
|
|
52
|
-
"@protobase/workflows": "0.94.
|
|
46
|
+
"@protobase/config": "0.94.27",
|
|
47
|
+
"@protobase/layout": "0.94.27",
|
|
48
|
+
"@protobase/query": "0.94.27",
|
|
49
|
+
"@protobase/schema": "0.94.27",
|
|
50
|
+
"@protobase/server": "0.94.27",
|
|
51
|
+
"@protobase/ui": "0.94.27",
|
|
52
|
+
"@protobase/workflows": "0.94.27",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -10,6 +10,8 @@ Uploaded files and images, where they are kept and how they are served.
|
|
|
10
10
|
- [S3-compatible buckets](../reference/files.md#s3-compatible-buckets) (beta): Files are kept in any bucket that speaks the S3 API, when the app runs on Bun.
|
|
11
11
|
- [Files from a seed](../reference/files.md#writing-files-from-a-seed): A seed or another script writes files into the app's providers, read from its config and environment as the server reads them.
|
|
12
12
|
- [Type detection](../reference/files.md#how-the-type-is-decided): An upload's type is decided from its content, and a disguised file is refused.
|
|
13
|
+
- [Your own types](../reference/files.md#your-own-types): An app names its own media types and their extensions, and files with them are stored and served as those types.
|
|
14
|
+
- [File viewers](../reference/files.md#viewers): A plugin registers a viewer for a media type, and a file of that type opens in it in the app instead of downloading.
|
|
13
15
|
- [Signed downloads](../reference/files.md#downloads): Private files open through short-lived links that stop working once the record no longer holds the file.
|
|
14
16
|
- [Derived fields](../reference/files.md#derived-fields): Width, height, size and type of each upload are written to other fields.
|
|
15
17
|
- [Image variants and placeholders](../reference/files.md#image-variants-and-placeholders): Resized copies of uploaded images, and a blurred placeholder while they load.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Files options
|
|
4
4
|
|
|
5
|
-
The config key files, where file fields keep their bytes, with each provider kind, retention, signing, trusted hosts, the Storage API and the image library, their types, defaults and environment variables.
|
|
5
|
+
The config key files, where file fields keep their bytes, with each provider kind, retention, signing, trusted hosts, the app's own media types, the Storage API and the image library, their types, defaults and environment variables.
|
|
6
6
|
|
|
7
7
|
The `files` key of [`protobase.config.ts`](../config.md): where [file fields](../files.md) keep their bytes, and how. Every key is optional; without `files`, the providers a field names default to folders under `data/files`.
|
|
8
8
|
|
|
@@ -76,6 +76,17 @@ Hosts whose images the admin app draws with the page's referrer, besides the app
|
|
|
76
76
|
export default defineConfig({ files: { trustedHosts: ['images.example.com'] } })
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
+
## files.types
|
|
80
|
+
|
|
81
|
+
- **Type:** `Record<string, string[]>`
|
|
82
|
+
- **Default:** none
|
|
83
|
+
|
|
84
|
+
The app's own media types, each with its extensions, the first being the one its files are stored with. A file uploaded with such an extension, whose content is no type the server recognizes, is stored and served as that type, and a [viewer](../files.md#viewers) registered for it opens it in the admin app. An extension may hold dots. A malformed type, a built-in type or a built-in extension stops startup. See [Your own types](../files.md#your-own-types).
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
export default defineConfig({ files: { types: { 'application/vnd.example.report+json': ['report.json'] } } })
|
|
88
|
+
```
|
|
89
|
+
|
|
79
90
|
## files.storage
|
|
80
91
|
|
|
81
92
|
- **Type:** `{ provider?: string; maxFileSize?: number | string } | false`
|
|
@@ -166,6 +166,7 @@ export default defineUi({ extends: [tasksUi] })
|
|
|
166
166
|
| MCP tools of `mcp/tools.ts` | the extensions' first, in order, then the app's | an error naming the tool and both folders |
|
|
167
167
|
| `jobs`, functions, file providers (`files.providers`) | all kept, by name | an error naming the name and both folders |
|
|
168
168
|
| workflow plugins of `workflows/plugins/` | all kept | an error naming the plugin and both sources |
|
|
169
|
+
| `files.types` | all kept, by type | an error naming the type and both folders |
|
|
169
170
|
| `files.trustedHosts` | all kept | |
|
|
170
171
|
| the other keys of `files` | each the app's own; otherwise the last config that sets it | |
|
|
171
172
|
| `writeHooks` | all run, in the same order | |
|
|
@@ -184,6 +184,18 @@ An upload carries three hints: what the **content** is (C, from its magic bytes)
|
|
|
184
184
|
|
|
185
185
|
The decided type picks the stored extension, and downloads are served by that extension, so nothing posing as a PDF is ever served as something else, and nothing is served as HTML.
|
|
186
186
|
|
|
187
|
+
### Your own types
|
|
188
|
+
|
|
189
|
+
`files.types` adds the app's own media types, each with its extensions, the first being the one its files are stored with. A file named with such an extension whose content is not a recognized type takes that type: `weekly.report.json` below is stored and served as `application/vnd.example.report+json`, while `weekly.json` stays `application/json`. An extension may hold dots, and the longest one a name ends in counts. A malformed type, a built-in type or a built-in extension stops startup with an error naming it.
|
|
190
|
+
|
|
191
|
+
```ts
|
|
192
|
+
export default defineConfig({
|
|
193
|
+
files: { types: { 'application/vnd.example.report+json': ['report.json'] } },
|
|
194
|
+
})
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Such files download as attachments. A [viewer](#viewers) opens them in the admin app instead.
|
|
198
|
+
|
|
187
199
|
## Downloads
|
|
188
200
|
|
|
189
201
|
`GET /api/files/<provider>/<path>` on the app's own host:
|
|
@@ -193,6 +205,12 @@ The decided type picks the stored extension, and downloads are served by that ex
|
|
|
193
205
|
- Every download is `nosniff` with `Content-Security-Policy: sandbox; default-src 'none'`. Raster images, PDF, audio and video are `inline`; everything else, SVG included, is an attachment. A private file is named as its uploader named it, with the extension matched to the type (`photo.png` holding a JPEG downloads as `photo.jpg`); a public file by its stored path. `Range` requests work.
|
|
194
206
|
- A provider in a bucket answers with a redirect to the bucket instead, after the same checks, see [S3-compatible buckets](#s3-compatible-buckets).
|
|
195
207
|
|
|
208
|
+
## Viewers
|
|
209
|
+
|
|
210
|
+
A plugin, or the app's own `protobase.ui.tsx`, registers a viewer for a media type (see [File viewers](plugins.md#file-viewers)). A file field's link to a file of that type, on the record page and its form, then opens the viewer on the record's address with `?file=<field>`, such as `/attachments/7?file=file`, in place of a download: a bar with the way back to the record, the file's name and size and a Download button, and the viewer below it. A file without a viewer links to its download as before.
|
|
211
|
+
|
|
212
|
+
The viewer gets the file and its **siblings**: the record's other files, and the files of the records of the same resource that point at the same records through filterable relations, read in one list call of at most 100 records. For attachments that each point at a task, the siblings of one are the other attachments of that task, so a report can show the images it names by file name.
|
|
213
|
+
|
|
196
214
|
## Derived fields
|
|
197
215
|
|
|
198
216
|
`.derive({ field: processor })` computes values from each upload into other fields of the same resource. Those fields must be `readOnly()`, so only the upload sets them.
|
|
@@ -152,7 +152,7 @@ Every place in the app has an address, and the app writes and reads them in one
|
|
|
152
152
|
| Address | Is |
|
|
153
153
|
| --- | --- |
|
|
154
154
|
| `{ kind: 'list', resource, filter?, orderBy?, display? }` | A resource's list, with the filter, order and [display](ui-config.md#list-displays) the list page would show. |
|
|
155
|
-
| `{ kind: 'record', resource, key, edit?, open?, tab?, standard?, version?, run?, panel? }` | One record; `key` is its value, or its parts for a composite key. `edit: true` is its form (`?edit=true`), on a view whose record page opens as a [read view or locked](ui-config.md#read-view-and-edit). `open` lists the titles of the record page's collapsed [groups](ui-config.md#groups) that are open (`?open=<title>`, once per group), and `tab` the title of the [tab](ui-config.md#tabs) it shows (`?tab=<title>`). `standard: true` is its standard page (`?standard=true`), on a view whose record page is a [component of the app's own](ui-config.md#full-area-record-pages) or [opens another](ui-config.md#a-record-page-that-opens-another). On a workflow, `version` is the saved version its graph shows, read-only (`?version=<number>`), and `run` the run shown on it (`?run=<id>`); see [The workflow's page](workflows.md#the-workflows-page). `panel` is the panel a [focus page](ui-config.md#focus-pages) opens with, by a name its surface knows (`?panel=<name>`). |
|
|
155
|
+
| `{ kind: 'record', resource, key, edit?, open?, tab?, standard?, version?, run?, panel?, file? }` | One record; `key` is its value, or its parts for a composite key. `edit: true` is its form (`?edit=true`), on a view whose record page opens as a [read view or locked](ui-config.md#read-view-and-edit). `open` lists the titles of the record page's collapsed [groups](ui-config.md#groups) that are open (`?open=<title>`, once per group), and `tab` the title of the [tab](ui-config.md#tabs) it shows (`?tab=<title>`). `standard: true` is its standard page (`?standard=true`), on a view whose record page is a [component of the app's own](ui-config.md#full-area-record-pages) or [opens another](ui-config.md#a-record-page-that-opens-another). On a workflow, `version` is the saved version its graph shows, read-only (`?version=<number>`), and `run` the run shown on it (`?run=<id>`); see [The workflow's page](workflows.md#the-workflows-page). `panel` is the panel a [focus page](ui-config.md#focus-pages) opens with, by a name its surface knows (`?panel=<name>`). `file` names a file field whose file opens in the [viewer](files.md#viewers) for its type (`?file=<field>`). |
|
|
156
156
|
| `{ kind: 'create', resource, values? }` | The form for a new record, with `values` filled in by field name, as text: `{ kind: 'create', resource: 'notes', values: { listing_id: '{id}' } }` on a listing's page starts a note about that listing. A relation shows the name of the record it points at. The values are a start the person can change, not a rule: what they may write is still up to the access rules. A view with a [create page](ui-config.md#create-pages) shows that page here instead, with the values in the address. |
|
|
157
157
|
| `{ kind: 'page', page, tab? }` | A composed page; `tab` the name of one of its [tabs](blocks.md#tabs-and-tab) (`/<page>/<tab>`), the first when omitted. |
|
|
158
158
|
|
|
@@ -39,6 +39,7 @@ Each place a plugin can fill is an extension point. The config names it, or a pl
|
|
|
39
39
|
| [Record card](custom-components.md#record-cards) | `d.cards(fields, { card: component('Name') })` | A PascalCase export | `{ row }` | The built-in card: title, subtitle, badge, meta fields |
|
|
40
40
|
| [Field type](#field-types) | `r.field.widget('name', props)` in a view's `fields` | `fields: { name: { of, display, editor?, cell? } }` | `{ field, value, props }`, and `onChange`, `invalid` for the editor | The field as it shows without one |
|
|
41
41
|
| Widget part (the [assistant](assistant.md#widget-parts)) | A widget part's name | A PascalCase export | The part's props | The part's fallback card |
|
|
42
|
+
| [File viewer](#file-viewers) | A file's media type | `fileViewers: { 'type': { component } }` | `{ file, siblings }` | The file's link downloads it; a viewer that throws leaves a Download button |
|
|
42
43
|
| [Action handler](custom-components.md#action-handlers) | `a.action('name')` in a view | `actions: { name }` | `ActionContext` | The button is disabled |
|
|
43
44
|
| [Shell slot](custom-components.md#shell-slots) | Nothing: drawn on every page | `shell: { actions, rightPanel, logo, bell }` | Nothing; `logo` gets `compact`, `workspace`, `appName` and `appIcon` | Not drawn; Protobase's logo for `logo`, its notification bell for `bell` |
|
|
44
45
|
| [Before sign-in](#before-sign-in) | `beforeSignIn: true` where the plugin is listed | `beforeSignIn` | `children`, `params`, `removeParams`, `signedIn` | The pages as they are without it |
|
|
@@ -173,6 +174,37 @@ The create form and the record's form pick the members of the organization the s
|
|
|
173
174
|
|
|
174
175
|
`workflow_run` is the field type the `workflow_runs` resource draws its own `id` with: the run's [trace](workflows.md#following-and-debugging-a-run) on its workflow's graph, with the chosen step's records under it. Another uuid field holding a run's id picks it as `r.run_id.widget('workflow_run')`. It takes the whole width, and a list's table shows the id. A plugin that registers a field type named `workflow_run` replaces it.
|
|
175
176
|
|
|
177
|
+
## File viewers
|
|
178
|
+
|
|
179
|
+
A file viewer shows files of one media type in the app, such as a report the app writes as JSON, instead of downloading them. A plugin registers it by the type, which the server must know: a built-in type, or one of the app's own in `files.types` (see [Your own types](files.md#your-own-types)).
|
|
180
|
+
|
|
181
|
+
```tsx
|
|
182
|
+
// protobase.ui.tsx
|
|
183
|
+
import { definePlugin, fileNamed, useFileText, type FileViewerProps } from '@protobase/ui'
|
|
184
|
+
|
|
185
|
+
const ReportViewer = ({ file, siblings }: FileViewerProps) => {
|
|
186
|
+
const read = useFileText(file)
|
|
187
|
+
if (!read.data) return null
|
|
188
|
+
const report = JSON.parse(read.data)
|
|
189
|
+
const chart = fileNamed(siblings, report.chart)
|
|
190
|
+
return (
|
|
191
|
+
<article>
|
|
192
|
+
<h2>{report.title}</h2>
|
|
193
|
+
{chart && <img src={chart.url} alt={chart.name} />}
|
|
194
|
+
</article>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export default definePlugin({ fileViewers: { 'application/vnd.example.report+json': { component: ReportViewer } } })
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
| Props | |
|
|
202
|
+
| --- | --- |
|
|
203
|
+
| `file` | The file: `name`, `type`, `size`, `url`, the link that downloads it, and `uri`, its stored value. |
|
|
204
|
+
| `siblings` | The other files of its record and of the records that point at the same records, see [Viewers](files.md#viewers). `fileNamed(siblings, 'shots/before.png')` finds one by the last segment of a relative reference, and gives none for an absolute address. |
|
|
205
|
+
|
|
206
|
+
`useFileText(file)` reads the file's text once, as a TanStack Query result kept while the file stays the same. The viewer draws on the page below the file's bar, which scrolls as the page does. The file's link is a download link served with a sandboxing CSP, so a viewer reads the file and draws it itself rather than framing it.
|
|
207
|
+
|
|
176
208
|
## Building
|
|
177
209
|
|
|
178
210
|
```sh
|
|
@@ -105,7 +105,7 @@ Field hints:
|
|
|
105
105
|
| `.confirm(question)` | Asks `question` before a person changes the value in a form or a list cell, and Cancel keeps it. See [Confirming a change](#confirming-a-change). |
|
|
106
106
|
| `.format(format)` | `badge` shows statuses as coloured badges, `code` sets identifiers in monospace, as the list's identifier column too, `percent` adds a % sign, and `signed` shows a whole number in a list with its sign, green above zero and red below, such as a stock change of `+12` or `−3`; it needs an integer field. On a text field, `email`, `phone` and `url` show the value as a link that writes to it (`mailto:`), calls it (`tel:`, its digits and a leading +) or opens it in a new tab (only an `http` or `https` address; anything else stays text), and `.format('url', { text })` gives the link [its own text](#json-fields-and-link-text), on the record page, in its sidebar and in the list's cells but the title's, which links to the record; forms edit it in an email, phone or web address input, which brings up the keyboard for it on a mobile screen and offers the browser's autofill. Another field type with one of them stops the server at startup. `relative` on a timestamp shows it as "5 minutes ago" or "in 2 hours" in lists and on the record page, with the exact time on hover; `absolute` and `compact` are accepted and carried in `/meta` for apps that render their own lists. <gap>The admin does not use the `absolute` and `compact` formats yet.</gap> |
|
|
107
107
|
| `.multiline()` | A text of several lines, such as a description: forms edit it in a box that grows with the text, so the page scrolls rather than the box, and the record page's sections, a page's field blocks and a card's subtitle keep its line breaks (a card shows the first three lines); the record's sidebar shows it on one line. On the record page and the create form it takes the whole width of its section. Only a text field takes it; the list's table shows the text on one line. |
|
|
108
|
-
| `.markdown()` | Markdown, such as a task's notes: forms edit its source in a box that grows with it, with a Write and Preview switch above it, and store it exactly as typed. The record page's sections, a page's field blocks and a conversation's messages show it rendered as GitHub does, line breaks kept; raw HTML shows as text, links and images keep only http(s), mailto, tel and relative addresses, and links open in a new tab. A card's subtitle shows its first three lines rendered, its links as text; the list's table, the record's sidebar and a card's other lines show its text on one line without the marks. On the record page and the create form it takes the whole width of its section. Only a text field takes it, and the renderer loads with the first markdown shown. |
|
|
108
|
+
| `.markdown()` | Markdown, such as a task's notes: forms edit its source in a box that grows with it, with a Write and Preview switch above it, and store it exactly as typed. The record page's sections, a page's field blocks and a conversation's messages show it rendered as GitHub does, line breaks kept, a heading in a section one level under the section's title and no larger than the text, so `#` and `##` show as h3, `###` as h4 and so on to h6 (<gap>A value whose first heading is `###` cannot start at h3 because numbering from the value's own top heading is not implemented.</gap>); raw HTML shows as text, links and images keep only http(s), mailto, tel and relative addresses, and links open in a new tab. A card's subtitle shows its first three lines rendered, its links as text; the list's table, the record's sidebar and a card's other lines show its text on one line without the marks. On the record page and the create form it takes the whole width of its section. Only a text field takes it, and the renderer loads with the first markdown shown. |
|
|
109
109
|
| `.prefix(text)`, `.suffix(text)`, `.decimals(n)` | Text around a number and its decimals: `€` and `2` show `€1,234.50`, `.suffix(' m²')` shows `120 m²`. They show wherever the number does: records, cards, table cells, forms and the range filter. A prefix is plain text, so a list does not show `€` as money; `.currency()` does. |
|
|
110
110
|
| `.currency(code)` | The currency a decimal is an amount of, as an ISO 4217 code such as `EUR`: the list shows it as money in that currency, in its table and its range filter. See [Value tones and currencies](#value-tones-and-currencies). |
|
|
111
111
|
| `.icon(name)` | An icon before the value on a card's meta row: one of the names [actions](layouts.md#named-actions) take, such as `bed`, `calendar` or `cpu`, and above the value in a section of [key facts](#key-facts). Nowhere else shows it. |
|
|
@@ -1357,7 +1357,7 @@ a.update('answer', { label: 'Answer', inputs: (i) => [i.text('answer', { label:
|
|
|
1357
1357
|
| `i.checklist(name, { from })` | The same, with each record's own boxes, which its JSON field `from` holds as a list of texts. See [signing several records off at once](blocks.md#signing-several-records-off). |
|
|
1358
1358
|
| `i.custom(name, { component, props? })` | What a [component](custom-components.md) of the app's `protobase.ui.tsx`, by the name it is registered under, edits. |
|
|
1359
1359
|
|
|
1360
|
-
Each takes `label`, and optionally `help`, a `default`, `optional: true` to allow an empty answer (every other input is required) and `when`, an AIP-160 condition over the inputs before it, as [`<Show when>`](layouts.md#conditions) is over a record: `"start = 'github' OR code = 'github'"`. An input whose condition does not hold is hidden, not required and left out of `values`, and the inputs after it read it as empty. A `when` that names no input before it, a `default` that is not one of the options and a name given twice stop the config from loading; so does a choice of a resource the app does not have, when the server starts.
|
|
1360
|
+
Each takes `label`, and optionally `help`, a `default`, `optional: true` to allow an empty answer (every other input is required) and `when`, an AIP-160 condition over the inputs before it, as [`<Show when>`](layouts.md#conditions) is over a record: `"start = 'github' OR code = 'github'"`. A checklist takes neither `default` nor `optional: true`: it starts unticked and needs every box. An input whose condition does not hold is hidden, not required and left out of `values`, and the inputs after it read it as empty. A `when` that names no input before it, a `default` that is not one of the options and a name given twice stop the config from loading; so does a choice of a resource the app does not have, when the server starts.
|
|
1361
1361
|
|
|
1362
1362
|
An empty answer is `null`. Before the handler runs, the dialog refuses a required answer left empty, a number that is none, a date that is not `YYYY-MM-DD` and a text longer than `max`, each under its input. When the handler throws an `ActionInputError` from `@protobase/ui`, such as `new ActionInputError({ email: 'No user has this address' })`, or an API error, such as a [function's](../guides/api-functions.md) answer, whose errors name an input as their `field`, each message shows under its input and the dialog stays open; another error shows above the inputs. When it resolves, the dialog closes and the action ends as any other: everything shown of the resource reloads and a toast says it is done.
|
|
1363
1363
|
|
|
@@ -1393,6 +1393,6 @@ Any action whose handler fails with a function's [mailbox problem](email.md#from
|
|
|
1393
1393
|
])
|
|
1394
1394
|
```
|
|
1395
1395
|
|
|
1396
|
-
Besides the record page, the list's row menu offers each named action without `inputs` on the rows it applies to, disabled where it is disabled on the record page, and in red when it is a delete or a danger action; a link is a link there, or a disabled item without one where it is disabled. An `a.update` or `a.action` with `bulk` is also offered for the selected rows, as **Start (2)**, while one of them applies: it asks its `confirm` or its inputs once,
|
|
1396
|
+
Besides the record page, the list's row menu offers each named action without `inputs` on the rows it applies to, disabled where it is disabled on the record page, and in red when it is a delete or a danger action; a link is a link there, or a disabled item without one where it is disabled. An `a.update` or `a.action` with `bulk` is also offered for the selected rows, as **Start (2)**, while one of them applies: it asks its `confirm` or its inputs once, with the count in the dialog's title; an inputs dialog for two or more records also lists their titles, while the `confirm` question and a dialog for one record show the count alone. <gap>A bulk `confirm` question cannot list the records it runs on because passing their titles to the confirm dialog is not implemented.</gap> It runs on each row it applies to, one after another, and its toast says how many it ran on, skipped, refused and failed on. An `a.action`'s handler is called once per row. A row the person may not change is refused, by its record's permissions or by the API's `403`, while the others run, and the toast names each refused record by its title. <gap>The list page cannot offer bulk actions on a phone because selecting its mobile rows is not implemented; a [`Table`](blocks.md#signing-several-records-off) with `bulk` offers them there.</gap>
|
|
1397
1397
|
|
|
1398
1398
|
A condition reads only the record's own fields, so the list decides it for each row from the row itself: `protobase build` refuses one that names a relation's field (`host_id.name`), counts records (`hosts.count`) or names a field the resource does not have, a disabled button without a `reason`, and a `reason` or `otherwise` without `when`. In `/api/meta`, a user who cannot read a field the condition reads does not get the action. The condition only decides what the buttons show: the resource's [access rules](access.md) decide what the API lets the user do.
|