diff --git a/app/components/kommonitorAdmin/adminGeoresourcesManagement/georesourceBatchUpdateModal/georesource-batch-update-modal.component.js b/app/components/kommonitorAdmin/adminGeoresourcesManagement/georesourceBatchUpdateModal/georesource-batch-update-modal.component.js index 14e5bce1b..e75e8523b 100644 --- a/app/components/kommonitorAdmin/adminGeoresourcesManagement/georesourceBatchUpdateModal/georesource-batch-update-modal.component.js +++ b/app/components/kommonitorAdmin/adminGeoresourcesManagement/georesourceBatchUpdateModal/georesource-batch-update-modal.component.js @@ -7,6 +7,9 @@ angular.module('georesourceBatchUpdateModal').component('georesourceBatchUpdateM this.kommonitorImporterHelperServiceInstance = kommonitorImporterHelperService; this.kommonitorBatchUpdateHelperServiceInstance = kommonitorBatchUpdateHelperService; + const supportedDatasourceTypes = ["FILE", "INLINE", "HTTP"]; + const supportedConverters = ["GeoJSON", "Shapefile (ZIP-Ordner mit .shp, .dbf, .prj)", "Tabelle_Geokodierung_Adresse_strukturierte_Einzelspalten", "Tabelle_Geokodierung_Strasse_Hausnummer_Stadt", "Tabelle_Geokodierung_beliebige_Zeichenkette", "Tabelle_XY_Koordinate_zu_Punkt", "WFS_v1"]; + $scope.isFirstStart = true; $scope.lastUpdateResponseObj; $scope.keepMissingValues = true; @@ -62,9 +65,32 @@ angular.module('georesourceBatchUpdateModal').component('georesourceBatchUpdateM } }); + $scope.getSupportedDatasourceTypes = function() { + var result = []; + kommonitorImporterHelperService.availableDatasourceTypes.forEach((dt) => { + if (supportedDatasourceTypes.includes(dt.type)) { + result.push(dt); + } + }); + return result; + } + + $scope.getSupportedConverters = function() { + var result = []; + kommonitorImporterHelperService.availableConverters.forEach((c) => { + if (supportedConverters.includes(c.name)) { + result.push(c); + } + }); + return result; + } + // initializes the modal $scope.initialize = function() { + $scope.availableDatasourceTypes = $scope.getSupportedDatasourceTypes(); + $scope.availableConverters = $scope.getSupportedConverters(); + if($scope.isFirstStart) { kommonitorBatchUpdateHelperService.addNewRowToBatchList("georesource", $scope.batchList) $scope.isFirstStart = false; diff --git a/app/components/kommonitorAdmin/adminGeoresourcesManagement/georesourceBatchUpdateModal/georesource-batch-update-modal.template.html b/app/components/kommonitorAdmin/adminGeoresourcesManagement/georesourceBatchUpdateModal/georesource-batch-update-modal.template.html index a8c9a6711..3d909afa4 100644 --- a/app/components/kommonitorAdmin/adminGeoresourcesManagement/georesourceBatchUpdateModal/georesource-batch-update-modal.template.html +++ b/app/components/kommonitorAdmin/adminGeoresourcesManagement/georesourceBatchUpdateModal/georesource-batch-update-modal.template.html @@ -120,7 +120,7 @@ @@ -233,7 +233,7 @@ diff --git a/app/components/kommonitorAdmin/adminIndicatorsManagement/indicatorBatchUpdateModal/indicator-batch-update-modal.component.js b/app/components/kommonitorAdmin/adminIndicatorsManagement/indicatorBatchUpdateModal/indicator-batch-update-modal.component.js index 3b44ecc25..4966d45af 100644 --- a/app/components/kommonitorAdmin/adminIndicatorsManagement/indicatorBatchUpdateModal/indicator-batch-update-modal.component.js +++ b/app/components/kommonitorAdmin/adminIndicatorsManagement/indicatorBatchUpdateModal/indicator-batch-update-modal.component.js @@ -6,6 +6,9 @@ angular.module('indicatorBatchUpdateModal').component('indicatorBatchUpdateModal this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService; this.kommonitorImporterHelperServiceInstance = kommonitorImporterHelperService; this.kommonitorBatchUpdateHelperServiceInstance = kommonitorBatchUpdateHelperService; + + const supportedDatasourceTypes = ["FILE", "INLINE", "HTTP"]; + const supportedConverters = ["GeoJSON", "Shapefile (ZIP-Ordner mit .shp, .dbf, .prj)", "Tabelle_Zeitreihe_zu_Indikator", "WFS_v1"]; $scope.isFirstStart = true; $scope.lastUpdateResponseObj; @@ -61,9 +64,32 @@ angular.module('indicatorBatchUpdateModal').component('indicatorBatchUpdateModal } }); + $scope.getSupportedDatasourceTypes = function() { + var result = []; + kommonitorImporterHelperService.availableDatasourceTypes.forEach((dt) => { + if (supportedDatasourceTypes.includes(dt.type)) { + result.push(dt); + } + }); + return result; + } + + $scope.getSupportedConverters = function() { + var result = []; + kommonitorImporterHelperService.availableConverters.forEach((c) => { + if (supportedConverters.includes(c.name)) { + result.push(c); + } + }); + return result; + } + // initializes the modal $scope.initialize = function() { + + $scope.availableDatasourceTypes = $scope.getSupportedDatasourceTypes(); + $scope.availableConverters = $scope.getSupportedConverters(); if($scope.isFirstStart) { kommonitorBatchUpdateHelperService.addNewRowToBatchList("indicator", $scope.batchList) diff --git a/app/components/kommonitorAdmin/adminIndicatorsManagement/indicatorBatchUpdateModal/indicator-batch-update-modal.template.html b/app/components/kommonitorAdmin/adminIndicatorsManagement/indicatorBatchUpdateModal/indicator-batch-update-modal.template.html index 861ebf0d5..be36c444f 100644 --- a/app/components/kommonitorAdmin/adminIndicatorsManagement/indicatorBatchUpdateModal/indicator-batch-update-modal.template.html +++ b/app/components/kommonitorAdmin/adminIndicatorsManagement/indicatorBatchUpdateModal/indicator-batch-update-modal.template.html @@ -88,7 +88,7 @@ @@ -152,7 +152,7 @@ diff --git a/app/components/kommonitorAdmin/kommonitor-admin.template.html b/app/components/kommonitorAdmin/kommonitor-admin.template.html index 0c3aa1a2b..0f1c9b5c2 100644 --- a/app/components/kommonitorAdmin/kommonitor-admin.template.html +++ b/app/components/kommonitorAdmin/kommonitor-admin.template.html @@ -273,6 +273,16 @@

Achtung



 	    
+
+    
       
     
   
diff --git a/app/util/genericServices/kommonitorBatchUpdateHelperService/kommonitor-batch-update-helper-service.module.js b/app/util/genericServices/kommonitorBatchUpdateHelperService/kommonitor-batch-update-helper-service.module.js
index 48cbb33fd..587c4135d 100644
--- a/app/util/genericServices/kommonitorBatchUpdateHelperService/kommonitor-batch-update-helper-service.module.js
+++ b/app/util/genericServices/kommonitorBatchUpdateHelperService/kommonitor-batch-update-helper-service.module.js
@@ -9,6 +9,10 @@ angular
 				let thisService = this; // to enable access to service methods from inside other functions (e. g. $timeout) where 'this' references something else
 				let timeseriesMappingReference;
 
+				const unsupportedDatasourceWarningMessage = "Nicht unterstützte Datenquelle: Die in der Mappintabelle angegebene Datenquelle wird für ein Batch-Update noch nicht unterstützt. Bitte geben Sie eine andere Datenquelle an!";
+				const unsupportedConverterWarningMessage = "Nicht unterstützter Converter: Der in der Mappintabelle angegebene Converter wird für ein Batch-Update noch nicht unterstützt. Bitte geben Sie einen anderen Converter an!";
+				const invalidMappingTableErrorMessage = "Die Mappingtabelle konnte nicht gelesen werden oder hat ein fehlerhaftes Format.";
+
 				// Maps the values of the "name" property in the converter's parameter array to the property names used in the batch update
 				// We can't use the parameters array directly because we have to bind angularjs variables to object properties, not array elements
 				// Used in converterParametersArrayToProperties and converterPropertiesToParametersArray 
@@ -596,7 +600,11 @@ angular
 
 					// Remove all properties that are not part of the selected converter.
 					// This is usually needed when the user switches to a different converter.
-					let paramNames = selectedConverter.parameters.map(obj => obj.name);
+					let paramNames = [];
+					if(selectedConverter.parameters) {
+						paramNames = selectedConverter.parameters.map(obj => obj.name);
+					}
+					
 					for(var i=oldConverter.parameters.length-1; i>=0; i--) {
 						if(!paramNames.includes(oldConverter.parameters[i].name)) {
 							oldConverter.parameters.splice(i, 1);
@@ -1057,62 +1065,82 @@ angular
 
 				this.onMappingTableSelected = function(resourceType, event, rowIndex, file, batchList) {
 				
-					let mappingObj = JSON.parse(event.target.result);
+					let mappingObj;
+					try {
+						mappingObj = JSON.parse(event.target.result);			
 
-					batchList[rowIndex].mappingTableName = file.name;
-			
-					mappingObj.converter = this.converterParametersArrayToProperties(mappingObj.converter);
-					mappingObj.dataSource = this.dataSourceParametersArrayToProperty(mappingObj.dataSource);
-				
-					// set value of column "Datensatz-Quellformat*" by converter name
-					let converterName = mappingObj.converter.name
-					for(let i=0; i