File tree Expand file tree Collapse file tree 1 file changed +33
-2
lines changed
Expand file tree Collapse file tree 1 file changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,9 @@ export default {
341341 },
342342 ],
343343 valueTypeReturned: ' ' ,
344+ assetType: null ,
345+ assetTypeResolved: false ,
346+ screenId: null ,
344347 };
345348 },
346349 watch: {
@@ -504,9 +507,37 @@ export default {
504507 monacoMounted (editor ) {
505508 editor .getAction (' editor.action.formatDocument' ).run ();
506509 },
507- getDataSourceList () {
510+ resolveAssetType () {
511+ if (this .assetTypeResolved ) {
512+ return Promise .resolve (this .assetType );
513+ }
514+ const match = window .location .pathname .match (/ screen-builder\/ (\d + )\/ edit/ );
515+ if (! match) {
516+ this .assetTypeResolved = true ;
517+ return Promise .resolve (this .assetType );
518+ }
519+ this .screenId = match[1 ];
520+ return this .$dataProvider
521+ .get (` /screens/${ this .screenId } ` )
522+ .then (response => {
523+ this .assetType = response .data .asset_type || null ;
524+ this .assetTypeResolved = true ;
525+ return this .assetType ;
526+ })
527+ .catch (() => {
528+ this .assetTypeResolved = true ;
529+ return this .assetType ;
530+ });
531+ },
532+ async getDataSourceList () {
533+ await this .resolveAssetType ();
534+ const params = {};
535+ if (this .assetType ) {
536+ // For PM Block screens, expose both regular and PM Block connectors.
537+ params .asset_type = this .assetType === ' PM_BLOCK' ? ' all' : this .assetType ;
538+ }
508539 this .$dataProvider
509- .get (' /data_sources' )
540+ .get (' /data_sources' , { params } )
510541 .then (response => {
511542 let jsonData = response .data .data ;
512543 // Map the data sources response to value/text items list
You can’t perform that action at this time.
0 commit comments