import { Component, OnInit, Input,
    ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'

import { DashboardService, DashboardGroup, DashboardPageMetaData } from '../../openapi'
import { AuthenticationService } from '../../_services/authentication.service'
import { Observable, map, of } from 'rxjs'
import { Dash } from 'plotly.js-dist-min'

@Component({
    selector: 'gisaf-dashboard-menu',
    templateUrl: './dashboard-menu.component.html',
    styleUrls: ['./dashboard-menu.component.scss'],
    changeDetection: ChangeDetectionStrategy.OnPush,
})
export class DashboardMenuComponent implements OnInit {
    @Input() menuItems: DashboardGroup[]

    constructor(
        public dashboardService: DashboardService,
        public authenticationService: AuthenticationService,
        private cdr: ChangeDetectorRef,
    ) {}

    ngOnInit() {
        this.dashboardService.getGroupsApiDashboardGroupsGet().subscribe(
            data => {
                this.menuItems = data
                this.cdr.markForCheck()
            }
        )
    }
}
