simplify power button

This commit is contained in:
Maxi Quoß
2023-01-26 20:03:22 +01:00
parent 2d7a5755ce
commit 3dc2eaca6d
2 changed files with 30 additions and 29 deletions

View File

@@ -30,8 +30,8 @@ Open up [http://localhost:5173/](http://localhost:5173/)
- frontend
- [x] add rest of settings page
- [x] form for adding new devices
- [x] ~~add rest of settings page~~
- [x] ~~form for adding new devices~~
- [ ] add per device settings
- [x] ~~theme toggle button~~
- [x] ~~add device ports to cards~~
@@ -40,11 +40,11 @@ Open up [http://localhost:5173/](http://localhost:5173/)
- [x] ~~make sure ping works~~
- [ ] make sure arp works
- [x] make sure wake works
- [x] ~~make sure wake works~~
- [ ] remove nmap?
- [ ] add shutdown command
- [ ] add scheduled wake
- [x] [#34 Add support for WOL passwords](https://github.com/seriousm4x/UpSnap/issues/34)
- [x] [~~#34 Add support for WOL passwords~~](https://github.com/seriousm4x/UpSnap/issues/34)
- [x] [~~#33 Seemingly High Ram usage~~](https://github.com/seriousm4x/UpSnap/issues/33)
- [x] [~~#32 API available?~~](https://github.com/seriousm4x/UpSnap/issues/32)

View File

@@ -30,36 +30,37 @@
<div class="card-body">
<div class="row">
<div class="col-auto me-auto">
<span
class:text-danger={device.status == 'offline' ? true : false}
class:text-success={device.status == 'online' ? true : false}
on:click={device.status == 'offline'
? () => wake()
: device.status == 'online'
? () => shutdown()
: ''}
on:keydown={device.status == 'offline'
? () => wake()
: device.status == 'online'
? () => shutdown()
: ''}
>
{#if device.status === 'pending'}
<div
class="spinner-border text-warning"
style="width: 23px;height: 23px;"
role="status"
>
<span class="visually-hidden">Loading...</span>
</div>
{:else}
{#if device.status === 'offline'}
<span class="text-danger" on:click={() => wake()} on:keydown={() => wake()}>
<div role="button">
<Fa icon={faPowerOff} class="fs-4 power-hover" />
</div>
</span>
{:else if device.status === 'online'}
{#if device.shutdown_cmd !== ''}
<span class="text-success" on:click={() => shutdown()} on:keydown={() => shutdown()}>
<div role="button">
<Fa icon={faPowerOff} class="fs-4 power-hover" />
</div>
</span>
{:else}
<span class="text-success">
<div>
<Fa icon={faPowerOff} class="fs-4" />
</div>
</span>
{/if}
</span>
{:else if device.status === 'pending'}
<div
class="spinner-border text-warning"
style="width: 23px;height: 23px;"
role="status"
>
<span class="visually-hidden">Loading...</span>
</div>
{/if}
</div>
<div class="col-auto">
<div class="col-auto fs-5">
<Fa icon={faEllipsisVertical} />
</div>
</div>