@@ -14,6 +14,7 @@ import { generateMetric } from '../../utils/generate-metric';
14
14
import { TabNames } from '../../utils/tab-names' ;
15
15
import * as FileSaver from '../../services/file-saver' ;
16
16
import { TabDescription } from '../../../server/reporting/tab-description' ;
17
+ import { UnsupportedComponents } from '../../utils/components-os-support' ;
17
18
import {
18
19
metricsGeneral ,
19
20
metricsAudit ,
@@ -165,7 +166,7 @@ export class AgentsController {
165
166
this . $scope . hostMonitoringTabs = [ 'general' , 'fim' , 'syscollector' ] ;
166
167
this . $scope . systemAuditTabs = [ 'pm' , 'sca' , 'audit' , 'oscap' , 'ciscat' ] ;
167
168
this . $scope . securityTabs = [ 'vuls' , 'virustotal' , 'osquery' , 'docker' ] ;
168
- this . $scope . complianceTabs = [ 'pci' , 'gdpr' ] ;
169
+ this . $scope . complianceTabs = [ 'pci' , 'gdpr' , 'hipaa' , 'nist' ] ;
169
170
170
171
/**
171
172
* This check if given array of items contais a single given item
@@ -214,6 +215,9 @@ export class AgentsController {
214
215
215
216
this . $scope . startVis2Png = ( ) => this . startVis2Png ( ) ;
216
217
218
+ this . $scope . shouldShowComponent = component =>
219
+ this . shouldShowComponent ( component ) ;
220
+
217
221
this . $scope . $on ( '$destroy' , ( ) => {
218
222
this . visFactoryService . clearAll ( ) ;
219
223
} ) ;
@@ -225,6 +229,14 @@ export class AgentsController {
225
229
this . $location . path ( '/manager/groups' ) ;
226
230
} ;
227
231
232
+ this . $scope . exportConfiguration = enabledComponents => {
233
+ this . reportingService . startConfigReport (
234
+ this . $scope . agent ,
235
+ 'agentConfig' ,
236
+ enabledComponents
237
+ ) ;
238
+ } ;
239
+
228
240
this . $scope . restartAgent = async agent => {
229
241
this . $scope . restartingAgent = true ;
230
242
try {
@@ -437,14 +449,6 @@ export class AgentsController {
437
449
} ;
438
450
439
451
this . $scope . expand = i => this . expand ( i ) ;
440
-
441
- this . $scope . welcomeCardsProps = {
442
- switchTab : tab => this . switchTab ( tab ) ,
443
- extensions : this . $scope . extensions ,
444
- api : this . appState . getCurrentAPI ( ) ,
445
- setExtensions : ( api , extensions ) =>
446
- this . appState . setExtensions ( api , extensions )
447
- } ;
448
452
}
449
453
/**
450
454
* Create metric for given object
@@ -562,7 +566,7 @@ export class AgentsController {
562
566
this . $scope . agent . status =
563
567
( ( ( agentInfo || { } ) . data || { } ) . data || { } ) . status ||
564
568
this . $scope . agent . status ;
565
- } catch ( error ) { } // eslint-disable-line
569
+ } catch ( error ) { } // eslint-disable-line
566
570
}
567
571
568
572
try {
@@ -579,6 +583,18 @@ export class AgentsController {
579
583
this . $scope . selectedGdprIndex = 0 ;
580
584
}
581
585
586
+ if ( tab === 'hipaa' ) {
587
+ const hipaaTabs = await this . commonData . getHIPAA ( ) ;
588
+ this . $scope . hipaaTabs = hipaaTabs ;
589
+ this . $scope . selectedHipaaIndex = 0 ;
590
+ }
591
+
592
+ if ( tab === 'nist' ) {
593
+ const nistTabs = await this . commonData . getNIST ( ) ;
594
+ this . $scope . nistTabs = nistTabs ;
595
+ this . $scope . selectedNistIndex = 0 ;
596
+ }
597
+
582
598
if ( tab === 'sca' ) {
583
599
try {
584
600
this . $scope . loadSca = true ;
@@ -598,7 +614,7 @@ export class AgentsController {
598
614
if ( tab === 'syscollector' )
599
615
try {
600
616
await this . loadSyscollector ( this . $scope . agent . id ) ;
601
- } catch ( error ) { } // eslint-disable-line
617
+ } catch ( error ) { } // eslint-disable-line
602
618
if ( tab === 'configuration' ) {
603
619
this . $scope . switchConfigurationTab ( 'welcome' ) ;
604
620
} else {
@@ -730,12 +746,13 @@ export class AgentsController {
730
746
if ( agentInfo && this . $scope . agent . os ) {
731
747
this . $scope . agentOS =
732
748
this . $scope . agent . os . name + ' ' + this . $scope . agent . os . version ;
733
- this . $scope . agent . isLinuxOS = this . $scope . agent . os . uname . includes (
734
- 'Linux'
735
- ) ;
749
+ const isLinux = this . $scope . agent . os . uname . includes ( 'Linux' ) ;
750
+ this . $scope . agent . agentPlatform = isLinux
751
+ ? 'linux'
752
+ : this . $scope . agent . os . platform ;
736
753
} else {
737
754
this . $scope . agentOS = '-' ;
738
- this . $scope . agent . isLinuxOS = false ;
755
+ this . $scope . agent . agentPlatform = false ;
739
756
}
740
757
741
758
await this . $scope . switchTab ( this . $scope . tab , true ) ;
@@ -748,6 +765,7 @@ export class AgentsController {
748
765
this . $scope . agent . group && ! this . $scope . agent . group . includes ( item )
749
766
) ;
750
767
768
+ this . loadWelcomeCardsProps ( ) ;
751
769
this . $scope . load = false ;
752
770
this . $scope . $applyAsync ( ) ;
753
771
return ;
@@ -767,11 +785,48 @@ export class AgentsController {
767
785
this . $location . path ( '/agents-preview' ) ;
768
786
}
769
787
}
788
+
770
789
this . $scope . load = false ;
771
790
this . $scope . $applyAsync ( ) ;
772
791
return ;
773
792
}
774
793
794
+ shouldShowComponent ( component ) {
795
+ return ! (
796
+ UnsupportedComponents [ this . $scope . agent . agentPlatform ] ||
797
+ UnsupportedComponents [ 'other' ]
798
+ ) . includes ( component ) ;
799
+ }
800
+
801
+ cleanExtensions ( extensions ) {
802
+ const result = { } ;
803
+ for ( const extension in extensions ) {
804
+ if (
805
+ ! (
806
+ UnsupportedComponents [ this . $scope . agent . agentPlatform ] ||
807
+ UnsupportedComponents [ 'other' ]
808
+ ) . includes ( extension )
809
+ ) {
810
+ result [ extension ] = extensions [ extension ] ;
811
+ }
812
+ }
813
+ return result ;
814
+ }
815
+
816
+ /**
817
+ * Get available welcome cards after getting the agent
818
+ */
819
+ loadWelcomeCardsProps ( ) {
820
+ this . $scope . welcomeCardsProps = {
821
+ switchTab : tab => this . switchTab ( tab ) ,
822
+ extensions : this . cleanExtensions ( this . $scope . extensions ) ,
823
+ agent : this . $scope . agent ,
824
+ api : this . appState . getCurrentAPI ( ) ,
825
+ setExtensions : ( api , extensions ) =>
826
+ this . appState . setExtensions ( api , extensions )
827
+ } ;
828
+ }
829
+
775
830
switchGroupEdit ( ) {
776
831
this . $scope . editGroup = ! ! ! this . $scope . editGroup ;
777
832
this . $scope . $applyAsync ( ) ;
0 commit comments