-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add plugin list modal for updating to hb v2.0
- Loading branch information
Showing
10 changed files
with
201 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
84 changes: 84 additions & 0 deletions
84
ui/src/app/core/manage-plugins/hb-update-confirm/hb-update-confirm.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title">Homebridge v2 Update</h5> | ||
<button | ||
type="button" | ||
class="btn-close" | ||
data-bs-dismiss="modal" | ||
[attr.aria-label]="'form.button_close' | translate" | ||
(click)="$activeModal.close('Dismiss')" | ||
></button> | ||
</div> | ||
<div class="modal-body w-100 text-center"> | ||
<div *ngIf="loading" class="w-100 text-center primary-text"> | ||
<i class="fa fa-fw fa-cog fa-spin" style="font-size: 75px"></i> | ||
</div> | ||
<div *ngIf="!loading"> | ||
<div *ngIf="allPluginsSupported"> | ||
<i class="fas fa-fw fa-check-circle primary-text mb-4" style="font-size: 75px"></i> | ||
<p>All your plugins are marked as compatible with the new version of Homebridge.</p> | ||
<p>You are all set to continue below.</p> | ||
</div> | ||
<div *ngIf="!allPluginsSupported"> | ||
<i class="fas fa-fw fa-info-circle primary-text mb-4" style="font-size: 75px"></i> | ||
<p>Some of your plugins are not explicitly marked as compatible with the new version of Homebridge.</p> | ||
<p> | ||
This does <span class="fw-bold">not</span> necessarily mean that they won't work. We just can't guarantee that | ||
they will. | ||
</p> | ||
<p> | ||
For more information about this update, please see the | ||
<a href="https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0" target="_blank" | ||
>wiki page</a | ||
>. | ||
</p> | ||
<p>To ignore this warning and continue with the update, click continue below.</p> | ||
</div> | ||
<ul class="list-group list-group-box mt-4"> | ||
<li | ||
*ngFor="let plugin of installedPlugins" | ||
class="list-group-item d-flex flex-row flex-wrap justify-content-between" | ||
> | ||
<span class="font-monospace">{{ plugin.name }}</span> | ||
<span *ngIf="plugin.hb2Ready === 'supported'"> | ||
<i | ||
class="fas fa-check-circle green-text fa-xl ms-2" | ||
aria-label="The developer has specifically marked this plugin as compatible with Homebridge v2.0" | ||
></i> | ||
</span> | ||
<span *ngIf="plugin.hb2Ready === 'unknown'"> | ||
<i | ||
class="fas fa-question-circle yellow-text fa-xl ms-2" | ||
aria-label="The developer has not specifically marked this plugin as compatible with Homebridge v2.0, but it may still work." | ||
></i> | ||
</span> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
<div class="modal-footer justify-content-between"> | ||
<div class="text-start"> | ||
<button | ||
type="button" | ||
class="btn btn-elegant" | ||
data-bs-dismiss="modal" | ||
(click)="$activeModal.close('Dismiss')" | ||
[attr.aria-label]="'form.button_close' | translate" | ||
> | ||
{{ 'form.button_close' | translate }} | ||
</button> | ||
</div> | ||
<div class="text-center"></div> | ||
<div class="text-end"> | ||
<button | ||
[disabled]="loading" | ||
type="button" | ||
class="btn btn-primary" | ||
data-bs-dismiss="modal" | ||
(click)="$activeModal.close('update')" | ||
> | ||
{{ 'plugins.node_update.continue' | translate }} | ||
</button> | ||
</div> | ||
</div> | ||
</div> |
56 changes: 56 additions & 0 deletions
56
ui/src/app/core/manage-plugins/hb-update-confirm/hb-update-confirm.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ApiService } from '@/app/core/api.service' | ||
import { SettingsService } from '@/app/core/settings.service' | ||
import { Component, OnInit } from '@angular/core' | ||
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap' | ||
import { TranslateService } from '@ngx-translate/core' | ||
import { ToastrService } from 'ngx-toastr' | ||
import { firstValueFrom } from 'rxjs' | ||
|
||
@Component({ | ||
templateUrl: './hb-update-confirm.component.html', | ||
}) | ||
export class HbUpdateConfirmComponent implements OnInit { | ||
public loading = true | ||
public installedPlugins: any = [] | ||
public allPluginsSupported = true | ||
|
||
constructor( | ||
public $activeModal: NgbActiveModal, | ||
private $api: ApiService, | ||
public $settings: SettingsService, | ||
private $toastr: ToastrService, | ||
private $translate: TranslateService, | ||
) {} | ||
|
||
ngOnInit() { | ||
this.loadInstalledPlugins() | ||
} | ||
|
||
async loadInstalledPlugins() { | ||
this.installedPlugins = [] | ||
this.loading = true | ||
const homebridgeVersion = this.$settings.env.homebridgeVersion.split('.')[0] | ||
|
||
try { | ||
const installedPlugins = await firstValueFrom(this.$api.get('/plugins')) | ||
this.installedPlugins = installedPlugins | ||
.filter((x: any) => x.name !== 'homebridge-config-ui-x') | ||
.map((x: any) => { | ||
const hbEngines = x.engines?.homebridge?.split('||').map((x: string) => x.trim()) || [] | ||
const hb2Ready = homebridgeVersion === '2' ? 'hide' : hbEngines.some((x: string) => (x.startsWith('^2') || x.startsWith('>=2'))) ? 'supported' : 'unknown' | ||
if (hb2Ready === 'unknown') { | ||
this.allPluginsSupported = false | ||
} | ||
return { | ||
...x, | ||
hb2Ready, | ||
} | ||
}) | ||
|
||
this.loading = false | ||
} catch (error) { | ||
console.error(error) | ||
this.$toastr.error(this.$translate.instant('plugins.toast_failed_to_load_plugins'), this.$translate.instant('toast.title_error')) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters