home-page.component.ts 1015 B

12345678910111213141516171819202122232425262728293031
  1. import { Component, OnInit } from '@angular/core';
  2. import { faAngleDown, faAngleRight, faChalkboard, faChartBar, faServer, faTheaterMasks } 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. host: { class: 'd-flex flex-column h-100 overflow-auto' }
  9. })
  10. export class HomePageComponent implements OnInit {
  11. public fa = { faAngleDown, faAngleRight, faChalkboard, faChartBar, faServer, faTheaterMasks };
  12. public serverConfigs: ServerConfig[] = [];
  13. public grid = {
  14. columns: 3,
  15. rows: 1
  16. };
  17. constructor(private apiService: ServerApiService) {
  18. this.apiService.serverConfigs$.subscribe({ next: this.onServerConfigs.bind(this) });
  19. }
  20. async ngOnInit(): Promise<void> {}
  21. private onServerConfigs(data: ServerConfig[]) {
  22. this.serverConfigs = data;
  23. this.grid.rows = this.serverConfigs.length + 1;
  24. }
  25. }