Ga naar hoofdinhoud

CnTransitionInputDialog

Collects a lifecycle transition's declared inputs before the transition is applied. Mounted by CnLifecycleActions when the clicked transition declares an inputs list (mirroring the schema's x-openregister-lifecycle.transitions.<action>.inputs); the transition endpoint then accepts { action, data: { <field>: <value> } }.

The dialog performs no request itself — it emits confirm with the collected values and the parent POSTs. Cancelling emits close only, so no request is made. Lives in its own file under src/dialogs/ per the modal-isolation rule.

Import

import { CnTransitionInputDialog } from '@conduction/nextcloud-vue'

Usage

<CnTransitionInputDialog
v-if="inputTransition"
:transition="inputTransition"
:schema="schema"
@confirm="onInputConfirm"
@close="inputTransition = null" />
// In methods:
async onInputConfirm(data) {
this.inputTransition = null
await axios.post(url, { action: 'reject', data })
}

Field rendering

Each declared input's field is resolved against the object's JSON Schema via fieldsFromSchema() when a schema is given:

  • Label = the property's title (required inputs get a * marker).
  • booleanNcCheckboxRadioSwitch (switch).
  • number / integerNcTextField with type="number" (value cast to a number on confirm).
  • Long text (maxLength > 255, or a textarea/markdown format) → NcTextArea.
  • Everything else — including richer widgets like selects or date pickers, and fields the schema does not declare — degrades to a plain labelled NcTextField. Deliberately minimal: this is not a form engine (use CnFormDialog for full object forms).

The confirm button's label is the transition's label and stays disabled until every required: true input holds a non-empty value (a required boolean must be checked; whitespace does not count).

Props

PropTypeDefaultDescription
transitionObject— (required)The transition being applied: { action, label, inputs: [{ field, required }] }. label doubles as dialog title + confirm label.
schemaObject | nullnullThe object's JSON Schema (with properties) used to resolve labels/widgets. Optional — undeclared fields render as plain text inputs.

Events

EventPayloadDescription
confirm{ <field>: <value>, ... }The user confirmed with all required inputs filled. Payload holds exactly the declared input keys; the parent POSTs { action, data }.
closeCancel / dialog dismissed. No confirm was or will be emitted.