diff --git a/ui/src/app/modules/plugins/plugin-card/plugin-card.component.html b/ui/src/app/modules/plugins/plugin-card/plugin-card.component.html index 74121cecc..6375153a4 100644 --- a/ui/src/app/modules/plugins/plugin-card/plugin-card.component.html +++ b/ui/src/app/modules/plugins/plugin-card/plugin-card.component.html @@ -56,7 +56,7 @@

placement="top" ngbTooltip="{{'plugins.status_update_available' | translate:plugin }}" container="body" [openDelay]="150"> - diff --git a/ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts b/ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts index 3592469a1..a5bda09eb 100644 --- a/ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts +++ b/ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts @@ -32,6 +32,7 @@ export class PluginCardComponent implements OnInit { public childBridgeStatus = 'pending'; public childBridgeRestartInProgress = false; public recommendChildBridge = false; + public childBridgesLoaded = false; constructor( public $plugin: ManagePluginsService, @@ -45,7 +46,23 @@ export class PluginCardComponent implements OnInit { private $settings: SettingsService, ) {} - ngOnInit(): void {} + ngOnInit(): void { + if ( + !this.$settings.env.recommendChildBridges + || !this.$settings.env.serviceMode + || ['homebridge', 'homebridge-config-ui-x'].includes(this.plugin.name) + ) { + this.recommendChildBridge = false; + return; + } + this.$api.get(`/plugins/config-schema/${encodeURIComponent(this.plugin.name)}`, {}).toPromise() + .then((schema) => { + this.recommendChildBridge = schema.pluginType === 'platform'; + }) + .catch(() => { + this.recommendChildBridge = false; + }); + } @Input() set childBridges(childBridges: any[]) { this.hasChildBridges = childBridges.length > 0; @@ -64,20 +81,7 @@ export class PluginCardComponent implements OnInit { } this._childBridges = childBridges; - - if ( - this.$settings.env.recommendChildBridges - && this.$settings.env.serviceMode - && !['homebridge', 'homebridge-config-ui-x'].includes(this.plugin.name) - ) { - this.$api.get(`/plugins/config-schema/${encodeURIComponent(this.plugin.name)}`, {}).toPromise() - .then((schema) => { - this.recommendChildBridge = schema.pluginType === 'platform'; - }) - .catch(() => { - // ignore - }); - } + this.childBridgesLoaded = true; } openFundingModal(plugin: any) {