askrobots / dbbasic-object-server
Public
Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.
danq9
signup: the person chooses the password and name on the confirm page
83c7aa6
2 weeks, 5 days ago
History
attention_counts.json · 4.2 KB · 98 lines
| 1 | { |
| 2 | "name": "attention_counts", |
| 3 | "title": "Attention counts", |
| 4 | "version": 1, |
| 5 | "description": "The answers, as of a moment ago. One row per attention_sources declaration, written by object_daemon.process_attention -- never folded live at render time. That is the whole reason this collection exists rather than a helper the home page calls: this box once went to 675MB resident and started swapping because something folded a big collection on a timer, and a home page that folds a dozen collections on every render is that same mistake with a nicer name. A rollup makes the page's cost one small read no matter how many packages are installed, and bounds the staleness at the pass interval (default five minutes) instead of pretending it away. Two rules make the numbers honest. A provider that raises, or answers with something that is not an integer, writes `error` and KEEPS its previous count -- a broken provider must look broken, never look calm, and zeroing it would report an empty queue when what happened is that nobody looked. And zero is stored but never shown: an empty queue is not news, and a board that says '0 pending' every day trains people to stop reading it.", |
| 6 | "fields": [ |
| 7 | { |
| 8 | "name": "id" |
| 9 | }, |
| 10 | { |
| 11 | "name": "source_id", |
| 12 | "type": "text", |
| 13 | "label": "Source", |
| 14 | "help": "The attention_sources row this count answers. Always equal to `id` -- carried as its own column so a row read on its own says what it is about." |
| 15 | }, |
| 16 | { |
| 17 | "name": "label", |
| 18 | "type": "text", |
| 19 | "label": "Label", |
| 20 | "validation": {"max_length": 60}, |
| 21 | "help": "Copied from the source at rollup time so a surface renders from one read. A stale label on a fresh count is a smaller problem than a second collection join on the front page." |
| 22 | }, |
| 23 | { |
| 24 | "name": "path", |
| 25 | "type": "text", |
| 26 | "label": "Path", |
| 27 | "validation": {"max_length": 200}, |
| 28 | "help": "Where this count clicks through to, copied from the source." |
| 29 | }, |
| 30 | { |
| 31 | "name": "nav_id", |
| 32 | "type": "text", |
| 33 | "label": "Nav entry", |
| 34 | "validation": {"max_length": 64}, |
| 35 | "help": "The nav_entries row this count decorates, copied from the source." |
| 36 | }, |
| 37 | { |
| 38 | "name": "group", |
| 39 | "type": "text", |
| 40 | "label": "Group", |
| 41 | "default": "Apps" |
| 42 | }, |
| 43 | { |
| 44 | "name": "severity", |
| 45 | "type": "enum", |
| 46 | "label": "Severity", |
| 47 | "default": "normal", |
| 48 | "enum": ["normal", "warning", "urgent"], |
| 49 | "help": "Copied from the source. First sort key on the home band; count breaks the tie." |
| 50 | }, |
| 51 | { |
| 52 | "name": "count", |
| 53 | "type": "integer", |
| 54 | "label": "Count", |
| 55 | "default": "0", |
| 56 | "help": "How many things are waiting. Zero rows are written and kept -- the absence of a row means nobody has ever run the provider, which is a different fact from 'the queue is empty' -- but no surface renders them." |
| 57 | }, |
| 58 | { |
| 59 | "name": "detail", |
| 60 | "type": "text", |
| 61 | "label": "Detail", |
| 62 | "validation": {"max_length": 200}, |
| 63 | "help": "The provider's own second sentence: '3 over a week old', '12 units across 4 orders'. This is where a queue says the thing a bare number cannot, and it is optional because most queues have nothing extra to say." |
| 64 | }, |
| 65 | { |
| 66 | "name": "computed_at", |
| 67 | "type": "datetime", |
| 68 | "label": "Computed", |
| 69 | "help": "When the pass last ran this provider. The page states the age rather than implying the number is live." |
| 70 | }, |
| 71 | { |
| 72 | "name": "error", |
| 73 | "type": "text", |
| 74 | "label": "Error", |
| 75 | "validation": {"max_length": 400}, |
| 76 | "help": "Why the last run of this provider did not produce a number. Set alongside the PREVIOUS count, never instead of it: a provider that fails silently and reads zero is a queue that looks handled, which is the single worst thing this collection could do." |
| 77 | }, |
| 78 | { |
| 79 | "name": "owner_id", |
| 80 | "type": "text", |
| 81 | "label": "Owner" |
| 82 | }, |
| 83 | { |
| 84 | "name": "created_at", |
| 85 | "type": "datetime", |
| 86 | "label": "Created", |
| 87 | "read_only": true |
| 88 | } |
| 89 | ], |
| 90 | "views": { |
| 91 | "list_mode": "table", |
| 92 | "list_fields": ["label", "count", "detail", "severity", "group", "computed_at", "error"], |
| 93 | "filter_fields": ["group", "severity"] |
| 94 | }, |
| 95 | "search": { |
| 96 | "fields": ["label", "detail"] |
| 97 | } |
| 98 | } |