Project

General

Profile

« Previous | Next » 

Revision 58380

remoteMdstore API creation in other infrastructure (partial implementation)

View differences:

repoControllers.js
5 5
	function ($scope, $http, $timeout, $sce, $location) {
6 6
		common_init($scope, $http, $sce, $location);
7 7
		$scope.repoBrowseFields = getBrowseFields();
8
		
8

  
9 9
		$scope.sortType     = 'term';
10 10
		$scope.sortReverse  = false;
11
		
11

  
12 12
		$scope.repoBrowseData = { 'data' : [] };
13
			
13

  
14 14
		$scope.searchApis = function (text) {
15 15
			$scope.go('/list/__SEARCH__/' + text); 
16 16
		} 
17
		
17

  
18 18
		$scope.browseApis = function (field, value) {
19 19
			$('#showRepoBrowseData').modal('hide');
20 20
			$scope.showSpinner();
......
22 22
				$scope.go('/list/' + field + '/' + value);
23 23
			}, 1500);
24 24
		}
25
		
25

  
26 26
		$scope.browseRepoField = function(field) {
27 27
			$scope.repoBrowseData = {
28
				'label' : field.label,
29
				'id' :    field.id,
30
				'data'  : []
28
					'label' : field.label,
29
					'id' :    field.id,
30
					'data'  : []
31 31
			};
32 32
			$scope.showSpinner();
33
	      	$http.get('browseRepoField.do?field=' + field.id).success(
34
	            function(data) {
35
	            	$scope.hideSpinner();
36
	            	$scope.repoBrowseData.data = data;
37
	            	$('#showRepoBrowseData').modal('show');
38
	            }
39
	        ).error(
40
	            function() {
41
	            	$scope.showError('Something really bad must have happened to our fellow hamster..');
42
	            	$scope.hideSpinner();
43
	            }
44
	        );
33
			$http.get('browseRepoField.do?field=' + field.id).success(
34
					function(data) {
35
						$scope.hideSpinner();
36
						$scope.repoBrowseData.data = data;
37
						$('#showRepoBrowseData').modal('show');
38
					}
39
			).error(
40
					function() {
41
						$scope.showError('Something really bad must have happened to our fellow hamster..');
42
						$scope.hideSpinner();
43
					}
44
			);
45 45
		};
46 46
	}
47
]);
47
	]);
48 48

  
49 49
repoControllers.controller('repoListCtrl', [
50 50
	'$scope', '$http', '$timeout', '$sce', '$routeParams', '$location',
......
54 54
		$scope.sortType     = 'repoName';
55 55
		$scope.sortReverse  = false;
56 56
		$scope.apis = [];		
57
    	$scope.currentApiSelectionParam = $routeParams.param;
58
    	$scope.currentApiSelectionValue = $routeParams.value;
59
    	
60
    	$scope.updateApis = function(refresh) {
57
		$scope.currentApiSelectionParam = $routeParams.param;
58
		$scope.currentApiSelectionValue = $routeParams.value;
59

  
60
		$scope.updateApis = function(refresh) {
61 61
			$scope.showSpinner();
62
						    
62

  
63 63
			var params = {
64
				'param' : $scope.currentApiSelectionParam,
65
				'value' : $scope.currentApiSelectionValue
64
					'param' : $scope.currentApiSelectionParam,
65
					'value' : $scope.currentApiSelectionValue
66 66
			};
67 67
			if (refresh) {
68 68
				params.refresh = 1;
......
70 70

  
71 71
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
72 72
			$http.post('listApis.do', $.param(params)).success(
73
	            function(data) {
74
	            	$scope.hideSpinner();
75
	            	$scope.apis = data;
76
	            }
77
	        ).error(
78
	            function() {
79
	            	$scope.showError('Something really bad must have happened to our fellow hamster..');
80
	            	$scope.hideSpinner();
81
	            }
82
	        );
83
    	};
84
        	
85
    	$scope.updateApis(false);
73
					function(data) {
74
						$scope.hideSpinner();
75
						$scope.apis = data;
76
					}
77
			).error(
78
					function() {
79
						$scope.showError('Something really bad must have happened to our fellow hamster..');
80
						$scope.hideSpinner();
81
					}
82
			);
83
		};
84

  
85
		$scope.updateApis(false);
86 86
	}
87
]);
87
	]);
88 88

  
89 89
repoControllers.controller('repoApiCtrl', [
90 90
	'$scope', '$http', '$timeout', '$sce', '$routeParams', '$location',
91 91
	function ($scope, $http, $timeout, $sce, $routeParams, $location) {
92 92
		common_init($scope, $http, $sce, $location);
93
		
93

  
94 94
		commonInitialize($scope, $http, $sce);
95 95
		wf_init($scope, $http, $sce);
96
		
96

  
97 97
		$scope.availableRepohiWfs = getAvailableRepohiWfs();
98 98
		$scope.compatibilityLevels = getCompatibilityLevels();
99
		
99

  
100 100
		$scope.validatorBlacklistAddress = '';
101 101
		$scope.validatorBlacklistAddress = '';
102
    			
102

  
103 103
		$scope.currentRepoApi = {};
104 104
		$scope.currentSets = [];
105 105
		$scope.selectedSets = [];
106
		
107
		$scope.newSyncApi = {};
108
    	
109
    	$scope.loadApi = function() {
110
    		$scope.showSpinner();
111
    		$(".btnRefreshApi").attr("disabled", "disabled");
112
    		$http.get('repoApi.get?repoId=' + $routeParams.repoId + "&ifaceId=" +  $routeParams.ifaceId)
113
            .success(
114
                function(data) {
115
                	$scope.currentRepoApi = data;
116
                	$scope.metaworkflows = data.metaWFs;
117 106

  
118
                	angular.forEach(data.otherParams, function(term){
119
                		if (term.id == 'last_validation_job') {
120
                			if (getValidatorAddress()) {
121
                				$scope.validatorDetailsAddress = getValidatorAddress() + "/" + term.value;
122
                			}
123
                			if (getValidatorServiceAddress()) {
124
                				$scope.validatorBlacklistAddress = getValidatorServiceAddress() + "/workflows?request=GetBlacklistedRecords&datasourceId=" + $routeParams.repoId;
125
                			}
126
                		}                                       
127
                	});
128
                	
129
                	if (data.protocol == 'oai') {
130
    	            	var found = false;
131
    	            	angular.forEach(data.accessParams, function(param, pos){
132
    	                    if (param.name == 'set') {
133
    	                    	$scope.listSets($scope.currentRepoApi.accessParams);
134
    	                    }
135
    	        		});
136
                	}
137
                	$scope.hideSpinner(); 
138
                	            	
139
                	$(".btnRefreshApi").removeAttr("disabled");
140
                	
141
                	if ($routeParams.metawf != 'ALL' && $routeParams.wf != 'ALL') {
142
                		$scope.getAtomicWorkflowAndMetaWf($routeParams.metawf, $routeParams.wf);
143
                		$timeout(function() {
144
                			$("#collapse_" + $routeParams.metawf.substring(0, 36)).collapse('show');
145
                		}, 2000);
146
                	}
147
                }
148
            ).error(
149
                function() {
150
                	$scope.showError('Something really bad must have happened to our fellow hamster..');
151
                	$scope.hideSpinner();
152
                }
153
            );
154
    	};
155
    	
156
    	
157
    	$scope.removeApi = function() {
158
    		if (confirm("You are deleting the current API.\n\nAre you sure?")) {
159
	    		$scope.showSpinner();
160
	    		$http.get('repoApi.delete?repo=' + $routeParams.repoId + "&iface=" +  $routeParams.ifaceId).success(function(data) {
161
	    			alert("The API has been deleted !!!");
162
	    			$scope.hideSpinner();
163
	    			$scope.go("/browse");
164
	    		}).error(function(err) {
165
	    			$scope.showError('Error removing API: '  + err.message);
166
	    			$scope.hideSpinner();
167
	    		});
168
    		}
169
    	};
170
   	
171
    	
107
		$scope.syncApi = {};
108

  
109
		$scope.loadApi = function() {
110
			$scope.showSpinner();
111
			$(".btnRefreshApi").attr("disabled", "disabled");
112
			$http.get('repoApi.get?repoId=' + $routeParams.repoId + "&ifaceId=" +  $routeParams.ifaceId)
113
			.success(
114
					function(data) {
115
						$scope.currentRepoApi = data;
116
						$scope.metaworkflows = data.metaWFs;
117

  
118
						angular.forEach(data.otherParams, function(term){
119
							if (term.id == 'last_validation_job') {
120
								if (getValidatorAddress()) {
121
									$scope.validatorDetailsAddress = getValidatorAddress() + "/" + term.value;
122
								}
123
								if (getValidatorServiceAddress()) {
124
									$scope.validatorBlacklistAddress = getValidatorServiceAddress() + "/workflows?request=GetBlacklistedRecords&datasourceId=" + $routeParams.repoId;
125
								}
126
							}                                       
127
						});
128

  
129
						if (data.protocol == 'oai') {
130
							var found = false;
131
							angular.forEach(data.accessParams, function(param, pos){
132
								if (param.name == 'set') {
133
									$scope.listSets($scope.currentRepoApi.accessParams);
134
								}
135
							});
136
						}
137
						$scope.hideSpinner(); 
138

  
139
						$(".btnRefreshApi").removeAttr("disabled");
140

  
141
						if ($routeParams.metawf != 'ALL' && $routeParams.wf != 'ALL') {
142
							$scope.getAtomicWorkflowAndMetaWf($routeParams.metawf, $routeParams.wf);
143
							$timeout(function() {
144
								$("#collapse_" + $routeParams.metawf.substring(0, 36)).collapse('show');
145
							}, 2000);
146
						}
147
					}
148
			).error(
149
					function() {
150
						$scope.showError('Something really bad must have happened to our fellow hamster..');
151
						$scope.hideSpinner();
152
					}
153
			);
154
		};
155

  
156

  
157
		$scope.removeApi = function() {
158
			if (confirm("You are deleting the current API.\n\nAre you sure?")) {
159
				$scope.showSpinner();
160
				$http.get('repoApi.delete?repo=' + $routeParams.repoId + "&iface=" +  $routeParams.ifaceId).success(function(data) {
161
					alert("The API has been deleted !!!");
162
					$scope.hideSpinner();
163
					$scope.go("/browse");
164
				}).error(function(err) {
165
					$scope.showError('Error removing API: '  + err.message);
166
					$scope.hideSpinner();
167
				});
168
			}
169
		};
170

  
171

  
172 172
		$scope.newDataProviderWorkflow = function (wf) {
173
			
173

  
174 174
			if (wf == undefined) {
175 175
				$scope.showError('Please choose a workflow !');
176
	    		return;
176
				return;
177 177
			}
178
			
178

  
179 179
			$scope.showSpinner();
180
	
180

  
181 181
			$scope.metaworkflows.push({"id":"","name":"Waiting...","status":"MISSING","progress":0});
182
	    				
182

  
183 183
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
184 184
			$http.post('repoMetaWf.new', $.param({
185 185
				'wf'    : wf,
......
187 187
				'id'    : $scope.currentRepoApi.repoId, 
188 188
				'name'  : $scope.currentRepoApi.repoName
189 189
			})).success(
190
	       			function(data) {
191
	       				$scope.hideSpinner();
192
	       				$(".btnRefreshApi").attr("disabled", "disabled");
193
	       				$timeout(function () { $scope.loadApi() }, 7000);
194
		            }
195
	       	).error(
196
	       			function() {
197
	       				$scope.showError('Something really bad must have happened to our fellow hamster..');
198
	       				$scope.hideSpinner();
199
		           }
200
	       	);
190
					function(data) {
191
						$scope.hideSpinner();
192
						$(".btnRefreshApi").attr("disabled", "disabled");
193
						$timeout(function () { $scope.loadApi() }, 7000);
194
					}
195
			).error(
196
					function() {
197
						$scope.showError('Something really bad must have happened to our fellow hamster..');
198
						$scope.hideSpinner();
199
					}
200
			);
201 201
		};
202
		
202

  
203 203
		$scope.destroyDataProviderWorkflow = function (metaWf) {
204
			
204

  
205 205
			if (metaWf.destroyWorkflow == undefined) {
206 206
				$scope.showError('Destroy wf is missing !');
207
	    		return;
207
				return;
208 208
			}
209
			
209

  
210 210
			if (!confirm("Are you sure ?")) {
211 211
				return;
212 212
			}
213
					
213

  
214 214
			$scope.showSpinner();
215
			
215

  
216 216
			metaWf.deleting = true;
217
			
217

  
218 218
			$http.get('repoMetaWf.destroy?destroyWf=' + metaWf.destroyWorkflow)
219
	       	.success(
220
	       			function(data) {
221
	       				$scope.hideSpinner();
222
	       				$(".btnRefreshApi").attr("disabled", "disabled");
223
	       				$timeout(function () { $scope.loadApi() }, 7000);
224
		            }
225
	       	).error(
226
	       			function() {
227
	       				$scope.showError('Something really bad must have happened to our fellow hamster..');
228
	       				$scope.hideSpinner();
229
		           }
230
	       	);
219
			.success(
220
					function(data) {
221
						$scope.hideSpinner();
222
						$(".btnRefreshApi").attr("disabled", "disabled");
223
						$timeout(function () { $scope.loadApi() }, 7000);
224
					}
225
			).error(
226
					function() {
227
						$scope.showError('Something really bad must have happened to our fellow hamster..');
228
						$scope.hideSpinner();
229
					}
230
			);
231 231
		};
232
		
232

  
233 233
		$scope.testOAI = function (params) {
234 234
			angular.forEach(params, function(param, pos){
235
	            if (param.name == 'baseUrl') {
236
	            	location.href = "oaiExplorer.do?oaiBaseUrl=" + param.value;
237
	            }
235
				if (param.name == 'baseUrl') {
236
					location.href = "oaiExplorer.do?oaiBaseUrl=" + param.value;
237
				}
238 238
			});
239 239
		}
240
	
240

  
241 241
		$scope.prepareUpdateRepoApi = function() {
242 242
			$scope.tempAccessParams = angular.copy($scope.currentRepoApi.accessParams); 
243 243

  
244 244
			$scope.tempMdIdPath = '';
245 245
			angular.forEach($scope.currentRepoApi.otherParams, function(param, pos){
246
	            if (param.name == 'metadata_identifier_path') {
247
	            	$scope.tempMdIdPath = param.value;
248
	            }
246
				if (param.name == 'metadata_identifier_path') {
247
					$scope.tempMdIdPath = param.value;
248
				}
249 249
			});
250 250
		}
251
		
252
		
251

  
252

  
253 253
		$scope.updateRepoApi = function() {
254 254
			$scope.showSpinner();
255
	
255

  
256 256
			var map = {};
257 257
			angular.forEach($scope.tempAccessParams, function(param, pos){
258
	            if (param.name) {
259
	            	map[param.name] = param.value
260
	            }
258
				if (param.name) {
259
					map[param.name] = param.value
260
				}
261 261
			});
262
			
262

  
263 263
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
264
	        $http.post('repoApi.update', $.param({
265
	      		'id'           : $scope.currentRepoApi.repoId,
266
	      		'iface'        : $scope.currentRepoApi.id,
267
	      		'mdIdPath'     : $scope.tempMdIdPath,
268
	      		'accessParams' : JSON.stringify(map)
269
	      	})).success(function(data) {
270
	      		$scope.showNotification('Api correctly saved !');
271
	        	$scope.loadApi(); 
272
	        }).error(function(err) {
273
	        	$scope.hideSpinner();
274
	        	$scope.showError('Error updating api: ' + err.message);
275
	        });
264
			$http.post('repoApi.update', $.param({
265
				'id'           : $scope.currentRepoApi.repoId,
266
				'iface'        : $scope.currentRepoApi.id,
267
				'mdIdPath'     : $scope.tempMdIdPath,
268
				'accessParams' : JSON.stringify(map)
269
			})).success(function(data) {
270
				$scope.showNotification('Api correctly saved !');
271
				$scope.loadApi(); 
272
			}).error(function(err) {
273
				$scope.hideSpinner();
274
				$scope.showError('Error updating api: ' + err.message);
275
			});
276 276
		};
277
		
278
		
277

  
278

  
279 279
		$scope.updateSets = function(selection, accessParams) {
280 280
			var s = selection.join();
281 281
			angular.forEach(accessParams, function(param, pos){
282
	            if (param.name == 'set') {
283
	            	param.value = s;
284
	            }
282
				if (param.name == 'set') {
283
					param.value = s;
284
				}
285 285
			});
286 286
		}
287
		
287

  
288 288
		$scope.listSets = function(accessParams) {
289 289
			var baseUrl = '';
290
			
290

  
291 291
			$scope.selectedSets = [];
292 292
			$scope.currentSets = [];
293
			
293

  
294 294
			angular.forEach(accessParams, function(param, pos){
295
	            if (param.name == 'baseUrl') {
296
	            	baseUrl = param.value
297
	            }
298
	            if (param.name == 'set') {
299
	            	$scope.selectedSets = param.value.split(",");
300
	            }
295
				if (param.name == 'baseUrl') {
296
					baseUrl = param.value
297
				}
298
				if (param.name == 'set') {
299
					$scope.selectedSets = param.value.split(",");
300
				}
301 301
			});
302
			
302

  
303 303
			if (!baseUrl) {
304 304
				$scope.showError("baseUrl param is missing");
305 305
				return;
......
307 307

  
308 308
			$scope.showSpinner();
309 309
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
310
	        $http.post("listValidValuesForParam.do", $.param({
311
	        	'protocol' : 'oai',
312
	        	'param'    : 'set',
313
	        	'baseUrl'  : baseUrl
314
	        })).success(function(data) {
310
			$http.post("listValidValuesForParam.do", $.param({
311
				'protocol' : 'oai',
312
				'param'    : 'set',
313
				'baseUrl'  : baseUrl
314
			})).success(function(data) {
315 315
				$scope.hideSpinner();
316
	        	$scope.currentSets = data;
317
	        	angular.forEach($scope.currentSets, function(curr, pos1) {
318
		        	angular.forEach($scope.selectedSets, function(sel, pos2) {
319
		        		if (curr.id.trim() == sel.trim()) {
320
		        			curr.selected = true;
321
		        		}
322
		        	});
316
				$scope.currentSets = data;
317
				angular.forEach($scope.currentSets, function(curr, pos1) {
318
					angular.forEach($scope.selectedSets, function(sel, pos2) {
319
						if (curr.id.trim() == sel.trim()) {
320
							curr.selected = true;
321
						}
322
					});
323 323
				});
324
	        }).error(function(err) {
324
			}).error(function(err) {
325 325
				$scope.hideSpinner();
326 326
				$scope.showError(err.message);
327 327
			});
328
	        
328

  
329 329
		};
330
		
331
		
330

  
331

  
332 332
		$scope.verifyMetaWf = function(ds, wf) {
333 333
			var compliance = '';
334 334
			var type = '';
335 335
			angular.forEach(ds.commonParams, function(p,pos) {
336
	        	if (p.id == 'compliance') {
337
	        		compliance = p.value;
338
	        	}
339
	        	if (p.id == 'typology') {
340
	        		type = p.value;
341
	        	}
336
				if (p.id == 'compliance') {
337
					compliance = p.value;
338
				}
339
				if (p.id == 'typology') {
340
					type = p.value;
341
				}
342 342
			});
343
			
343

  
344 344
			return (compliance && type && $scope.isValidTerm(compliance, wf.compliances) && $scope.isValidTerm(type, wf.ifaceTypes)); 
345 345
		}
346 346

  
347 347
		$scope.isValidTerm = function(term, list) {
348
			
348

  
349 349
			if (list.length == 0) {
350 350
				return true;
351 351
			}
352 352
			var res = false;
353 353
			angular.forEach(list, function(curr,pos) {
354
	        	if (term.lastIndexOf(curr, 0) === 0) { // implementation of term.startsWith(curr)
355
	        		res = true;
356
	        	}
354
				if (term.lastIndexOf(curr, 0) === 0) { // implementation of term.startsWith(curr)
355
					res = true;
356
				}
357 357
			});
358 358
			return res;
359 359
		}
......
361 361
		$scope.overrideApiCompliance = function(level) {
362 362
			$scope.showSpinner();
363 363
			$http.get('repoApiCompliance.update?id=' + $scope.currentRepoApi.repoId + '&iface=' + $scope.currentRepoApi.id + '&compliance=' + level)
364
	        .success(
365
	        		function(data) {
366
	        			$scope.hideSpinner();
367
	        			$scope.showNotification('Api correctly updated !');
368
	        			$scope.loadApi(); 
369
	        		}
370
	        ).error(
371
	        		function() {
372
	        			$scope.showError('Something really bad must have happened to our fellow hamster..');
373
	        			$scope.hideSpinner();
374
	        		}
375
	        );
364
			.success(
365
					function(data) {
366
						$scope.hideSpinner();
367
						$scope.showNotification('Api correctly updated !');
368
						$scope.loadApi(); 
369
					}
370
			).error(
371
					function() {
372
						$scope.showError('Something really bad must have happened to our fellow hamster..');
373
						$scope.hideSpinner();
374
					}
375
			);
376 376
		}
377
		
377

  
378 378
		$scope.resetApiCompliance = function() {
379 379
			$scope.showSpinner();
380 380
			$http.get('repoApiCompliance.reset?id=' + $scope.currentRepoApi.repoId + '&iface=' + $scope.currentRepoApi.id)
381
	        .success(
382
	        		function(data) {
383
	        			$scope.hideSpinner();
384
	        			$scope.showNotification('Api correctly updated !');
385
	        			$scope.loadApi(); 
386
	        		}
387
	        ).error(
388
	        		function() {
389
	        			$scope.showError('Something really bad must have happened to our fellow hamster..');
390
	        			$scope.hideSpinner();
391
	        		}
392
	        );
381
			.success(
382
					function(data) {
383
						$scope.hideSpinner();
384
						$scope.showNotification('Api correctly updated !');
385
						$scope.loadApi(); 
386
					}
387
			).error(
388
					function() {
389
						$scope.showError('Something really bad must have happened to our fellow hamster..');
390
						$scope.hideSpinner();
391
					}
392
			);
393 393
		}
394
		
394

  
395 395
		$scope.showCreateRemoteSyncApi = function(mongoUrl, mongoDB, mdId, apiSuffix) {
396
			
396

  
397 397
			var path = "//*[local-name()='header']/*[local-name()='identifier']";
398 398
			angular.forEach($scope.currentRepoApi.otherParams, function(p) {
399 399
				if (p.id=='metadata_identifier_path') {
400 400
					path = p.value;
401 401
				}
402 402
			});
403
			
403

  
404 404
			var compliance = "UNKNOWN";
405 405
			angular.forEach($scope.currentRepoApi.commonParams, function(p) {
406 406
				if (p.id=='compliance') {
......
408 408
				}
409 409
			});
410 410
			
411
			$scope.newSyncApi = {
412
				'dsId'  : $routeParams.repoId,
413
				'apiId' : 'api_________::' + $routeParams.repoId + "::" + apiSuffix,
414
				'compatibility' : compliance,
415
				'contentdescription' : 'metadata',
416
				'protocol' : 'remoteMdstore',
417
				'baseurl'  : mongoUrl,
418
				'apiParams' : {
419
					'remote_database'   : mongoDB,
420
					'remote_mdstore_id' : mdId
421
				},
422
				'metadataIdentifierPath' : path
423
			};
411
			var typology = "UNKNOWN";
412
			angular.forEach($scope.currentRepoApi.commonParams, function(p) {
413
				if (p.id=='typology') {
414
					typology = p.value;
415
				}
416
			});
417

  
418
			$scope.showSpinner();
419
			$http.get('remoteDatasource/apis?repo=' + $routeParams.repoId)
420
			.success(
421
					function(data) {
422
						$scope.hideSpinner();
423

  
424
						var alreadyPresent = false;
425
						var apiId = 'api_________::' + $routeParams.repoId + "::" + apiSuffix;
426

  
427
						if(data.api) {
428
							angular.forEach(data.api, function(api) {
429
								if (api.id == apiId) {
430
									alreadyPresent = true;
431
									$scope.syncApi = api;
432
								}
433
							});
434
						}
435

  
436
						if (alreadyPresent) {
437
							$('#showRemoteSyncApiModal').modal('show');
438
						} else {
439
							$scope.syncApi = {
440
									"datasource": $routeParams.repoId,
441
									"id": apiId,
442
									"protocol": "remoteMdstore",
443
									"contentdescription": "metadata",
444
									"typology": typology,
445
									"compatibility": compliance,
446
									"baseurl": mongoUrl,
447
									"removable": true,
448
									"apiParams": [
449
										{
450
											"param": "remote_database",
451
											"value": mongoDB
452
										},
453
										{
454
											"param": "remote_mdstore_id",
455
											"value": mdId
456
										}
457
									],
458
									"otherParams": [
459
										{
460
											"param": "metadata_identifier_path",
461
											"value": path
462
										}
463
									]
464
							};
465
							$('#newRemoteSyncApiModal').modal('show');	        				
466
						}
467
					}
468
			).error(
469
					function() {
470
						$scope.showError('Something really bad must have happened to our fellow hamster..');
471
						$scope.hideSpinner();
472
					}
473
			);
474

  
475
		}
476
		
477
		$scope.createRemoteSyncApi = function(api) {
478
			$scope.showSpinner();
424 479
			
425
			$('#remoteSyncApiModal').modal('show');
426
			
480
			$http.defaults.headers.post["Content-Type"] = "application/json;charset=UTF-8";
481
			$http.post('remoteDatasource/api', api).success(function(data) {
482
				$scope.hideSpinner();
483

  
484
			}).error(function() {
485
				$scope.showError('Something really bad must have happened to our fellow hamster..');
486
				$scope.hideSpinner();
487
			});
427 488
		}
428
				
429
    	$scope.loadApi();
489

  
490
		$scope.loadApi();
430 491
	}
431
		
432
 ]);
433 492

  
493
	]);
494

  

Also available in: Unified diff