@@ -24,7 +24,7 @@ import {
24
24
useWorkflowApp ,
25
25
} from './Services/WorkflowAndArtifacts' ;
26
26
import { ArmParser } from './Utilities/ArmParser' ;
27
- import { WorkflowUtility } from './Utilities/Workflow' ;
27
+ import { WorkflowUtility , addConnectionData } from './Utilities/Workflow' ;
28
28
import { Chatbot , chatbotPanelWidth } from '@microsoft/logic-apps-chatbot' ;
29
29
import {
30
30
BaseApiManagementService ,
@@ -123,9 +123,8 @@ const DesignerEditor = () => {
123
123
[ originalConnectionsData , parameters , settingsData ?. properties ]
124
124
) ;
125
125
126
- const addConnectionData = async ( connectionAndSetting : ConnectionAndAppSetting ) : Promise < void > => {
127
- addConnectionInJson ( connectionAndSetting , connectionsData ?? { } ) ;
128
- addOrUpdateAppSettings ( connectionAndSetting . settings , settingsData ?. properties ?? { } ) ;
126
+ const addConnectionDataInternal = async ( connectionAndSetting : ConnectionAndAppSetting ) : Promise < void > => {
127
+ addConnectionData ( connectionAndSetting , connectionsData ?? { } , settingsData ?? { } ) ;
129
128
} ;
130
129
131
130
const getConnectionConfiguration = async ( connectionId : string ) : Promise < any > => {
@@ -168,7 +167,7 @@ const DesignerEditor = () => {
168
167
equals ( workflow ?. kind , 'stateful' ) ,
169
168
connectionsData ?? { } ,
170
169
workflowAppData as WorkflowApp ,
171
- addConnectionData ,
170
+ addConnectionDataInternal ,
172
171
getConnectionConfiguration ,
173
172
tenantId ,
174
173
objectId ,
@@ -716,43 +715,6 @@ const getDesignerServices = (
716
715
} ;
717
716
} ;
718
717
719
- const addConnectionInJson = ( connectionAndSetting : ConnectionAndAppSetting , connectionsJson : ConnectionsData ) : void => {
720
- const { connectionData, connectionKey, pathLocation } = connectionAndSetting ;
721
-
722
- let pathToSetConnectionsData : any = connectionsJson ;
723
-
724
- for ( const path of pathLocation ) {
725
- if ( ! pathToSetConnectionsData [ path ] ) {
726
- pathToSetConnectionsData [ path ] = { } ;
727
- }
728
-
729
- pathToSetConnectionsData = pathToSetConnectionsData [ path ] ;
730
- }
731
-
732
- if ( pathToSetConnectionsData && pathToSetConnectionsData [ connectionKey ] ) {
733
- // TODO: To show this in a notification of info bar on the blade.
734
- // const message = 'ConnectionKeyAlreadyExist - Connection key \'{0}\' already exists.'.format(connectionKey);
735
- return ;
736
- }
737
-
738
- pathToSetConnectionsData [ connectionKey ] = connectionData ;
739
- } ;
740
-
741
- const addOrUpdateAppSettings = ( settings : Record < string , string > , originalSettings : Record < string , string > ) : Record < string , string > => {
742
- const settingsToAdd = Object . keys ( settings ) ;
743
-
744
- for ( const settingKey of settingsToAdd ) {
745
- if ( originalSettings [ settingKey ] ) {
746
- // TODO: To show this in a notification of info bar on the blade that key will be overriden.
747
- }
748
-
749
- // eslint-disable-next-line no-param-reassign
750
- originalSettings [ settingKey ] = settings [ settingKey ] ;
751
- }
752
-
753
- return originalSettings ;
754
- } ;
755
-
756
718
const hasNewKeys = ( original : Record < string , any > = { } , updated : Record < string , any > = { } ) => {
757
719
return ! Object . keys ( updated ) . some ( ( key ) => ! Object . keys ( original ) . includes ( key ) ) ;
758
720
} ;
0 commit comments