migrace z tinydb, nove direktivy
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
//JS code for using config value on the frontend
|
||||
//TODO zvazit presunuti do TOML z JSONu
|
||||
|
||||
configData = {}
|
||||
|
||||
function get_from_config(name, def_value) {
|
||||
|
||||
@@ -5,7 +5,6 @@ $(document).ready(function () {
|
||||
let editingItemId = null;
|
||||
var localArray = []
|
||||
|
||||
|
||||
// Function to populate the config list and load JSON data initially
|
||||
function populateConfigList(to_select = null) {
|
||||
$.ajax({
|
||||
@@ -28,6 +27,20 @@ $(document).ready(function () {
|
||||
$('#itemName').val(item.item_name);
|
||||
$('#jsonTextarea').val(item.json_data);
|
||||
editingItemId = item.id;
|
||||
// Get the textarea element.
|
||||
var textarea = $("#jsonTextarea");
|
||||
|
||||
// // Highlight the JSON formatted string in the textarea.
|
||||
// hljs.highlightElement(textarea.get(0));
|
||||
// console.log(textarea.get(0))
|
||||
// console.log(textarea.get(1))
|
||||
|
||||
// // Highlight the JSON formatted string whenever the textarea is edited.
|
||||
// textarea.on("input", function() {
|
||||
// hljs.highlightElement(textarea.get(0));
|
||||
// //hljs.highlightBlock(textarea.get(0),{ language: 'json' });
|
||||
// });
|
||||
|
||||
}
|
||||
configList.append(`<option value="${item.id}" ${selected}>${item.item_name}</option>`);
|
||||
});
|
||||
|
||||
@@ -17,11 +17,11 @@ if (statusBarConfig == null) {
|
||||
|
||||
const sorter = (a, b) => a.time > b.time ? 1 : -1;
|
||||
|
||||
indConfig = {}
|
||||
var indConfig = null
|
||||
settings = {}
|
||||
settings
|
||||
//ostatni indicatory nez vwap, volume a bary
|
||||
indConfig = [ {name: "ema", titlevisible: false, embed: true, display: true, priceScaleId: "right", lastValueVisible: false},
|
||||
var indConfig_default = [ {name: "ema", titlevisible: false, embed: true, display: true, priceScaleId: "right", lastValueVisible: false},
|
||||
{name: "ema20", titlevisible: false, embed: true, display: true, priceScaleId: "right", lastValueVisible: false},
|
||||
{name: "tick_volume", histogram: true, titlevisible: true, embed: true, display: true, priceScaleId: '', lastValueVisible: false},
|
||||
{name: "tick_price", titlevisible: true, embed: true, display: true, priceScaleId: "right", lastValueVisible: false},
|
||||
@@ -50,7 +50,7 @@ indConfig = [ {name: "ema", titlevisible: false, embed: true, display: true, pri
|
||||
{name: "ppo", titlevisible: true, embed: true, display: true, priceScaleId: "middle", lastValueVisible: false},
|
||||
{name: "stoch2", titlevisible: true, embed: true, display: true, priceScaleId: "middle", lastValueVisible: false},
|
||||
{name: "sec_price", titlevisible: true, embed: true, display: true, priceScaleId: "right", lastValueVisible: false},]
|
||||
console.log(JSON.stringify(indConfig, null,null, 2))
|
||||
console.log(JSON.stringify(indConfig_default, null,null, 2))
|
||||
|
||||
|
||||
function initialize_statusheader() {
|
||||
@@ -129,6 +129,11 @@ function initialize_statusheader() {
|
||||
|
||||
|
||||
function get_ind_config(indName) {
|
||||
|
||||
if (indConfig == null) {
|
||||
indConfig = get_from_config("indConfig", indConfig_default)
|
||||
}
|
||||
|
||||
const i = indConfig.findIndex(e => e.name === indName);
|
||||
if (i>-1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user