mirror of
https://github.com/datahub-project/datahub.git
synced 2025-10-21 22:15:34 +00:00
Merge pull request #284 from theseyi/master
Reformats /javascripts/search.js source indentation to meet current code convention, and usage of quotes, removes duplicate function declaration
This commit is contained in:
commit
2477a80d54
@ -1,18 +1,17 @@
|
|||||||
(function (window, $) {
|
(function (window, $) {
|
||||||
$('#advsearchtabs a:first').tab("show");
|
$('#advsearchtabs').find('a:first').tab('show');
|
||||||
$('#datasetAdvSearchLink').addClass("active");
|
$('#datasetAdvSearchLink').addClass('active');
|
||||||
String.prototype.replaceAll = function (target, replacement) {
|
String.prototype.replaceAll = function (target, replacement) {
|
||||||
return this.split(target).join(replacement);
|
return this.split(target).join(replacement);
|
||||||
};
|
};
|
||||||
window.g_currentCategory = 'Datasets';
|
window.g_currentCategory = 'Datasets';
|
||||||
function renderAdvSearchDatasetSources(parent, sources)
|
function renderAdvSearchDatasetSources(parent, sources) {
|
||||||
{
|
let content = '';
|
||||||
if ((!parent) || (!sources) || sources.length == 0)
|
if ((!parent) || (!sources) || sources.length == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var content = '';
|
for (var i = 0; i < sources.length; i++) {
|
||||||
for (var i = 0; i < sources.length; i++)
|
|
||||||
{
|
|
||||||
content += '<label class="checkbox"><input type="checkbox" name="sourceCheckbox" value="';
|
content += '<label class="checkbox"><input type="checkbox" name="sourceCheckbox" value="';
|
||||||
content += sources[i] + '"/>' + sources[i] + '</label>';
|
content += sources[i] + '"/>' + sources[i] + '</label>';
|
||||||
}
|
}
|
||||||
@ -21,15 +20,16 @@
|
|||||||
|
|
||||||
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
|
$.ui.autocomplete.prototype._renderItem = function (ul, item) {
|
||||||
var term = this.term.split(' ').join('|');
|
var term = this.term.split(' ').join('|');
|
||||||
var re = new RegExp("(" + term + ")", "gi") ;
|
var re = new RegExp('(' + term + ')', 'gi');
|
||||||
var t = item.label.replace(re, "<b><font color='blue'>$1</font></b>");
|
var t = item.label.replace(re, "<b><font color='blue'>$1</font></b>");
|
||||||
return $( "<li></li>" )
|
return $('<li></li>')
|
||||||
.data( "item.autocomplete", item )
|
.data('item.autocomplete', item)
|
||||||
.append( "<a>" + t + "</a>" )
|
.append('<a>' + t + '</a>')
|
||||||
.appendTo(ul);
|
.appendTo(ul);
|
||||||
};
|
};
|
||||||
|
|
||||||
var maxReturnedResults = 20;
|
var maxReturnedResults = 20;
|
||||||
|
|
||||||
function split(val) {
|
function split(val) {
|
||||||
return val.split(/,\s*/);
|
return val.split(/,\s*/);
|
||||||
}
|
}
|
||||||
@ -38,20 +38,18 @@
|
|||||||
return split(term).pop();
|
return split(term).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortAutocompleteResult(data, term)
|
function sortAutocompleteResult(data, term) {
|
||||||
{
|
|
||||||
var source = $.ui.autocomplete.filter(data, term);
|
var source = $.ui.autocomplete.filter(data, term);
|
||||||
var keyword = $.ui.autocomplete.escapeRegex(term);
|
var keyword = $.ui.autocomplete.escapeRegex(term);
|
||||||
if (keyword && keyword.length < 4)
|
if (keyword && keyword.length < 4) {
|
||||||
{
|
|
||||||
return source.slice(0, maxReturnedResults);
|
return source.slice(0, maxReturnedResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
var startsWithMatcher = new RegExp("^" + keyword, "i");
|
var startsWithMatcher = new RegExp('^' + keyword, 'i');
|
||||||
var startsWith = $.grep(source, function (value) {
|
var startsWith = $.grep(source, function (value) {
|
||||||
return startsWithMatcher.test(value.label || value.value || value);
|
return startsWithMatcher.test(value.label || value.value || value);
|
||||||
});
|
});
|
||||||
var containsMatcher = new RegExp(keyword, "i")
|
var containsMatcher = new RegExp(keyword, 'i');
|
||||||
var contains = $.grep(source, function (value) {
|
var contains = $.grep(source, function (value) {
|
||||||
return containsMatcher.test(value.label || value.value || value);
|
return containsMatcher.test(value.label || value.value || value);
|
||||||
});
|
});
|
||||||
@ -62,43 +60,25 @@
|
|||||||
return sorted.slice(0, maxReturnedResults);
|
return sorted.slice(0, maxReturnedResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderAdvSearchDatasetSources(parent, sources)
|
$('.searchCategory').click(function (e) {
|
||||||
{
|
var objs = $('.searchCategory');
|
||||||
if ((!parent) || (!sources) || sources.length == 0)
|
if (objs) {
|
||||||
return;
|
|
||||||
|
|
||||||
var content = '';
|
|
||||||
for (var i = 0; i < sources.length; i++)
|
|
||||||
{
|
|
||||||
content += '<label class="checkbox"><input type="checkbox" name="sourceCheckbox" value="';
|
|
||||||
content += sources[i] + '"/>' + sources[i] + '</label>';
|
|
||||||
}
|
|
||||||
parent.append(content);
|
|
||||||
}
|
|
||||||
|
|
||||||
$(".searchCategory").click(function(e){
|
|
||||||
var objs = $(".searchCategory");
|
|
||||||
if (objs)
|
|
||||||
{
|
|
||||||
$.each(objs, function (index, value) {
|
$.each(objs, function (index, value) {
|
||||||
$(objs[index]).parent().removeClass("active");
|
$(objs[index]).parent().removeClass('active');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
window.g_currentCategory = e.target.text;
|
window.g_currentCategory = e.target.text;
|
||||||
updateSearchCategories(e.target.text);
|
updateSearchCategories(e.target.text);
|
||||||
//$(e.target).parent().addClass( "active" );
|
//$(e.target).parent().addClass( 'active' );
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
});
|
});
|
||||||
|
|
||||||
var datasetSourcesUrl = '/api/v1/advsearch/sources';
|
var datasetSourcesUrl = '/api/v1/advsearch/sources';
|
||||||
$.get(datasetSourcesUrl, function (data) {
|
$.get(datasetSourcesUrl, function (data) {
|
||||||
if (data && data.status == "ok")
|
if (data && data.status == 'ok') {
|
||||||
{
|
var advSearchSourceObj = $('#advSearchSource');
|
||||||
var advSearchSourceObj = $("#advSearchSource");
|
if (advSearchSourceObj) {
|
||||||
if (advSearchSourceObj)
|
if (data.sources) {
|
||||||
{
|
|
||||||
if (data.sources)
|
|
||||||
{
|
|
||||||
renderAdvSearchDatasetSources(advSearchSourceObj, data.sources);
|
renderAdvSearchDatasetSources(advSearchSourceObj, data.sources);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -110,6 +90,7 @@
|
|||||||
$('#searchInput').autocomplete({
|
$('#searchInput').autocomplete({
|
||||||
source: function ({term}, res) {
|
source: function ({term}, res) {
|
||||||
const matchResults = $.ui.autocomplete.filter(possibleMatches, extractLast(term));
|
const matchResults = $.ui.autocomplete.filter(possibleMatches, extractLast(term));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort the matches by giving precedence to matches that are closer in length to searchTerm and have
|
* Sort the matches by giving precedence to matches that are closer in length to searchTerm and have
|
||||||
* the searchTerm occurring closer to the start of the matching string.
|
* the searchTerm occurring closer to the start of the matching string.
|
||||||
@ -170,7 +151,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
$.get('/api/v1/advsearch/scopes', function (data) {
|
$.get('/api/v1/advsearch/scopes', function (data) {
|
||||||
$(".scopeInput").autocomplete({
|
$('.scopeInput').autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function (req, res) {
|
source: function (req, res) {
|
||||||
var results = $.ui.autocomplete.filter(data.scopes, extractLast(req.term));
|
var results = $.ui.autocomplete.filter(data.scopes, extractLast(req.term));
|
||||||
@ -183,15 +164,15 @@
|
|||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.value);
|
||||||
terms.push( "" );
|
terms.push('');
|
||||||
this.value = terms.join( ", " );
|
this.value = terms.join(', ');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$.get('/api/v1/advsearch/tables', function (data) {
|
$.get('/api/v1/advsearch/tables', function (data) {
|
||||||
$(".tableInput").autocomplete({
|
$('.tableInput').autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function (req, res) {
|
source: function (req, res) {
|
||||||
var results = $.ui.autocomplete.filter(data.tables, extractLast(req.term));
|
var results = $.ui.autocomplete.filter(data.tables, extractLast(req.term));
|
||||||
@ -204,15 +185,15 @@
|
|||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.value);
|
||||||
terms.push( "" );
|
terms.push('');
|
||||||
this.value = terms.join( ", " );
|
this.value = terms.join(', ');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$.get('/api/v1/advsearch/fields', function (data) {
|
$.get('/api/v1/advsearch/fields', function (data) {
|
||||||
$(".fieldInput").autocomplete({
|
$('.fieldInput').autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function (req, res) {
|
source: function (req, res) {
|
||||||
var results = $.ui.autocomplete.filter(data.fields, extractLast(req.term));
|
var results = $.ui.autocomplete.filter(data.fields, extractLast(req.term));
|
||||||
@ -225,15 +206,15 @@
|
|||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.value);
|
||||||
terms.push( "" );
|
terms.push('');
|
||||||
this.value = terms.join( ", " );
|
this.value = terms.join(', ');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$.get('/api/v1/advsearch/appcodes', function (data) {
|
$.get('/api/v1/advsearch/appcodes', function (data) {
|
||||||
$(".appcodeInput").autocomplete({
|
$('.appcodeInput').autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function (req, res) {
|
source: function (req, res) {
|
||||||
var results = $.ui.autocomplete.filter(data.appcodes, extractLast(req.term));
|
var results = $.ui.autocomplete.filter(data.appcodes, extractLast(req.term));
|
||||||
@ -246,15 +227,15 @@
|
|||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.value);
|
||||||
terms.push( "" );
|
terms.push('');
|
||||||
this.value = terms.join( ", " );
|
this.value = terms.join(', ');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$.get('/api/v1/advsearch/flowNames', function (data) {
|
$.get('/api/v1/advsearch/flowNames', function (data) {
|
||||||
$(".flowInput").autocomplete({
|
$('.flowInput').autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function (req, res) {
|
source: function (req, res) {
|
||||||
var results = $.ui.autocomplete.filter(data.flowNames, extractLast(req.term));
|
var results = $.ui.autocomplete.filter(data.flowNames, extractLast(req.term));
|
||||||
@ -267,15 +248,15 @@
|
|||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.value);
|
||||||
terms.push( "" );
|
terms.push('');
|
||||||
this.value = terms.join( ", " );
|
this.value = terms.join(', ');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$.get('/api/v1/advsearch/jobNames', function (data) {
|
$.get('/api/v1/advsearch/jobNames', function (data) {
|
||||||
$(".jobInput").autocomplete({
|
$('.jobInput').autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function (req, res) {
|
source: function (req, res) {
|
||||||
var results = $.ui.autocomplete.filter(data.jobNames, extractLast(req.term));
|
var results = $.ui.autocomplete.filter(data.jobNames, extractLast(req.term));
|
||||||
@ -288,16 +269,16 @@
|
|||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.value);
|
||||||
terms.push( "" );
|
terms.push('');
|
||||||
this.value = terms.join( ", " );
|
this.value = terms.join(', ');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$( "#scopeInInput" ).blur(function() {
|
$('#scopeInInput').blur(function () {
|
||||||
$.get('/api/v1/advsearch/tables', {scopes: $( "#scopeInInput").val()}, function(data){
|
$.get('/api/v1/advsearch/tables', {scopes: $('#scopeInInput').val()}, function (data) {
|
||||||
$(".tableInput").autocomplete({
|
$('.tableInput').autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function (req, res) {
|
source: function (req, res) {
|
||||||
var results = $.ui.autocomplete.filter(data.tables, extractLast(req.term));
|
var results = $.ui.autocomplete.filter(data.tables, extractLast(req.term));
|
||||||
@ -310,17 +291,17 @@
|
|||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.value);
|
||||||
terms.push( "" );
|
terms.push('');
|
||||||
this.value = terms.join( ", " );
|
this.value = terms.join(', ');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$( "#tableInInput" ).blur(function() {
|
$('#tableInInput').blur(function () {
|
||||||
$.get('/api/v1/advsearch/fields', {tables: $( "#tableInInput").val()}, function(data){
|
$.get('/api/v1/advsearch/fields', {tables: $('#tableInInput').val()}, function (data) {
|
||||||
$(".fieldInput").autocomplete({
|
$('.fieldInput').autocomplete({
|
||||||
minLength: 0,
|
minLength: 0,
|
||||||
source: function (req, res) {
|
source: function (req, res) {
|
||||||
var results = $.ui.autocomplete.filter(data.fields, extractLast(req.term));
|
var results = $.ui.autocomplete.filter(data.fields, extractLast(req.term));
|
||||||
@ -333,8 +314,8 @@
|
|||||||
var terms = split(this.value);
|
var terms = split(this.value);
|
||||||
terms.pop();
|
terms.pop();
|
||||||
terms.push(ui.item.value);
|
terms.push(ui.item.value);
|
||||||
terms.push( "" );
|
terms.push('');
|
||||||
this.value = terms.join( ", " );
|
this.value = terms.join(', ');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -343,111 +324,98 @@
|
|||||||
|
|
||||||
$('#searchBtn').click(function () {
|
$('#searchBtn').click(function () {
|
||||||
var inputObj = $('#searchInput');
|
var inputObj = $('#searchInput');
|
||||||
if (inputObj)
|
if (inputObj) {
|
||||||
{
|
|
||||||
var keyword = inputObj.val();
|
var keyword = inputObj.val();
|
||||||
if (keyword)
|
if (keyword) {
|
||||||
{
|
|
||||||
window.location = '/#/search?keywords=' + btoa(keyword) +
|
window.location = '/#/search?keywords=' + btoa(keyword) +
|
||||||
'&category=' + window.g_currentCategory + '&source=default&page=1'
|
'&category=' + window.g_currentCategory + '&source=default&page=1'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function advSearchForDataset()
|
// This is a stop gap implementation to solve the issue with handling the enter key on user search
|
||||||
{
|
document.querySelector('#searchInput')
|
||||||
|
.addEventListener('keypress', ({keyCode}) => {
|
||||||
|
if (keyCode === 13) {
|
||||||
|
document.querySelector('#searchBtn').click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function advSearchForDataset() {
|
||||||
var empty = true;
|
var empty = true;
|
||||||
var scopeInInputObj = $('#scopeInInput');
|
var scopeInInputObj = $('#scopeInInput');
|
||||||
var scopeIn = '';
|
var scopeIn = '';
|
||||||
if (scopeInInputObj)
|
if (scopeInInputObj) {
|
||||||
{
|
|
||||||
scopeIn = scopeInInputObj.val();
|
scopeIn = scopeInInputObj.val();
|
||||||
if (scopeIn)
|
if (scopeIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var scopeNotInInputObj = $('#scopeNotInInput');
|
var scopeNotInInputObj = $('#scopeNotInInput');
|
||||||
var scopeNotIn = '';
|
var scopeNotIn = '';
|
||||||
if (scopeNotInInputObj)
|
if (scopeNotInInputObj) {
|
||||||
{
|
|
||||||
scopeNotIn = scopeNotInInputObj.val();
|
scopeNotIn = scopeNotInInputObj.val();
|
||||||
if (scopeNotIn)
|
if (scopeNotIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var tableInInputObj = $('#tableInInput');
|
var tableInInputObj = $('#tableInInput');
|
||||||
var tableIn = '';
|
var tableIn = '';
|
||||||
if (tableInInputObj)
|
if (tableInInputObj) {
|
||||||
{
|
|
||||||
tableIn = tableInInputObj.val();
|
tableIn = tableInInputObj.val();
|
||||||
if (tableIn)
|
if (tableIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var tableNotInInputObj = $('#tableNotInInput');
|
var tableNotInInputObj = $('#tableNotInInput');
|
||||||
var tableNotIn = '';
|
var tableNotIn = '';
|
||||||
if (tableNotInInputObj)
|
if (tableNotInInputObj) {
|
||||||
{
|
|
||||||
tableNotIn = tableNotInInputObj.val();
|
tableNotIn = tableNotInInputObj.val();
|
||||||
if (tableNotIn)
|
if (tableNotIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var fieldAnyInputObj = $('#fieldAnyInput');
|
var fieldAnyInputObj = $('#fieldAnyInput');
|
||||||
var fieldAny = '';
|
var fieldAny = '';
|
||||||
if (fieldAnyInputObj)
|
if (fieldAnyInputObj) {
|
||||||
{
|
|
||||||
fieldAny = fieldAnyInputObj.val();
|
fieldAny = fieldAnyInputObj.val();
|
||||||
if (fieldAny)
|
if (fieldAny) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var fieldAllInputObj = $('#fieldAllInput');
|
var fieldAllInputObj = $('#fieldAllInput');
|
||||||
var fieldAll = '';
|
var fieldAll = '';
|
||||||
if (fieldAllInputObj)
|
if (fieldAllInputObj) {
|
||||||
{
|
|
||||||
fieldAll = fieldAllInputObj.val();
|
fieldAll = fieldAllInputObj.val();
|
||||||
if (fieldAll)
|
if (fieldAll) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var fieldNotInInputObj = $('#fieldNotInInput');
|
var fieldNotInInputObj = $('#fieldNotInInput');
|
||||||
var fieldNotIn = '';
|
var fieldNotIn = '';
|
||||||
if (fieldNotInInputObj)
|
if (fieldNotInInputObj) {
|
||||||
{
|
|
||||||
fieldNotIn = fieldNotInInputObj.val();
|
fieldNotIn = fieldNotInInputObj.val();
|
||||||
if (fieldNotIn)
|
if (fieldNotIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var commentsInputObj = $('#commentsInput');
|
var commentsInputObj = $('#commentsInput');
|
||||||
var comments = '';
|
var comments = '';
|
||||||
if (commentsInputObj)
|
if (commentsInputObj) {
|
||||||
{
|
|
||||||
comments = commentsInputObj.val();
|
comments = commentsInputObj.val();
|
||||||
if (comments)
|
if (comments) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var sources = '';
|
var sources = '';
|
||||||
$('input[name="sourceCheckbox"]:checked').each(function() {
|
$('input[name=sourceCheckbox]:checked').each(function () {
|
||||||
sources += this.value + ','
|
sources += this.value + ','
|
||||||
});
|
});
|
||||||
sources = sources.substring(0, sources.length - 1);
|
sources = sources.substring(0, sources.length - 1);
|
||||||
if (sources)
|
if (sources) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
if (empty)
|
if (empty) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,75 +426,61 @@
|
|||||||
advSearchOpts.fields = {'any': fieldAny, 'all': fieldAll, 'not': fieldNotIn};
|
advSearchOpts.fields = {'any': fieldAny, 'all': fieldAll, 'not': fieldNotIn};
|
||||||
advSearchOpts.comments = comments;
|
advSearchOpts.comments = comments;
|
||||||
advSearchOpts.sources = sources;
|
advSearchOpts.sources = sources;
|
||||||
window.location = "/#/advsearch/?query=" + btoa(JSON.stringify(advSearchOpts)) + '&page=1';
|
window.location = '/#/advsearch/?query=' + btoa(JSON.stringify(advSearchOpts)) + '&page=1';
|
||||||
}
|
}
|
||||||
|
|
||||||
function advSearchForFlow()
|
function advSearchForFlow() {
|
||||||
{
|
|
||||||
var empty = true;
|
var empty = true;
|
||||||
var appcodeInInputObj = $('#appcodeInInput');
|
var appcodeInInputObj = $('#appcodeInInput');
|
||||||
var appcodeIn = '';
|
var appcodeIn = '';
|
||||||
if (appcodeInInputObj)
|
if (appcodeInInputObj) {
|
||||||
{
|
|
||||||
appcodeIn = appcodeInInputObj.val();
|
appcodeIn = appcodeInInputObj.val();
|
||||||
if (appcodeIn)
|
if (appcodeIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var appcodeNotInInputObj = $('#appcodeNotInInput');
|
var appcodeNotInInputObj = $('#appcodeNotInInput');
|
||||||
var appcodeNotIn = '';
|
var appcodeNotIn = '';
|
||||||
if (appcodeNotInInputObj)
|
if (appcodeNotInInputObj) {
|
||||||
{
|
|
||||||
appcodeNotIn = appcodeNotInInputObj.val();
|
appcodeNotIn = appcodeNotInInputObj.val();
|
||||||
if (appcodeNotIn)
|
if (appcodeNotIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var flowInInputObj = $('#flowInInput');
|
var flowInInputObj = $('#flowInInput');
|
||||||
var flowIn = '';
|
var flowIn = '';
|
||||||
if (flowInInputObj)
|
if (flowInInputObj) {
|
||||||
{
|
|
||||||
flowIn = flowInInputObj.val();
|
flowIn = flowInInputObj.val();
|
||||||
if (flowIn)
|
if (flowIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var flowNotInInputObj = $('#flowNotInInput');
|
var flowNotInInputObj = $('#flowNotInInput');
|
||||||
var flowNotIn = '';
|
var flowNotIn = '';
|
||||||
if (flowNotInInputObj)
|
if (flowNotInInputObj) {
|
||||||
{
|
|
||||||
flowNotIn = flowNotInInputObj.val();
|
flowNotIn = flowNotInInputObj.val();
|
||||||
if (flowNotIn)
|
if (flowNotIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var jobInInputObj = $('#jobInInput');
|
var jobInInputObj = $('#jobInInput');
|
||||||
var jobIn = '';
|
var jobIn = '';
|
||||||
if (jobInInputObj)
|
if (jobInInputObj) {
|
||||||
{
|
|
||||||
jobIn = jobInInputObj.val();
|
jobIn = jobInInputObj.val();
|
||||||
if (jobIn)
|
if (jobIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var jobNotInInputObj = $('#jobNotInInput');
|
var jobNotInInputObj = $('#jobNotInInput');
|
||||||
var jobNotIn = '';
|
var jobNotIn = '';
|
||||||
if (jobNotInInputObj)
|
if (jobNotInInputObj) {
|
||||||
{
|
|
||||||
jobNotIn = jobNotInInputObj.val();
|
jobNotIn = jobNotInInputObj.val();
|
||||||
if (jobNotIn)
|
if (jobNotIn) {
|
||||||
{
|
|
||||||
empty = false;
|
empty = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty)
|
if (empty) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,20 +489,17 @@
|
|||||||
advSearchOpts.appcode = {'in': appcodeIn, 'not': appcodeNotIn};
|
advSearchOpts.appcode = {'in': appcodeIn, 'not': appcodeNotIn};
|
||||||
advSearchOpts.flow = {'in': flowIn, 'not': flowNotIn};
|
advSearchOpts.flow = {'in': flowIn, 'not': flowNotIn};
|
||||||
advSearchOpts.job = {'in': jobIn, 'not': jobNotIn};
|
advSearchOpts.job = {'in': jobIn, 'not': jobNotIn};
|
||||||
window.location = "/#/advsearch/?query=" + btoa(JSON.stringify(advSearchOpts)) + '&page=1';
|
window.location = '/#/advsearch/?query=' + btoa(JSON.stringify(advSearchOpts)) + '&page=1';
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#advSearchBtn').click(function () {
|
$('#advSearchBtn').click(function () {
|
||||||
var obj = $("#advsearchtabs").find(".active")
|
var obj = $('#advsearchtabs').find('.active');
|
||||||
if (obj)
|
if (obj) {
|
||||||
{
|
|
||||||
var text = obj.text();
|
var text = obj.text();
|
||||||
if (text == 'Datasets')
|
if (text == 'Datasets') {
|
||||||
{
|
|
||||||
advSearchForDataset();
|
advSearchForDataset();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
advSearchForFlow();
|
advSearchForFlow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,78 +507,64 @@
|
|||||||
|
|
||||||
$('#advSearchResetBtn').click(function () {
|
$('#advSearchResetBtn').click(function () {
|
||||||
var scopeInInputObj = $('#scopeInInput');
|
var scopeInInputObj = $('#scopeInInput');
|
||||||
if (scopeInInputObj)
|
if (scopeInInputObj) {
|
||||||
{
|
|
||||||
scopeInInputObj.val('');
|
scopeInInputObj.val('');
|
||||||
}
|
}
|
||||||
var scopeNotInInputObj = $('#scopeNotInInput');
|
var scopeNotInInputObj = $('#scopeNotInInput');
|
||||||
if (scopeNotInInputObj)
|
if (scopeNotInInputObj) {
|
||||||
{
|
|
||||||
scopeNotInInputObj.val('');
|
scopeNotInInputObj.val('');
|
||||||
}
|
}
|
||||||
var tableInInputObj = $('#tableInInput');
|
var tableInInputObj = $('#tableInInput');
|
||||||
if (tableInInputObj)
|
if (tableInInputObj) {
|
||||||
{
|
|
||||||
tableInInputObj.val('');
|
tableInInputObj.val('');
|
||||||
}
|
}
|
||||||
var tableNotInInputObj = $('#tableNotInInput');
|
var tableNotInInputObj = $('#tableNotInInput');
|
||||||
if (tableNotInInputObj)
|
if (tableNotInInputObj) {
|
||||||
{
|
|
||||||
tableNotInInputObj.val('');
|
tableNotInInputObj.val('');
|
||||||
}
|
}
|
||||||
var fieldAnyInputObj = $('#fieldAnyInput');
|
var fieldAnyInputObj = $('#fieldAnyInput');
|
||||||
if (fieldAnyInputObj)
|
if (fieldAnyInputObj) {
|
||||||
{
|
|
||||||
fieldAnyInputObj.val('');
|
fieldAnyInputObj.val('');
|
||||||
}
|
}
|
||||||
var fieldAllInputObj = $('#fieldAllInput');
|
var fieldAllInputObj = $('#fieldAllInput');
|
||||||
if (fieldAllInputObj)
|
if (fieldAllInputObj) {
|
||||||
{
|
|
||||||
fieldAllInputObj.val('');
|
fieldAllInputObj.val('');
|
||||||
}
|
}
|
||||||
var fieldNotInInputObj = $('#fieldNotInInput');
|
var fieldNotInInputObj = $('#fieldNotInInput');
|
||||||
if (fieldNotInInputObj)
|
if (fieldNotInInputObj) {
|
||||||
{
|
|
||||||
fieldNotInInputObj.val('');
|
fieldNotInInputObj.val('');
|
||||||
}
|
}
|
||||||
var commentsInputObj = $('#commentsInput');
|
var commentsInputObj = $('#commentsInput');
|
||||||
if (commentsInputObj)
|
if (commentsInputObj) {
|
||||||
{
|
|
||||||
commentsInputObj.val('');
|
commentsInputObj.val('');
|
||||||
}
|
}
|
||||||
$('input[name="sourceCheckbox"]:checked').each(function() {
|
$('input[name=sourceCheckbox]:checked').each(function () {
|
||||||
this.checked = false;
|
this.checked = false;
|
||||||
});
|
});
|
||||||
var appcodeInInputObj = $('#appcodeInInput');
|
var appcodeInInputObj = $('#appcodeInInput');
|
||||||
if (appcodeInInputObj)
|
if (appcodeInInputObj) {
|
||||||
{
|
|
||||||
appcodeInInputObj.val('');
|
appcodeInInputObj.val('');
|
||||||
}
|
}
|
||||||
var appcodeNotInInputObj = $('#appcodeNotInInput');
|
var appcodeNotInInputObj = $('#appcodeNotInInput');
|
||||||
if (appcodeNotInInputObj)
|
if (appcodeNotInInputObj) {
|
||||||
{
|
|
||||||
appcodeNotInInputObj.val('');
|
appcodeNotInInputObj.val('');
|
||||||
}
|
}
|
||||||
var flowInInputObj = $('#flowInInput');
|
var flowInInputObj = $('#flowInInput');
|
||||||
if (flowInInputObj)
|
if (flowInInputObj) {
|
||||||
{
|
|
||||||
flowInInputObj.val('');
|
flowInInputObj.val('');
|
||||||
}
|
}
|
||||||
var flowNotInInputObj = $('#flowNotInInput');
|
var flowNotInInputObj = $('#flowNotInInput');
|
||||||
if (flowNotInInputObj)
|
if (flowNotInInputObj) {
|
||||||
{
|
|
||||||
flowNotInInputObj.val('');
|
flowNotInInputObj.val('');
|
||||||
}
|
}
|
||||||
var jobInInputObj = $('#jobInInput');
|
var jobInInputObj = $('#jobInInput');
|
||||||
if (jobInInputObj)
|
if (jobInInputObj) {
|
||||||
{
|
|
||||||
jobInInputObj.val('');
|
jobInInputObj.val('');
|
||||||
}
|
}
|
||||||
var jobNotInInputObj = $('#jobNotInInput');
|
var jobNotInInputObj = $('#jobNotInInput');
|
||||||
if (jobNotInInputObj)
|
if (jobNotInInputObj) {
|
||||||
{
|
|
||||||
jobNotInInputObj.val('');
|
jobNotInInputObj.val('');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
})(window, jQuery)
|
})(window, jQuery);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user