import { Breakpoints , BreakpointObserver , BreakpointState } from '@angular/cdk/layout' ; import { Component , Input , OnChanges , SimpleChanges } from '@angular/core' ; import { MatSnackBar } from '@angular/material' ; import { AuthenticationService } from '@app/core/services/authentication.service' ; import { ProjectService } from '@core/services/index.service' ; import { ProjectModel } from '../../models/index.model' ; /**
 * Project list component
 */ @ Component ( { selector : 'dashboard-projects-list' , templateUrl : './projects-list.component.html' , styleUrls : [ './projects-list.component.scss' ] , } ) export class ProjectsListComponent implements OnChanges { @ Input ( ) public projects : ProjectModel [ ] = [ ] ; public displayedColumns : string [ ] ; public pingCount : [ ] ; public isSmallScreen : boolean ; param breakpointObserver param authService param projectService param snackBar constructor ( private breakpointObserver , private authService , private projectService , private snackBar ) { this . breakpointObserver . observe ( [ Breakpoints . Medium ] ) . subscribe ( ( state ) => { if ( state . matches ) { this . isSmallScreen = false ; this . displayedColumns = [ 'type' , 'title' , 'url' , 'repository' , 'monitors' , 'pings' , 'user' , 'lastDate' ] ; } else { this . isSmallScreen = false ; this . displayedColumns = [ 'type' , 'title' , 'description' , 'url' , 'repository' , 'monitors' , 'pings' , 'user' , 'lastDate' ] ; } } ) ; this . breakpointObserver . observe ( [ Breakpoints . Small ] ) . subscribe ( ( state ) => { if ( state . matches ) { this . displayedColumns = [ 'type' , 'title' , 'url' , 'repository' ] ; this . isSmallScreen = false ; } } ) ; this . breakpointObserver . observe ( [ Breakpoints . XSmall ] ) . subscribe ( ( state ) => { if ( state . matches ) { this . displayedColumns = [ 'title' , 'repository' ] ; this . isSmallScreen = true ; } } ) ; } param project isAdmin ( project ) { return project . isAdmin ( this . authService . profile . uid ) ; } /**
     * Life cycle on change event to detect change in input property
     */ ngOnChanges ( changes ) { if ( changes . projects ) { this . projects = changes . projects . currentValue ; } } param project public checkTypeOfProject ( project ) { return project . isPrivate ( ) ? 'lock' : 'lock_open' ; } param projectUid public delete ( projectUid ) { this . projectService . showDeleteDialog ( projectUid ) . subscribe ( ( ) => this . snackBar . open ( 'Project deleted successfully' , undefined , { duration : 5000 } ) ) ; } }