diff --git a/app/views/category/categorySelectionModal.scala.html b/app/views/category/categorySelectionModal.scala.html index ec8742c..b4ba7d3 100644 --- a/app/views/category/categorySelectionModal.scala.html +++ b/app/views/category/categorySelectionModal.scala.html @@ -34,12 +34,12 @@ var typeaheadData = data.map( function(item, index) { return {name: item._id.$oid, label: item.name}; }); - populateFieldTypeahed( - $('#categoryTypeahead'), - $('#categoryId'), - typeaheadData, - @FilterShowFieldStyle.LabelsOnly.id - ); + populateFieldTypeahead({ + typeaheadElement: $('#categoryTypeahead'), + fieldNameElement: $('#categoryId'), + fieldNameAndLabels: typeaheadData, + showOption: @FilterShowFieldStyle.LabelsOnly.id + }); }, error: function(data){ showErrorResponse(data) diff --git a/app/views/category/edit.scala.html b/app/views/category/edit.scala.html index 787428e..d21b620 100644 --- a/app/views/category/edit.scala.html +++ b/app/views/category/edit.scala.html @@ -41,12 +41,12 @@ } diff --git a/app/views/category/treeChart.scala.html b/app/views/category/treeChart.scala.html index a508973..feff638 100644 --- a/app/views/category/treeChart.scala.html +++ b/app/views/category/treeChart.scala.html @@ -8,10 +8,10 @@ implicit request: Request[_], webJarAssets: WebJarAssets ) - + - +
} - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/chart/highcharts/highchartsJsImportForBulkExport.scala.html b/app/views/chart/highcharts/highchartsJsImportForBulkExport.scala.html index 37a6b6f..7a230fa 100644 --- a/app/views/chart/highcharts/highchartsJsImportForBulkExport.scala.html +++ b/app/views/chart/highcharts/highchartsJsImportForBulkExport.scala.html @@ -3,4 +3,4 @@ @()(implicit webJarAssets: WebJarAssets) - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/dataset/cluster.scala.html b/app/views/dataset/cluster.scala.html index 864f470..a855802 100644 --- a/app/views/dataset/cluster.scala.html +++ b/app/views/dataset/cluster.scala.html @@ -38,12 +38,12 @@ var typeaheadData = data.map(function (item, index) { return {name: item._id.$oid, label: item.name}; }); - populateFieldTypeahed( - $('#mlModelTypeahead'), - $('#mlModelId'), - typeaheadData, - @FilterShowFieldStyle.LabelsOnly.id - ); + populateFieldTypeahead({ + typeaheadElement: $('#mlModelTypeahead'), + fieldNameElement: $('#mlModelId'), + fieldNameAndLabels: typeaheadData, + showOption: @FilterShowFieldStyle.LabelsOnly.id + }); } }); diff --git a/app/views/dataset/cumulativeCount.scala.html b/app/views/dataset/cumulativeCount.scala.html index 963cd13..6e4a527 100644 --- a/app/views/dataset/cumulativeCount.scala.html +++ b/app/views/dataset/cumulativeCount.scala.html @@ -50,8 +50,8 @@ $('#inputDiv #groupFieldTypeahead').keypress(function (e) { if (e.which == 13) { - var groupFieldTypeahedVal = $('#inputDiv #groupFieldTypeahead').val(); - if (!groupFieldTypeahedVal) + var groupFieldTypeaheadVal = $('#inputDiv #groupFieldTypeahead').val(); + if (!groupFieldTypeaheadVal) $('#inputDiv #groupFieldName').val(""); calcCumulativeCount(); diff --git a/app/views/dataset/dataSetExportDropdown.scala.html b/app/views/dataset/dataSetExportDropdown.scala.html index 19c3ea8..3467406 100644 --- a/app/views/dataset/dataSetExportDropdown.scala.html +++ b/app/views/dataset/dataSetExportDropdown.scala.html @@ -131,8 +131,20 @@ success: function (fieldNameAndLabels) { var fieldNamesAndLabelsWithNone = fieldNameAndLabels.concat([["", "[None]"]]) - populateFieldTypeahed($('#exportTranSMARTDataModal #visitFieldTypeahead'), $('#exportTranSMARTDataModal #visitFieldName'), fieldNamesAndLabelsWithNone, showOption, true); - populateFieldTypeahed($('#exportTranSMARTMappingModal #visitFieldTypeahead'), $('#exportTranSMARTMappingModal #visitFieldName'), fieldNamesAndLabelsWithNone, showOption, true); + populateFieldTypeahead({ + typeaheadElement: $('#exportTranSMARTDataModal #visitFieldTypeahead'), + fieldNameElement: $('#exportTranSMARTDataModal #visitFieldName'), + fieldNameAndLabels: fieldNamesAndLabelsWithNone, + showOption, + initSelectByNameElement: true + }); + populateFieldTypeahead({ + typeaheadElement: $('#exportTranSMARTMappingModal #visitFieldTypeahead'), + fieldNameElement: $('#exportTranSMARTMappingModal #visitFieldName'), + fieldNameAndLabels: fieldNamesAndLabelsWithNone, + showOption, + initSelectByNameElement: true + }); }, error: showErrorResponse }); diff --git a/app/views/dataset/datasetJsImport.scala.html b/app/views/dataset/datasetJsImport.scala.html index 6394be0..dfae733 100644 --- a/app/views/dataset/datasetJsImport.scala.html +++ b/app/views/dataset/datasetJsImport.scala.html @@ -1,3 +1,3 @@ @import org.incal.play.routes.CustomDirAssets - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/dataset/distribution.scala.html b/app/views/dataset/distribution.scala.html index 19c92da..f9c6bbb 100644 --- a/app/views/dataset/distribution.scala.html +++ b/app/views/dataset/distribution.scala.html @@ -77,8 +77,8 @@ $('#inputDiv #groupFieldTypeahead').keypress(function (e) { if (e.which == 13) { - var groupFieldTypeahedVal = $('#inputDiv #groupFieldTypeahead').val(); - if (!groupFieldTypeahedVal) + var groupFieldTypeaheadVal = $('#inputDiv #groupFieldTypeahead').val(); + if (!groupFieldTypeaheadVal) $('#inputDiv #groupFieldName').val("") calcDistribution(); return false; diff --git a/app/views/dataset/heatmap.scala.html b/app/views/dataset/heatmap.scala.html index bfe14c0..7fb5c0f 100644 --- a/app/views/dataset/heatmap.scala.html +++ b/app/views/dataset/heatmap.scala.html @@ -29,8 +29,8 @@ @bottomResources = { - - + + @helper.javascriptRouter("dataSetJsRoutes")( dataSetJsRouter.calcHeatmap, @@ -64,8 +64,8 @@ $('#inputDiv #valueFieldTypeahead').keypress(function (e) { if (e.which == 13) { - var valueFieldTypeahedVal = $('#inputDiv #valueFieldTypeahead').val(); - if (!valueFieldTypeahedVal) + var valueFieldTypeaheadVal = $('#inputDiv #valueFieldTypeahead').val(); + if (!valueFieldTypeaheadVal) $('#inputDiv #valueFieldName').val("") calcHeatmap(); diff --git a/app/views/dataset/matthewsCorrelation.scala.html b/app/views/dataset/matthewsCorrelation.scala.html index a3939fe..c34920a 100644 --- a/app/views/dataset/matthewsCorrelation.scala.html +++ b/app/views/dataset/matthewsCorrelation.scala.html @@ -34,8 +34,8 @@ @bottomResources = { - - + + @helper.javascriptRouter("dataSetJsRoutes")( dataSetJsRouter.calcMatthewsCorrelations, diff --git a/app/views/dataset/pearsonCorrelation.scala.html b/app/views/dataset/pearsonCorrelation.scala.html index e28c5cb..f6f9147 100644 --- a/app/views/dataset/pearsonCorrelation.scala.html +++ b/app/views/dataset/pearsonCorrelation.scala.html @@ -30,8 +30,8 @@ @bottomResources = { - - + + @helper.javascriptRouter("dataSetJsRoutes")( dataSetJsRouter.calcPearsonCorrelations, diff --git a/app/views/dataset/processSeries.scala.html b/app/views/dataset/processSeries.scala.html index c02bde4..ffd59d4 100644 --- a/app/views/dataset/processSeries.scala.html +++ b/app/views/dataset/processSeries.scala.html @@ -55,12 +55,12 @@ - + + @helper.javascriptRouter("dataSetJsRoutes")( dataSetJsRouter.calcScatter, @@ -66,8 +66,8 @@ $('#inputDiv #groupOrValueFieldTypeahead').keypress(function (e) { if (e.which == 13) { - var groupOrValueFieldTypeahedVal = $('#inputDiv #groupOrValueFieldTypeahead').val(); - if (!groupOrValueFieldTypeahedVal) + var groupOrValueFieldTypeaheadVal = $('#inputDiv #groupOrValueFieldTypeahead').val(); + if (!groupOrValueFieldTypeaheadVal) $('#inputDiv #groupOrValueFieldName').val("") calcScatter(); diff --git a/app/views/dataset/transformSeries.scala.html b/app/views/dataset/transformSeries.scala.html index 9558436..13d7d11 100644 --- a/app/views/dataset/transformSeries.scala.html +++ b/app/views/dataset/transformSeries.scala.html @@ -54,12 +54,12 @@ \ No newline at end of file diff --git a/app/views/datasettrans/filterDataSetElements.scala.html b/app/views/datasettrans/filterDataSetElements.scala.html index 9799812..2ebd7a7 100644 --- a/app/views/datasettrans/filterDataSetElements.scala.html +++ b/app/views/datasettrans/filterDataSetElements.scala.html @@ -56,7 +56,12 @@ dataSetTransformationJsRoutes2.org.ada.web.controllers.dataset.datatrans.DataSetTransformationController.filterIdAndNames(dataSetId).ajax({ success: function (data) { - populateIdNameTypeahed($('#filterTypeahead'), $('#filterId'), data, true) + populateIdNameTypeahead({ + typeaheadElement: $('#filterTypeahead'), + idElement: $('#filterId'), + idNames: data, + initSelectByNameElement: true + }) }, error: showErrorResponse }) diff --git a/app/views/datasettrans/mergeFullyMultiDataSetsElements.scala.html b/app/views/datasettrans/mergeFullyMultiDataSetsElements.scala.html index 6df48e0..55b43e7 100644 --- a/app/views/datasettrans/mergeFullyMultiDataSetsElements.scala.html +++ b/app/views/datasettrans/mergeFullyMultiDataSetsElements.scala.html @@ -38,12 +38,12 @@ - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/filter/jsTreeImport.scala.html b/app/views/filter/jsTreeImport.scala.html index 0ff4744..8cbc412 100644 --- a/app/views/filter/jsTreeImport.scala.html +++ b/app/views/filter/jsTreeImport.scala.html @@ -2,7 +2,7 @@ @()(implicit webJarAssets: WebJarAssets) - + - - \ No newline at end of file + + \ No newline at end of file diff --git a/app/views/layout/dataSets.scala.html b/app/views/layout/dataSets.scala.html index ebcb9dd..a7f1cac 100644 --- a/app/views/layout/dataSets.scala.html +++ b/app/views/layout/dataSets.scala.html @@ -70,11 +70,11 @@ - + @if(topResources.isDefined) { @topResources.get } diff --git a/app/views/mlRun/create.scala.html b/app/views/mlRun/create.scala.html index d596dcf..a9b4f72 100644 --- a/app/views/mlRun/create.scala.html +++ b/app/views/mlRun/create.scala.html @@ -59,13 +59,13 @@ var nameElement = $('#inputDiv #' + fieldPrefix + 'Name'); var focusFun = (isFocus) ? function() {setTimeout(function(){ $(typeaheadElement).focus();}, 250)} : null - populateFieldTypeahedFromUrl( + populateFieldTypeaheadFromUrl({ typeaheadElement, - nameElement, + fieldNameElement: nameElement, url, - @setting.filterShowFieldStyle.getOrElse(FilterShowFieldStyle.NamesAndLabels).id, - focusFun - ) + showOption: @setting.filterShowFieldStyle.getOrElse(FilterShowFieldStyle.NamesAndLabels).id, + postFunction: focusFun + }) } function populateIdLabelTypeaheadFromUrl(fieldPrefix, url, isFocus) { @@ -79,12 +79,12 @@ var typeaheadData = data.map(function (item, index) { return {name: item._id.$oid, label: item.name}; }); - populateFieldTypeahed( - typeaheadElement, - idElement, - typeaheadData, - @FilterShowFieldStyle.LabelsOnly.id - ); + populateFieldTypeahead({ + typeaheadElement: typeaheadElement, + fieldNameElement: idElement, + fieldNameAndLabels: typeaheadData, + showOption: @FilterShowFieldStyle.LabelsOnly.id + }); } }); } diff --git a/app/views/mlRun/inputFieldAndFilterResources.scala.html b/app/views/mlRun/inputFieldAndFilterResources.scala.html index b9f9e8b..fa7d25e 100644 --- a/app/views/mlRun/inputFieldAndFilterResources.scala.html +++ b/app/views/mlRun/inputFieldAndFilterResources.scala.html @@ -15,12 +15,12 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/app/views/typeaheadJsImport.scala.html b/app/views/typeaheadJsImport.scala.html index 8b24b79..5f9444b 100644 --- a/app/views/typeaheadJsImport.scala.html +++ b/app/views/typeaheadJsImport.scala.html @@ -2,5 +2,5 @@ @()(implicit webJarAssets: WebJarAssets) - + \ No newline at end of file diff --git a/app/views/typeaheadSelectionModal.scala.html b/app/views/typeaheadSelectionModal.scala.html index de352b1..db10095 100644 --- a/app/views/typeaheadSelectionModal.scala.html +++ b/app/views/typeaheadSelectionModal.scala.html @@ -30,7 +30,7 @@ var typeaheadElement = $('#@{modalId} #@{itemId}Typeahead'); var idElement = $('#@{modalId} #@{itemId}Id') - populateIdNameTypeahedFromUrl(typeaheadElement, idElement, '@Html(idAndNamesCall.url)'); + populateIdNameTypeaheadFromUrl({typeaheadElement, idElement, url: '@Html(idAndNamesCall.url)'}); $("#@{modalId}").on('shown.bs.modal', function () { typeaheadElement.focus(); diff --git a/app/views/user/dataSetTypeahead.scala.html b/app/views/user/dataSetTypeahead.scala.html index db8bca7..a67a5de 100644 --- a/app/views/user/dataSetTypeahead.scala.html +++ b/app/views/user/dataSetTypeahead.scala.html @@ -27,11 +27,11 @@ \ No newline at end of file diff --git a/app/views/user/elements.scala.html b/app/views/user/elements.scala.html index f442fbc..9a94195 100644 --- a/app/views/user/elements.scala.html +++ b/app/views/user/elements.scala.html @@ -153,12 +153,12 @@ handleModalButtonEnterPressed("addCustomDataSetPermissionModal", "addCustomDataSetPermissionSubmitButton", addCustomDataSetPermission, true) $("#permission-controller").val("") - populateFieldTypeahedFromUrl( - $('#classNameTypeahead'), - $('#className'), - '@Html(routes.RunnableController.getRunnableNames().url)', - @FilterShowFieldStyle.LabelsOnly.id - ) + populateFieldTypeaheadFromUrl({ + typeaheadElement: $('#classNameTypeahead'), + fieldNameElement: $('#className'), + url: '@Html(routes.RunnableController.getRunnableNames().url)', + showOption: @FilterShowFieldStyle.LabelsOnly.id + }) $('#addRunnablePermissionModal #classNameTypeahead').on("keydown", function(e) { if(e.keyCode == 13) { diff --git a/build.sbt b/build.sbt index d72e2f3..fdf7ec7 100644 --- a/build.sbt +++ b/build.sbt @@ -88,17 +88,10 @@ mappings in (Compile, packageBin) ~= { _.filter(!_._1.getName.endsWith("custom.c // Asset stages -pipelineStages in Assets := Seq(closure, cssCompress, digest, gzip) +pipelineStages in Assets := Seq(digest, gzip) excludeFilter in gzip := (excludeFilter in gzip).value || new SimpleFileFilter(file => new File(file.getAbsolutePath + ".gz").exists) -includeFilter in closure := (includeFilter in closure).value && new SimpleFileFilter(f => f.getPath.contains("javascripts")) - -includeFilter in cssCompress := (includeFilter in cssCompress).value && new SimpleFileFilter(f => f.getPath.contains("stylesheets")) - -//includeFilter in uglify := GlobFilter("javascripts/*.js") - - // For licenses not automatically downloaded (need to list them manually) licenseOverrides := { case diff --git a/conf/core/spark-ml.conf b/conf/core/spark-ml.conf index 9cc0b85..c14c4d0 100644 --- a/conf/core/spark-ml.conf +++ b/conf/core/spark-ml.conf @@ -16,6 +16,7 @@ spark.executor.memory = "4g" spark.rdd.compress = "true" // spark.kryo.registrationRequired = "true" +spark.driver.host = "localhost" spark.driver.bindAddress = "127.0.0.1" // spark.driver.port = 35701 // spark.blockManager.port = 35702 diff --git a/project/plugins.sbt b/project/plugins.sbt index 74f17dd..8667a61 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -34,8 +34,6 @@ addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.8.2") addSbtPlugin("net.ground5hark.sbt" % "sbt-css-compress" % "0.1.3") -addSbtPlugin("net.ground5hark.sbt" % "sbt-closure" % "0.1.3") - // addSbtPlugin("me.lessis" % "bintray-sbt" % "0.1.1") // code coverage diff --git a/public/javascripts/main.js b/public/javascripts/main.js index 0a1716a..bd941cd 100644 --- a/public/javascripts/main.js +++ b/public/javascripts/main.js @@ -113,10 +113,10 @@ function createStringDatumTokenizer(searchAsContainsFlag, nonWhitespaceDelimiter return stringDatumTokenizer.bind(null, searchAsContainsFlag).bind(null, nonWhitespaceDelimiter) } -function populateStringTypeahead(element, data, searchAsContainsFlag, nonWhitespaceDelimiter, updateValueElement) { +function populateStringTypeahead({element, data, searchAsContainsFlag, nonWhitespaceDelimiter, updateValueElement}) { var datumTokenizer = createStringDatumTokenizer(searchAsContainsFlag, nonWhitespaceDelimiter) var source = createBloodhoundSource(data, datumTokenizer) - populateTypeahead(element, source, null, null, updateValueElement) + populateTypeahead({element, source, updateValueElement}) } function createBloodhoundSource(data, datumTokenizer) { @@ -139,18 +139,18 @@ function createBloodhoundSource(data, datumTokenizer) { return listSearchWithAll; } -function populateTypeahead(element, source, displayFun, suggestionFun, updateValueElement) { +function populateTypeahead({element, source, displayFun, suggestionFun, updateValueElement, minLength}) { element.typeahead({ hint: true, highlight: true, - minLength: 0 + minLength: typeof minLength === 'undefined' ? 0 : minLength }, { source: source, display: displayFun, templates: { suggestion: suggestionFun }, - limit: 25 + limit: 1000 }); element.on("focus", function () { @@ -237,14 +237,19 @@ function createFieldBloodhoundSource(fieldNameAndLabels, showOption) { ) } -function populateFieldTypeaheds(typeaheadElements, fieldNameElements, fieldNameAndLabels, showOption, initSelectByNameElement) { +function populateFieldTypeaheads({typeaheadElements, + fieldNameElements, + fieldNameAndLabels, + showOption, + initSelectByNameElement, + minLength}) { var source = createFieldBloodhoundSource(fieldNameAndLabels, showOption) for(var i = 0; i < typeaheadElements.length; i++){ var typeaheadElement = typeaheadElements[i] var fieldNameElement = fieldNameElements[i] - populateFieldTypeahedAux(typeaheadElement, fieldNameElement, source, showOption) + populateFieldTypeaheadAux({typeaheadElement, fieldNameElement, source, showOption, minLength}) if (initSelectByNameElement) { selectByNameElement(typeaheadElement, fieldNameElement, fieldNameAndLabels, showOption) @@ -260,10 +265,15 @@ function populateFieldTypeaheds(typeaheadElements, fieldNameElements, fieldNameA * @param showOption 0 - show field names only, 1 - show field labels only, * 2 - show field labels, and field names if no label defined, 3 - show both, field names and labels */ -function populateFieldTypeahed(typeaheadElement, fieldNameElement, fieldNameAndLabels, showOption, initSelectByNameElement) { +function populateFieldTypeahead({typeaheadElement, + fieldNameElement, + fieldNameAndLabels, + showOption, + initSelectByNameElement, + minLength}) { var source = createFieldBloodhoundSource(fieldNameAndLabels, showOption) - populateFieldTypeahedAux(typeaheadElement, fieldNameElement, source, showOption) + populateFieldTypeaheadAux({typeaheadElement, fieldNameElement, source, showOption, minLength}) if (initSelectByNameElement) { selectByNameElement(typeaheadElement, fieldNameElement, fieldNameAndLabels, showOption) @@ -298,37 +308,54 @@ function selectByNameElement(typeaheadElement, fieldNameElement, fieldNameAndLab } } -function populateFieldTypeahedAux(typeaheadElement, fieldNameElement, source, showOption) { - populateTypeahead( - typeaheadElement, - source, - function (item) { - return item.value; - }, - function (item) { - var nameBadge = ''; - var labelBadge = ''; - switch (showOption) { - case 0: nameBadge = ''; break; - case 1: nameBadge = ''; break; - case 2: nameBadge = 'name'; break; - case 3: nameBadge = 'name'; break; - } - switch (showOption) { - case 0: labelBadge = ''; break; - case 1: labelBadge = ''; break; - case 2: labelBadge = 'label'; break; - case 3: labelBadge = 'label'; break; - } - if (item.isLabel) - return '
' + item.value + '' + labelBadge + '
'; - else - return '
' + item.value + '' + nameBadge + '
'; - }, - function (item) { - fieldNameElement.val(item.key); +function populateFieldTypeaheadAux({typeaheadElement, fieldNameElement, source, showOption, minLength}) { + populateTypeahead({ + element: typeaheadElement, + source, + displayFun: function(item) { + return item.value; + }, + suggestionFun: function(item) { + var nameBadge = ''; + var labelBadge = ''; + switch (showOption) { + case 0: + nameBadge = ''; + break; + case 1: + nameBadge = ''; + break; + case 2: + nameBadge = 'name'; + break; + case 3: + nameBadge = 'name'; + break; + } + switch (showOption) { + case 0: + labelBadge = ''; + break; + case 1: + labelBadge = ''; + break; + case 2: + labelBadge = 'label'; + break; + case 3: + labelBadge = 'label'; + break; } - ); + if (item.isLabel) + return '
' + item.value + '' + labelBadge + '
'; + else + return '
' + item.value + '' + nameBadge + '
'; + }, + updateValueElement: function(item) { + fieldNameElement.val(item.key); + }, + minLength + }); } /** @@ -339,11 +366,18 @@ function populateFieldTypeahedAux(typeaheadElement, fieldNameElement, source, sh * @param showOption 0 - show field names only, 1 - show field labels only, * 2 - show field labels, and field names if no label defined, 3 - show both, field names and labels */ -function populateFieldTypeahedFromUrl(typeaheadElement, fieldNameElement, url, showOption, postFunction, initSelectByNameElement) { +function populateFieldTypeaheadFromUrl({typeaheadElement, fieldNameElement, url, showOption, postFunction, initSelectByNameElement, minLength}) { $.ajax({ url: url, success: function (fieldNameAndLabels) { - populateFieldTypeahed(typeaheadElement, fieldNameElement, fieldNameAndLabels, showOption, initSelectByNameElement); + populateFieldTypeahead({ + typeaheadElement, + fieldNameElement, + fieldNameAndLabels, + showOption, + initSelectByNameElement, + minLength + }); if (postFunction) { postFunction() } @@ -352,11 +386,17 @@ function populateFieldTypeahedFromUrl(typeaheadElement, fieldNameElement, url, s }); } -function populateFieldTypeahedsFromUrl(typeaheadElements, fieldNameElements, url, showOption, initSelectByNameElement, postFunction) { +function populateFieldTypeaheadsFromUrl({typeaheadElements, fieldNameElements, url, showOption, initSelectByNameElement, postFunction}) { $.ajax({ url: url, success: function (fieldNameAndLabels) { - populateFieldTypeaheds(typeaheadElements, fieldNameElements, fieldNameAndLabels, showOption, initSelectByNameElement); + populateFieldTypeaheads({ + typeaheadElements, + fieldNameElements, + fieldNameAndLabels, + showOption, + initSelectByNameElement + }); if (postFunction) { postFunction() } @@ -365,11 +405,16 @@ function populateFieldTypeahedsFromUrl(typeaheadElements, fieldNameElements, url }); } -function populateIdNameTypeahedFromUrl(typeaheadElement, idElement, url, initSelectByNameElement) { +function populateIdNameTypeaheadFromUrl({typeaheadElement, idElement, url, initSelectByNameElement}) { $.ajax({ url: url, success: function (data) { - populateIdNameTypeahed(typeaheadElement, idElement, data, initSelectByNameElement); + populateIdNameTypeahead({ + typeaheadElement, + idElement, + idNames: data, + initSelectByNameElement + }); }, error: function(data){ showErrorResponse(data) @@ -377,24 +422,37 @@ function populateIdNameTypeahedFromUrl(typeaheadElement, idElement, url, initSel }); } -function populateIdNameTypeahed(typeaheadElement, idElement, idNames, initSelectByNameElement) { +function populateIdNameTypeahead({typeaheadElement, idElement, idNames, initSelectByNameElement, minLength}) { var typeaheadData = idNames.map(function (item, index) { return {name: item._id.$oid, label: item.name}; }); - populateFieldTypeahed(typeaheadElement, idElement, typeaheadData, 1, initSelectByNameElement); + populateFieldTypeahead({ + typeaheadElement, + fieldNameElement: idElement, + fieldNameAndLabels: typeaheadData, + showOption: 1, + initSelectByNameElement, + minLength + }); } -function populateIdNameTypeahedsFromUrl(typeaheadElements, idElements, url, initSelectByNameElement) { - $.ajax({ - url: url, - success: function (data) { - var fieldNameAndLabels = data.map(function (item, index) { - return {name: item._id.$oid, label: item.name}; - }); - populateFieldTypeaheds(typeaheadElements, idElements, fieldNameAndLabels, 1, initSelectByNameElement); - }, - error: showErrorResponse - }); +function populateIdNameTypeaheadsFromUrl({typeaheadElements, idElements, url, initSelectByNameElement}) { + $.ajax({ + url: url, + success: function (data) { + var fieldNameAndLabels = data.map(function (item, index) { + return {name: item._id.$oid, label: item.name}; + }); + populateFieldTypeaheads({ + typeaheadElements, + fieldNameElements: idElements, + fieldNameAndLabels, + showOption: 1, + initSelectByNameElement + }); + }, + error: showErrorResponse + }); } function registerMessageEventSource(url) { @@ -640,10 +698,10 @@ function loadNewTableContent(element, url, data, callType) { function activateRowClickable() { $(function() { - $(".clickable-row").dblclick(function () { + $(".clickable-row").click(function () { window.document.location = $(this).data("href"); }); - $(".no-rowClicked").dblclick(function (event) { + $(".no-rowClicked").click(function (event) { event.stopPropagation(); }); }); @@ -827,12 +885,8 @@ function updateFilterValueElement(filterElement, data) { var conditionTypeElement = filterElement.find("#conditionType") var conditionType = conditionTypeElement.val(); - - console.log(conditionType) - var isInNinType = (conditionType == "in" || conditionType == "nin") ? "multiple" : "" - var newValueElement = null; if (data.allowedValues.length > 0) { conditionTypeElement.change(function() { @@ -990,8 +1044,8 @@ function getSelectedRowIds(tableElement) { return ids; } -function enableFieldDragover(fieldNameElement, fieldTypeahedElement, execFun, acceptedTypes) { - fieldTypeahedElement.on('dragover', false).on('drop', function (ev) { +function enableFieldDragover(fieldNameElement, fieldTypeaheadElement, execFun, acceptedTypes) { + fieldTypeaheadElement.on('dragover', false).on('drop', function (ev) { $(this).removeClass("dragged-over") ev.preventDefault(); var transfer = ev.originalEvent.dataTransfer; @@ -1001,7 +1055,7 @@ function enableFieldDragover(fieldNameElement, fieldTypeahedElement, execFun, ac if (id && (!acceptedTypes || acceptedTypes.includes(type))) { $(fieldNameElement).val(id) - $(fieldTypeahedElement).val(text) + $(fieldTypeaheadElement).val(text) execFun(); } }).on("dragover", function (ev) { diff --git a/public/javascripts/multiFilter.js b/public/javascripts/multiFilter.js index cc09de3..3b867c8 100644 --- a/public/javascripts/multiFilter.js +++ b/public/javascripts/multiFilter.js @@ -423,12 +423,12 @@ $.widget("custom.multiFilter", { }); that.filterTypeaheadElement.typeahead('destroy'); if (filterTypeaheadData.length > 0) { - populateFieldTypeahed( - that.filterTypeaheadElement, - that.filterIdModalElement, - filterTypeaheadData, - 1 - ); + populateFieldTypeahead({ + typeaheadElement: that.filterTypeaheadElement, + fieldNameElement: that.filterIdModalElement, + fieldNameAndLabels: filterTypeaheadData, + showOption: 1 + }); if (successFun) successFun() } else { @@ -502,12 +502,13 @@ $.widget("custom.multiFilter", { this.fieldNameTypeaheadElement.typeahead('destroy'); - populateFieldTypeahed( - this.fieldNameTypeaheadElement, - this.fieldNameElement, - this.fieldNameAndLabels, - choiceValue - ) + populateFieldTypeahead({ + typeaheadElement: this.fieldNameTypeaheadElement, + fieldNameElement: this.fieldNameElement, + fieldNameAndLabels: this.fieldNameAndLabels, + showOption: choiceValue, + minLength: 2 + }) this.fieldNameTypeaheadElement.typeahead('val', ''); diff --git a/public/stylesheets/main.css b/public/stylesheets/main.css index fb9314e..616d8d9 100644 --- a/public/stylesheets/main.css +++ b/public/stylesheets/main.css @@ -651,4 +651,11 @@ a.carousel-control.right{ .alert-very-light { background-color: #f5f5f5; padding-bottom: 0px; +} + +.glyphicon-chevron-down > a,.glyphicon-chevron-up > a { + font-family: "Ubuntu",Tahoma,"Helvetica Neue",Helvetica,Arial,sans-serif; + font-size: 14px; + font-weight: bold; + color: #2c8d3a; } \ No newline at end of file diff --git a/public/stylesheets/typeahead.css b/public/stylesheets/typeahead.css index a055416..cc10250 100644 --- a/public/stylesheets/typeahead.css +++ b/public/stylesheets/typeahead.css @@ -33,11 +33,12 @@ .tt-menu { width: 300px; + max-height: 155px; + overflow-y: auto; margin: 12px 0; padding: 8px 0; background-color: #fff; border: 1px solid #ccc; - border: 1px solid rgba(0, 0, 0, 0.2); -webkit-border-radius: 8px; -moz-border-radius: 8px; border-radius: 8px; @@ -65,4 +66,4 @@ .tt-suggestion p { margin: 0; -} \ No newline at end of file +}