Skip to content

Commit

Permalink
Merge branch 'beta-4.57.2' into alpha-4.57.2
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Sep 7, 2024
2 parents 8dd6499 + a52cc6c commit ed2171f
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ All notable changes to `homebridge-config-ui-x` will be documented in this file.
- rename instances of `BatteryService` to `Battery`
- update `@ngx-translate/core` and `angular-gridster2`
- make use of `overrides` in the `package.json` files to patch dependency vulnerabilities
- support node 22

### Homebridge Dependencies

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"hb-service": "dist/bin/hb-service.js"
},
"engines": {
"node": "^18 || ^20",
"node": "^18 || ^20 || ^22",
"homebridge": "^1.8.0 || ^2.0.0-beta.0"
},
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions ui/package-lock.json

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

14 changes: 9 additions & 5 deletions ui/src/app/core/manage-plugins/manage-plugins.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ export class ManagePluginsService {
ref.componentInstance.plugin = plugin;
}

async updatePlugin(plugin: any, targetVersion = 'latest') {
async checkAndUpdatePlugin(plugin: any, targetVersion = 'latest') {
if (!await this.checkHbAndNodeVersion(plugin, 'update')) {
return;
}

await this.updatePlugin(plugin, targetVersion);
}

async updatePlugin(plugin: any, targetVersion: string) {
const ref = this.modalService.open(ManagePluginComponent, {
size: 'lg',
backdrop: 'static',
Expand Down Expand Up @@ -91,19 +95,19 @@ export class ManagePluginsService {
ref.componentInstance.plugin = plugin;

try {
const { action, selectedVersion, engines } = await ref.result;
const { action, version, engines } = await ref.result;

if (!await this.checkHbAndNodeVersion({ ...plugin, updateEngines: engines }, action)) {
return;
}

if (plugin.name === 'homebridge') {
return await this.upgradeHomebridge(plugin, selectedVersion);
return await this.upgradeHomebridge(plugin, version);
}

return plugin.installedVersion
? await this.updatePlugin(plugin, selectedVersion)
: this.installPlugin(plugin.name, selectedVersion);
? await this.updatePlugin(plugin, version)
: this.installPlugin(plugin.name, version);
} catch (e) {
// do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h5 class="card-title mb-2 text-truncate">
</h5>
<div class="ml-auto">
<!-- update available -->
<a href="javascript:void(0)" class="card-link" (click)="$plugin.updatePlugin(plugin, plugin.updateTag || 'latest')"
<a href="javascript:void(0)" class="card-link" (click)="$plugin.checkAndUpdatePlugin(plugin, plugin.updateTag || 'latest')"
*ngIf="plugin.installedVersion && plugin.updateAvailable && !childBridgeRestartInProgress"
[ngbTooltip]="'plugins.button_update' | translate" container="body" [attr.aria-label]="'plugins.button_update' | translate">
<i class="far fa-fw fa-arrow-alt-circle-up primary-text fa-lg fa-fade ml-3" style="--fa-animation-duration: 2s;"></i>
Expand Down

0 comments on commit ed2171f

Please sign in to comment.