import { IMinemeldStatusService } from '../../app/services/status' ; import { INodeDetailResolverService , INodeDetailTab , INodeDetailClass } from '../../app/services/nodedetailresolver' ; ngInject export class NodeDetailController { $state : angular . ui . IStateService ; toastr : any ; nodename : string ; tabs : INodeDetailTab [ ] ; constructor ( $stateParams , $state , MinemeldStatusService , toastr , NodeDetailResolver ) { this . nodename = $stateParams [ 'nodename' ] ; this . $state = $state ; this . toastr = toastr ; NodeDetailResolver . resolveNode ( this . nodename ) . then ( ( details ) => { var atabs ; this . tabs = angular . copy ( details . tabs ) ; atabs = this . tabs . filter ( ( x ) => { return x . state === $state . current . name ; } ) ; if ( atabs . length === 0 ) { this . tabs [ 0 ] . active = true ; $state . go ( this . tabs [ 0 ] . state , { nodename : this . nodename } ) ; } else { atabs [ 0 ] . active = true ; } } , ( error ) => { this . toastr . error ( 'ERROR RESOLVING NODE ' + this . nodename + ': ' + error . status ) ; } ) ; } public select ( state ) { this . $state . go ( state , { nodename : this . nodename } ) ; } }