Switch to remove button for selected instances
This commit is contained in:
parent
7bea53805e
commit
f167e6ee7d
|
@ -207,20 +207,34 @@
|
||||||
<span style="color:{pingCache[instance].color}">{pingCache[instance].value}</span>
|
<span style="color:{pingCache[instance].color}">{pingCache[instance].value}</span>
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
<button
|
{#if !_options[selectedFrontend].includes(instance)}
|
||||||
class="add"
|
<button
|
||||||
aria-label="Add instance"
|
class="add"
|
||||||
on:click={() => {
|
aria-label="Add instance"
|
||||||
if (_options[selectedFrontend]) {
|
on:click={() => {
|
||||||
if (!_options[selectedFrontend].includes(instance)) {
|
if (_options[selectedFrontend]) {
|
||||||
_options[selectedFrontend].push(instance)
|
_options[selectedFrontend].push(instance)
|
||||||
options.set(_options)
|
options.set(_options)
|
||||||
}
|
}
|
||||||
}
|
}}
|
||||||
}}
|
>
|
||||||
>
|
<AddIcon />
|
||||||
<AddIcon />
|
</button>
|
||||||
</button>
|
{:else}
|
||||||
|
<button
|
||||||
|
class="add"
|
||||||
|
aria-label="Remove Instance"
|
||||||
|
on:click={() => {
|
||||||
|
const index = _options[selectedFrontend].indexOf(instance)
|
||||||
|
if (index > -1) {
|
||||||
|
_options[selectedFrontend].splice(index, 1)
|
||||||
|
options.set(_options)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
</Row>
|
</Row>
|
||||||
<hr />
|
<hr />
|
||||||
{/each}
|
{/each}
|
||||||
|
|
Loading…
Reference in New Issue