Commit 34789a0eea5e0d48bce0024c6f8e4b2107aa6392

Authored by Renato De Donato
1 parent f492146f

jsdatachecker ln, new interface 1

Showing 29 changed files with 2052 additions and 2564 deletions
alasql-utility/alasql-utility.js
... ... @@ -125,7 +125,8 @@ function _addParenthesis (fields) {
125 125 }
126 126  
127 127 function _normalizeField (field) {
128   - return "[" + field + "]";
  128 + return "`" + field + "`";
  129 + //return "[" + field + "]";
129 130 }
130 131  
131 132 function alasql_transformData (data, fields, round) {
... ...
bower_components/jsdatachecker/.bower.json
1 1 {
2   - "name": "JSDataChecker",
3   - "version": "0.0.9",
4   - "homepage": "https://github.com/donpir/JSDataChecker",
  2 + "name": "jsdatachecker",
  3 + "version": "0.1.2",
  4 + "homepage": "https://github.com/donpir/jsdatachecker",
5 5 "authors": [
6 6 "'Donato Pirozzi <'donatopirozzi@gmail.com'>"
7 7 ],
... ... @@ -19,17 +19,17 @@
19 19 "polymer": "Polymer/polymer#1.2.0",
20 20 "qunit": "~1.22.0",
21 21 "csvjson": "0.1.1",
22   - "polywc": "https://github.com/donpir/polywc.git#master"
  22 + "polywc-data-table": "https://github.com/donpir/polywc-data-table.git#master"
23 23 },
24 24 "private": false,
25   - "_release": "0.0.9",
  25 + "_release": "0.1.2",
26 26 "_resolution": {
27 27 "type": "version",
28   - "tag": "v0.0.9",
29   - "commit": "277c51efeee4daa0bd11051de022975ba86f47fa"
  28 + "tag": "v0.1.2",
  29 + "commit": "1cd37fc00315232a97de7978e5423784899eca29"
30 30 },
31 31 "_source": "https://github.com/donpir/JSDataChecker.git",
32   - "_target": "~0.0.9",
  32 + "_target": "~0.1.2",
33 33 "_originalSource": "jsdatachecker",
34 34 "_direct": true
35 35 }
36 36 \ No newline at end of file
... ...
bower_components/jsdatachecker/README.md
... ... @@ -3,6 +3,18 @@ JavaScript Library to read dataset content (e.g., Open Data), infer data types,
3 3  
4 4 In details, it analysis the json (specified paths) to infer the data type. In addition, when request (via code) the library converts the json data based on the inferred type.
5 5  
  6 +Recognised basic types:
  7 + - Text;
  8 + - Number;
  9 + - Date;
  10 + - Object;
  11 + - Null.
  12 +
  13 +Recognised types:
  14 + - Geographic coordinates;
  15 + - JSON;
  16 + - GEOJSON.
  17 +
6 18 ## Documentation
7 19  
8 20 See wiki pages [here](https://github.com/donpir/JSDataChecker/wiki).
... ...
bower_components/jsdatachecker/bower.json
1 1 {
2   - "name": "JSDataChecker",
3   - "version": "v0.0.9",
4   - "homepage": "https://github.com/donpir/JSDataChecker",
  2 + "name": "jsdatachecker",
  3 + "version": "v0.1.2",
  4 + "homepage": "https://github.com/donpir/jsdatachecker",
5 5 "authors": [
6 6 "'Donato Pirozzi <'donatopirozzi@gmail.com'>"
7 7 ],
... ... @@ -19,7 +19,7 @@
19 19 "polymer": "Polymer/polymer#1.2.0",
20 20 "qunit": "~1.22.0",
21 21 "csvjson": "0.1.1",
22   - "polywc": "https://github.com/donpir/polywc.git#master"
  22 + "polywc-data-table": "https://github.com/donpir/polywc-data-table.git#master"
23 23 },
24 24 "private": false
25 25 }
... ...
bower_components/jsdatachecker/build.cmd
1 1 del jsdatachecker.min.js
2   -uglifyjs src\ArrayUtils.js src\DataTypeConverter.js src\DataTypesUtils.js src\DataTypeHierarchy.js --compress -o jsdatachecker.min.js
3 2 \ No newline at end of file
  3 +uglifyjs src\ArrayUtils.js src\DataTypeConverter.js src\DataTypesUtils.js src\DataTypeHierarchy.js src\langs.js --compress -o jsdatachecker.min.js
4 4 \ No newline at end of file
... ...
bower_components/jsdatachecker/jsdatachecker.min.js
1   -function ArrayUtils(){}function DataTypeConverter(){this._fields=[],this._numOfRows=0}function DataTypesUtils(){}function DataTypeHierarchy(){}ArrayUtils.TestAndSet=function(arr,key,object){return"undefined"==typeof arr?null:0==Array.isArray(arr)?null:("undefined"==typeof arr[key]&&(arr[key]=object),arr[key])},ArrayUtils.TestAndInitializeKey=function(obj,key,value){return"undefined"==typeof obj?null:("undefined"==typeof obj[key]&&(obj[key]=value),obj[key])},ArrayUtils.TestAndIncrement=function(arr,key){var exists=arr[key];return"undefined"==typeof exists&&(arr[key]=0),arr[key]++,arr},ArrayUtils.toFieldsArray=function(obj){var fields=[];return ArrayUtils.IteratorOverKeys(obj,function(field,key){field.key=key,fields.push(field)}),fields},ArrayUtils.IteratorOverKeys=function(arr,callback){for(var property in arr)if(arr.hasOwnProperty(property)){var item=arr[property];callback(item,property)}},ArrayUtils.FindMinMax=function(arr,fncompare){var max1=null,max2=null;for(var key in arr)null==max1||fncompare(arr[key],max1.value)?(max2=max1,max1={index:-1,key:key,value:arr[key]}):(null==max2||fncompare(arr[key],max2.value))&&(max2={index:-1,key:key,value:arr[key]});return{first:max1,second:max2}},ArrayUtils.isArray=function(arr){return Array.isArray(arr)?arr.length>0:!1},DataTypeConverter.TYPES={TEXT:{value:0,name:"TEXT"},CODE:{value:1,name:"CODE"},NUMBER:{value:2,name:"NUMBER"},OBJECT:{value:3,name:"OBJECT"},BOOL:{value:5,name:"BOOL"},CONST:{value:6,name:"CONST"},CATEGORY:{value:7,name:"CATEGORY"},DATETIME:{value:8,name:"DATETIME"},EMPTY:{value:101,name:"NULL"}},DataTypeConverter.SUBTYPES={GEOCOORDINATE:{value:1e3,name:"GEOCOORDINATE"},PERCENTAGE:{value:1e3,name:"PERCENTAGE"},LATITUDE:{value:1001,name:"LATITUDE"},LONGITUDE:{value:1002,name:"LONGITUDE"}},DataTypeConverter.prototype=function(){var _analyseDataTypes=function(fields){ArrayUtils.IteratorOverKeys(fields,function(field){if(field._inferredTypes[DataTypeConverter.TYPES.CODE.name]){var confidence=field._inferredTypes[DataTypeConverter.TYPES.CODE.name]/field.numOfItems,_numericalInferredType=field._inferredTypes[DataTypeConverter.TYPES.NUMBER.name];return"undefined"!=typeof _numericalInferredType&&(confidence+=_numericalInferredType/field.numOfItems),field.type=DataTypeConverter.TYPES.CODE.name,void(field.typeConfidence=confidence)}var max=ArrayUtils.FindMinMax(field._inferredTypes,function(curval,lastval){return curval>lastval}),tkey=max.first.key;tkey===DataTypeConverter.TYPES.EMPTY.name&&null!=max.second&&"undefined"!=typeof max.second&&(tkey=max.second.key),field.type=tkey,field.typeConfidence=field._inferredTypes[max.first.key]/field.numOfItems;var max=ArrayUtils.FindMinMax(field._inferredSubTypes,function(curval,lastval){return curval>lastval});if(field.subtype=null,null!=max&&null!=max.first){field.subtype=max.first.key,field.subtypeConfidence=field._inferredSubTypes[field.subtype]/field.numOfItems;var fieldName=field.name.toLowerCase(),isLatType=field.subtype===DataTypeConverter.SUBTYPES.LATITUDE.name,fieldNameContainsLat=fieldName.indexOf("lat")>=0,fieldNameContainsLon=fieldName.indexOf("ng")>=0;1==isLatType&&0==fieldNameContainsLat&&1==fieldNameContainsLon&&(field.subtype=DataTypeConverter.SUBTYPES.LONGITUDE.name)}})},_processInferType=function(value){if(null===value||"undefined"==typeof value)return DataTypeConverter.TYPES.EMPTY;if("object"==typeof value)return DataTypeConverter.TYPES.OBJECT;if(/^0[0-9]+$/.test(value))return DataTypeConverter.TYPES.CODE;var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return DataTypeConverter.TYPES.NUMBER;var _date=DataTypesUtils.FilterDateTime(value);return 0==isNaN(_date)&&null!=_date?DataTypeConverter.TYPES.DATETIME:DataTypeConverter.TYPES.TEXT},_processInferSubType=function(value){if(null===value||"undefined"==typeof value)return null;var isnumber=DataTypesUtils.FilterFloat(value);return isNaN(isnumber)!==!0?isnumber>=-90&&90>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:isnumber>=-180&&180>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:null:null},_filterBasedOnThreshold=function(metadata,threshold){return ArrayUtils.IteratorOverKeys(metadata.types,function(fieldType,key){if(!(fieldType.typeConfidence>=threshold)){var arrHierarchyTypes=DataTypeHierarchy.HIERARCHY[fieldType.type],lastFieldType={lastType:arrHierarchyTypes[0],lastTypeCounter:fieldType._inferredTypes[arrHierarchyTypes[0]],typeConfidence:0};lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems;for(var curType,i=1;i<arrHierarchyTypes.length,curType=arrHierarchyTypes[i];i++){var numItemsOfCurType=fieldType._inferredTypes.hasOwnProperty(curType)?fieldType._inferredTypes[curType]:0;if(lastFieldType.lastType=curType,lastFieldType.lastTypeCounter+=numItemsOfCurType,lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems,lastFieldType.typeConfidence>=threshold){fieldType.type=lastFieldType.lastType,fieldType.typeConfidence=lastFieldType.typeConfidence;break}}}}),metadata},jsonTraverse=function(json,fieldKeys,callback){var stack=[],numOfRows=0;for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"!=fieldKey||1!=ArrayUtils.isArray(item)){var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j<jsonSubtree.length;j++){var jsonItem=jsonSubtree[j];stack.push({item:jsonItem,fieldKeyIndex:fieldKeyIndex+1})}else stack.push({item:jsonSubtree,fieldKeyIndex:fieldKeyIndex+1})}else for(var cell,j=0;j<item.length&&(cell=item[j]);j++)stack.push({item:cell,fieldKeyIndex:fieldKeyIndex}),numOfRows++;else{var sProcessedKeys=fieldKeys.slice(0,fieldKeyIndex).toString();ArrayUtils.IteratorOverKeys(item,function(value,key){var curKey=sProcessedKeys+(sProcessedKeys.length>0?",":"")+key,_value=callback(value,key,curKey,numOfRows);item[key]=_value}),numOfRows++}}};return{constructor:DataTypeConverter,cast:function(metadata,options){return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),this.convert(metadata,options)},convert:function(metadata,options){var lastRowIndex=0,numOfRows=0,numOfValues=0,datasetErrors=0,datasetMissingValues=0;return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),jsonTraverse(metadata.dataset,metadata.fieldKeys,function(value,key,traversedKeys,rowIndex){var inferredType=metadata.types[traversedKeys];numOfValues++,lastRowIndex!=rowIndex&&(lastRowIndex=rowIndex,numOfRows++),null==value||"undefined"==typeof value||0==(value+"").length;var isCast=inferredType.typeConfidence>=options.castThresholdConfidence;if(inferredType.type==DataTypeConverter.TYPES.NUMBER.name&&isCast){var number=parseFloat(value);return isNaN(number)?(datasetErrors++,value):number}return value}),metadata.qualityIndex.notNullValues=(numOfValues-datasetMissingValues)/numOfValues,metadata.qualityIndex.errors=(numOfValues-datasetErrors)/numOfValues,metadata},inferJsonDataType:function(json,fieldKeys,options){"undefined"!=typeof options&&null!=options||(options={thresholdConfidence:1});var stack=[],fieldsType={},numOfRows=0;if("undefined"==typeof fieldKeys)throw"IllegalArgumentException: undefined json path to analyse.";for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"==fieldKey&&ArrayUtils.isArray(item))for(var cell,j=0;j<item.length&&(cell=item[j]);j++)stack.push({item:cell,fieldKeyIndex:fieldKeyIndex}),numOfRows++;else{var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j<jsonSubtree.length;j++){var jsonItem=jsonSubtree[j];stack.push({item:jsonItem,fieldKeyIndex:fieldKeyIndex+1})}else stack.push({item:jsonSubtree,fieldKeyIndex:fieldKeyIndex+1})}else{var sProcessedKeys=fieldKeys.slice(0,fieldKeyIndex).toString();ArrayUtils.IteratorOverKeys(item,function(item,key){var curKey=sProcessedKeys+(0==sProcessedKeys.length?"":",")+key,fieldType=ArrayUtils.TestAndInitializeKey(fieldsType,curKey,{name:curKey,_inferredTypes:[],_inferredSubTypes:[],_inferredValues:[],numOfItems:0});fieldType.numOfItems++;var inferredType=_processInferType(item);ArrayUtils.TestAndIncrement(fieldType._inferredTypes,inferredType.name),inferredType===DataTypeConverter.TYPES.TEXT&&ArrayUtils.TestAndIncrement(fieldType._inferredValues,item);var inferredSubType=_processInferSubType(item);null!=inferredSubType&&"undefined"!=typeof inferredSubType&&ArrayUtils.TestAndIncrement(fieldType._inferredSubTypes,inferredSubType.name)}),numOfRows++}}_analyseDataTypes(fieldsType);var quality={homogeneity:1,completeness:1,totalNullValues:0,totalValues:0};ArrayUtils.IteratorOverKeys(fieldsType,function(fieldType){quality.totalValues+=fieldType.numOfItems,quality.homogeneity*=fieldType.typeConfidence,fieldType.totalNullValues=0,fieldType._inferredTypes.hasOwnProperty(DataTypeConverter.TYPES.EMPTY.name)&&(fieldType.totalNullValues=fieldType._inferredTypes[DataTypeConverter.TYPES.EMPTY.name],quality.totalNullValues+=fieldType.totalNullValues)}),quality.homogeneity=Math.round(100*quality.homogeneity)/100;var totFullValues=quality.totalValues-quality.totalNullValues;quality.completeness=Math.round(totFullValues/quality.totalValues*100)/100;var warningsTextual="";ArrayUtils.IteratorOverKeys(fieldsType,function(fieldType){fieldType.errorsDescription="";var description="";if(fieldType.typeConfidence<1){var incorrect=fieldType.numOfItems-fieldType.totalNullValues-fieldType._inferredTypes[fieldType.type];if(incorrect>0){description+="The column <"+fieldType.name+"> has the type <"+fieldType.type+">";var verb=1==incorrect?" value is":" values are";description+=", but "+incorrect+verb+" not a "+fieldType.type}}fieldType.totalNullValues>0&&(description+="The column <"+fieldType.name+"> has "+fieldType.totalNullValues+" EMPTY value",fieldType.totalNullValues>1&&(description+="s")),description.length>0&&(description+="."),fieldType.errorsDescription=description,warningsTextual+=description});var metadata={dataset:json,fieldKeys:fieldKeys,types:fieldsType,qualityIndex:quality,warningsTextual:warningsTextual};return _filterBasedOnThreshold(metadata,options.thresholdConfidence),metadata},inferDataTypeOfValue:function(value){return _processInferType(value)}}}(),DataTypesUtils.FilterTime=function(value){var expTime=/^[0-9]{2}:[0-9]{2}(:[0-9]{2})?(\+[0-9]{2}:[0-9]{2})?$/;if(0==expTime.test(value))return null;var splitted=value.split(/[:|\+]/),expNumber=/^[0-9]{2}$/,HH=expNumber.test(splitted[0])?parseInt(splitted[0]):0,MM=expNumber.test(splitted[1])?parseInt(splitted[1]):0,SS=splitted.length>=3&&expNumber.test(splitted[2])?parseInt(splitted[2]):0,dt=new Date;return dt.setHours(HH),dt.setMinutes(MM),dt.setSeconds(SS),dt},DataTypesUtils.FilterDateTime=function(value){var _dtSplitted=value.split(/[T|\s]/);if(2==_dtSplitted.length){var dtTime=DataTypesUtils.FilterTime(_dtSplitted[1]);if(null==dtTime)return null;var dtDateTime=DataTypesUtils.FilterDate(_dtSplitted[0],dtTime);return dtDateTime}var dtDate=DataTypesUtils.FilterDate(value);if(null!=dtDate)return dtDate;var dtTime=DataTypesUtils.FilterTime(value);return dtTime},DataTypesUtils.FilterDate=function(value,dtDate){if(null==dtDate&&(dtDate=new Date),/^[0-9][0-9][0-9][0-9]\-[0-9][0-9]$/.test(value)){var year=parseInt(value.substring(0,4)),month=parseInt(value.substring(5));return dtDate.setYear(year),dtDate.setMonth(month),dtDate}var expDate=/^[0-9]{4}(\-|\/)[0-9]{2}((\-|\/)[0-9]{2})?$/;if(expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[0]),month=parseInt(splitted[1]),day=3==splitted.length?parseInt(splitted[2]):0;return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}if(expDate=/^[0-9]{2}(\-|\/)[0-9]{2}(\-|\/)[0-9]{4}$/,expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[2]),month=parseInt(splitted[1]),day=parseInt(splitted[0]);return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}return null},DataTypesUtils.FilterFloat=function(value){return/^(\-|\+)?((0|([1-9][0-9]*))(\.[0-9]+)?|Infinity)$/.test(value)?Number(value):NaN},DataTypesUtils.DecimalPlaces=function(num){var match=(""+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return match?Math.max(0,(match[1]?match[1].length:0)-(match[2]?+match[2]:0)):0},DataTypeHierarchy.HIERARCHY=[],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.TEXT.name]=[DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.NUMBER.name]=[DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.DATETIME.name]=[DataTypeConverter.TYPES.DATETIME.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.SUBTYPES.GEOCOORDINATE.name]=[DataTypeConverter.SUBTYPES.GEOCOORDINATE.name,DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.canConvert=function(fromType,toType){var arrConvertableTypes=DataTypeHierarchy.HIERARCHY[fromType],idx=arrConvertableTypes.indexOf(toType);return idx>=0};
2 1 \ No newline at end of file
  2 +function ArrayUtils(){}function DataTypeConverter(){this._fields=[],this._numOfRows=0}function DataTypesUtils(){}function DataTypeHierarchy(){}ArrayUtils.TestAndSet=function(arr,key,object){return"undefined"==typeof arr?null:0==Array.isArray(arr)?null:("undefined"==typeof arr[key]&&(arr[key]=object),arr[key])},ArrayUtils.TestAndInitializeKey=function(obj,key,value){return"undefined"==typeof obj?null:("undefined"==typeof obj[key]&&(obj[key]=value),obj[key])},ArrayUtils.TestAndIncrement=function(arr,key){var exists=arr[key];return"undefined"==typeof exists&&(arr[key]=0),arr[key]++,arr},ArrayUtils.toFieldsArray=function(obj){var fields=[];return ArrayUtils.IteratorOverKeys(obj,function(field,key){field.key=key,fields.push(field)}),fields},ArrayUtils.IteratorOverKeys=function(arr,callback){for(var property in arr)if(arr.hasOwnProperty(property)){var item=arr[property];callback(item,property)}},ArrayUtils.FindMinMax=function(arr,fncompare){var max1=null,max2=null;for(var key in arr)null==max1||fncompare(arr[key],max1.value)?(max2=max1,max1={index:-1,key:key,value:arr[key]}):(null==max2||fncompare(arr[key],max2.value))&&(max2={index:-1,key:key,value:arr[key]});return{first:max1,second:max2}},ArrayUtils.isArray=function(arr){return Array.isArray(arr)?arr.length>0:!1},DataTypeConverter.TYPES={EMPTY:{value:0,name:"NULL"},TEXT:{value:1,name:"TEXT"},NUMBER:{value:2,name:"NUMBER"},OBJECT:{value:3,name:"OBJECT"},DATETIME:{value:4,name:"DATETIME"}},DataTypeConverter.SUBTYPES={GEOCOORDINATE:{value:1e3,name:"GEOCOORDINATE"},GEOJSON:{value:1001,name:"GEOJSON"},BOOL:{value:1002,name:"BOOL"},CONST:{value:1003,name:"CONST"},CATEGORY:{value:1004,name:"CATEGORY"},PERCENTAGE:{value:1100,name:"PERCENTAGE"},LATITUDE:{value:1101,name:"LATITUDE"},LONGITUDE:{value:1102,name:"LONGITUDE"}},DataTypeConverter.LANGS={EN:{value:1e3,name:"EN"},IT:{value:1001,name:"IT"},FR:{value:1100,name:"FR"},NL:{value:1101,name:"NL"}},DataTypeConverter.GEOJSONTYPES=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon","GeometryCollection","Feature","FeatureCollection"],DataTypeConverter.prototype=function(){var _analyseDataTypes=function(fields){ArrayUtils.IteratorOverKeys(fields,function(field){var max=ArrayUtils.FindMinMax(field._inferredTypes,function(curval,lastval){return curval>lastval}),tkey=max.first.key;tkey===DataTypeConverter.TYPES.EMPTY.name&&null!=max.second&&"undefined"!=typeof max.second&&(tkey=max.second.key),field.type=tkey,field.typeConfidence=field._inferredTypes[max.first.key]/field.numOfItems;var max=ArrayUtils.FindMinMax(field._inferredSubTypes,function(curval,lastval){return curval>lastval});if(field.subtype=null,null!=max&&null!=max.first){field.subtype=max.first.key,field.subtypeConfidence=field._inferredSubTypes[field.subtype]/field.numOfItems;var fieldName=field.name.toLowerCase(),isLatType=field.subtype===DataTypeConverter.SUBTYPES.LATITUDE.name,fieldNameContainsLat=fieldName.indexOf("lat")>=0,fieldNameContainsLon=fieldName.indexOf("ng")>=0;1==isLatType&&0==fieldNameContainsLat&&1==fieldNameContainsLon&&(field.subtype=DataTypeConverter.SUBTYPES.LONGITUDE.name)}})},_processInferType=function(value){if(null===value||"undefined"==typeof value)return DataTypeConverter.TYPES.EMPTY;if("object"==typeof value)return DataTypeConverter.TYPES.OBJECT;var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return DataTypeConverter.TYPES.NUMBER;var _date=DataTypesUtils.FilterDateTime(value);return 0==isNaN(_date)&&null!=_date?DataTypeConverter.TYPES.DATETIME:DataTypeConverter.TYPES.TEXT},_processInferSubType=function(value){if(null===value||"undefined"==typeof value)return null;if(Array.isArray(value)&&2==value.length&&NaN!=DataTypesUtils.FilterFloat(value[0])&&NaN!=DataTypesUtils.FilterFloat(value[1])&&DataTypesUtils.DecimalPlaces(value[0])>4&&DataTypesUtils.DecimalPlaces(value[1])>4)return DataTypeConverter.SUBTYPES.GEOCOORDINATE;if("string"==typeof value){var split=value.split(",");if(DataTypesUtils.IsLatLng(split[0])&&DataTypesUtils.IsLatLng(split[1]))return DataTypeConverter.SUBTYPES.GEOCOORDINATE}var isnumber=DataTypesUtils.FilterFloat(value);if(isNaN(isnumber)!==!0)return isnumber>=-90&&90>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:isnumber>=-180&&180>=isnumber&&DataTypesUtils.DecimalPlaces(isnumber)>=5?DataTypeConverter.SUBTYPES.GEOCOORDINATE:null;if("object"==typeof value&&value.hasOwnProperty("type")){var geotype=value.type,isincluded=DataTypeConverter.GEOJSONTYPES.includes(geotype);if(isincluded)return DataTypeConverter.SUBTYPES.GEOJSON}return null},_filterBasedOnThreshold=function(metadata,threshold){return ArrayUtils.IteratorOverKeys(metadata.types,function(fieldType,key){if(!(fieldType.typeConfidence>=threshold)){var arrHierarchyTypes=DataTypeHierarchy.HIERARCHY[fieldType.type];if(null==arrHierarchyTypes)return metadata;var lastFieldType={lastType:arrHierarchyTypes[0],lastTypeCounter:fieldType._inferredTypes[arrHierarchyTypes[0]],typeConfidence:0};lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems;for(var curType,i=1;i<arrHierarchyTypes.length,curType=arrHierarchyTypes[i];i++){var numItemsOfCurType=fieldType._inferredTypes.hasOwnProperty(curType)?fieldType._inferredTypes[curType]:0;if(lastFieldType.lastType=curType,lastFieldType.lastTypeCounter+=numItemsOfCurType,lastFieldType.typeConfidence=lastFieldType.lastTypeCounter/fieldType.numOfItems,lastFieldType.typeConfidence>=threshold){fieldType.type=lastFieldType.lastType,fieldType.typeConfidence=lastFieldType.typeConfidence;break}}}}),metadata},_capitalizeFirstLetter=function(string){return string.charAt(0).toUpperCase()+string.slice(1)},jsonTraverse=function(json,fieldKeys,callback){var stack=[],numOfRows=0;for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"!=fieldKey||1!=ArrayUtils.isArray(item)){var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j<jsonSubtree.length;j++){var jsonItem=jsonSubtree[j];stack.push({item:jsonItem,fieldKeyIndex:fieldKeyIndex+1})}else stack.push({item:jsonSubtree,fieldKeyIndex:fieldKeyIndex+1})}else for(var cell,j=0;j<item.length&&(cell=item[j]);j++)stack.push({item:cell,fieldKeyIndex:fieldKeyIndex}),numOfRows++;else{var sProcessedKeys=fieldKeys.slice(0,fieldKeyIndex).toString();ArrayUtils.IteratorOverKeys(item,function(value,key){var curKey=sProcessedKeys+(sProcessedKeys.length>0?",":"")+key,_value=callback(value,key,curKey,numOfRows);item[key]=_value}),numOfRows++}}};return{constructor:DataTypeConverter,cast:function(metadata,options){return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),this.convert(metadata,options)},convert:function(metadata,options){var lastRowIndex=0,numOfRows=0,numOfValues=0,datasetErrors=0,datasetMissingValues=0;return"undefined"!=typeof options&&null!=options||(options={castThresholdConfidence:1,castIfNull:!1}),jsonTraverse(metadata.dataset,metadata.fieldKeys,function(value,key,traversedKeys,rowIndex){var inferredType=metadata.types[traversedKeys];numOfValues++,lastRowIndex!=rowIndex&&(lastRowIndex=rowIndex,numOfRows++),null==value||"undefined"==typeof value||0==(value+"").length;var isCast=inferredType.typeConfidence>=options.castThresholdConfidence;if(inferredType.type==DataTypeConverter.TYPES.NUMBER.name&&isCast){var number=parseFloat(value);return isNaN(number)?(datasetErrors++,value):number}return value}),metadata.qualityIndex.notNullValues=(numOfValues-datasetMissingValues)/numOfValues,metadata.qualityIndex.errors=(numOfValues-datasetErrors)/numOfValues,metadata},inferJsonDataType:function(json,fieldKeys,options){"undefined"!=typeof options&&null!=options||(options={}),0==options.hasOwnProperty("thresholdConfidence")&&(options.thresholdConfidence=1),0==options.hasOwnProperty("language")?options.language=DataTypeConverter.LANGS.EN.name:options.language=options.language.toUpperCase();var stack=[],fieldsType={},numOfRows=0;if("undefined"==typeof fieldKeys)throw"IllegalArgumentException: undefined json path to analyse.";for(stack.push({item:json,fieldKeyIndex:0});stack.length>0;){var stackTask=stack.pop(),item=stackTask.item,fieldKeyIndex=stackTask.fieldKeyIndex,fieldKey=fieldKeys[fieldKeyIndex];if("*"!=fieldKey||0!=ArrayUtils.isArray(item))if("*"==fieldKey&&ArrayUtils.isArray(item))for(var cell,j=0;j<item.length&&(cell=item[j]);j++)stack.push({item:cell,fieldKeyIndex:fieldKeyIndex}),numOfRows++;else{var jsonSubtree=item[fieldKey];if(Array.isArray(jsonSubtree))for(var j=0;j<jsonSubtree.length;j++){var jsonItem=jsonSubtree[j];stack.push({item:jsonItem,fieldKeyIndex:fieldKeyIndex+1})}else stack.push({item:jsonSubtree,fieldKeyIndex:fieldKeyIndex+1})}else{var sProcessedKeys=fieldKeys.slice(0,fieldKeyIndex).toString();ArrayUtils.IteratorOverKeys(item,function(item,key){var curKey=sProcessedKeys+(0==sProcessedKeys.length?"":",")+key,fieldType=ArrayUtils.TestAndInitializeKey(fieldsType,curKey,{name:curKey,_inferredTypes:[],_inferredSubTypes:[],_inferredValues:[],numOfItems:0});fieldType.numOfItems++;var inferredType=_processInferType(item);ArrayUtils.TestAndIncrement(fieldType._inferredTypes,inferredType.name),inferredType===DataTypeConverter.TYPES.TEXT&&ArrayUtils.TestAndIncrement(fieldType._inferredValues,item);var inferredSubType=_processInferSubType(item);null!=inferredSubType&&"undefined"!=typeof inferredSubType&&ArrayUtils.TestAndIncrement(fieldType._inferredSubTypes,inferredSubType.name)}),numOfRows++}}_analyseDataTypes(fieldsType);var quality={homogeneity:1,completeness:1,totalNullValues:0,totalValues:0};ArrayUtils.IteratorOverKeys(fieldsType,function(fieldType){quality.totalValues+=fieldType.numOfItems,quality.homogeneity*=fieldType.typeConfidence,fieldType.totalNullValues=0,fieldType._inferredTypes.hasOwnProperty(DataTypeConverter.TYPES.EMPTY.name)&&(fieldType.totalNullValues=fieldType._inferredTypes[DataTypeConverter.TYPES.EMPTY.name],quality.totalNullValues+=fieldType.totalNullValues)}),quality.homogeneity=Math.round(100*quality.homogeneity)/100;var totFullValues=quality.totalValues-quality.totalNullValues;quality.completeness=Math.round(totFullValues/quality.totalValues*100)/100;var warningsTextual="";ArrayUtils.IteratorOverKeys(fieldsType,function(fieldType){fieldType.errorsDescription="";var description="";if(fieldType.typeConfidence<1){var incorrect=fieldType.numOfItems-fieldType.totalNullValues-fieldType._inferredTypes[fieldType.type];if(incorrect>0){var _descr1=_capitalizeFirstLetter(JDC_LNG.key_declaretype[options.language])+".",_descr2=_capitalizeFirstLetter(JDC_LNG.key_notoftype_singular[options.language])+".";incorrect>1&&(_descr2=_capitalizeFirstLetter(JDC_LNG.key_notoftype_plural[options.language])+".");var descr=_descr1+" "+_descr2;descr=descr.replace(/%COL_NAME/g,fieldType.name),descr=descr.replace(/%COL_TYPE/g,fieldType.type),descr=descr.replace(/%COL_ERRORS/g,incorrect),description+=descr}}var descr="";1==fieldType.totalNullValues?descr=_capitalizeFirstLetter(JDC_LNG.key_emptyvalue_singolar[options.language])+".":fieldType.totalNullValues>1&&(descr=_capitalizeFirstLetter(JDC_LNG.key_emptyvalue_plural[options.language])+"."),descr=descr.replace(/%COL_NAME/g,fieldType.name),descr=descr.replace(/%COL_TYPE/g,fieldType.type),descr=descr.replace(/%COL_NULLVALUES/g,fieldType.totalNullValues),fieldType.errorsDescription=description,warningsTextual+=description});var metadata={dataset:json,fieldKeys:fieldKeys,types:fieldsType,qualityIndex:quality,warningsTextual:warningsTextual};return _filterBasedOnThreshold(metadata,options.thresholdConfidence),metadata},inferDataTypeOfValue:function(value){return _processInferType(value)},inferDataSubTypeOfValue:function(value){return _processInferSubType(value)}}}(),DataTypesUtils.FilterTime=function(value){var expTime=/^[0-9]{2}:[0-9]{2}(:[0-9]{2})?(\+[0-9]{2}:[0-9]{2})?$/;if(0==expTime.test(value))return null;var splitted=value.split(/[:|\+]/),expNumber=/^[0-9]{2}$/,HH=expNumber.test(splitted[0])?parseInt(splitted[0]):0,MM=expNumber.test(splitted[1])?parseInt(splitted[1]):0,SS=splitted.length>=3&&expNumber.test(splitted[2])?parseInt(splitted[2]):0,dt=new Date;return dt.setHours(HH),dt.setMinutes(MM),dt.setSeconds(SS),dt},DataTypesUtils.FilterDateTime=function(value){var _dtSplitted=value.split(/[T|\s]/);if(2==_dtSplitted.length){var dtTime=DataTypesUtils.FilterTime(_dtSplitted[1]);if(null==dtTime)return null;var dtDateTime=DataTypesUtils.FilterDate(_dtSplitted[0],dtTime);return dtDateTime}var dtDate=DataTypesUtils.FilterDate(value);if(null!=dtDate)return dtDate;var dtTime=DataTypesUtils.FilterTime(value);return dtTime},DataTypesUtils.FilterDate=function(value,dtDate){if(null==dtDate&&(dtDate=new Date),/^[0-9][0-9][0-9][0-9]\-[0-9][0-9]$/.test(value)){var year=parseInt(value.substring(0,4)),month=parseInt(value.substring(5));return dtDate.setYear(year),dtDate.setMonth(month),dtDate}var expDate=/^[0-9]{4}(\-|\/)[0-9]{2}((\-|\/)[0-9]{2})?$/;if(expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[0]),month=parseInt(splitted[1]),day=3==splitted.length?parseInt(splitted[2]):0;return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}if(expDate=/^[0-9]{2}(\-|\/)[0-9]{2}(\-|\/)[0-9]{4}$/,expDate.test(value)){var splitted=value.split(/[\-|\/]/),year=parseInt(splitted[2]),month=parseInt(splitted[1]),day=parseInt(splitted[0]);return dtDate.setYear(year),dtDate.setMonth(month),dtDate.setDate(day),dtDate}return null},DataTypesUtils.FilterFloat=function(value){return/^(\-|\+)?((0|([1-9][0-9]*))(\.[0-9]+)?|Infinity)$/.test(value)?Number(value):NaN},DataTypesUtils.DecimalPlaces=function(num){var match=(""+num).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return match?Math.max(0,(match[1]?match[1].length:0)-(match[2]?+match[2]:0)):0},DataTypesUtils.IsLatLng=function(num){return NaN==DataTypesUtils.FilterFloat(num)?!1:DataTypesUtils.DecimalPlaces(num)>4},DataTypeHierarchy.HIERARCHY=[],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.TEXT.name]=[DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.NUMBER.name]=[DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.TYPES.DATETIME.name]=[DataTypeConverter.TYPES.DATETIME.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.HIERARCHY[DataTypeConverter.SUBTYPES.GEOCOORDINATE.name]=[DataTypeConverter.SUBTYPES.GEOCOORDINATE.name,DataTypeConverter.TYPES.NUMBER.name,DataTypeConverter.TYPES.TEXT.name],DataTypeHierarchy.canConvert=function(fromType,toType){var arrConvertableTypes=DataTypeHierarchy.HIERARCHY[fromType],idx=arrConvertableTypes.indexOf(toType);return idx>=0};var JDC_LNG={key_declaretype:{EN:"the column <%COL_NAME> is of type <%COL_TYPE>",IT:"la colonna <%COL_NAME> รจ di tipo <%COL_TYPE>",FR:"le colum <%COL_NAME> est de type <%COL_TYPE>",NL:"de kolom <%COL_NAME> is van het type <%COL_TYPE>"},key_notoftype_singular:{EN:"a value is not <%COL_TYPE>",IT:"un valore non รจ un <%COL_TYPE>",FR:"une valeur est pas <%COL_TYPE> se trouvant",NL:"een waarde is niet <%COL_TYPE>"},key_notoftype_plural:{EN:"%COL_ERRORS values are not <%COL_TYPE>",IT:"%COL_ERRORS valori non sono di tipo <%COL_TYPE>",FR:"les valeurs %COL_ERRORS sont du type <%COL_TYPE>",NL:"%COL_ERRORS waarden niet <%COL_TYPE>"},key_emptyvalue_singolar:{EN:"the column <%COL_NAME> has an empty value",IT:"la colonna <%COL_NAME> ha un valore vuoto",FR:"la colonne <%COL_NAME> a une valeur vide",NL:"de kolom <%COL_NAME> heeft een lege waarde"},key_emptyvalue_plural:{EN:"the column <%COL_NAME> has <%COL_NULLVALUES> empty values",IT:"la colonna <%COL_NAME> ha <%COL_NULLVALUES> valori vuoti",FR:"la colonne <%COL_NAME> a <%COL_NULLVALUES> valeurs vide",NL:"de kolom <%COL_NAME> heeft <%COL_NULLVALUES> lege waarde"},key_type:{EN:"type",IT:"tipo",FR:"type",NL:"type"},key_subtype:{EN:"subtype",IT:"sottotipo",FR:"sous-type",NL:"subtype"},key_typetext:{EN:"text",IT:"testo",FR:"texte",NL:"tekst"},key_typenumber:{EN:"number",IT:"numero",FR:"nombre",NL:"aantal"},key_typeobject:{EN:"object",IT:"oggetto",FR:"objet",NL:"voorwerp"},key_typedatetime:{EN:"date or time",IT:"data o orario",FR:"date ou l'heure",NL:"datum of tijd"},key_typeempty:{EN:"empty",IT:"vuoto",FR:"vide",NL:"leeg"},key_typelatitude:{EN:"latitude",IT:"latitudine",FR:"latitude",NL:"breedtegraad"},key_typelongitude:{EN:"longitude",IT:"longitudine",FR:"longitude",NL:"lengtegraad"}};
3 3 \ No newline at end of file
... ...
bower_components/jsdatachecker/src/DataTypeConverter.js
... ... @@ -25,29 +25,40 @@ function DataTypeConverter() {
25 25 };//EndConstructor.
26 26  
27 27 DataTypeConverter.TYPES = {
28   - TEXT : { value: 0, name: "TEXT" },
29   - CODE : { value: 1, name: "CODE"},
  28 + EMPTY : { value: 0, name: "NULL"},
30 29  
  30 + TEXT : { value: 1, name: "TEXT" },
31 31 NUMBER : { value: 2, name: "NUMBER" },
32 32 OBJECT : { value: 3, name: "OBJECT" },
  33 + DATETIME : { value: 4, name: "DATETIME" }
  34 +};
33 35  
  36 +DataTypeConverter.SUBTYPES = {
  37 + GEOCOORDINATE : { value: 1000, name: "GEOCOORDINATE" },
  38 + GEOJSON : { value: 1001, name: "GEOJSON" },
  39 + BOOL : { value: 1002, name: "BOOL"},
  40 + CONST : { value: 1003, name: "CONST" },
  41 + CATEGORY : { value: 1004, name: "CATEGORY" },
34 42  
35   - BOOL : { value: 5, name: "BOOL"},
36   - CONST : { value: 6, name: "CONST" },
37   - CATEGORY : { value: 7, name: "CATEGORY" },
38   -
39   - DATETIME : { value: 8, name: "DATETIME" },
  43 + PERCENTAGE : { value: 1100, name: "PERCENTAGE" },
  44 + LATITUDE : { value: 1101, name: "LATITUDE" },
  45 + LONGITUDE : { value: 1102, name: "LONGITUDE" }
40 46  
41   - EMPTY : { value: 101, name: "NULL" }
  47 + /*CODE : { value: 2000, name: "CODE"},*/
42 48 };
43 49  
44   -DataTypeConverter.SUBTYPES = {
45   - GEOCOORDINATE : { value: 1000, name: "GEOCOORDINATE" },
46   - PERCENTAGE : { value: 1000, name: "PERCENTAGE" },
47   - LATITUDE : { value: 1001, name: "LATITUDE" },
48   - LONGITUDE : { value: 1002, name: "LONGITUDE" }
  50 +DataTypeConverter.LANGS = {
  51 + EN : { value: 1000, name: "EN" },
  52 + IT : { value: 1001, name: "IT" },
  53 + FR : { value: 1100, name: "FR" },
  54 + NL : { value: 1101, name: "NL" }
49 55 };
50 56  
  57 +
  58 +DataTypeConverter.GEOJSONTYPES = [ "Point", "MultiPoint", "LineString",
  59 + "MultiLineString", "Polygon", "MultiPolygon", "GeometryCollection", "Feature",
  60 + "FeatureCollection" ];
  61 +
51 62 DataTypeConverter.prototype = (function () {
52 63  
53 64 /***
... ... @@ -111,6 +122,10 @@ DataTypeConverter.prototype = (function () {
111 122  
112 123 var _analyseDataTypes = function(fields) {
113 124 ArrayUtils.IteratorOverKeys(fields, function(field) {
  125 +
  126 +
  127 + /*
  128 + //TODO: removed CODE, I don't know whether it must be inserted
114 129 if (field._inferredTypes[DataTypeConverter.TYPES.CODE.name]) {
115 130 var confidence = field._inferredTypes[DataTypeConverter.TYPES.CODE.name] / field.numOfItems;
116 131 var _numericalInferredType = field._inferredTypes[DataTypeConverter.TYPES.NUMBER.name];
... ... @@ -119,7 +134,7 @@ DataTypeConverter.prototype = (function () {
119 134 field.type = DataTypeConverter.TYPES.CODE.name;
120 135 field.typeConfidence = confidence;
121 136 return;
122   - }
  137 + }*/
123 138  
124 139 //Infers the field TYPE.
125 140 var max = ArrayUtils.FindMinMax(field._inferredTypes, function (curval, lastval) {
... ... @@ -189,11 +204,6 @@ DataTypeConverter.prototype = (function () {
189 204 if (typeof value === 'object')
190 205 return DataTypeConverter.TYPES.OBJECT;
191 206  
192   - //If the value starts with a zero and contains all numbers, it is
193   - //inferred as textual content.
194   - if (/^0[0-9]+$/.test(value))
195   - return DataTypeConverter.TYPES.CODE;
196   -
197 207 //Try to parse the float.
198 208 var isnumber = DataTypesUtils.FilterFloat(value);
199 209 if (isNaN(isnumber) !== true) {//It is a number.
... ... @@ -222,6 +232,21 @@ DataTypeConverter.prototype = (function () {
222 232 var _processInferSubType = function (value) {
223 233 if (value === null || typeof value === 'undefined') return null;
224 234  
  235 + //GEOCOORDINATE
  236 + if (Array.isArray(value) && value.length == 2) {//It recognises the LAT LNG as array of two values.
  237 + //Checks if the two array's values are numbers.
  238 + if ( DataTypesUtils.FilterFloat(value[0]) != NaN && DataTypesUtils.FilterFloat(value[1]) != NaN )
  239 + if (DataTypesUtils.DecimalPlaces(value[0]) > 4 && DataTypesUtils.DecimalPlaces(value[1]) > 4 )
  240 + return DataTypeConverter.SUBTYPES.GEOCOORDINATE;
  241 + }//EndIf.
  242 +
  243 + if (typeof value === 'string') {
  244 + var split = value.split(",");
  245 + //if (split.length == 2)
  246 + if (DataTypesUtils.IsLatLng(split[0]) && DataTypesUtils.IsLatLng(split[1]))
  247 + return DataTypeConverter.SUBTYPES.GEOCOORDINATE;
  248 + }
  249 +
225 250 //Try to parse the float.
226 251 var isnumber = DataTypesUtils.FilterFloat(value);
227 252 if (isNaN(isnumber) !== true) {//It is a number.
... ... @@ -240,6 +265,19 @@ DataTypeConverter.prototype = (function () {
240 265 return null;
241 266 }
242 267  
  268 + //Try to parse GEOJSON.
  269 + if (typeof value === 'object' && value.hasOwnProperty('type')) {
  270 + //Check the type variable.
  271 + var geotype = value.type;
  272 + var isincluded = DataTypeConverter.GEOJSONTYPES.includes(geotype);
  273 + if (isincluded) return DataTypeConverter.SUBTYPES.GEOJSON;
  274 + }
  275 +
  276 + //If the value starts with a zero and contains all numbers, it is
  277 + //inferred as textual content.
  278 + /*if (/^0[0-9]+$/.test(value))
  279 + return DataTypeConverter.TYPES.CODE;*/
  280 +
243 281 return null;
244 282 };//EndFunction.
245 283  
... ... @@ -248,6 +286,9 @@ DataTypeConverter.prototype = (function () {
248 286 if (fieldType.typeConfidence >= threshold) return;
249 287  
250 288 var arrHierarchyTypes = DataTypeHierarchy.HIERARCHY[fieldType.type];
  289 + if (arrHierarchyTypes == null)
  290 + return metadata;
  291 +
251 292 var lastFieldType = { lastType: arrHierarchyTypes[0],
252 293 lastTypeCounter: fieldType._inferredTypes[arrHierarchyTypes[0]],
253 294 typeConfidence: 0 };
... ... @@ -270,6 +311,15 @@ DataTypeConverter.prototype = (function () {
270 311 return metadata;
271 312 };//EndFunction.
272 313  
  314 + var _capitalizeFirstLetter = function(string) {
  315 + return string.charAt(0).toUpperCase() + string.slice(1);
  316 + };//EndFunction.
  317 +
  318 + var _replaceAll = function(search, replacement) {
  319 + var target = this;
  320 + return target.split(search).join(replacement);
  321 + };
  322 +
273 323 var jsonTraverse = function(json, fieldKeys, callback) {
274 324 var stack = [];
275 325 var numOfRows = 0;
... ... @@ -396,8 +446,17 @@ DataTypeConverter.prototype = (function () {
396 446 * @param options Infer Data Type options, in particular the threshold value for the confidence.
397 447 */
398 448 inferJsonDataType: function (json, fieldKeys, options) {
399   - if (typeof options === 'undefined' || options == null)
400   - options = { thresholdConfidence: 1 };
  449 +
  450 + //Default options initialisation.
  451 + if (typeof options === 'undefined' || options == null) options = { };
  452 +
  453 + if (options.hasOwnProperty("thresholdConfidence") == false)
  454 + options.thresholdConfidence = 1;
  455 +
  456 + if (options.hasOwnProperty("language") == false)
  457 + options.language = DataTypeConverter.LANGS.EN.name;
  458 + else
  459 + options.language = options.language.toUpperCase();
401 460  
402 461 var stack = [];
403 462 var fieldsType = {};
... ... @@ -508,19 +567,43 @@ DataTypeConverter.prototype = (function () {
508 567  
509 568 var incorrect = fieldType.numOfItems - fieldType.totalNullValues - fieldType._inferredTypes[fieldType.type];
510 569 if (incorrect > 0) {
511   - description += "The column <" + fieldType.name + "> has the type <" + fieldType.type + ">";
  570 + var _descr1 = _capitalizeFirstLetter(JDC_LNG['key_declaretype'][options.language]) + ".";
  571 + var _descr2 = _capitalizeFirstLetter(JDC_LNG['key_notoftype_singular'][options.language]) + ".";
  572 + if (incorrect > 1)
  573 + _descr2 = _capitalizeFirstLetter(JDC_LNG['key_notoftype_plural'][options.language]) + ".";
  574 +
  575 + var descr = _descr1 + " " + _descr2;
  576 + descr = descr.replace(/%COL_NAME/g, fieldType.name);
  577 + descr = descr.replace(/%COL_TYPE/g, fieldType.type);
  578 + descr = descr.replace(/%COL_ERRORS/g, incorrect);
  579 +
  580 + description += descr;
  581 +
  582 + /*description += "The column <" + fieldType.name + "> has the type <" + fieldType.type + ">";
512 583 var verb = (incorrect == 1) ? " value is" : " values are";
513   - description += ", but " + incorrect + verb + " not a " + fieldType.type;
  584 + description += ", but " + incorrect + verb + " not a " + fieldType.type;*/
514 585 }
515 586 }
516 587  
517   - if (fieldType.totalNullValues > 0) {
  588 + var descr = "";
  589 + if (fieldType.totalNullValues == 1)
  590 + descr = _capitalizeFirstLetter(JDC_LNG['key_emptyvalue_singolar'][options.language]) + ".";
  591 + else if (fieldType.totalNullValues > 1 )
  592 + descr = _capitalizeFirstLetter(JDC_LNG['key_emptyvalue_plural'][options.language]) + ".";
  593 +
  594 + descr = descr.replace(/%COL_NAME/g, fieldType.name);
  595 + descr = descr.replace(/%COL_TYPE/g, fieldType.type);
  596 + descr = descr.replace(/%COL_NULLVALUES/g, fieldType.totalNullValues);
  597 +
  598 + /*if (fieldType.totalNullValues > 0) {
  599 + var descr = _capitalizeFirstLetter(JDC_LNG['key_declaretype'][options.language]) + ".";
  600 +
518 601 description += "The column <" + fieldType.name + "> has " + fieldType.totalNullValues + " EMPTY value";
519 602 if (fieldType.totalNullValues > 1) description += "s";
520 603 }
521 604  
522 605 if (description.length > 0)
523   - description += ".";
  606 + description += ".";*/
524 607  
525 608 fieldType.errorsDescription = description;
526 609 warningsTextual += description;
... ... @@ -547,6 +630,15 @@ DataTypeConverter.prototype = (function () {
547 630 */
548 631 inferDataTypeOfValue: function (value) {
549 632 return _processInferType(value);
  633 + },//EndFunction.
  634 +
  635 + /**
  636 + * Given in input a value, the function infers the data type.
  637 + * @param value
  638 + * @returns {*}
  639 + */
  640 + inferDataSubTypeOfValue: function (value) {
  641 + return _processInferSubType(value);
550 642 }//EndFunction.
551 643  
552 644 };
... ...
bower_components/jsdatachecker/src/DataTypesUtils.js
... ... @@ -122,4 +122,10 @@ DataTypesUtils.DecimalPlaces = function (num) {
122 122 (match[1] ? match[1].length : 0)
123 123 // Adjust for scientific notation.
124 124 - (match[2] ? +match[2] : 0));
  125 +}//EndFunction.
  126 +
  127 +DataTypesUtils.IsLatLng = function (num) {
  128 + if (DataTypesUtils.FilterFloat(num) == NaN) return false;
  129 + if (DataTypesUtils.DecimalPlaces(num) > 4) return true;
  130 + return false;
125 131 }//EndFunction.
126 132 \ No newline at end of file
... ...
bower_components/jsdatachecker/src/ODPlatforms/CKAN.js
... ... @@ -39,6 +39,7 @@ CKANApi.prototype = (function() {
39 39 errorCallback("Check DataStoreAPI.");
40 40 };
41 41 xhttp.open("GET", theUrl, true);//true for asynchronous.
  42 + //xhttp.setRequestHeader('Content-yype')
42 43 xhttp.send(null);
43 44 };//EndFunction.
44 45  
... ...
bower_components/jsdatachecker/src/ODPlatforms/ODStatistics.js
... ... @@ -53,18 +53,44 @@ ODStatistics.prototype = (function() {
53 53  
54 54 stats.numOfDatasets = datasets.length;
55 55 stats.formats = [];
  56 + stats.formatsAggregated = [];
56 57  
57 58 for (var i=0; i<datasets.length; i++) {
58 59 var dataset = datasets[i];
59 60  
60 61 //Statistics on the datasets' formats.
61 62 ArrayUtils.TestAndIncrement(stats.formats, dataset.format);
  63 +
  64 + var dsformat = dataset.format.toLowerCase();
  65 +
  66 + //Aggregated formats.
  67 + if (dsformat.includes("csv"))
  68 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "csv");
  69 + else if (dsformat.includes("pdf"))
  70 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "pdf");
  71 + else if (dsformat.includes("html"))
  72 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "html");
  73 + else if (dsformat.includes("json"))
  74 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "json");
  75 + else if (dsformat.includes("xml"))
  76 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "xml");
  77 + else if (dsformat.includes("shp"))
  78 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "shp");
  79 + else if (dsformat.includes("geojson"))
  80 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "geojson");
  81 + else if (dsformat.includes("kml"))
  82 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "kml");
  83 + else if (dsformat.includes("txt"))
  84 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "txt");
  85 + else if (dsformat.includes("xls") || dsformat.includes("xlsx") || dsformat.includes("ods"))
  86 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "xls/ods");
  87 + else
  88 + ArrayUtils.TestAndIncrement(stats.formatsAggregated, "other");
62 89 }//EndForI.
63 90  
64 91 //Calculates the formats percentages.
65 92 var tmpArrFormats = stats.formats;
66 93 stats.formats = [];
67   -
68 94 ArrayUtils.IteratorOverKeys(tmpArrFormats, function(item, property) {
69 95 var recordFormat = {};
70 96 recordFormat.name = property;
... ... @@ -74,6 +100,18 @@ ODStatistics.prototype = (function() {
74 100 stats.formats.push(recordFormat);
75 101 });
76 102  
  103 + //Calculates the formats percentage for the aggregated formats.
  104 + var tmpArrFormatsAggregated = stats.formatsAggregated;
  105 + stats.formatsAggregated = [];
  106 + ArrayUtils.IteratorOverKeys(tmpArrFormatsAggregated, function(item, property) {
  107 + var recordFormat = {};
  108 + recordFormat.name = property;
  109 + recordFormat.occurrance = item;
  110 + recordFormat.occurrancePercentage = (item / datasets.length) * 100;
  111 + recordFormat.occurrancePercentage = Math.round(recordFormat.occurrancePercentage * 100) / 100;
  112 + stats.formatsAggregated.push(recordFormat);
  113 + });
  114 +
77 115 return stats;
78 116 };//EndFunction.
79 117  
... ...
bower_components/jsdatachecker/src/langs.js 0 โ†’ 100644
  1 +
  2 +
  3 +
  4 +var JDC_LNG = {
  5 +
  6 + "key_declaretype": {
  7 + "EN": "the column <%COL_NAME> is of type <%COL_TYPE>",
  8 + "IT": "la colonna <%COL_NAME> รจ di tipo <%COL_TYPE>",
  9 + "FR": "le colum <%COL_NAME> est de type <%COL_TYPE>",
  10 + "NL": "de kolom <%COL_NAME> is van het type <%COL_TYPE>"
  11 + },
  12 +
  13 + "key_notoftype_singular": {
  14 + "EN": "a value is not <%COL_TYPE>",
  15 + "IT": "un valore non รจ un <%COL_TYPE>",
  16 + "FR": "une valeur est pas <%COL_TYPE> se trouvant",
  17 + "NL": "een waarde is niet <%COL_TYPE>"
  18 + },
  19 +
  20 + "key_notoftype_plural": {
  21 + "EN": "%COL_ERRORS values are not <%COL_TYPE>",
  22 + "IT": "%COL_ERRORS valori non sono di tipo <%COL_TYPE>",
  23 + "FR": "les valeurs %COL_ERRORS sont du type <%COL_TYPE>",
  24 + "NL": "%COL_ERRORS waarden niet <%COL_TYPE>"
  25 + },
  26 +
  27 + "key_emptyvalue_singolar": {
  28 + "EN": "the column <%COL_NAME> has an empty value",
  29 + "IT": "la colonna <%COL_NAME> ha un valore vuoto",
  30 + "FR": "la colonne <%COL_NAME> a une valeur vide",
  31 + "NL": "de kolom <%COL_NAME> heeft een lege waarde"
  32 + },
  33 +
  34 + "key_emptyvalue_plural": {
  35 + "EN": "the column <%COL_NAME> has <%COL_NULLVALUES> empty values",
  36 + "IT": "la colonna <%COL_NAME> ha <%COL_NULLVALUES> valori vuoti",
  37 + "FR": "la colonne <%COL_NAME> a <%COL_NULLVALUES> valeurs vide",
  38 + "NL": "de kolom <%COL_NAME> heeft <%COL_NULLVALUES> lege waarde"
  39 + },
  40 +
  41 + "key_type": {
  42 + "EN": "type",
  43 + "IT": "tipo",
  44 + "FR": "type",
  45 + "NL": "type"
  46 + },
  47 +
  48 + "key_subtype": {
  49 + "EN": "subtype",
  50 + "IT": "sottotipo",
  51 + "FR": "sous-type",
  52 + "NL": "subtype"
  53 + },
  54 +
  55 + "key_typetext": {
  56 + "EN": "text",
  57 + "IT": "testo",
  58 + "FR": "texte",
  59 + "NL": "tekst"
  60 + },
  61 +
  62 + "key_typenumber": {
  63 + "EN": "number",
  64 + "IT": "numero",
  65 + "FR": "nombre",
  66 + "NL": "aantal"
  67 + },
  68 +
  69 + "key_typeobject": {
  70 + "EN": "object",
  71 + "IT": "oggetto",
  72 + "FR": "objet",
  73 + "NL": "voorwerp"
  74 + },
  75 +
  76 + "key_typedatetime": {
  77 + "EN": "date or time",
  78 + "IT": "data o orario",
  79 + "FR": "date ou l'heure",
  80 + "NL": "datum of tijd"
  81 + },
  82 +
  83 + "key_typeempty": {
  84 + "EN": "empty",
  85 + "IT": "vuoto",
  86 + "FR": "vide",
  87 + "NL": "leeg"
  88 + },
  89 +
  90 + "key_typelatitude": {
  91 + "EN": "latitude",
  92 + "IT": "latitudine",
  93 + "FR": "latitude",
  94 + "NL": "breedtegraad"
  95 + },
  96 +
  97 + "key_typelongitude": {
  98 + "EN": "longitude",
  99 + "IT": "longitudine",
  100 + "FR": "longitude",
  101 + "NL": "lengtegraad"
  102 + }
  103 +
  104 +};
0 105 \ No newline at end of file
... ...
controllets/data-sevc-controllet/data-sevc-controllet.html
... ... @@ -47,7 +47,7 @@
47 47  
48 48 listeners : {
49 49 'page-slider-controllet_selected' : '_updateSlider',
50   - 'dataset-selection-controllet_data-url' : '_allowSecondStep',
  50 + 'select-dataset-controllet_data-url' : '_allowSecondStep',
51 51 'select-fields-controllet_selected-fields' : '_allowThirdStep',
52 52 'filters-controllet_filters': '_allowThirdStep',
53 53 'aggregators-controllet_aggregators': '_allowThirdStep',
... ... @@ -117,7 +117,7 @@
117 117  
118 118 _allowSecondStep : function(e){
119 119 this.$.slider.chevronRight(false);
120   -//
  120 +
121 121 var f = Object.create(providerFactory);
122 122 var provider = f.getProvider(e.detail.url);
123 123 var dataUrl = provider.addLimit(e.detail.url);
... ... @@ -135,6 +135,8 @@
135 135 }
136 136 else
137 137 this.$.select_dataset.$.selected_url.invalid = true;
  138 +
  139 + this.$.select_dataset.showDatasetInfo();
138 140 },
139 141  
140 142 _allowThirdStep : function(){
... ...
controllets/data-sevc-controllet/demo/index.html
... ... @@ -18,8 +18,10 @@
18 18 <data-sevc-controllet deep-url="http://172.16.15.38/DEEalerProvider/DEEP/"
19 19 datalets-list-url="http://172.16.15.38/DEEalerProvider/DEEP/datalets-list"
20 20 datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 2","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b056c5e6-76af-4526-a35d-7dee664fb6ee\/download\/isislab.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/818c2edb-0cb7-4288-b340-e4dd1933d817\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New---Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination - dl","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/fd8c4d6f-315d-4aa0-b7bd-4fdde7bf641b\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New---Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) dissemination of ROUTE-TO-PA project","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/b0ef6017-8c64-4e11-8046-7e51a8561856\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New---Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"test dissemination with link","resource_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/ba5054af-7561-4f99-9504-76ea004a1e85\/resource\/4cc2349d-bf7b-4bbe-a7ca-db5312bb6c94\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New---Link.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Dissemination activity of the first year","resource_name":"Dissemination activity of the first year (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/61f07087-210a-4c35-9606-2aafe183633b\/resource\/5f9d8d8b-1c41-45f7-9dbb-61b9a7bcd076\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"City of the Hague Municipality","package_name":"Test 3- Buurten","resource_name":"Test Buurten - 3","url":"http:\/\/ckan.routetopa.eu\/dataset\/1248d447-2901-4beb-91ae-c2f249fd8a99\/resource\/1fdbc765-8945-4271-8dce-9c7eba45a67d\/download\/Test-3-Compare.csv","metas":"{\"organization\":\"City of the Hague Municipality\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'
  21 + suggested-datasets='[{"resource_name":"SUGGESTED 1","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 2","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 3","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"}]'
  22 + <!--suggested-datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 2","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b056c5e6-76af-4526-a35d-7dee664fb6ee\/download\/isislab.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/818c2edb-0cb7-4288-b340-e4dd1933d817\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination - dl","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/fd8c4d6f-315d-4aa0-b7bd-4fdde7bf641b\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) dissemination of ROUTE-TO-PA project","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/b0ef6017-8c64-4e11-8046-7e51a8561856\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"test dissemination with link","resource_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/ba5054af-7561-4f99-9504-76ea004a1e85\/resource\/4cc2349d-bf7b-4bbe-a7ca-db5312bb6c94\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Dissemination activity of the first year","resource_name":"Dissemination activity of the first year (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/61f07087-210a-4c35-9606-2aafe183633b\/resource\/5f9d8d8b-1c41-45f7-9dbb-61b9a7bcd076\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"City of the Hague Municipality","package_name":"Test 3- Buurten","resource_name":"Test Buurten - 3","url":"http:\/\/ckan.routetopa.eu\/dataset\/1248d447-2901-4beb-91ae-c2f249fd8a99\/resource\/1fdbc765-8945-4271-8dce-9c7eba45a67d\/download\/Test-3-Compare.csv","metas":"{\"organization\":\"City of the Hague Municipality\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'-->
21 23 <!--datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 2","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b056c5e6-76af-4526-a35d-7dee664fb6ee\/download\/isislab.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/818c2edb-0cb7-4288-b340-e4dd1933d817\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination - dl","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/fd8c4d6f-315d-4aa0-b7bd-4fdde7bf641b\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) dissemination of ROUTE-TO-PA project","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/b0ef6017-8c64-4e11-8046-7e51a8561856\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"test dissemination with link","resource_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/ba5054af-7561-4f99-9504-76ea004a1e85\/resource\/4cc2349d-bf7b-4bbe-a7ca-db5312bb6c94\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Dissemination activity of the first year","resource_name":"Dissemination activity of the first year (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/61f07087-210a-4c35-9606-2aafe183633b\/resource\/5f9d8d8b-1c41-45f7-9dbb-61b9a7bcd076\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"City of the Hague Municipality","package_name":"Test 3- Buurten","resource_name":"Test Buurten - 3","url":"http:\/\/ckan.routetopa.eu\/dataset\/1248d447-2901-4beb-91ae-c2f249fd8a99\/resource\/1fdbc765-8945-4271-8dce-9c7eba45a67d\/download\/Test-3-Compare.csv","metas":"{\"organization\":\"City of the Hague Municipality\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'-->
22   - <!--suggested-datasets='[{"resource_name":"SUGGESTED 1","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 2","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 3","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"}]'-->
  24 +
23 25 </data-sevc-controllet>
24 26  
25 27 <!--<co-datalets-creator-controllet data='[{"a":"0", "b":"1"},{"a":"2", "b":"3a"},{"a":"2", "b":"3"}]' deep-url="http://172.16.15.38/DEEalerProvider/DEEP/"-->
... ...
controllets/data-table-controllet/data-table-controllet.html
... ... @@ -40,15 +40,20 @@
40 40 }
41 41  
42 42 paper-icon-button.order {
43   - height: 24px;
44   - width: 24px;
  43 + height: 40px;
  44 + width: 40px;
  45 + padding: 4px;
  46 +
45 47 cursor: pointer;
46 48 }
47 49  
48 50 paper-icon-button.warning {
49   - height: 24px;
50   - width: 24px;
  51 + height: 40px;
  52 + width: 40px;
  53 + padding: 4px;
51 54 color: #FFEB3B;
  55 + --paper-icon-button-ink-color: #FFEB3B;
  56 +
52 57 cursor: help;
53 58 }
54 59  
... ... @@ -77,18 +82,22 @@
77 82  
78 83 #data_table_container #header {
79 84 background: #B6B6B6;
80   - height: 24px;
81   - padding: 12px;
  85 + height: 40px;
  86 + padding: 4px;
82 87 text-align: center;
83 88 font-weight: 700;
84 89 cursor: help;
85 90 }
86 91  
  92 + #data_table_container #header * {
  93 + line-height: 40px !important;
  94 + }
  95 +
87 96 #data_table_container table {
88 97 height: calc(100% - 96px);
89 98 width: 100%;
90 99  
91   - border-spacing: 0px;
  100 + border-spacing: 0;
92 101 }
93 102  
94 103 #data_table_container tbody {
... ... @@ -103,22 +112,35 @@
103 112  
104 113 #data_table_container th,
105 114 #data_table_container td{
106   - height: 24px;
107   - padding: 12px;
  115 + height: 32px;
  116 + /*padding: 12px;*/
108 117 text-align: center;
109   - max-width: 256px;
110   - min-width: 156px;
  118 + /*max-width: 256px;*/
  119 + /*min-width: 156px;*/
111 120 overflow: hidden;
112 121 white-space: nowrap;
113 122 text-overflow: ellipsis;
114 123 width: 1%;
115 124 }
116 125  
  126 + #data_table_container td {
  127 + font-size: 14px;
  128 + padding: 4px 12px;
  129 + max-width: calc(360px - 24px);
  130 + }
  131 +
117 132 #data_table_container th {
118 133 background: #2196F3;
119 134 color: #FFFFFF;
120 135 font-weight: 700;
121 136 cursor: help;
  137 + border-right: 2px solid #FFFFFF;
  138 + height: 40px;
  139 + padding: 4px 12px;
  140 + }
  141 +
  142 + #data_table_container tr :nth-last-child(2) {
  143 + border-right: 0;
122 144 }
123 145  
124 146 #data_table_container th,
... ... @@ -128,17 +150,13 @@
128 150  
129 151 #data_table_container th .th_label {
130 152 display: inline-block;
131   - max-width: calc(100% - 48px - 8px);
  153 + /*max-width: calc(100% - 48px - 8px);*/
132 154 vertical-align: middle;
133 155 overflow: hidden;
134 156 white-space: nowrap;
135 157 text-overflow: ellipsis;
136 158 line-height: 24px;/**/
137   - }
138   -
139   - #data_table_container td {
140   - font-size: 14px;
141   - padding: 4px;
  159 + max-width: calc(360px - 114px);
142 160 }
143 161  
144 162 #data_table_container #footer {
... ... @@ -202,10 +220,10 @@
202 220 <paper-material id="data_table_container" elevation="5">
203 221  
204 222 <div id="header">
205   - <span id="selected_data"></span>
206 223 <template is="dom-if" if={{hasWarnings}}>
207 224 <paper-icon-button class="warning" icon="warning"></paper-icon-button>
208 225 </template>
  226 + <span id="selected_data"></span>
209 227 </div>
210 228  
211 229 <paper-tooltip id="tooltip_wornings" for="header" offset="56">
... ... @@ -223,10 +241,11 @@
223 241 <tr>
224 242 <template is="dom-repeat" items="{{fields}}">
225 243 <th id="id_{{index}}">
226   - <div class="th_label">{{item.name}}</div>
  244 +
227 245 <template is="dom-if" if={{item.errorsDescription.length}}>
228 246 <paper-icon-button class="warning" icon="warning"></paper-icon-button>
229 247 </template>
  248 + <div class="th_label">{{item.name}}</div>
230 249 <paper-icon-button id="{{index}}" class="order" on-click="_order" icon="unfold-more"></paper-icon-button>
231 250 </th>
232 251 </template>
... ... @@ -340,7 +359,7 @@
340 359  
341 360 setData : function(data) {
342 361 var converter = new DataTypeConverter();
343   - var result = converter.inferJsonDataType(data, ["*"]);
  362 + var result = converter.inferJsonDataType(data, ["*"], { language: ln["localization"] } );
344 363 result = converter.cast(result);
345 364 this.fields = ArrayUtils.toFieldsArray(result.types);
346 365 this.data = result.dataset;
... ...
controllets/datasets-list-controllet/datasets-list-controllet.html 0 โ†’ 100644
  1 +<link rel="import" href="../../bower_components/polymer/polymer.html">
  2 +
  3 +<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
  4 +<link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
  5 +<link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
  6 +<link rel="import" href="../../bower_components/paper-item/paper-item.html">
  7 +<link rel="import" href="../../bower_components/paper-spinner/paper-spinner.html">
  8 +
  9 +<dom-module id="datasets-list-controllet">
  10 + <template>
  11 + <style>
  12 +
  13 + #datasets_list_container {
  14 + height: 100%;
  15 + width: 100%;
  16 + }
  17 +
  18 + #datasets_list_container * {
  19 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  20 + font-size: 16px;
  21 + line-height: 24px;
  22 + }
  23 +
  24 + #datasets_list_container #list_info {
  25 + display: flex;
  26 + height: calc(100% - 48px);
  27 + width: 100%;
  28 +
  29 + background: #E0E0E0;
  30 + }
  31 +
  32 + #datasets_list_container #menu {
  33 + background: #E0E0E0;
  34 + }
  35 +
  36 + #datasets_list_container #list_container {
  37 + position: relative;
  38 + height: calc(100% - 28px);
  39 + width: calc(50% - 24px);
  40 + margin-top: 12px;
  41 + padding: 0 12px;
  42 + overflow: hidden;
  43 + background: #E0E0E0;
  44 + }
  45 +
  46 + #datasets_list_container #info_container {
  47 + position: relative;
  48 + height: calc(100% - 32px);
  49 + width: calc(50% - 32px);
  50 + padding: 16px;
  51 + background: #E0E0E0;
  52 + }
  53 +
  54 + #datasets_list_container #info {
  55 + position: relative;
  56 + height: calc(100% - 2px);
  57 + width: calc(100% - 2px);
  58 + border: 1px solid #B6B6B6;
  59 + border-radius: 2px;
  60 + background: #FFFFFF;
  61 + }
  62 +
  63 + #datasets_list_container #footer {
  64 + width: 100%;
  65 + height: 48px;
  66 + background: #B6B6B6;
  67 + display: flex;
  68 + flex-direction: row;
  69 + }
  70 +
  71 + #datasets_list_container .footer_block {
  72 + height: 24px;
  73 + padding: 12px 8px;
  74 + text-align: right;
  75 + }
  76 +
  77 + #datasets_list_container .footer_block:nth-child(1) {
  78 + width: 30%;
  79 + overflow: hidden;
  80 + white-space: nowrap;
  81 + text-overflow: ellipsis;
  82 + }
  83 +
  84 + #datasets_list_container .footer_block:nth-child(2) {
  85 + width: 40%;
  86 + height: 48px;
  87 + padding: 0 8px;
  88 + text-align: center;
  89 + }
  90 +
  91 + #datasets_list_container .footer_block:nth-child(3) {
  92 + width: 30%;
  93 + height: 40px;
  94 + padding: 4px 8px;
  95 + text-align: left;
  96 + }
  97 +
  98 + #datasets_list_container #info_header {
  99 + height: 24px;
  100 + padding: 12px;
  101 + text-align: center;
  102 + font-weight: 700;
  103 + color: #FFFFFF;
  104 + background: #2196F3;
  105 +
  106 + overflow: hidden;
  107 + white-space: nowrap;
  108 + text-overflow: ellipsis;
  109 +
  110 + border-bottom: 1px solid #B6B6B6;
  111 + }
  112 +
  113 + #datasets_list_container #info_body {
  114 + padding: 12px;
  115 + }
  116 +
  117 + #datasets_list_container br {
  118 + display: block;
  119 + margin-top: 8px;
  120 + content: " ";
  121 + }
  122 +
  123 + paper-input {
  124 + max-width: 288px;
  125 + --paper-input-container-focus-color: #2196F3;
  126 + }
  127 +
  128 + paper-menu {
  129 + padding: 0;
  130 + }
  131 +
  132 + paper-item {
  133 + cursor: pointer;
  134 + color: #000000;
  135 + margin: 4px;
  136 + padding: 0 12px;
  137 + border-radius: 2px;
  138 + border: 1px solid #B6B6B6;
  139 +
  140 + background: #FFFFFF;
  141 + }
  142 +
  143 + paper-item span {
  144 + width: 100%;
  145 + overflow: hidden;
  146 + white-space: nowrap;
  147 + text-overflow: ellipsis;
  148 + }
  149 +
  150 + paper-item.iron-selected {
  151 + background: #2196F3 !important;;
  152 + color: #FFFFFF;
  153 + /*font-weight: 700;*/
  154 + }
  155 +
  156 + paper-item:focus:before {
  157 + opacity: 0 !important;
  158 + background: white;
  159 + }
  160 +
  161 + paper-item:focus:after {
  162 + opacity: 0 !important;
  163 + background: white;
  164 + }
  165 +
  166 + paper-item:hover:not(.iron-selected) {
  167 + background: #BBDEFB !important;
  168 + }
  169 +
  170 + paper-icon-button{
  171 + height: 48px;
  172 + width: 48px;
  173 + padding: 0;
  174 + --paper-icon-button-ink-color: #FFFFFF;
  175 + }
  176 +
  177 + paper-icon-button:hover{
  178 + color: #2196F3;
  179 + }
  180 +
  181 + paper-icon-button.clear {
  182 + width: 24px;
  183 + height: 24px;
  184 + padding: 0 4px;
  185 + color: #F44336;
  186 + --paper-icon-button-ink-color: #FFFFFF;
  187 + }
  188 +
  189 + #datasets_list_container #spinner_container {
  190 + height: calc(100% - 49px);
  191 + width: 100%;
  192 + text-align: center;
  193 + display: none;
  194 + }
  195 +
  196 + paper-spinner {
  197 + top: calc(50% - 32px);
  198 + height: 64px;
  199 + width: 64px;
  200 +
  201 + --paper-spinner-stroke-width: 8px;
  202 +
  203 + --paper-spinner-layer-1-color: #2196F3;
  204 + --paper-spinner-layer-2-color: #F44336;;
  205 + --paper-spinner-layer-3-color: #FFEB3B;;
  206 + --paper-spinner-layer-4-color: #4CAF50;;
  207 + }
  208 +
  209 + </style>
  210 +
  211 + <div id="datasets_list_container">
  212 + <div id="list_info">
  213 + <div id="list_container">
  214 + <div id="menu_container">
  215 + <paper-menu id="menu">
  216 + <template is="dom-repeat" items="{{shownDatasets}}">
  217 + <paper-item id={{index}} title="{{item.resource_name}}" on-click="_selectDataset" style$="background: {{_getColorForItem(item)}};"><span>{{_getVersionedResourceName(item)}}</span></paper-item>
  218 + </template>
  219 + </paper-menu>
  220 + </div>
  221 + </div>
  222 + <div id="info_container">
  223 + <div id="info">
  224 + <div id="info_header"><span id="datasets_info"></span></div>
  225 + <div id="info_body"></div>
  226 + <div id="spinner_container">
  227 + <paper-spinner id="spinner"></paper-spinner>
  228 + </div>
  229 + </div>
  230 + </div>
  231 + </div>
  232 +
  233 + <div id="footer">
  234 + <div class="footer_block">
  235 + <span id="showing"></span> {{shownPrev}} <span id="to"></span> {{shownNext}} <span id="of"></span> {{length}} <span id="rows"></span>
  236 + </div>
  237 + <div class="footer_block">
  238 + <paper-icon-button id="slider_chevron_left" class="chevron-left" on-click="_onPrevClick" icon="chevron-left"></paper-icon-button>
  239 + <paper-icon-button id="slider_chevron_right" class="chevron-right" on-click="_onNextClick" icon="chevron-right"></paper-icon-button>
  240 + </div>
  241 + <div class="footer_block">
  242 + <paper-input id="filter" value={{filter}} no-label-float>
  243 + <iron-icon class="search" icon="search" prefix></iron-icon>
  244 + <paper-icon-button class="clear" suffix on-click="_clearInput" icon="clear"></paper-icon-button>
  245 + </paper-input>
  246 + </div>
  247 + </div>
  248 + </div>
  249 +
  250 + </template>
  251 +
  252 + <script>
  253 + HTMLImports.whenReady(function() {
  254 + Polymer({
  255 + is: 'datasets-list-controllet',
  256 +
  257 + properties: {
  258 +
  259 + datasets: {
  260 + type: Object,
  261 + value: undefined
  262 + },
  263 +
  264 + providers: {
  265 + type: Object,
  266 + value: undefined
  267 + },
  268 +
  269 + filter : {
  270 + type : String,
  271 + value : "",
  272 + observer : '_filter'
  273 + }
  274 +
  275 + },
  276 +
  277 +// _loadTreeMap : function(){
  278 +// this.async(function () {
  279 +// var h = $("#list_info").height();
  280 +// var w = $("#list_info").width();
  281 +//
  282 +// var data = JSON.stringify({result : {providers: this.providers, datasets: this.datasets}}).replace(/'/g, "");
  283 +//
  284 +// this.$.list_info.innerHTML = "<datasetexplorer-datalet data='"+data+"' width=\""+w+"\" height=\""+h+"\" fields='[\"provider_name\",\"organization_name\",\"package_name\",\"resource_name\",\"url\",\"w\",\"metas\"]'></datasetexplorer-datalet>";
  285 +// }, 100);
  286 +// },
  287 +//
  288 +// setProviders : function(providers) {
  289 +// this.providers = this._copy(providers);
  290 +// },
  291 +
  292 + ready : function() {
  293 + $(this.$.list_container).perfectScrollbar();
  294 + $(this.$.info).perfectScrollbar();
  295 +
  296 + this.step = 20;
  297 + this.version = true;
  298 + this.selectedItemId = -1;
  299 + },
  300 +
  301 + attached: function() {
  302 + this._translate();
  303 + },
  304 +
  305 + setDatasets : function(datasets) {
  306 + this.datasets = this._copy(datasets);
  307 +
  308 + this.prev = 1;
  309 + this.next = this.step;
  310 + this.length = this.datasets.length;
  311 +
  312 + this.shownPrev = Math.min(this.prev, this.length);
  313 + this.shownNext = Math.min(this.next, this.length);
  314 + this.shownDatasets = this.datasets.slice(this.prev-1, this.next);
  315 +
  316 + this._filter();
  317 + },
  318 +
  319 + showDatasetInfo : function() {
  320 + this.$.spinner_container.style.display = "none";
  321 + this.$.info_body.style.display = "block";
  322 + this.$.spinner.active = false;
  323 + },
  324 +
  325 + showVersion : function(flag) {
  326 + this.version = flag;
  327 + },
  328 +
  329 + _loadDatasetInfo : function() {
  330 + $(this.$.info).animate({ scrollTop: 0}, 0);
  331 + this.$.info_body.style.display = "none";
  332 + this.$.spinner_container.style.display = "block";
  333 + this.$.spinner.active = true;
  334 + },
  335 +
  336 + _onPrevClick : function(){
  337 + if(this.prev != 1) {
  338 + this.prev -= this.step;
  339 + this.next -= this.step;
  340 +
  341 + this.shownPrev = Math.min(this.prev, this.length);
  342 + this.shownNext = Math.min(this.next, this.length);
  343 + this.shownDatasets = this.datasets.slice(this.prev - 1, this.next);
  344 + }
  345 + $(this.$.list_container).animate({ scrollTop: 0}, 0);
  346 + this.$.menu.selected = -1;
  347 + },
  348 +
  349 + _onNextClick : function(){
  350 + if(this.next < this.length) {
  351 + this.prev += this.step;
  352 + this.next += this.step;
  353 +
  354 + this.shownPrev = Math.min(this.prev, this.length);
  355 + this.shownNext = Math.min(this.next, this.length);
  356 + this.shownDatasets = this.datasets.slice(this.prev - 1, this.next);
  357 + }
  358 + $(this.$.list_container).animate({ scrollTop: 0}, 0);
  359 + this.$.menu.selected = -1;
  360 + },
  361 +
  362 + _filter : function() {
  363 + this.debounce('_filter', function () {
  364 + if(this.datasets && this.datasets.length) {
  365 + var filter = this.filter.toLowerCase();
  366 +
  367 + if(filter == "")
  368 + this.shownDatasets = this.datasets;
  369 + else
  370 + this.shownDatasets = this.datasets.filter(function (el) {
  371 + return (el.resource_name.toLowerCase().indexOf(filter) > -1);
  372 + });
  373 +
  374 + this.prev = 1;
  375 + this.next = this.step;
  376 + this.length = this.shownDatasets.length;
  377 +
  378 + this.shownPrev = Math.min(this.prev, this.length);
  379 + this.shownNext = Math.min(this.next, this.length);
  380 + this.shownDatasets = this.shownDatasets.slice(this.prev - 1, this.next);
  381 +
  382 + $(this.$.list_container).animate({ scrollTop: 0}, 0);
  383 + this.$.menu.selected = -1;
  384 + }
  385 + }, 0);
  386 + },
  387 +
  388 + _clearInput : function() {
  389 + this.$.filter.value = "";
  390 + },
  391 +
  392 + _translate : function(){
  393 + this.$.datasets_info.innerHTML = ln["datasetsInfo_" + ln["localization"]];
  394 +
  395 + this.$.showing.innerHTML = ln["showing_" + ln["localization"]];
  396 + this.$.to.innerHTML = ln["to_" + ln["localization"]];
  397 + this.$.of.innerHTML = ln["of_" + ln["localization"]];
  398 +
  399 + this.$.filter.setAttribute("label", ln["search_" + ln["localization"]]);
  400 + },
  401 +
  402 + _selectDataset : function(){
  403 + var id = this.$.menu.selectedItem.id;
  404 + if(id == this.selectedItemId)
  405 + return;
  406 +
  407 + this.selectedItemId = id;
  408 +
  409 + this._loadDatasetInfo();
  410 +
  411 + var dataset = this.shownDatasets[id];
  412 +
  413 + var html = '';
  414 +
  415 + var users = dataset.users;
  416 + var metas = JSON.parse(dataset.metas);
  417 +
  418 + if(users) {
  419 + html += '<b>users:</b><div class="user_icons" style="display: flex; flex-direction: row;">';
  420 + for(var j in users) {
  421 + html += '<a href="' + users[j].href + '">';
  422 + html += '<div class="user_icon" style="background-image: url(' + users[j].src + '); background-size: 40px 40px; height:40px; width:40px; border-radius: 50%; cursor: pointer; margin-right: 12px;" title="' + users[j].user + '"></div>';
  423 + html += '</a>';
  424 +
  425 + }
  426 + html += '</div>';
  427 + html += '<b> version:</b> ' + dataset.version + '<br>';
  428 + }
  429 +
  430 + for(var i in metas)
  431 + html += '<b>' + i + ':</b> ' + metas[i] + '<br>';
  432 +
  433 +// this.$.info_header.innerHTML = this._getVersionedResourceName(dataset);
  434 + this.$.info_header.innerHTML = dataset.resource_name;
  435 + this.$.info_body.innerHTML = html;
  436 +
  437 + this.fire("datasets-list-controllet_dataset", { dataset: dataset });
  438 + },
  439 +
  440 + _getVersionedResourceName : function(dataset){
  441 + if(this.version && dataset.version)
  442 +// return dataset.resource_name + ' [' + ln["Version_" + ln["localization"]] + ' ' + dataset.version + ']';
  443 + return dataset.resource_name + ' [VER ' + dataset.version + ']';
  444 + return dataset.resource_name;
  445 + },
  446 +
  447 + _getColorForItem : function(item) {
  448 + if(!item.provider_name)
  449 + return "#FFEB3B";
  450 + },
  451 +
  452 + _copy : function(o) {
  453 + var out, v, key;
  454 + out = Array.isArray(o) ? new Array(o.length) : {};
  455 + for (key in o) {
  456 + v = o[key];
  457 + out[key] = (typeof v === "object") ? this._copy(v) : v;
  458 + }
  459 + return out;
  460 + }
  461 +
  462 + });
  463 + });
  464 + </script>
  465 +</dom-module>
0 466 \ No newline at end of file
... ...
controllets/datasets-list-controllet/demo/index.html 0 โ†’ 100644
  1 +<html>
  2 +
  3 +<head>
  4 + <script src="../../shared_js/jquery-1.11.2.min.js"></script>
  5 +
  6 + <script src="../../../bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
  7 +
  8 + <script src="../../shared_js/perfect-scrollbar/js/min/perfect-scrollbar.jquery.min.js"></script>
  9 + <link rel="stylesheet" href="../../shared_js/perfect-scrollbar/css/perfect-scrollbar.min.css">
  10 +
  11 + <script src="../../../locales/controllet_ln.js"></script>
  12 + <script>
  13 + ln["localization"] = "en";
  14 + </script>
  15 +
  16 + <link rel="import" href="../datasets-list-controllet.html" />
  17 +</head>
  18 +
  19 +<body>
  20 +
  21 +<style>
  22 +
  23 + .container {
  24 + width: 1200px;
  25 + height: 600px;
  26 + position: relative;
  27 + top: 96px;
  28 + left: calc((100% - 1200px) / 2);
  29 + }
  30 +
  31 +</style>
  32 +
  33 +<div class="container">
  34 + <datasets-list-controllet datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'></datasets-list-controllet>
  35 +
  36 + <!--<select-dataset-controllet id="ds" datasets="we"></select-dataset-controllet>-->
  37 +
  38 + <!--<select-dataset-controllet id="ds" datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 2","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b056c5e6-76af-4526-a35d-7dee664fb6ee\/download\/isislab.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/818c2edb-0cb7-4288-b340-e4dd1933d817\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) ROUTE-TO-PA Dissemination - dl","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/fd8c4d6f-315d-4aa0-b7bd-4fdde7bf641b\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","resource_name":"First year (2015) dissemination of ROUTE-TO-PA project","url":"http:\/\/ckan.routetopa.eu\/dataset\/d81d451d-8b3d-47f4-b57f-e295e8f51da0\/resource\/b0ef6017-8c64-4e11-8046-7e51a8561856\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link-Upd.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"test dissemination with link","resource_name":"Year 1 Dissemination of the ROUTE-TO-PA project (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/ba5054af-7561-4f99-9504-76ea004a1e85\/resource\/4cc2349d-bf7b-4bbe-a7ca-db5312bb6c94\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New-&#45;&#45;Link.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"ROUTE-TO-PA","package_name":"Dissemination activity of the first year","resource_name":"Dissemination activity of the first year (2015)","url":"http:\/\/ckan.routetopa.eu\/dataset\/61f07087-210a-4c35-9606-2aafe183633b\/resource\/5f9d8d8b-1c41-45f7-9dbb-61b9a7bcd076\/download\/ROUTE-TO-PA-Individual-Dissemination-Activity-Report-Form-Responses-New.csv","metas":"{\"organization\":\"ROUTE-TO-PA\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"},{"w":1,"provider_name":"p:1","organization_name":"City of the Hague Municipality","package_name":"Test 3- Buurten","resource_name":"Test Buurten - 3","url":"http:\/\/ckan.routetopa.eu\/dataset\/1248d447-2901-4beb-91ae-c2f249fd8a99\/resource\/1fdbc765-8945-4271-8dce-9c7eba45a67d\/download\/Test-3-Compare.csv","metas":"{\"organization\":\"City of the Hague Municipality\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'-->
  39 + <!--suggested-datasets='[{"resource_name":"SUGGESTED 1","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 2","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"},{"resource_name":"SUGGESTED 3","url":"noUrl.csv","metas":"{\"description\":\"noDescriione\"}"}]'-->
  40 + <!--<select-dataset-controllet id="ds" datasets='{"result":{"providers":{"1":{"title":"CKAN","api_url":"http:\/\/ckan.routetopa.eu","image_hash":"11","id":"1"}},"datasets":[{"w":1,"provider_name":"p:1","organization_name":"Dublin","package_name":"isislab DATA","resource_name":"Resource 1","url":"http:\/\/ckan.routetopa.eu\/dataset\/566c2867-ea89-45a2-bd7a-30ae82606007\/resource\/b3d3d9ff-291e-47ca-a0d2-a15deef81737\/download\/isislab2.csv","metas":"{\"organization\":\"Dublin\",\"description\":\"\",\"format\":\"\",\"last_modified\":\"\",\"name\":\"\",\"created\":\"\"}"}]}}'></select-dataset-controllet>-->
  41 +</div>
  42 +
  43 +<script>
  44 + var description = "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa "+
  45 + " aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa "+
  46 + " aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa "+
  47 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  48 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  49 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  50 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  51 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  52 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  53 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  54 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  55 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  56 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  57 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  58 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  59 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa"+
  60 + "aaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa aaaaaaaaaaaa aaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaa";
  61 +
  62 + var dataset1 = {description: description, name: "Data", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=c3b52992-ba61-4a73-a637-0f2e1ca26aab"};
  63 + var dataset2 = {description: "", name: "Klassen", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=dfd27de5-0790-466c-af59-6a82509e7fbb"};
  64 + var dataset3 = {description: "descrizione bellissima purissima levissima sbiricuda antani", name: "Derelict Sites", url: "http://ckan.routetopa.eu/api/action/datastore_search?resource_id=fcbee83e-3d3d-4303-a568-24dd33d02adc"};
  65 + var datasets = [dataset1, dataset2, dataset3];
  66 + var datasets = [dataset1, dataset2, dataset3, dataset1, dataset2, dataset3, dataset1, dataset2, dataset3, dataset1, dataset2, dataset3, dataset1, dataset2, dataset3];
  67 +
  68 + // var ds = document.getElementById('ds');
  69 + // ds.setAttribute("items", JSON.stringify(datasets));
  70 + // ds.setAttribute("items", a);
  71 +
  72 +</script>
  73 +
  74 +</body>
  75 +
  76 +</html>
... ...
controllets/select-dataset-controllet/select-dataset-controllet.html
1 1 <link rel="import" href="../../bower_components/polymer/polymer.html">
2 2  
  3 +<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
3 4 <link rel="import" href="../../bower_components/paper-tabs/paper-tabs.html">
4 5 <link rel="import" href="../../bower_components/paper-tabs/paper-tab.html">
5   -
6   -<link rel="import" href="../../bower_components/neon-animation/neon-animation.html">
7   -<link rel="import" href="../../bower_components/neon-animation/neon-animatable.html">
8   -<link rel="import" href="../../bower_components/neon-animation/neon-animations.html">
9   -
10   -<link rel="import" href="../../bower_components/iron-flex-layout/iron-flex-layout.html">
11   -<!--<link rel="import" href="../../bower_components/app-layout/app-toolbar/app-toolbar.html">-->
12   -<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
13   -<link rel="import" href="../../bower_components/paper-styles/color.html">
14   -<link rel="import" href="../../bower_components/paper-styles/typography.html">
15   -<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
16   -<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">
17   -<link rel="import" href="../../bower_components/iron-image/iron-image.html">
18   -<link rel="import" href="../../bower_components/iron-list/iron-list.html">
19   -
20 6 <link rel="import" href="../../bower_components/paper-dropdown-menu/paper-dropdown-menu.html">
21 7 <link rel="import" href="../../bower_components/paper-menu/paper-menu.html">
22 8 <link rel="import" href="../../bower_components/paper-item/paper-item.html">
  9 +<link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">
  10 +<link rel="import" href="../../bower_components/paper-tooltip/paper-tooltip.html">
23 11  
24   -<link rel="import" href="../../bower_components/paper-input/paper-input.html">
25   -
26   -<link rel="import" href="../../bower_components/paper-input/paper-textarea.html">
27   -
28   -<link rel="import" href="../../bower_components/paper-material/paper-material.html" />
29   -
30   -<link rel="import" href="../../bower_components/paper-icon-button/paper-icon-button.html">
31   -<link rel="import" href="../../bower_components/iron-icons/hardware-icons.html">
32   -<!--<link rel="import" href="../../bower_components/iron-icons/iron-icons.html">-->
33   -
34   -<link rel="import" href="../../bower_components/paper-checkbox/paper-checkbox.html">
35   -
36   -<link rel="import" href="../providers-utility-controllet/providers-utility-controllet.html">
37   -<link rel="import" href="ortelio-controllet.html">
38   -<link rel="import" href="../../datalets/datasetexplorer-datalet/datasetexplorer-datalet.html">
  12 +<link rel="import" href="../datasets-list-controllet/datasets-list-controllet.html">
39 13  
40 14 <dom-module id="select-dataset-controllet">
41 15 <template>
42 16 <style>
43   - :host {
44   - --paper-dropdown-menu-icon: {
45   - color: #000000;
46   - };
47   - --paper-dropdown-menu-ripple: {
48   - color: #FFFFFF;
49   - };
50   - /*--paper-tab-ink: {*/
51   - /*color: #FFFFFF;*/
52   - /*};*/
53   - }
54   -
55   - iron-list {
56   - --iron-list-items-container: {
57   - margin:16px 16px 8px 16px;
58   - };
59   - }
60 17  
61   - paper-textarea {
62   - width: 100%;
63   - --paper-input-container-focus-color: #2196F3;
64   - }
65   -
66   - paper-input {
67   - --paper-input-container-focus-color: #2196F3;
68   - }
69   - paper-dropdown-menu {
70   - width: 100%;
71   - --paper-input-container-focus-color: #2196F3;
  18 + #select_dataset_container {
  19 + margin-top: 8px;
72 20 }
73 21  
74   - paper-item.iron-selected {
75   - background-color: #2196F3;
76   - color: #FFFFFF;
  22 + #select_dataset_container * {
  23 + font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  24 + font-size: 16px;
  25 + line-height: 24px;
77 26 }
78 27  
79   - paper-checkbox {
80   - height: 24px;
81   - /*margin-top: 8px*/
82   - --paper-checkbox-checked-color: #2196F3;
83   - --paper-checkbox-checked-ink-color: #FFFFFF;
84   - --paper-checkbox-unchecked-color: #000000;
85   - --paper-checkbox-unchecked-ink-color: #FFFFFF;
86   - --paper-checkbox-label-color: #000000;
87   - }
  28 + #select_dataset_container #options {
  29 + display: flex;
  30 + flex-direction: row;
88 31  
89   - paper-icon-button{
90 32 height: 48px;
91   - width: 48px;
92   - padding: 0px;
93   - --paper-icon-button-ink-color: #FFFFFF;
94   - }
95   -
96   - paper-icon-button:hover{
97   - color: #2196F3;
98   - }
99   -
100   - paper-icon-button[disabled]{
101   - color: #B6B6B6;
102   - }
  33 + padding: 0;
  34 + font-weight: 700;
  35 + background: #B6B6B6;
103 36  
104   - paper-icon-button.clear {
105   - width: 24px;
106   - height: 24px;
107   - padding: 0px 4px;
108   - color: #F44336;
109   - --paper-icon-button-ink-color: #FFFFFF;
110   - }
  37 + margin-top: 2px;
111 38  
112   - paper-tabs {
113   - font-weight: bold;
  39 + overflow: hidden;
114 40 }
115 41  
116   - paper-tab {
117   - transition: all 1.0s;
118   - }
119   -
120   - paper-tab.iron-selected {
121   - background-color: #2196F3;
122   - color: #FFFFFF;
123   - }
124   -
125   - paper-tab:not(.iron-selected):hover {
126   - color: #2196F3;
  42 + #select_dataset_container #options_header {
  43 + width: calc(100% - 96px);
  44 + text-align: center;
  45 + padding: 12px 0 12px 48px;
127 46 }
128 47  
129   - .item {
130   - /*@apply(--layout-horizontal);*/
131   - display: flex;
132   - padding: 11px;
133   - border: 1px solid #B6B6B6;
134   - border-radius: 4px;
135   - cursor: pointer;
136   - margin-bottom: 8px;
137   - background-color: #E0E0E0;
138   - }
  48 + #select_dataset_container .header_block {
  49 + width: calc((100% - 48px) / 2);
  50 + max-width: 400px;
  51 + margin-left: 12px;
139 52  
140   - .item.expanded {
141   - /*border: 2px solid #2196F3;*/
142   - border-color: #2196F3;
143   - }
  53 + line-height: 40px;
144 54  
145   - .pad {
146   - @apply(--layout-flex);
147   - /*@apply(--layout-vertical);*/
  55 + display: none;
148 56 }
149 57  
150   - .primary {
151   - font-weight: bold;
152   - }
  58 + #select_dataset_container #url {
  59 + padding: 0 12px 12px 12px;
  60 + height: 60px;
153 61  
154   - .item.expanded .primary {
155   - color: #2196F3;
  62 + border: 2px solid #B6B6B6;
  63 + border-top: 0;
156 64 }
157 65  
158   - .longText {
159   - display: none;
  66 + #select_dataset_container #datasets_list_container {
  67 + height: calc(100% - 96px - 2px - 74px);
  68 + width: 100%;
160 69 }
161 70  
162   - .item.expanded .longText {
163   - display: block;
  71 + paper-tabs {
  72 + background: #B6B6B6;
164 73 }
165 74  
166   - #select_dataset_container {
167   - margin-top: 8px;
  75 + paper-tab {
  76 + font-weight: 700;
  77 + border-right: 2px solid #FFFFFF;
168 78 }
169 79  
170   - #select_dataset_container * {
171   - font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
172   - font-size: 16px;
173   - line-height: 24px;
  80 + paper-tab:nth-child(2) {
  81 + border-right: 0;
174 82 }
175 83  
176   - #select_dataset_container #neon_container {
177   - height: calc(100% - 172px);
178   - width: calc(100% - 8px);
  84 + paper-tab.iron-selected {
  85 + color: #FFFFFF;
  86 + background: #2196F3;;
179 87 }
180 88  
181   - #select_dataset_container #list_info {
182   - display: flex;
183   - height: calc(100% - 48px);
184   - width: calc(100% + 8px);/*bad*/
  89 + paper-tab:not(.iron-selected):hover {
  90 + color: #2196F3;
185 91 }
186 92  
187   - #select_dataset_container #list_container {
188   - position: relative;
189   - height: 100%;
190   - width: 50%;
191   - border-left: 4px solid #B6B6B6;
  93 + paper-input {
  94 + --paper-input-container-focus-color: #2196F3;
192 95 }
193 96  
194   - #select_dataset_container #info_container {
195   - position: relative;
196   - height: 100%;
197   - width: 50%;
198   - border-right: 4px solid #B6B6B6;
  97 + paper-icon-button {
  98 + height: 48px;
  99 + width: 48px;
  100 + padding: 8px;
199 101 }
200 102  
201   - #select_dataset_container #info {
202   - position: relative;
203   - height: calc(100% - 56px);
204   - width: calc(100% - 56px);
205   - padding: 11px;
206   - border: 1px solid #B6B6B6;
207   - border-radius: 4px;
208   - background-color: #E0E0E0;
209   - margin: 16px;
210   - }
  103 + paper-icon-button[icon="settings"] {
  104 + cursor: pointer;
  105 + color: #00BCD4;
  106 + --paper-icon-button-ink-color: #00BCD4;
211 107  
212   - #select_dataset_container #treemap_container {
213   - /*height: calc(100% - 244px);*/
214   - /*width: calc(100% - 8px);*/
215   - height: calc(100% - 48px);
216   - width: 100%;
217   - border: 4px solid #B6B6B6;
218   - border-top: 0px;
219   - border-bottom: 0px;
220   - position: relative;
  108 + background: #E0E0E0;
  109 + float: right;
  110 + position: absolute;
  111 + right: 0;
221 112 }
222 113  
223   - #select_dataset_container #header {
224   - position: relative;
225   - z-index: 1;
226   - -webkit-box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
227   - -moz-box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
228   - box-shadow: 0 30px 24px -12px rgba(0, 0, 0, 0.14), 0 20px 30px -9px rgba(0, 0, 0, 0.12), 0 20px 10px -19px rgba(0, 0, 0, 0.4);
229   -
230   - background-color: #B6B6B6;
231   - display: flex;
232   - padding: 0px 4px;
  114 + paper-icon-button[icon="info-outline"] {
  115 + cursor: help;
233 116 }
234 117  
235   - #select_dataset_container #footer_list {
236   - position: relative;
237   - z-index: 1;
238   - -webkit-box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
239   - -moz-box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
240   - box-shadow: 0 -30px 24px -12px rgba(0, 0, 0, 0.14), 0 -20px 30px -9px rgba(0, 0, 0, 0.12), 0 -20px 10px -19px rgba(0, 0, 0, 0.4);
  118 + :host {
  119 + --paper-dropdown-menu-icon: {
  120 + color: #000000;
  121 + };
  122 + --paper-dropdown-menu-ripple: {
  123 + color: #FFFFFF;
  124 + };
241 125 }
242 126  
243   - .noshadow {
244   - -webkit-box-shadow: none !important;
245   - -moz-box-shadow: none !important;
246   - box-shadow: none !important;
  127 + paper-dropdown-menu {
  128 + width: 200px;
  129 + --paper-input-container-focus-color: #2196F3;
247 130 }
248 131  
249   - #select_dataset_container #footer_list,
250   - #select_dataset_container #footer_treemap {
251   - width: 100%;
252   - background-color: #B6B6B6;
253   - display: flex;
254   - padding: 0px 4px;
  132 + paper-item {
  133 + min-width: 128px;
  134 + white-space: nowrap;
255 135 }
256 136  
257   - #select_dataset_container #url {
258