Commit 4ac83653 authored by Gert Paimla's avatar Gert Paimla
Browse files

fix dashboard

parent 0a39d593
......@@ -120,7 +120,7 @@
<div class="col-sm-12">
Disable html stripping:
<input type="checkbox" name="html_stripping"
class="pull-right">
class="pull-right">
</div>
</div>
</div>
......@@ -612,11 +612,11 @@
<label for="head" class="margin-left"> Color range maximum</label>
</div>
<div class="flex-row margin-bottom">
<input type="color" name="dashboard-color-minimum"
<input type="color" name="dashboard-color-minimum"
value="#bfffc4">
<label for="body" class="margin-left"> Color range minimum</label>
</div>
<button type="button" onclick="javascript:dashboard();"
<button type="button" id="dashboardButton" onclick="javascript:dashboard();"
class="btn btn-default form-control"><span
class="glyphicon glyphicon-filter"></span> Dashboard
</button>
......
......@@ -18,7 +18,9 @@ $(function () {
$('#right').empty()
},
success: function (data) {
if (checkNested(data, 'indices')) {
document.getElementById('dashboardButton').removeAttribute('disabled');
console.log(data);
updateLoaderStatus('Drawing Dashboard')
let indicesArray = [];
......@@ -172,7 +174,7 @@ function makeFrequentItemsTables(index) {
let colorRowIndex = 1;
let t_id = 0;
let rootProperty = index.getFrequentItems();
for (let field in rootProperty) {
if (rootProperty.hasOwnProperty(field)) {
let result = formatFrequentItems(index, rootProperty[field]);
......
......@@ -147,6 +147,10 @@ function query() {
var columns = []
$('#columnsRow').find('th').each(function (index) {
// Append _DtCol to end to safe from naming conflicts
<<<<<<< HEAD
=======
columns.push({'className': 'DtCol_' + $(this).text(), 'targets': index})
>>>>>>> ab47fd1e... fix dashboard
if (index !== 0) {
columns.push({
'className': 'DtCol_' + $(this).text(),
......@@ -166,7 +170,7 @@ function query() {
"render": function (data, type, row, meta) {
return '<input type="checkbox" id=' + data + ' name=dt_delete_doc_checkbox>';
}
})
}
})
......@@ -325,16 +329,20 @@ function rejectDocument(id) {
$('#docs_rejected').val($('#docs_rejected').val() + id + '\n')
$('#row_' + id).remove()
}
function dashboard () {
function dashboard() {
var container = $('#right')
container.empty()
document.getElementById('dashboardButton').setAttribute('disabled', 'disabled');
var formElement = document.getElementById('filters')
var request = new XMLHttpRequest()
request.onreadystatechange = function () {
if (request.readyState === 4 && request.status === 200) {
console.log(request);
container.html(request.response)
} else if (request.readyState === 4) {
document.getElementById('dashboardButton').removeAttribute('disabled');
}
}
......@@ -342,7 +350,8 @@ function dashboard () {
request.send(new FormData(formElement), true)
}
function aggregate () {
function aggregate() {
var container = $('#right')
container.empty()
container.append('Loading...')
......@@ -600,7 +609,7 @@ function deleteFactArray(factArray, source) {
}
}
function showStringChildren (data, childrenContainer, grandchildrenContainer, rowKey, type, field) {
function showStringChildren(data, childrenContainer, grandchildrenContainer, rowKey, type, field) {
childrenContainer.empty()
grandchildrenContainer.empty()
......@@ -615,12 +624,12 @@ function showStringChildren (data, childrenContainer, grandchildrenContainer, ro
if (type === 'fact') {
searchKey = strip_html(rowKey, true)
searchVal = strip_html(this.key, true)
var addToSearchIcon = $('<i>', {
var addToSearchIcon = $('<i>', {
class: "glyphicon glyphicon-search pull-right",
'data-toggle': "tooltip",
title:"Add to search",
style:"cursor: pointer",
title: "Add to search",
style: "cursor: pointer",
onclick: `addFactToSearch("${searchKey}","${searchVal}", "${field}")`
});
......@@ -720,7 +729,7 @@ function clusterToLex(id) {
})
}
function addFactToSearch (factName, factVal, field) {
function addFactToSearch(factName, factVal, field) {
// Creates a fact_str_val search with the factName, factVal, and field
const fields_filtered = $('#constraint_field option').toArray().filter((obj) => {
......@@ -731,10 +740,10 @@ function addFactToSearch (factName, factVal, field) {
return false
}
})
if (fields_filtered.length > 0) {
$('#constraint_field').val($(fields_filtered[0]).val())
var hasField = false
$('span[id^=selected_field_]').each(function (index) {
if ($(this).text().includes(['[fact_text_values]'])) {
......@@ -745,7 +754,7 @@ function addFactToSearch (factName, factVal, field) {
/* global addField, sidebar */
addField('', '', false)
}
var splitID = $('input[name^=fact_txt_]').last().attr('id').split('_')
var suggestionID = splitID[splitID.length - 2] + '_' + splitID[splitID.length - 1]
if (hasField) {
......@@ -754,14 +763,14 @@ function addFactToSearch (factName, factVal, field) {
splitID = $('input[name^=fact_txt_]').last().attr('id').split('_')
suggestionID = splitID[splitID.length - 2] + '_' + splitID[splitID.length - 1]
}
$('#field_' + splitID[splitID.length - 2] + ' #fact_txt_' + suggestionID).val(factName)
$('#fact_constraint_op_' + suggestionID).val('=')
$('#fact_constraint_val_' + suggestionID).val(factVal)
}
}
function deleteFactFromDoc (fact_name, fact_value, doc_id) {
function deleteFactFromDoc(fact_name, fact_value, doc_id) {
var form_data = new FormData()
form_data.append(fact_name, fact_value)
form_data.append('doc_id', doc_id)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment