import { Component , OnInit , Injector } from '@angular/core' ; import { DeployedCodePackageBaseControllerDirective } from '../DeployedCodePackageBase' ; import { ITab } from 'src/app/shared/component/navbar/navbar.component' ; import { DataService } from 'src/app/services/data.service' ; import { TreeService } from 'src/app/services/tree.service' ; import { IdGenerator } from 'src/app/Utils/IdGenerator' ; import { Constants } from 'src/app/Common/Constants' ; import { IResponseMessageHandler } from 'src/app/Common/ResponseMessageHandlers' ; import { Observable , of } from 'rxjs' ; @ Component ( { selector : 'app-base' , templateUrl : './base.component.html' , styleUrls : [ './base.component.scss' ] } ) export class BaseComponent extends DeployedCodePackageBaseControllerDirective { containerLogTabName = 'container logs' ; tabs : ITab [ ] = [ { name : 'essentials' , route : './' } , { name : 'details' , route : './details' } ] ; constructor ( protected data , injector , private tree ) { super ( data , injector ) ; } setup ( ) { this . tree . selectTreeNode ( [ IdGenerator . cluster ( ) , IdGenerator . nodeGroup ( ) , IdGenerator . node ( this . nodeName ) , IdGenerator . deployedApp ( this . appId ) , IdGenerator . deployedServicePackage ( this . serviceId , this . activationId ) , IdGenerator . deployedCodePackageGroup ( ) , IdGenerator . deployedCodePackage ( this . codePackageName ) ] , true ) ; } refresh ( messageHandler ? ) { if ( this . deployedCodePackage . raw . HostType === Constants . ContainerHostTypeName ) { if ( ! this . tabs . some ( tab => tab . name === this . containerLogTabName ) ) { this . tabs . push ( { name : this . containerLogTabName , route : './containerlogs' } ) ; } } else { this . tabs = this . tabs . filter ( tab => tab . name !== this . containerLogTabName ) ; } return of ( null ) ; } }