Skip to content

Commit 5bab561

Browse files
os-zhuangclaude
andauthored
feat(showcase): add the action disabled-predicate specimen (Archive) (#3643)
* feat(showcase): add the action `disabled`-predicate specimen (Archive) showcase_archive_task demonstrates disabled vs visible: where MarkDone's `visible: '!record.done'` HIDES once done, Archive's `disabled: 'record.done != true'` stays on screen and greys until the task is done. Added to the task-detail quick-actions bar (actionNames is an explicit list — a new action does not appear without being named). Dogfoods the renderer-side wiring completed in objectui (#1885 follow-through): browser-verified greyed on an in-progress task, clickable on a done one. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * chore: empty changeset for the examples-only showcase change Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent d8231ac commit 5bab561

3 files changed

Lines changed: 40 additions & 1 deletion

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
feat(showcase): add the action `disabled`-predicate specimen (`showcase_archive_task`) — greyed until `record.done`, contrasting `visible` (hide) with `disabled` (grey). Examples-only; releases nothing.

examples/app-showcase/src/ui/actions/index.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,37 @@ export const ActionParamGalleryAction = defineAction({
235235
refreshAfter: false,
236236
});
237237

238+
/**
239+
* script — the `disabled` predicate specimen. Where `visible` HIDES an action
240+
* (see MarkDoneAction), `disabled` keeps it ON SCREEN but greyed until its
241+
* precondition holds: Archive stays visible on every task and only becomes
242+
* clickable once the task is done. Same authoring rules as `visible`
243+
* (`record.`-prefixed, single comparison; disabled when the CEL is TRUE).
244+
* Exercises the renderer-side wiring (objectui: DeclaredActionsBar +
245+
* action:button/group/icon/menu) that #1885's follow-through completed.
246+
*/
247+
export const ArchiveTaskAction = defineAction({
248+
name: 'showcase_archive_task',
249+
label: 'Archive',
250+
icon: 'archive',
251+
objectName: task,
252+
type: 'script',
253+
body: {
254+
language: 'js',
255+
// No destructive side effect — the specimen's value is the disabled
256+
// behavior itself; echo which record would be archived.
257+
source:
258+
"var id = ctx.recordId || (ctx.record && ctx.record.id) || input.recordId;" +
259+
"return { ok: true, archived: id };",
260+
capabilities: [],
261+
},
262+
successMessage: 'Task archived (demo — no data changed).',
263+
// Disabled while the task is not done — visible either way.
264+
disabled: 'record.done != true',
265+
locations: ['record_header', 'record_section'],
266+
refreshAfter: false,
267+
});
268+
238269
export const allActions = [
239270
MarkDoneAction,
240271
OpenDocsAction,
@@ -245,4 +276,5 @@ export const allActions = [
245276
NewTaskAction,
246277
SubmitForSignoffAction,
247278
ActionParamGalleryAction,
279+
ArchiveTaskAction,
248280
];

examples/app-showcase/src/ui/pages/task-detail.page.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ export const TaskDetailPage = definePage({
6161
properties: {
6262
location: 'record_section',
6363
align: 'start',
64-
actionNames: ['showcase_mark_done', 'showcase_log_time'],
64+
// showcase_archive_task is the `disabled`-predicate specimen:
65+
// visible on every task, greyed until `record.done` (contrast with
66+
// showcase_mark_done's `visible`, which HIDES once done).
67+
actionNames: ['showcase_mark_done', 'showcase_log_time', 'showcase_archive_task'],
6568
},
6669
},
6770
{

0 commit comments

Comments
 (0)