mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-05 04:16:31 +02:00
* improve dismissal logic, use AutomationSnippet component, use wizard service for tracking dismissal * use class helper to check for multiple nodes when rendering tree chart, add test coverage * update comments * add modal for namespace intro and improve reusability * style updates and general reusability updates * make intro pages more generic and rename welcome to intro * update tests * update styles, use service to track intro visibility, rename components * Update arg docs Co-authored-by: lane-wetmore <lane.wetmore@hashicorp.com>
59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
/**
|
|
* Copyright IBM Corp. 2016, 2025
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
|
|
interface Args {
|
|
/**
|
|
* The active step. Steps are zero-indexed.
|
|
*/
|
|
currentStep: number;
|
|
/**
|
|
* Define step information to be shown in the Stepper Nav
|
|
*/
|
|
steps: { title: string; description?: string }[];
|
|
/**
|
|
* Callback to update viewing state when the wizard is exited.
|
|
*/
|
|
onDismiss: CallableFunction;
|
|
/**
|
|
* Callback to update the current step when navigating backwards or
|
|
* forwards through the wizard
|
|
*/
|
|
onStepChange: CallableFunction;
|
|
/**
|
|
* Whether the current step allows proceeding to the next step
|
|
*/
|
|
canProceed?: boolean;
|
|
/**
|
|
* State tracked across steps.
|
|
*/
|
|
wizardState?: unknown;
|
|
/**
|
|
* Callback to update state tracked across steps.
|
|
*/
|
|
updateWizardState?: CallableFunction;
|
|
}
|
|
|
|
export default class GuidedStart extends Component<Args> {
|
|
get isFinalStep() {
|
|
return this.args.currentStep === this.args.steps.length - 1;
|
|
}
|
|
|
|
@action
|
|
onStepChange(change: number) {
|
|
const { currentStep, onStepChange } = this.args;
|
|
const target = currentStep + change;
|
|
onStepChange(target);
|
|
}
|
|
|
|
@action
|
|
onNavStepChange(_event: Event, stepIndex: number) {
|
|
const { onStepChange } = this.args;
|
|
onStepChange(stepIndex);
|
|
}
|
|
}
|