re-divorce entry active state from trigger strategy
This commit is contained in:
parent
218416010f
commit
704058ac36
|
@ -5298,12 +5298,15 @@
|
||||||
<div class="world_entry">
|
<div class="world_entry">
|
||||||
<form class="world_entry_form wi-card-entry">
|
<form class="world_entry_form wi-card-entry">
|
||||||
<div class="inline-drawer wide100p">
|
<div class="inline-drawer wide100p">
|
||||||
<div class="inline-drawer-toggle inline-drawer-header gap5px padding0">
|
<div class="inline-drawer-header gap5px padding0">
|
||||||
<span class="drag-handle">☰</span>
|
<span class="drag-handle">☰</span>
|
||||||
<div class="gap5px world_entry_thin_controls wide100p alignitemscenter">
|
<div class="gap5px world_entry_thin_controls wide100p alignitemscenter">
|
||||||
<div class="fa-fw fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
|
<div class="inline-drawer-toggle fa-fw fa-solid fa-circle-chevron-down inline-drawer-icon down"></div>
|
||||||
|
<div class="fa-solid fa-toggle-on" name="entryKillSwitch"></div>
|
||||||
<div class="flex-container alignitemscenter wide100p">
|
<div class="flex-container alignitemscenter wide100p">
|
||||||
|
|
||||||
<div class="WIEntryTitleAndStatus flex-container flex1 alignitemscenter">
|
<div class="WIEntryTitleAndStatus flex-container flex1 alignitemscenter">
|
||||||
|
|
||||||
<div class="flex-container flex1">
|
<div class="flex-container flex1">
|
||||||
<textarea class="text_pole" rows="1" name="comment" maxlength="5000" data-i18n="[placeholder]Entry Title/Memo" placeholder="Entry Title/Memo"></textarea>
|
<textarea class="text_pole" rows="1" name="comment" maxlength="5000" data-i18n="[placeholder]Entry Title/Memo" placeholder="Entry Title/Memo"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5312,7 +5315,7 @@
|
||||||
<option value="constant" title="Constant" data-i18n="[title]WI_Entry_Status_Constant">🔵</option>
|
<option value="constant" title="Constant" data-i18n="[title]WI_Entry_Status_Constant">🔵</option>
|
||||||
<option value="normal" title="Normal" data-i18n="[title]WI_Entry_Status_Normal">🟢</option>
|
<option value="normal" title="Normal" data-i18n="[title]WI_Entry_Status_Normal">🟢</option>
|
||||||
<option value="vectorized" title="Vectorized" data-i18n="[title]WI_Entry_Status_Vectorized">🔗</option>
|
<option value="vectorized" title="Vectorized" data-i18n="[title]WI_Entry_Status_Vectorized">🔗</option>
|
||||||
<option value="disabled" title="Disabled" data-i18n="[title]WI_Entry_Status_Disabled">❌</option>
|
<!--<option value="disabled" title="Disabled" data-i18n="[title]WI_Entry_Status_Disabled">❌</option>-->
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="WIEnteryHeaderControls flex-container">
|
<div class="WIEnteryHeaderControls flex-container">
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div id="WIEntryHeaderTitlesPC" class="flex-container wide100p spaceBetween justifyCenter textAlignCenter" style="padding:0 4.5em;">
|
<div id="WIEntryHeaderTitlesPC" class="flex-container wide100p spaceBetween justifyCenter textAlignCenter" style="padding:0 4.5em;">
|
||||||
<small class="flex1" data-i18n="Title/Memo">Title/Memo</small>
|
<small class="flex1" data-i18n="Title/Memo">Title/Memo</small>
|
||||||
<small style="width: calc(3.5em + 15px)" data-i18n="Status">Status</small>
|
<small style="width: calc(3.5em + 15px)" data-i18n="Strategy">Strategy</small>
|
||||||
<small style="width: calc(3.5em + 30px)" data-i18n="Position">Position</small>
|
<small style="width: calc(3.5em + 30px)" data-i18n="Position">Position</small>
|
||||||
<small style="width: calc(3.5em + 20px)" data-i18n="Depth">Depth</small>
|
<small style="width: calc(3.5em + 20px)" data-i18n="Depth">Depth</small>
|
||||||
<small style="width: calc(3.5em + 20px)" data-i18n="Order">Order</small>
|
<small style="width: calc(3.5em + 20px)" data-i18n="Order">Order</small>
|
||||||
|
|
|
@ -2859,21 +2859,7 @@ async function getWorldEntry(name, data, entry) {
|
||||||
//add UID above content box (less important doesn't need to be always visible)
|
//add UID above content box (less important doesn't need to be always visible)
|
||||||
template.find('.world_entry_form_uid_value').text(`(UID: ${entry.uid})`);
|
template.find('.world_entry_form_uid_value').text(`(UID: ${entry.uid})`);
|
||||||
|
|
||||||
// disable
|
//new tri-state selector for constant/normal/vectorized
|
||||||
/*
|
|
||||||
const disableInput = template.find('input[name="disable"]');
|
|
||||||
disableInput.data("uid", entry.uid);
|
|
||||||
disableInput.on("input", async function () {
|
|
||||||
const uid = $(this).data("uid");
|
|
||||||
const value = $(this).prop("checked");
|
|
||||||
data.entries[uid].disable = value;
|
|
||||||
setOriginalDataValue(data, uid, "enabled", !data.entries[uid].disable);
|
|
||||||
await saveWorldInfo(name, data);
|
|
||||||
});
|
|
||||||
disableInput.prop("checked", entry.disable).trigger("input");
|
|
||||||
*/
|
|
||||||
|
|
||||||
//new tri-state selector for constant/normal/disabled
|
|
||||||
const entryStateSelector = template.find('select[name="entryStateSelector"]');
|
const entryStateSelector = template.find('select[name="entryStateSelector"]');
|
||||||
entryStateSelector.data('uid', entry.uid);
|
entryStateSelector.data('uid', entry.uid);
|
||||||
entryStateSelector.on('click', function (event) {
|
entryStateSelector.on('click', function (event) {
|
||||||
|
@ -2886,31 +2872,32 @@ async function getWorldEntry(name, data, entry) {
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case 'constant':
|
case 'constant':
|
||||||
data.entries[uid].constant = true;
|
data.entries[uid].constant = true;
|
||||||
data.entries[uid].disable = false;
|
//data.entries[uid].disable = false;
|
||||||
data.entries[uid].vectorized = false;
|
data.entries[uid].vectorized = false;
|
||||||
setWIOriginalDataValue(data, uid, 'enabled', true);
|
setWIOriginalDataValue(data, uid, 'enabled', true);
|
||||||
setWIOriginalDataValue(data, uid, 'constant', true);
|
setWIOriginalDataValue(data, uid, 'constant', true);
|
||||||
setWIOriginalDataValue(data, uid, 'extensions.vectorized', false);
|
setWIOriginalDataValue(data, uid, 'extensions.vectorized', false);
|
||||||
template.removeClass('disabledWIEntry');
|
//template.removeClass('disabledWIEntry');
|
||||||
break;
|
break;
|
||||||
case 'normal':
|
case 'normal':
|
||||||
data.entries[uid].constant = false;
|
data.entries[uid].constant = false;
|
||||||
data.entries[uid].disable = false;
|
//data.entries[uid].disable = false;
|
||||||
data.entries[uid].vectorized = false;
|
data.entries[uid].vectorized = false;
|
||||||
setWIOriginalDataValue(data, uid, 'enabled', true);
|
setWIOriginalDataValue(data, uid, 'enabled', true);
|
||||||
setWIOriginalDataValue(data, uid, 'constant', false);
|
setWIOriginalDataValue(data, uid, 'constant', false);
|
||||||
setWIOriginalDataValue(data, uid, 'extensions.vectorized', false);
|
setWIOriginalDataValue(data, uid, 'extensions.vectorized', false);
|
||||||
template.removeClass('disabledWIEntry');
|
//template.removeClass('disabledWIEntry');
|
||||||
break;
|
break;
|
||||||
case 'vectorized':
|
case 'vectorized':
|
||||||
data.entries[uid].constant = false;
|
data.entries[uid].constant = false;
|
||||||
data.entries[uid].disable = false;
|
//data.entries[uid].disable = false;
|
||||||
data.entries[uid].vectorized = true;
|
data.entries[uid].vectorized = true;
|
||||||
setWIOriginalDataValue(data, uid, 'enabled', true);
|
setWIOriginalDataValue(data, uid, 'enabled', true);
|
||||||
setWIOriginalDataValue(data, uid, 'constant', false);
|
setWIOriginalDataValue(data, uid, 'constant', false);
|
||||||
setWIOriginalDataValue(data, uid, 'extensions.vectorized', true);
|
setWIOriginalDataValue(data, uid, 'extensions.vectorized', true);
|
||||||
template.removeClass('disabledWIEntry');
|
//template.removeClass('disabledWIEntry');
|
||||||
break;
|
break;
|
||||||
|
/*
|
||||||
case 'disabled':
|
case 'disabled':
|
||||||
data.entries[uid].constant = false;
|
data.entries[uid].constant = false;
|
||||||
data.entries[uid].disable = true;
|
data.entries[uid].disable = true;
|
||||||
|
@ -2920,15 +2907,38 @@ async function getWorldEntry(name, data, entry) {
|
||||||
setWIOriginalDataValue(data, uid, 'extensions.vectorized', false);
|
setWIOriginalDataValue(data, uid, 'extensions.vectorized', false);
|
||||||
template.addClass('disabledWIEntry');
|
template.addClass('disabledWIEntry');
|
||||||
break;
|
break;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
await saveWorldInfo(name, data);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
const entryKillSwitch = template.find('div[name="entryKillSwitch"]');
|
||||||
|
entryKillSwitch.data('uid', entry.uid);
|
||||||
|
entryKillSwitch.on('click', async function (event) {
|
||||||
|
event.stopPropagation();
|
||||||
|
const uid = entry.uid;
|
||||||
|
data.entries[uid].disable = !data.entries[uid].disable;
|
||||||
|
let isActive = data.entries[uid].disable;
|
||||||
|
setWIOriginalDataValue(data, uid, 'enabled', isActive);
|
||||||
|
if (isActive) {
|
||||||
|
template.removeClass('disabledWIEntry');
|
||||||
|
entryKillSwitch.removeClass('fa-toggle-off');
|
||||||
|
entryKillSwitch.addClass('fa-toggle-on');
|
||||||
|
} else {
|
||||||
|
template.addClass('disabledWIEntry');
|
||||||
|
entryKillSwitch.addClass('fa-toggle-off');
|
||||||
|
entryKillSwitch.removeClass('fa-toggle-on');
|
||||||
}
|
}
|
||||||
await saveWorldInfo(name, data);
|
await saveWorldInfo(name, data);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const entryState = function () {
|
const entryState = function () {
|
||||||
if (entry.disable === true) {
|
/* if (entry.disable === true) {
|
||||||
return 'disabled';
|
return 'disabled';
|
||||||
} else if (entry.constant === true) {
|
} else */
|
||||||
|
if (entry.constant === true) {
|
||||||
return 'constant';
|
return 'constant';
|
||||||
} else if (entry.vectorized === true) {
|
} else if (entry.vectorized === true) {
|
||||||
return 'vectorized';
|
return 'vectorized';
|
||||||
|
@ -2936,6 +2946,20 @@ async function getWorldEntry(name, data, entry) {
|
||||||
return 'normal';
|
return 'normal';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isActive = !entry.disable;
|
||||||
|
if (isActive) {
|
||||||
|
console.warn(`${entry.uid} is active`);
|
||||||
|
template.removeClass('disabledWIEntry');
|
||||||
|
entryKillSwitch.removeClass('fa-toggle-off');
|
||||||
|
entryKillSwitch.addClass('fa-toggle-on');
|
||||||
|
} else {
|
||||||
|
console.warn(`${entry.uid} is not active`);
|
||||||
|
template.addClass('disabledWIEntry');
|
||||||
|
entryKillSwitch.addClass('fa-toggle-off');
|
||||||
|
entryKillSwitch.removeClass('fa-toggle-on');
|
||||||
|
}
|
||||||
|
|
||||||
template
|
template
|
||||||
.find(`select[name="entryStateSelector"] option[value=${entryState()}]`)
|
.find(`select[name="entryStateSelector"] option[value=${entryState()}]`)
|
||||||
.prop('selected', true)
|
.prop('selected', true)
|
||||||
|
|
Loading…
Reference in New Issue