mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
🔃 Node sync v0.2
This commit is contained in:
@@ -144,7 +144,16 @@ function cacheSettings()
|
||||
if(options_params != [])
|
||||
{
|
||||
// handles only strings of length == 1
|
||||
resolvedOptions = `["${resolveParams(options_params, resolvedOptions[0])}"]`
|
||||
|
||||
resolved = resolveParams(options_params, resolvedOptions[0])
|
||||
|
||||
if(resolved.includes('"')) // check if list of strings
|
||||
{
|
||||
resolvedOptions = `[${resolved}]`
|
||||
} else // one value only
|
||||
{
|
||||
resolvedOptions = `["${resolved}"]`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1027,8 +1036,18 @@ function resolveParams(params, template) {
|
||||
// If the parameter type is 'setting', retrieve setting value
|
||||
if (param.type == "setting") {
|
||||
var value = getSetting(param.value);
|
||||
|
||||
// Remove brackets and single quotes, replace them with double quotes
|
||||
value = value.replace('[','').replace(']','').replace(/'/g, '"');
|
||||
|
||||
// Split the string into an array, remove empty elements
|
||||
const arr = value.split(',').filter(Boolean);
|
||||
|
||||
// Join the array elements with commas
|
||||
const result = arr.join(', ');
|
||||
|
||||
// Replace placeholder with setting value
|
||||
template = template.replace("{" + param.name + "}", value);
|
||||
template = template.replace("{" + param.name + "}", result);
|
||||
} else {
|
||||
// If the parameter type is not 'setting', use the provided value
|
||||
template = template.replace("{" + param.name + "}", param.value);
|
||||
|
||||
@@ -539,6 +539,7 @@ function getParam(targetId, key, skipCache = false) {
|
||||
// optionsArray = getSettingOptions(set['Code_Name'] )
|
||||
valuesArray = createArray(set['Value']);
|
||||
|
||||
|
||||
// create unique ID
|
||||
var targetLocation = set['Code_Name'] + "_initSettingDropdown";
|
||||
|
||||
|
||||
@@ -95,9 +95,29 @@ function initSettingDropdown(settingKey, // Identifier for the setting
|
||||
{
|
||||
|
||||
var optionsHtml = ""
|
||||
|
||||
|
||||
if(settingKey == 'SYNC_plugins' || settingKey == 'VNDRPDT_WATCH')
|
||||
{
|
||||
console.log('getSettingOptions(settingKey)');
|
||||
console.log(getSettingOptions(settingKey));
|
||||
|
||||
}
|
||||
|
||||
|
||||
optionsArray = createArray(getSettingOptions(settingKey))
|
||||
|
||||
|
||||
if(settingKey == 'SYNC_plugins' || settingKey == 'VNDRPDT_WATCH')
|
||||
{
|
||||
console.log('settingKey');
|
||||
console.log(settingKey);
|
||||
console.log('valuesArray');
|
||||
console.log(valuesArray);
|
||||
console.log('optionsArray');
|
||||
console.log(optionsArray);
|
||||
}
|
||||
|
||||
// check if the result is a SQL query
|
||||
if(isSQLQuery(optionsArray[0]))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user