import { ScenarioIds } from './../../models/constants' ; import { DashboardType } from 'app/tree-view/models/dashboard-type' ; import { TranslateService } from '@ngx-translate/core' ; import { ArmSiteDescriptor } from 'app/shared/resourceDescriptors' ; import { ScenarioCheckInput } from './scenario.models' ; import { Environment , ScenarioResult } from 'app/shared/services/scenario/scenario.models' ; export class SiteSlotEnvironment extends Environment { name = 'SiteSlot' ; constructor ( translateService ) { super ( ) ; this . scenarioChecks [ ScenarioIds . showSiteAvailability ] = { id : ScenarioIds . showSiteAvailability , runCheck : ( ) => { return { status : 'disabled' } ; } , } ; this . scenarioChecks [ ScenarioIds . filterAppNodeChildren ] = { id : ScenarioIds . filterAppNodeChildren , runCheck : ( input ) => { return this . _filterAppNodeChildren ( input ) ; } , } ; } public isCurrentEnvironment ( input ? ) { if ( input && input . site ) { const descriptor = new ArmSiteDescriptor ( input . site . id ) ; return ! ! descriptor . slot ; } return false ; } private _filterAppNodeChildren ( input ) { const descriptor = new ArmSiteDescriptor ( input . site . id ) ; let data = input . appNodeChildren ; if ( descriptor . slot ) { data = input . appNodeChildren . filter ( c => c . dashboardType !== DashboardType . SlotsDashboard ) ; } return < ScenarioResult > { status : 'enabled' , data : data , } ; } }