Inherited Settings

Settings that a workspace sets and a team or project can override.

Keep run history forOverrides Northwind

Older runs and their data are deleted.

Review before publishingEnforced by Northwind

A second person approves a workflow before it goes live.

Northwind sets this for everything under it, so it can't change here.

Installation

pnpm dlx shadcn@latest add checkfu/uicontext/scope

Usage

import { ScopeSetting } from "./ui/uicontext/components/kit/Scope.ts"
const Message = UiSchema.TaggedEnum({ SetRetention: { value: Schema.NullOr(Schema.String) } })export const Retention = (h: Html.H<typeof Message.Type>, teamValue: string | null) =>	ScopeSetting(h, {		props: {			label: "Keep run history for",			options: [{ value: "30", label: "30 days" }, { value: "90", label: "90 days" }],			levels: [				{ id: "org", label: "Northwind", value: "30" },				{ id: "ops", label: "Operations team", ...(teamValue === null ? {} : { value: teamValue }) },			],			can: ["edit"],		},		onEmit: {			RequestedInherit: () => Message.SetRetention({ value: null }),			RequestedValue: ({ value }) => Message.SetRetention({ value }),		},	})

API reference

ScopeSettingComponent

Props

ScopeSetting props
NameTypeDescription
agentIdstringThis setting's id for agents, unique on the page: "scope-design-participation"
labelrequiredstring"Respond automatically"
descriptionstringA sentence under the label about what the setting does
optionsrequiredScopeOption[]The values to choose from, each with an example and why it may be locked
levelsrequiredNonEmptyArrayTop level first; the last is the level being edited
control"radio" | "select"Radios for a few options, a select for many
canrequiredCan(["edit"])What the viewer may do here: "edit" changes the value at this level
readOnlyReasonstringWhy it's read-only: "Only owners change this"
consequentialbooleanWhat an agent's change is: consequential (the default) for settings that change what others get
outcomeOutcomeThe app's answer to the last request: "inherit" for RequestedInherit, "value" for RequestedValue. Pending shows "Saving…"; a refusal shows its reason.

Events

ScopeSetting events
EventPayloadDescription
RequestedInherit{}Stop setting a value here
RequestedValue{ value: string }Set this value at the level being edited

Agent actions

What agents can do with ScopeSetting
ActionDescription
ChoseValueSet a value at this level (value from page_query). Target: { value, setHere } as in the snapshot.
ChoseInheritStop setting it here and take the inherited value. Target: { value, setHere }.

ScopeTreeView function

Options

ScopeTree options
NameTypeDescription
labelrequiredstringWhat the tree is of, for screen readers: "Workspace and teams"
nodesrequiredScopeNode[]The scopes, top level first, each with its children
currentstringThe id of the scope being edited, marked as the current page

Accessibility

  • The setting is a fieldset with radios for a few options or a select for many; where its value comes from is tied to it with aria-describedby.
  • Locked options stay in the list and say why they can't be chosen.
  • The tree is a nav of links, the scope being edited marked aria-current="page".

Source