projects/cobbler-frontend/src/app/actions/validate-autoinstalls/validate-autoinstalls.component.ts

Implements

OnDestroy

Metadata

Relationships

Used by

No results matching.

Depends on

Index

Properties
Methods

Methods

ngOnDestroy
ngOnDestroy()
Returns : void
runValidateAutoinstalls
runValidateAutoinstalls()
Returns : void

Properties

Private _snackBar
Type : unknown
Default value : inject(MatSnackBar)
Private cobblerApiService
Type : unknown
Default value : inject(CobblerApiService)
Private ngUnsubscribe
Type : unknown
Default value : new Subject<void>()
userService
Type : unknown
Default value : inject(UserService)
import { Component, OnDestroy, inject } from '@angular/core';
import { MatButton } from '@angular/material/button';
import { MatSnackBar } from '@angular/material/snack-bar';
import { CobblerApiService } from 'cobbler-api';
import { Subject } from 'rxjs';
import { takeUntil } from 'rxjs/operators';
import { UserService } from '../../services/user.service';
import Utils from '../../utils';

@Component({
  selector: 'cobbler-validate-autoinstalls',
  imports: [MatButton],
  templateUrl: './validate-autoinstalls.component.html',
  styleUrl: './validate-autoinstalls.component.scss',
})
export class ValidateAutoinstallsComponent implements OnDestroy {
  userService = inject(UserService);
  private cobblerApiService = inject(CobblerApiService);
  private _snackBar = inject(MatSnackBar);

  // Unsubscribe
  private ngUnsubscribe = new Subject<void>();

  ngOnDestroy(): void {
    this.ngUnsubscribe.next();
    this.ngUnsubscribe.complete();
  }

  runValidateAutoinstalls(): void {
    this.cobblerApiService
      .background_validate_autoinstall_files(this.userService.token)
      .pipe(takeUntil(this.ngUnsubscribe))
      .subscribe(
        (value) => {
          // TODO
        },
        (error) => {
          // HTML encode the error message since it originates from XML
          this._snackBar.open(
            Utils.toHTML(error.message),
            $localize`:@@snackbar.action.close:Close`,
          );
        },
      );
  }
}
<h1 i18n="@@action.validate-autoinstalls.title">VALIDATE AUTOINSTALLS</h1>

<button mat-button (click)="runValidateAutoinstalls()" i18n="@@button.run">
  Run
</button>

./validate-autoinstalls.component.scss

Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""