From 72b344f3132ce68463ce8bcf1a1d89a5408895f9 Mon Sep 17 00:00:00 2001 From: Donavan Becker Date: Tue, 7 Nov 2023 23:30:06 -0600 Subject: [PATCH] Revert "add child bridge restart" This reverts commit 2eef4ffcb7589ff0a8caa0b5956ce26e2bfae657. --- .../manage-plugins-modal.component.html | 21 ++----- .../manage-plugins-modal.component.ts | 59 +------------------ 2 files changed, 6 insertions(+), 74 deletions(-) diff --git a/ui/src/app/core/manage-plugins/manage-plugins-modal/manage-plugins-modal.component.html b/ui/src/app/core/manage-plugins/manage-plugins-modal/manage-plugins-modal.component.html index 491564464..120ed04e7 100644 --- a/ui/src/app/core/manage-plugins/manage-plugins-modal/manage-plugins-modal.component.html +++ b/ui/src/app/core/manage-plugins/manage-plugins-modal/manage-plugins-modal.component.html @@ -8,25 +8,14 @@

Restart Required

-

-

- Please restart Homebridge for the changes to apply. Alternatively, if you have this plugin running in child - bridges, you can close this modal and restart these instead. +

+

+ Please restart Homebridge for the changes to apply. Alternatively, if you have this plugin running in child bridges, you can close this modal and restart these instead.

- -

@@ -64,4 +53,4 @@
{{ release.name }}
- \ No newline at end of file + diff --git a/ui/src/app/core/manage-plugins/manage-plugins-modal/manage-plugins-modal.component.ts b/ui/src/app/core/manage-plugins/manage-plugins-modal/manage-plugins-modal.component.ts index 3a8ffa259..2079df874 100644 --- a/ui/src/app/core/manage-plugins/manage-plugins-modal/manage-plugins-modal.component.ts +++ b/ui/src/app/core/manage-plugins/manage-plugins-modal/manage-plugins-modal.component.ts @@ -20,16 +20,9 @@ export class ManagePluginsModalComponent implements OnInit, OnDestroy { @Input() pluginName; @Input() targetVersion = 'latest'; @Input() action; - @Input() plugin; private io = this.$ws.connectToNamespace('plugins'); - public canConfigure = true; - public configBlocks: any[] = []; - public enabledBlocks: Record = {}; - public usernameCache: Map = new Map(); - public deviceInfo: Map = new Map(); - private term = new Terminal(); private termTarget: HTMLElement; private fitAddon = new FitAddon(); @@ -39,7 +32,6 @@ export class ManagePluginsModalComponent implements OnInit, OnDestroy { public showReleaseNotes = false; public justUpdatedPlugin = false; public updateToBeta = false; - public restartInProgress: Record = {}; public changeLog: string; public release; @@ -53,7 +45,6 @@ export class ManagePluginsModalComponent implements OnInit, OnDestroy { public activeModal: NgbActiveModal, public $toastr: ToastrService, private translate: TranslateService, - private $translate: TranslateService, private $settings: SettingsService, private $api: ApiService, private $ws: WsService, @@ -63,8 +54,7 @@ export class ManagePluginsModalComponent implements OnInit, OnDestroy { this.term.loadAddon(this.fitAddon); } - ngOnInit(): void { - this.loadPluginConfig(); + ngOnInit() { this.termTarget = document.getElementById('plugin-log-output'); this.term.open(this.termTarget); this.fitAddon.fit(); @@ -107,32 +97,6 @@ export class ManagePluginsModalComponent implements OnInit, OnDestroy { } } - loadPluginConfig() { - this.$api.get(`/config-editor/plugin/${encodeURIComponent(this.plugin.name)}`).subscribe( - (configBlocks) => { - this.configBlocks = configBlocks; - for (const [i, block] of this.configBlocks.entries()) { - if (block._bridge && block._bridge.username) { - this.enabledBlocks[i] = true; - this.usernameCache.set(i, block._bridge.username); - this.getDeviceInfo(block._bridge.username); - } - } - }, - (err) => { - this.canConfigure = false; - }, - ); - } - - async getDeviceInfo(username: string) { - try { - this.deviceInfo[username] = await this.$api.get(`/server/pairings/${username.replace(/:/g, '')}`).toPromise(); - } catch (e) { - this.deviceInfo[username] = false; - } - } - install() { if (!this.onlineUpdateOk) { return; @@ -214,27 +178,6 @@ export class ManagePluginsModalComponent implements OnInit, OnDestroy { ); } - async restartChildBridge(username: string) { - this.restartInProgress[username] = true; - try { - await this.$api.put(`/server/restart/${username.replace(/:/g, '')}`, {}).toPromise(); - this.$toastr.success( - this.$translate.instant('child_bridge.toast_restart_requested'), - this.$translate.instant('toast.title_success'), - ); - } catch (err) { - this.$toastr.error( - 'Failed to restart bridge: ' + err.error?.message, - this.$translate.instant('toast.title_error'), - ); - this.restartInProgress[username] = false; - } finally { - setTimeout(() => { - this.restartInProgress[username] = false; - }, 12000); - } - } - upgradeHomebridge() { this.io.request('homebridge-update', { version: this.targetVersion,