4
4
* Licensed under The Universal Permissive License (UPL), Version 1.0 as shown at https://oss.oracle.com/licenses/upl/
5
5
*/
6
6
define ( [ 'accUtils' , 'utils/i18n' , 'knockout' , 'models/wkt-project' , 'utils/url-catalog' , 'utils/view-helper' ,
7
- 'utils/wkt-logger' , 'js-yaml' , ' wrc-frontend/integration/viewModels/utils', 'wdt-model-designer/loader' ,
7
+ 'utils/wkt-logger' , 'wrc-frontend/integration/viewModels/utils' , 'wdt-model-designer/loader' ,
8
8
'ojs/ojinputtext' , 'ojs/ojlabel' , 'ojs/ojbutton' , 'ojs/ojformlayout' ] ,
9
- function ( accUtils , i18n , ko , project , urlCatalog , viewHelper , wktLogger , jsYaml , ViewModelUtils ) {
9
+ function ( accUtils , i18n , ko , project , urlCatalog , viewHelper , wktLogger , ViewModelUtils ) {
10
10
function ModelDesignViewModel ( ) {
11
11
12
12
let subscriptions = [ ] ;
@@ -47,6 +47,7 @@ function(accUtils, i18n, ko, project, urlCatalog, viewHelper, wktLogger, jsYaml,
47
47
if ( this . designer ) {
48
48
viewHelper . componentReady ( this . designer ) . then ( ( ) => {
49
49
this . showWdtModelDesigner ( port , this . designer ) ;
50
+ this . designer . addEventListener ( 'archiveUpdated' , this . archiveUpdated ) ;
50
51
} ) ;
51
52
}
52
53
}
@@ -62,6 +63,7 @@ function(accUtils, i18n, ko, project, urlCatalog, viewHelper, wktLogger, jsYaml,
62
63
if ( this . designer ) {
63
64
wktLogger . debug ( 'disconnected() dataProvider = %s' , JSON . stringify ( this . dataProvider ) ) ;
64
65
this . designer . deactivateProvider ( this . dataProvider ) ;
66
+ this . designer . removeEventListener ( 'archiveUpdated' , this . archiveUpdated ) ;
65
67
}
66
68
67
69
viewHelper . removeEventListenerFromRootElement ( 'searchModel' , this . handleSearchModelEvent ) ;
@@ -127,12 +129,19 @@ function(accUtils, i18n, ko, project, urlCatalog, viewHelper, wktLogger, jsYaml,
127
129
128
130
if ( ! providerOptions . fileContents ) {
129
131
const modelTemplates = this . designer . getProperty ( 'modelTemplate' ) ;
130
- providerOptions . fileContents = modelTemplates . sparse ;
132
+ providerOptions . fileContents = modelTemplates . domain ;
131
133
}
132
134
133
135
// A name is needed to create a WDT Model File provider.
134
136
//
135
137
providerOptions [ 'name' ] = this . project . wdtModel . getDefaultModelFile ( ) ;
138
+
139
+ // Set model properties provider option
140
+ providerOptions [ 'modelProperties' ] = [ ...this . project . wdtModel . getModelPropertiesObject ( ) . observable ( ) ] ;
141
+
142
+ // Set model archive provider option
143
+ providerOptions [ 'modelArchive' ] = this . project . wdtModel . archiveRoots ;
144
+
136
145
return providerOptions ;
137
146
} ;
138
147
@@ -147,8 +156,7 @@ function(accUtils, i18n, ko, project, urlCatalog, viewHelper, wktLogger, jsYaml,
147
156
148
157
const providerOptions = this . getRemoteConsoleProviderOptions ( ) ;
149
158
try {
150
- const data = jsYaml . load ( providerOptions . fileContents ) ;
151
- wdtModelDesigner . createProvider ( providerOptions . name , data ) ;
159
+ wdtModelDesigner . createProvider ( providerOptions ) ;
152
160
} catch ( err ) {
153
161
ViewModelUtils . failureResponseDefaultHandling ( err ) ;
154
162
}
@@ -168,6 +176,20 @@ function(accUtils, i18n, ko, project, urlCatalog, viewHelper, wktLogger, jsYaml,
168
176
wktLogger . debug ( 'Received changesAutoDownloaded event with modelContent = %s' , event . detail . value ) ;
169
177
this . wrcBackendTriggerChange = true ;
170
178
this . project . wdtModel . modelContent ( event . detail . value ) ;
179
+ if ( event . detail . properties ) this . project . wdtModel . getModelPropertiesObject ( ) . observable ( event . detail . properties ) ;
180
+ } ;
181
+
182
+ this . archiveUpdated = ( event ) => {
183
+ const options = event . detail . options ;
184
+ wktLogger . debug ( 'Received archiveUpdated event with options = %s' , JSON . stringify ( event . detail . options ) ) ;
185
+ switch ( options . operation ) {
186
+ case 'add' :
187
+ this . project . wdtModel . addArchiveUpdate ( options . operation , options . archivePath , options . filePath ) ;
188
+ break ;
189
+ case 'remove' :
190
+ this . project . wdtModel . addArchiveUpdate ( options . operation , options . path ) ;
191
+ break ;
192
+ }
171
193
} ;
172
194
173
195
// Triggered when WDT Model File provider has been deactivated with the WRC backend.
0 commit comments