Skip to main content

useSetupStatus

Composable that reports an app's first-time-setup status (ADR-042). Backs CnAppRoot's setup phase (gate on required-unmet) and drives CnSetupWizard.

Signature

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

const { requiredUnmet, optionalUnmet, completed, loading, refresh } = useSetupStatus(appId, manifest)
ArgumentTypeDescription
appIdstringNextcloud app id (e.g. 'procest').
manifestobjectThe app manifest; reads manifest.setup.steps[].required.

It fetches GET /apps/{appId}/api/setup/status{ version, completed, steps: { <id>: { done, detail } } }, caches the result per appId for the page lifetime, and cross-references the manifest's required flags. On error it falls back to "nothing done" so a failed lookup never crashes the shell.

Return value

KeyTypeDescription
stepsComputedRef<object[]>The manifest steps merged with their server done/detail.
statusRef<object>The raw server status payload.
requiredUnmetComputedRef<object[]>Required steps that are not yet done — non-empty ⇒ gate the app.
optionalUnmetComputedRef<object[]>Optional steps not yet done — auto-open the wizard once (dismissible).
completedComputedRef<boolean>Server completion flag, never true while a required step is unmet.
enabledbooleanWhether the manifest declares an active setup block.
loadingRef<boolean>true while the status fetch is in flight.
errorRef<Error|null>The last fetch error, if any.
refresh() => Promise<void>Re-fetch the status (call after a step completes).

Notes

  • Mirrors useAppStatus: one shared fetch + reactive state per appId.
  • Gating uses requiredUnmet; the optional auto-open uses optionalUnmet + completed.