fix: webui modules bugs
This commit is contained in:
parent
b0c6c11bcb
commit
7f141e67df
2 changed files with 32 additions and 20 deletions
|
|
@ -332,8 +332,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
async function toggleSkipMount(mod) {
|
||||
if (mod.disabledByFlag) return;
|
||||
async function toggleSkipMount(event, mod) {
|
||||
if (mod.disabledByFlag) {
|
||||
event.target.checked = !event.target.checked;
|
||||
return
|
||||
};
|
||||
|
||||
const moduleDir = config.moduledir || DEFAULT_CONFIG.moduledir;
|
||||
const modulePath = `${moduleDir}/${mod.name}`;
|
||||
|
|
@ -351,6 +354,7 @@
|
|||
|
||||
if (errno !== 0) {
|
||||
console.error(stderr);
|
||||
event.target.checked = !event.target.checked;
|
||||
modules = modules.map(m =>
|
||||
m.name === mod.name ? { ...m, toggling: false, error: L.modules.toggleError } : m
|
||||
);
|
||||
|
|
@ -363,6 +367,7 @@
|
|||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
event.target.checked = !event.target.checked;
|
||||
modules = modules.map(m =>
|
||||
m.name === mod.name ? { ...m, toggling: false, error: L.modules.toggleError } : m
|
||||
);
|
||||
|
|
@ -579,22 +584,24 @@
|
|||
<div class="module-list">
|
||||
{#each modules as m (m.name)}
|
||||
<div class="module-row">
|
||||
<div class="module-name">{m.name}</div>
|
||||
<div class="module-info">
|
||||
<span class="module-name">{m.name}</span>
|
||||
<label class="switch {m.disabledByFlag ? 'disabled' : ''}">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={m.disabledByFlag ? false : !m.skipMount}
|
||||
disabled={m.disabledByFlag || m.toggling}
|
||||
on:change={(e) => {
|
||||
if (!m.disabledByFlag) toggleSkipMount(e,m);
|
||||
}}
|
||||
/>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<label class="switch {m.disabledByFlag ? 'disabled' : ''}">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={m.disabledByFlag ? false : !m.skipMount}
|
||||
disabled={m.disabledByFlag || m.toggling}
|
||||
on:change={() => {
|
||||
if (!m.disabledByFlag) toggleSkipMount(m);
|
||||
}}
|
||||
/>
|
||||
<span class="slider"></span>
|
||||
</label>
|
||||
|
||||
{#if m.error}
|
||||
<p class="error small">{m.error}</p>
|
||||
<div class="error small">{m.error}</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
|
|
|
|||
|
|
@ -229,7 +229,7 @@ button:disabled {
|
|||
.error {
|
||||
font-size: 12px;
|
||||
color: var(--nord11);
|
||||
margin-bottom: 4px;
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.path {
|
||||
|
|
@ -348,15 +348,20 @@ button:disabled {
|
|||
}
|
||||
|
||||
.module-row {
|
||||
padding: 12px 8px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
.module-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 12px 8px;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.08);
|
||||
}
|
||||
|
||||
}
|
||||
.module-name {
|
||||
font-size: 15px;
|
||||
overflow: scroll;
|
||||
flex:1;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
/* switch slider */
|
||||
|
|
|
|||
Loading…
Reference in a new issue