home-page.component.ts 898 B

123456789101112131415161718192021222324252627282930
  1. import { Component, OnInit } from '@angular/core';
  2. import { faAngleDown, faAngleRight, faChalkboard, faServer } from '@fortawesome/free-solid-svg-icons';
  3. import { ServerApiService } from '../../services/server-api.service';
  4. @Component({
  5. selector: 'app-home',
  6. templateUrl: './home-page.component.html',
  7. styleUrls: ['./home-page.component.scss']
  8. })
  9. export class HomePageComponent implements OnInit {
  10. public fa = { faAngleDown, faAngleRight, faChalkboard, faServer };
  11. public serverConfigs: ServerConfig[] = [];
  12. public grid = {
  13. columns: 3,
  14. rows: 1
  15. };
  16. constructor(private apiService: ServerApiService) {
  17. this.apiService.serverConfigs$.subscribe({ next: this.onServerConfigs.bind(this) });
  18. }
  19. async ngOnInit(): Promise<void> {}
  20. private onServerConfigs(data: ServerConfig[]) {
  21. this.serverConfigs = data;
  22. this.grid.rows = this.serverConfigs.length + 1;
  23. }
  24. }