Skip to content

Commit

Permalink
perform a full restart when updating homebridge
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Oct 26, 2024
1 parent 37289c2 commit 4ec2b21
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Plugin developers:
- check for service mode when querying child bridge status
- enable strict config validation for the UI
- bump the default node version from 20 to 22
- perform a full restart when updating `homebridge`

### Homebridge Dependencies

Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
import { Component } from '@angular/core'
import { ApiService } from '@/app/core/api.service'
import { Component, Input } from '@angular/core'
import { Router } from '@angular/router'
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'
import { TranslateService } from '@ngx-translate/core'
import { ToastrService } from 'ngx-toastr'

@Component({
templateUrl: './restart-homebridge.component.html',
})
export class RestartHomebridgeComponent {
@Input() fullRestart = false

constructor(
public $activeModal: NgbActiveModal,
private $api: ApiService,
private $router: Router,
private $toastr: ToastrService,
private $translate: TranslateService,
) {}

public onRestartHomebridgeClick() {
this.$router.navigate(['/restart'])
this.$activeModal.close()
if (!this.fullRestart) {
this.$router.navigate(['/restart'])
this.$activeModal.close()
return
}

this.$api.put('/platform-tools/hb-service/set-full-service-restart-flag', {}).subscribe({
next: () => {
this.$router.navigate(['/restart'])
},
error: (error) => {
console.error(error)
this.$toastr.error(error.message, this.$translate.instant('toast.title_error'))
},
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,11 @@ export class ManagePluginComponent implements OnInit, OnDestroy {
}).subscribe({
next: () => {
this.$activeModal.close()
this.$modal.open(RestartHomebridgeComponent, {
const ref = this.$modal.open(RestartHomebridgeComponent, {
size: 'lg',
backdrop: 'static',
})
ref.componentInstance.fullRestart = true
},
error: (error) => {
this.actionFailed = true
Expand Down

0 comments on commit 4ec2b21

Please sign in to comment.