core/setup/setup.component.ts
This component is the parent of each setup and can be injected into setup steps to control them.
OnInit
| selector | c8y-setup |
| standalone | true |
| imports |
TitleComponent
StepperOutletComponent
C8yTranslateDirective
PropertiesListComponent
C8yTranslatePipe
AsyncPipe
HumanizeAppNamePipe
SetupIllustrationComponent
|
| templateUrl | ./setup.component.html |
Properties |
|
Methods |
constructor(options: OptionsService, stepperService: StepperService, appState: AppStateService, alert: AlertService, permissions: Permissions, setupService: SetupService)
|
|||||||||||||||||||||
|
Parameters :
|
| cancel |
cancel()
|
|
Cancels the wizards and goes back to the start view.
Returns :
void
|
| Async finalize |
finalize()
|
|
Returns :
any
|
| finish |
finish()
|
|
Finish the wizard and will start the application.
Returns :
void
|
| getByIndex | ||||||||
getByIndex(stepIndex: unknown)
|
||||||||
|
Returns a step by it index position in the wizard.
Parameters :
Returns :
any
An indexed step definition. |
| skip |
skip()
|
|
Skips the current setup wizard
Returns :
void
|
| start |
start()
|
|
Starts the wizards (or finish the setup if no steps are found)
Returns :
void
|
| stepCompleted | |||||||||||||||
stepCompleted(stepIndex: unknown, isCompleted: unknown)
|
|||||||||||||||
|
Mark a step as completed. If the step is required, this is needed to fulfill the setup.
Parameters :
Returns :
void
|
| verify |
verify()
|
|
Verifies every step and checks if all required are completed. Updates the icons to reflect the state of the steps (error, warning, done).
Returns :
boolean
Returns true if no error was found. |
| currentSetupState |
Type : unknown
|
Default value : SetupState.START
|
|
The current state. SetupState.START shows an application overview while SetupState.WIZARD shows the steps. |
| data$ |
Type : unknown
|
Default value : new BehaviorSubject<Record<string, unknown>>({})
|
|
A subject which can be used to exchange data between steps. |
| Public options |
Type : OptionsService
|
| steps |
Type : SetupStep[]
|
|
All current shown setup steps. |
<c8y-title>
{{ options.name | humanizeAppName | async }}
</c8y-title>
@if (currentSetupState !== setupState.START) {
<div class="card content-fullpage fadeInRightBig animated">
<c8y-stepper-outlet
class="d-contents"
[showDefaultButtons]="false"
[steps]="steps"
></c8y-stepper-outlet>
</div>
}
@if (currentSetupState === setupState.START) {
<div class="card content-fullpage d-flex d-col zoomIn animated">
<div class="inner-scroll flex-grow">
<div class="card-block">
<div class="row">
<div class="col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3 p-t-24">
<c8y-setup-illustration></c8y-setup-illustration>
<h1
class="p-t-16 p-b-16 text-center text-medium"
ngNonBindable
translate
[translateParams]="{ appName: options.name | humanizeAppName | async }"
data-cy="c8y-setup--setup-header-title"
>
Welcome to {{ appName }}
</h1>
@if (hasRole) {
<p
class="lead text-normal"
translate
>
This application (or any plugin that you added recently) has pre-requirements that
needs to be configured first. This wizard will guide you through the steps that are
necessary to get your customized application up and running.
</p>
}
@if (properties.length > 0) {
<div class="flex-grow">
<c8y-properties-list
icon="info"
[title]="'Application properties' | translate"
[properties]="properties"
[data]="options"
></c8y-properties-list>
</div>
}
@if (!hasRole) {
<div class="alert alert-danger m-32">
<strong translate>No permission</strong>
<div translate>
You don't have sufficient rights to setup this application. Contact an application
administrator to setup the required steps.
</div>
</div>
}
@if (!isOwner) {
<div class="alert alert-danger m-32">
<strong translate>Not the owner</strong>
<div translate>
The current application is not owned by this tenant. Clone the application before
running the setup.
</div>
</div>
}
</div>
</div>
</div>
</div>
<div class="card-footer separator gap-8 d-flex j-c-center">
@if (canSkip) {
<button
class="btn btn-default"
[title]="
'You can skip the setup now. It will be shown again as soon as you restart the application.'
| translate
"
(click)="skip()"
translate
data-cy="c8y-setup--skip-setup-button"
>
Skip
</button>
}
<button
class="btn btn-primary"
[title]="'Start the setup wizard.' | translate"
(click)="start()"
translate
[disabled]="!hasRole || !isOwner"
data-cy="c8y-setup--start-setup-button"
>
Start
</button>
</div>
</div>
}