Project

General

Profile

« Previous | Next » 

Revision 50485

merged branch dsm into trunk

View differences:

addRepoApi.js
250 250
		
251 251
	$scope.$watch('repo', function() {
252 252
		if ($scope.repo) {
253
			$scope.apiParams = {};
253 254
			$scope.api = {
254
				'typology'     : $scope.repo.typology,
255
				'accessParams' : {},
256
				'extraFields'  : {}
255
				'typology'  : $scope.repo.typology,
256
				'apiParams' : []
257 257
			};
258 258
		}
259 259
	});
......
263 263
		$scope.selectedTypology = '';
264 264
		$scope.repo = {};
265 265
		$scope.api = {};
266
		$scope.apiParams = {};
266 267
		$scope.validValues = [];
267 268
	}
268 269
	
269 270
	$scope.registerApi = function() {
270 271
		if (confirm('Add new api to repository \n\n' + $scope.repo.name + '?')) {
272
			
273
			$scope.api.apiParams = [];
274
			angular.forEach($scope.apiParams, function(value, param) {
275
				$scope.api.apiParams.push({
276
					'param' : param,
277
					'value' : value
278
				});
279
			});
280
						
271 281
			$scope.showSpinner();
272 282
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
273 283
			$http.post('repoApi.new', $.param({
......
297 307
			return;
298 308
		}
299 309
		
300
		if (!$scope.api.accessProtocol) {
310
		if (!$scope.api.protocol) {
301 311
			$scope.showError("Access Protocol is missing");
302 312
			return;	
303 313
		}
304
		if (!$scope.api.baseUrl) {
314
		if (!$scope.api.baseurl) {
305 315
			$scope.showError("BaseUrl is missing");
306 316
			return;
307 317
		}
308 318
		
309
		var key = $scope.api.baseUrl + '@@@' + param;
319
		var key = $scope.api.baseurl + '@@@' + param;
310 320
		$scope.validValues[key] = [];
311 321

  
312 322
		$scope.showSpinner();
313 323
		$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
314 324
		$http.post('listValidValuesForParam.do', $.param({
315
			'protocol' : $scope.api.accessProtocol,
325
			'protocol' : $scope.api.protocol,
316 326
			'param'    : param,
317
			'baseUrl'  : $scope.api.baseUrl,
327
			'baseUrl'  : $scope.api.baseurl,
318 328
		})).success(function(data) {
319 329
			$scope.hideSpinner();
320 330
			$scope.validValues[key] = data;

Also available in: Unified diff