import { INodeDetailResolverService } from '../../app/services/nodedetailresolver' ; import { IMinemeldConfigService } from '../../app/services/config' ; import { NodeDetailInfoController } from './nodedetail.info.controller' ; import { IMinemeldStatusService } from '../../app/services/status' ; import { IConfirmService } from '../../app/services/confirm' ; import { IThrottleService } from '../../app/services/throttle' ; ngInject function o365APIConfig ( $stateProvider ) { $stateProvider . state ( 'nodedetail.o365apiinfo' , { templateUrl : 'app/nodedetail/o365api.info.html' , controller : NodeDetailO365APIInfoController , controllerAs : 'nodedetailinfo' } ) ; } ngInject function o365APIRegisterClass ( NodeDetailResolver ) { NodeDetailResolver . registerClass ( 'minemeld.ft.o365.O365API' , { tabs : [ { icon : 'fa fa-circle-o' , tooltip : 'INFO' , state : 'nodedetail.o365apiinfo' , active : false } , { icon : 'fa fa-area-chart' , tooltip : 'STATS' , state : 'nodedetail.stats' , active : false } , { icon : 'fa fa-asterisk' , tooltip : 'GRAPH' , state : 'nodedetail.graph' , active : false } ] } ) ; } class NodeDetailO365APIInfoController extends NodeDetailInfoController { MinemeldConfigService : IMinemeldConfigService ; disable_integrations : boolean ; $modal : angular . ui . bootstrap . IModalService ; ConfirmService : IConfirmService ; constructor ( toastr , $interval , MinemeldStatusService , moment , $scope , $compile , $state , $stateParams , MinemeldConfigService , $rootScope , ThrottleService , $modal , ConfirmService ) { this . MinemeldConfigService = MinemeldConfigService ; this . $modal = $modal ; this . ConfirmService = ConfirmService ; super ( toastr , $interval , MinemeldStatusService , moment , $scope , $compile , $state , $stateParams , $rootScope , ThrottleService ) ; this . loadSideConfig ( ) ; } loadSideConfig ( ) { this . MinemeldConfigService . getDataFile ( this . nodename + '_side_config' ) . then ( ( result ) => { if ( typeof result . disable_integrations !== 'undefined' ) { if ( result . disable_integrations ) { this . disable_integrations = true ; } else { this . disable_integrations = false ; } } else { this . disable_integrations = undefined ; } } , ( error ) => { this . toastr . error ( 'ERROR RETRIEVING NODE SIDE CONFIG: ' + error . status ) ; this . disable_integrations = undefined ; } ) ; } saveSideConfig ( ) { var side_config = { } ; if ( typeof this . disable_integrations !== 'undefined' ) { side_config . disable_integrations = this . disable_integrations ; } return this . MinemeldConfigService . saveDataFile ( this . nodename + '_side_config' , side_config , this . nodename ) ; } toggleDisableIntegrations ( ) { var p ; var new_value ; if ( this . disable_integrations ) { new_value = false ; p = this . ConfirmService . show ( 'O365 API INTEGRATIONS' , 'Are you sure you want to enable integrations ?' ) ; } else { new_value = true ; p = this . ConfirmService . show ( 'O365 API INTEGRATIONS' , 'Are you sure you want to disable integrations ?' ) ; } p . then ( ( result ) => { this . disable_integrations = new_value ; return this . saveSideConfig ( ) ; } ) . then ( ( result ) => { this . toastr . success ( 'O365 INTEGRATIONS TOGGLED' ) ; } , ( error ) => { this . toastr . error ( 'ERROR TOGGLING O365 INTEGRATIONS: ' + error . status ) ; } ) ; } } console . log ( 'Loading O365 API' ) ; angular . module ( 'minemeldWebui' ) . config ( o365APIConfig ) . run ( o365APIRegisterClass ) ;