exlab_wizard.ui.components.credential_field#
Credential field component (Frontend Spec §7.4.1).
Three resting / transient states:
not_set –
Status: Not setwith a[Set]button.set –
Status: Set ✓with[Replace]and[Clear].editing – inline password input with Save / Cancel.
Never displays a stored secret.
Functions
|
Return the editing state, remembering |
|
Return the resting state to collapse to when an edit is cancelled. |
|
Return the state after the operator confirms a Clear action. |
|
Resolve a Save click. |
|
Build a credential row (Frontend Spec §7.4.1). |
|
Compute the visible labels / button names for a state. |
Classes
|
In-memory state for a credential row. |
- class exlab_wizard.ui.components.credential_field.CredentialState(state='not_set', resting='not_set')[source]#
Bases:
objectIn-memory state for a credential row.
restingrecords which resting state (not_set/set) the row should collapse back to when the operator cancels an edit – a fresh Set cancels back tonot_set, a Replace cancels back toset.
- exlab_wizard.ui.components.credential_field.begin_edit(state)[source]#
Return the editing state, remembering
stateas the resting target.Idempotent: calling it on an already-editing row leaves
restinguntouched so a stray double-click does not lose the original resting state.- Parameters:
state (
CredentialState)- Return type:
- exlab_wizard.ui.components.credential_field.cancel_edit(state)[source]#
Return the resting state to collapse to when an edit is cancelled.
- Parameters:
state (
CredentialState)- Return type:
- exlab_wizard.ui.components.credential_field.clear_credential(state)[source]#
Return the state after the operator confirms a Clear action.
- Parameters:
state (
CredentialState)- Return type:
- exlab_wizard.ui.components.credential_field.commit_edit(state, typed_value)[source]#
Resolve a Save click.
Returns
(new_state, should_save). A non-emptytyped_valuetransitions the row tosetand signals the caller to invoke itson_savecallback; an empty value has nothing to persist, so the row stays in the editor andshould_saveisFalse.- Parameters:
state (
CredentialState)typed_value (
str)
- Return type:
- exlab_wizard.ui.components.credential_field.credential_field(*, label, on_save, on_clear, initial_state=None, data_testid=None)[source]#
Build a credential row (Frontend Spec §7.4.1).
Three states drive the row:
not_setshows a[Set]button;setshows[Replace]+[Clear];editingreveals an inline password input with Save / Cancel.on_saveis invoked with the typed password when the operator clicks Save with a non-empty value;on_clearis invoked when the operator confirms the Clear action. The stored secret is never displayed.The row re-renders itself in place on every state transition via a NiceGUI
@ui.refreshablebody, so the input box, status line, and buttons always reflect the current state.data_testid, when supplied, is the base for the row’s e2e hooks:<base>-status/-primary/-secondary/-input/-save/-cancel/-clear-confirm.