@@ -10,10 +10,10 @@ import { ProjectApolloService } from '../../services/project/project-apollo.serv
10
10
import { BricksCodeParser } from './helper/code-parser' ;
11
11
import { BricksDataRequestor } from './helper/data-requestor' ;
12
12
import { BricksAPIData , BricksIntegratorConfig , BricksSearchData , BricksVariable , BricksVariableType , getEmptyBricksIntegratorConfig , IntegratorPage } from './helper/type-helper' ;
13
- import { extendDummyElements , getDummyNodeByIdForApi } from './helper/dummy-nodes' ;
13
+ import { GROUPS_TO_REMOVE , extendDummyElements , getDummyNodeByIdForApi } from './helper/dummy-nodes' ;
14
14
import { caesarCipher } from 'src/app/util/cipher' ;
15
15
import { PASS_ME } from 'src/app/util/cipher' ;
16
- import { copyToClipboard , isStringTrue , jsonCopy } from 'submodules/javascript-functions/general' ;
16
+ import { copyToClipboard , removeArrayFromArray , isStringTrue , jsonCopy } from 'submodules/javascript-functions/general' ;
17
17
import { capitalizeFirst } from 'submodules/javascript-functions/case-types-parser' ;
18
18
19
19
@Component ( {
@@ -133,16 +133,25 @@ export class BricksIntegratorComponent implements OnInit, OnDestroy {
133
133
private buildSearchUrl ( ) : string {
134
134
let filter = "?pagination[pageSize]=99999" ;
135
135
filter += this . extendUrl ( this . moduleTypeFilter , "moduleType" ) ;
136
- filter += this . extendUrl ( this . executionTypeFilter , "executionType" )
136
+ filter += this . extendUrl ( this . executionTypeFilter , "executionType" ) ;
137
137
return this . HttpBaseLink + filter ;
138
138
}
139
139
140
140
private extendUrl ( value : string , attribute : string ) : string {
141
- if ( ! value ) return "" ;
142
141
let filter = "" ;
142
+ if ( ! value ) return filter += "&filters[executionType][$ne]=activeLearner" ;
143
143
const splitVal : string [ ] = value . split ( ',' ) ;
144
144
for ( let i = 0 ; i < splitVal . length ; i ++ ) {
145
145
filter += "&filters[" + attribute + "][$eq]=" + splitVal [ i ] . trim ( ) ;
146
+ filter += this . filterActiveLearnersFromGenerators ( splitVal , i , filter ) ;
147
+ }
148
+ return filter ;
149
+ }
150
+
151
+ private filterActiveLearnersFromGenerators ( splitVal : string [ ] , index : number , filter : string ) {
152
+ // Remove active learners from generators (on ac page we have generators and classifiers but we want to exclude active learners there)
153
+ if ( splitVal [ index ] . trim ( ) == 'generator' && this . executionTypeFilter != "activeLearner" ) {
154
+ filter += "&filters[executionType][$ne]=activeLearner" ;
146
155
}
147
156
return filter ;
148
157
}
@@ -170,12 +179,15 @@ export class BricksIntegratorComponent implements OnInit, OnDestroy {
170
179
this . config . search . currentRequest = null ;
171
180
let finalData ;
172
181
if ( this . config . extendedIntegrator ) {
173
- finalData = data . data . map ( e => {
174
- const c = jsonCopy ( e ) ;
175
- if ( e . attributes . partOfGroup ) c . attributes . partOfGroup = JSON . parse ( c . attributes . partOfGroup ) ;
176
- if ( e . attributes . availableFor ) c . attributes . availableFor = JSON . parse ( c . attributes . availableFor ) ;
177
- if ( e . attributes . integratorInputs ) c . attributes . integratorInputs = JSON . parse ( c . attributes . integratorInputs ) ;
178
- return c ;
182
+ finalData = data . data . map ( integratorData => {
183
+ const integratorDataCopy = jsonCopy ( integratorData ) ;
184
+ if ( integratorData . attributes . partOfGroup ) {
185
+ integratorDataCopy . attributes . partOfGroup = JSON . parse ( integratorDataCopy . attributes . partOfGroup ) ;
186
+ integratorDataCopy . attributes . partOfGroup = removeArrayFromArray ( integratorDataCopy . attributes . partOfGroup , GROUPS_TO_REMOVE ) ;
187
+ }
188
+ if ( integratorData . attributes . availableFor ) integratorDataCopy . attributes . availableFor = JSON . parse ( integratorDataCopy . attributes . availableFor ) ;
189
+ if ( integratorData . attributes . integratorInputs ) integratorDataCopy . attributes . integratorInputs = JSON . parse ( integratorDataCopy . attributes . integratorInputs ) ;
190
+ return integratorDataCopy ;
179
191
} ) ;
180
192
} else finalData = data . data ;
181
193
if ( this . executionTypeFilter ) {
@@ -262,8 +274,6 @@ export class BricksIntegratorComponent implements OnInit, OnDestroy {
262
274
263
275
private getGroupName ( groupKey : string ) : string {
264
276
switch ( groupKey ) {
265
- case "gdpr_compliant" : return "GDPR Compliant" ;
266
- case "not_gdpr_compliant" : return "Not GDPR Compliant" ;
267
277
case "no_api_key" : return "No API Key" ;
268
278
default : return capitalizeFirst ( groupKey ) ;
269
279
}
@@ -361,8 +371,10 @@ export class BricksIntegratorComponent implements OnInit, OnDestroy {
361
371
next : ( c : any ) => {
362
372
if ( ! c . data . attributes . integratorInputs ) this . config . api . data = c ;
363
373
else {
374
+ // Additional parsing for integrator inputs used in the overview section in the bricks integrator
364
375
this . config . api . data = c ;
365
376
this . config . api . data . data . attributes . partOfGroup = JSON . parse ( c . data . attributes . partOfGroup ) ;
377
+ this . config . api . data . data . attributes . partOfGroup = removeArrayFromArray ( this . config . api . data . data . attributes . partOfGroup , GROUPS_TO_REMOVE ) ;
366
378
this . config . api . data . data . attributes . partOfGroupText = this . config . api . data . data . attributes . partOfGroup . map ( x => this . getGroupName ( x ) ) . join ( ", " ) ;
367
379
this . config . api . data . data . attributes . availableFor = JSON . parse ( c . data . attributes . availableFor ) ;
368
380
this . config . api . data . data . attributes . integratorInputs = JSON . parse ( c . data . attributes . integratorInputs ) ;
0 commit comments