From 32122492a1195f96042cee9dc7f31871b4076dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20H=C3=B8gh?= Date: Tue, 15 Mar 2022 13:04:29 +0100 Subject: [PATCH] Config settings for table position and width and height --- browser/modules/init.js | 5 ++++ browser/modules/layerTree/index.js | 46 ++++++++++++++++-------------- browser/modules/sqlQuery.js | 1 - 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/browser/modules/init.js b/browser/modules/init.js index d91bb09aa..db1f58607 100644 --- a/browser/modules/init.js +++ b/browser/modules/init.js @@ -69,6 +69,11 @@ module.exports = { activeLayers: [], initFunction: null, snapshot: null, + vectorTable: { + position: 'bottom', + width: '30%', + height: '250px' + } }; // Set default for unset props for (let prop in defaults) { diff --git a/browser/modules/layerTree/index.js b/browser/modules/layerTree/index.js index a6516e42f..f4ef225a2 100644 --- a/browser/modules/layerTree/index.js +++ b/browser/modules/layerTree/index.js @@ -1441,29 +1441,33 @@ module.exports = { let styles; let height = null; let tableBodyHeight; - const m = 400; - const p = 30; - if (1 === 1) { - styles = `width: ${p}%; float: right;`; - $("#pane").css("width", `calc(100vw - ${p}%)`); - $("#pane").css("left", "0"); + const h = window.vidiConfig.vectorTable.height; + const w = window.vidiConfig.vectorTable.width; + const position = window.vidiConfig.vectorTable.position; + const e = $('#pane'); + if (position === 'left') { + styles = `width: ${w}; float: right;`; + e.css("width", `calc(100vw - ${w})`); + e.css("left", "0"); tableBodyHeight = "calc(100vh - 34px)"; - height= $(window).height(); - } else { - styles = `width: 100%; height: ${m}; bottom: 0; position: fixed;`; - $("#pane").css("height", `calc(100vh - ${m}px)`); - tableBodyHeight = (m - 34) + "px" - height = m; + height = $(window).height(); + } else if (position === 'bottom') { + styles = `width: 100%; height: ${h}; bottom: 0; position: fixed;`; + e.css("height", `calc(100vh - ${h})`); + height = parseInt(h); + tableBodyHeight = (height - 34) + "px" + } + if (position === 'left' || position === 'bottom') { + e.before(`
`) + _self.createTable(layerKey, true, "#" + VECTOR_SIDE_TABLE_EL, { + showToggle: false, + showExport: false, + showColumns: false, + cardView: false, + height: height, + tableBodyHeight: tableBodyHeight + }); } - $("#pane").before(`
`) - _self.createTable(layerKey, true, "#" + VECTOR_SIDE_TABLE_EL, { - showToggle: false, - showExport: false, - showColumns: false, - cardView: false, - height: height, - tableBodyHeight: tableBodyHeight - }); } if (reloadInterval && reloadInterval !== "") { let reloadCallback = meta.parseLayerMeta(layerKey)?.reload_callback; diff --git a/browser/modules/sqlQuery.js b/browser/modules/sqlQuery.js index c8e5a87a1..0f1150002 100644 --- a/browser/modules/sqlQuery.js +++ b/browser/modules/sqlQuery.js @@ -790,7 +790,6 @@ module.exports = { }) }); } - console.log("cm", cm) return cm; },