Skip to content

Commit

Permalink
add reload menu item when using as a PWA
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Nov 30, 2024
1 parent 569b80c commit c7a507f
Show file tree
Hide file tree
Showing 33 changed files with 71 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
- updates to the `de.json` language file (#2249) (@Staubgeborener)
- updates to the `ko.json` language file (#2251) (@alphaorderly)
- updates to the `uk.json` language file (#2255) (@xrust83)
- add reload menu item when using as a PWA

### Other Changes

Expand Down
21 changes: 21 additions & 0 deletions ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"dayjs": "1.11.13",
"emoji-js": "3.8.0",
"file-saver": "2.0.5",
"is-standalone-pwa": "0.1.1",
"jquery": "3.7.1",
"json5": "2.2.3",
"lodash-es": "4.17.21",
Expand Down
14 changes: 14 additions & 0 deletions ui/src/app/shared/layout/sidebar/sidebar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,20 @@
</div>
</div>

<div class="link" *ngIf="isPwa">
<div
class="link-row"
(click)="reloadPage()"
[attr.aria-label]="'menu.reload' | translate"
role="menuitem"
tabindex="0"
(keydown)="handleKeydown($event)"
>
<div class="icon"><i class="fa fa-fw fa-refresh"></i></div>
<div class="title">{{ 'menu.reload' | translate }}</div>
</div>
</div>

<div class="link" *ngIf="$settings.formAuth">
<div
class="link-row"
Expand Down
6 changes: 6 additions & 0 deletions ui/src/app/shared/layout/sidebar/sidebar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Component, Input, OnInit, Renderer2 } from '@angular/core'
import { NavigationEnd, Router } from '@angular/router'
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
import { TranslateService } from '@ngx-translate/core'
import { isStandalonePWA } from 'is-standalone-pwa'

@Component({
selector: 'app-sidebar',
Expand All @@ -20,6 +21,7 @@ export class SidebarComponent implements OnInit {
public rPiWasUnderVoltage = false
public isMobile: any = false
public freezeMenu = false
public isPwa = isStandalonePWA()

constructor(
public router: Router,
Expand Down Expand Up @@ -151,4 +153,8 @@ export class SidebarComponent implements OnInit {
}
}
}

reloadPage() {
window.location.reload()
}
}
1 change: 1 addition & 0 deletions ui/src/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Рестартирай Сървъра",
"menu.linux.label_shutdown_server": "Изключи Сървъра",
"menu.linux.label_terminal": "Терминал",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Излез",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Reiniciar Servidor",
"menu.linux.label_shutdown_server": "Apagar Servidor",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Reiniciar",
"menu.settings.title": "Ajustos",
"menu.tooltip_logout": "Tancar Sessió",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Restart serveru",
"menu.linux.label_shutdown_server": "Vypnutí serveru",
"menu.linux.label_terminal": "Terminál",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Odhlásit",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Server neustarten",
"menu.linux.label_shutdown_server": "Server herunterfahren",
"menu.linux.label_terminal": "Konsole",
"menu.reload": "Reload",
"menu.restart.title": "Energieoptionen",
"menu.settings.title": "Einstellungen",
"menu.tooltip_logout": "Ausloggen",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Restart OS",
"menu.linux.label_shutdown_server": "Shutdown OS",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Log Out",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Reiniciar Servidor",
"menu.linux.label_shutdown_server": "Apagar Servidor",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Inicio/Apagado",
"menu.settings.title": "Configuración",
"menu.tooltip_logout": "Cerrar Sesión",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Uudellenkäynnistä järjestelmä",
"menu.linux.label_shutdown_server": "Sulje järjestelmä",
"menu.linux.label_terminal": "Pääte",
"menu.reload": "Reload",
"menu.restart.title": "Käynnistys optiot",
"menu.settings.title": "Asetukset",
"menu.tooltip_logout": "Kirjaudu ulos",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Redémarrer le Serveur",
"menu.linux.label_shutdown_server": "Éteindre le Serveur",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Options d'alimentation",
"menu.settings.title": "Paramètres",
"menu.tooltip_logout": "Déconnexion",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "אתחל מחדש שרת",
"menu.linux.label_shutdown_server": "כבה שרת",
"menu.linux.label_terminal": "קונסולה",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "התנתק",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Szerver újraindítása",
"menu.linux.label_shutdown_server": "Szerver leállítása",
"menu.linux.label_terminal": "Terminál",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Kijelentkezés",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Mengulang Kembali Server",
"menu.linux.label_shutdown_server": "Mematikan Server",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Keluar",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Riavvia sistema",
"menu.linux.label_shutdown_server": "Arresta sistema",
"menu.linux.label_terminal": "Terminale",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Scollegati",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "サーバーを再起動",
"menu.linux.label_shutdown_server": "サーバーを終了",
"menu.linux.label_terminal": "ターミナル",
"menu.reload": "Reload",
"menu.restart.title": "電源オプション",
"menu.settings.title": "設定",
"menu.tooltip_logout": "ログアウト",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "서버 재시작",
"menu.linux.label_shutdown_server": "서버 종료",
"menu.linux.label_terminal": "터미널",
"menu.reload": "Reload",
"menu.restart.title": "전원 옵션",
"menu.settings.title": "설정",
"menu.tooltip_logout": "로그아웃",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/mk.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Рестартирај сервер",
"menu.linux.label_shutdown_server": "Исклучи сервер",
"menu.linux.label_terminal": "Терминал",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Одјави се",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Herstart Server",
"menu.linux.label_shutdown_server": "Server Stoppen",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Power Opties",
"menu.settings.title": "Instellingen",
"menu.tooltip_logout": "Uitloggen",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/no.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Restart serveren",
"menu.linux.label_shutdown_server": "Slå av serveren",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Logg ut",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Zrestartuj serwer",
"menu.linux.label_shutdown_server": "Wyłącz serwer",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Opcje zasilania",
"menu.settings.title": "Ustawienia",
"menu.tooltip_logout": "Wyloguj",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Reiniciar o Servidor",
"menu.linux.label_shutdown_server": "Desligar o Servidor",
"menu.linux.label_terminal": "Teminal",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Sair",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Reiniciar o Servidor",
"menu.linux.label_shutdown_server": "Desligar o Servidor",
"menu.linux.label_terminal": "Consola",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Terminar Sessão",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Перезапустить сервер",
"menu.linux.label_shutdown_server": "Завершение работы сервера",
"menu.linux.label_terminal": "Терминал",
"menu.reload": "Reload",
"menu.restart.title": "Опции питания",
"menu.settings.title": "Настройки",
"menu.tooltip_logout": "Выход",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/sl.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Znova zaženite strežnik",
"menu.linux.label_shutdown_server": "Zaustavi strežnik",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Odjava",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/sv.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Starta om servern",
"menu.linux.label_shutdown_server": "Stäng av servern",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Strömalternativ",
"menu.settings.title": "Inställningar",
"menu.tooltip_logout": "Logga ut",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/th.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "รีสตาร์ทเซิร์ฟเวอร์",
"menu.linux.label_shutdown_server": "ปิดเซิร์ฟเวอร์",
"menu.linux.label_terminal": "เทอร์มินอล",
"menu.reload": "Reload",
"menu.restart.title": "ตัวเลือกด้านพลังงาน",
"menu.settings.title": "การตั้งค่า",
"menu.tooltip_logout": "ออกจากระบบ",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Sunucuyu Yeniden Başlat",
"menu.linux.label_shutdown_server": "Sunucuyu Kapat",
"menu.linux.label_terminal": "Terminal",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "Çıkış Yap",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "Перезавантажити сервер",
"menu.linux.label_shutdown_server": "Завершення роботи сервера",
"menu.linux.label_terminal": "Термінал",
"menu.reload": "Reload",
"menu.restart.title": "Опції живлення",
"menu.settings.title": "Налаштування",
"menu.tooltip_logout": "Вихід",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "重启服务器",
"menu.linux.label_shutdown_server": "关闭服务器",
"menu.linux.label_terminal": "终端",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "注销",
Expand Down
1 change: 1 addition & 0 deletions ui/src/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
"menu.linux.label_restart_server": "重新啟動 Homebridge",
"menu.linux.label_shutdown_server": "關閉 Homebridge",
"menu.linux.label_terminal": "終端機",
"menu.reload": "Reload",
"menu.restart.title": "Power Options",
"menu.settings.title": "Settings",
"menu.tooltip_logout": "登出",
Expand Down

0 comments on commit c7a507f

Please sign in to comment.