module Sfx { export interface INetworkViewScope extends angular . IScope { network : Network ; listSettings : ListSettings ; apps : AppOnNetworkCollection ; appListSettings : ListSettings ; nodes : NodeOnNetworkCollection ; nodeListSettings : ListSettings ; containers : DeployedContainerOnNetworkCollection ; containerListSettings : ListSettings ; } export class NetworkViewController extends MainViewController { public networkName : string ; constructor ( $injector , public $scope ) { super ( $injector , { "essentials" : { name : "Essentials" } } ) ; this . tabs [ "essentials" ] . refresh = ( messageHandler ) => this . refreshEssentials ( messageHandler ) ; this . networkName = IdUtils . getNetworkName ( this . routeParams ) ; this . selectTreeNode ( [ IdGenerator . cluster ( ) , IdGenerator . networkGroup ( ) , IdGenerator . network ( this . networkName ) ] ) ; this . $scope . appListSettings = this . settings . getNewOrExistingListSettings ( "apps" , [ "appDetail.raw.Name" ] , [ new ListColumnSettingForLink ( "appDetail.raw.Name" , "Application Name" , item => item . viewPath ) , new ListColumnSetting ( "appDetail.raw.TypeName" , "Application Type" ) , new ListColumnSettingForBadge ( "appDetail.healthState" , "Health State" ) , new ListColumnSetting ( "appDetail.raw.Status" , "Status" ) , ] ) ; this . $scope . apps = new AppOnNetworkCollection ( this . data , this . networkName ) ; this . $scope . nodeListSettings = this . settings . getNewOrExistingListSettings ( "nodes" , [ "nodeDetails.name" ] , [ new ListColumnSettingForLink ( "nodeDetails.name" , "Name" , item => item . viewPath ) , new ListColumnSetting ( "nodeDetails.raw.IpAddressOrFQDN" , "Address" ) , new ListColumnSettingWithFilter ( "nodeDetails.raw.Type" , "Node Type" ) , new ListColumnSettingWithFilter ( "nodeDetails.raw.UpgradeDomain" , "Upgrade Domain" ) , new ListColumnSettingWithFilter ( "nodeDetails.raw.FaultDomain" , "Fault Domain" ) , new ListColumnSettingWithFilter ( "nodeDetails.raw.IsSeedNode" , "Is Seed Node" ) , new ListColumnSettingForBadge ( "nodeDetails.healthState" , "Health State" ) , new ListColumnSettingWithFilter ( "nodeDetails.nodeStatus" , "Status" ) , ] ) ; this . $scope . nodes = new NodeOnNetworkCollection ( this . data , this . networkName ) ; this . $scope . containerListSettings = this . settings . getNewOrExistingListSettings ( "containers" , [ "nodeName" , "raw.CodePackageName" ] , [ new ListColumnSettingForLink ( "raw.CodePackageName" , "Code Package Name" , item => item . viewPath ) , new ListColumnSetting ( "nodeName" , "Node Name" ) , new ListColumnSetting ( "raw.NetworkName" , "Network" ) , new ListColumnSetting ( "raw.ApplicationName" , "Application" ) , new ListColumnSetting ( "raw.CodePackageVersion" , "Version" ) , new ListColumnSetting ( "raw.ServiceManifestName" , "Service" ) , new ListColumnSetting ( "raw.ServicePackageActivationId" , "Activation Id" ) , new ListColumnSetting ( "raw.ContainerAddress" , "Container addresses" ) , new ListColumnSetting ( "raw.ContainerId" , "Container Id" ) ] ) ; this . $scope . containers = new DeployedContainerOnNetworkCollection ( this . data , this . networkName ) ; this . refresh ( ) ; } protected refreshCommon ( messageHandler ? ) { return this . data . getNetwork ( this . networkName , true , messageHandler ) . then ( network => { this . $scope . network = network ; } ) ; } private refreshEssentials ( messageHandler ? ) { return this . $q . all ( [ this . $scope . apps . refresh ( messageHandler ) , this . $scope . nodes . refresh ( messageHandler ) , this . $scope . containers . refresh ( messageHandler ) ] ) ; } } ( function ( ) { let module = angular . module ( "networkViewController" , [ "ngRoute" , "dataService" ] ) ; module . controller ( "NetworkViewController" , [ "$injector" , "$scope" , NetworkViewController ] ) ; } ) ( ) ; }