Skip to content

Commit

Permalink
no need to restart if updating disabled plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Dec 29, 2023
1 parent 15e0bf0 commit 8c71d6b
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 47 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ All notable changes to homebridge-config-ui-x will be documented in this file.
- add link to homebridge wiki in logs on plugin action error
- allow fan/fanv2 rotation speed to be a different unit than percentage
- improve plugin sorting, with actionable plugins at the top
- fix footer paddings for mobile and desktop (#1956) (@mkz212)
- no need to restart if updating disabled plugin

### Translation Changes

Expand Down
40 changes: 20 additions & 20 deletions package-lock.json

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

40 changes: 20 additions & 20 deletions ui/package-lock.json

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

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ <h5 class="modal-title">{{ presentTenseVerb }}: {{ pluginName }}</h5>
</div>
<div [hidden]="!onlineUpdateOk || actionComplete || showReleaseNotes" id="plugin-log-output" class="modal-body"></div>
<div *ngIf="actionComplete" class="modal-body plugin-modal-body">
<div *ngIf="justUpdatedPlugin">
<div *ngIf="justUpdatedPlugin && !isDisabled">
<h3 class="text-center primary-text" [translate]="'platform.version.title_service_restart_required'">
Restart Required
</h3>
Expand Down Expand Up @@ -57,20 +57,25 @@ <h5 *ngIf="updateToBeta">{{ 'plugins.manage.label_release_notes_beta' | translat
<div class="modal-footer justify-content-between" *ngIf="!onlineUpdateOk || actionComplete || showReleaseNotes || actionFailed">
<div class="text-left">
<button type="button" class="btn btn-elegant" data-dismiss="modal" (click)="activeModal.dismiss('Dismiss')"
[attr.aria-label]="'form.button_close' | translate">
[attr.aria-label]="'form.button_close' | translate" *ngIf="!justUpdatedPlugin || (justUpdatedPlugin && (!isDisabled || actionFailed))">
{{ 'form.button_close' | translate }}
</button>
</div>
<div class="text-center">
<button type="button" class="btn btn-elegant" data-dismiss="modal" (click)="activeModal.dismiss('Dismiss')"
[attr.aria-label]="'form.button_close' | translate" *ngIf="justUpdatedPlugin && isDisabled && !actionFailed">
{{ 'form.button_close' | translate }}
</button>
</div>
<div class="text-center"></div>
<div class="text-right">
<button *ngIf="onlineUpdateOk && showReleaseNotes" type="button" class="btn btn-primary" (click)="update()">
{{ 'plugins.button_update' | translate }}
</button>
<button type="button" class="btn btn-primary" *ngIf="justUpdatedPlugin && !['homebridge', 'homebridge-config-ui-x'].includes(pluginName) && childBridges.length > 0"
<button type="button" class="btn btn-primary" *ngIf="justUpdatedPlugin && !isDisabled && !['homebridge', 'homebridge-config-ui-x'].includes(pluginName) && childBridges.length > 0"
(click)="onRestartChildBridgeClick()">
{{ (childBridges.length === 1 ? 'plugins.manage.child_bridge_button_restart_now_one' : 'plugins.manage.child_bridge_button_restart_now') | translate }}
</button>
<button type="button" class="btn btn-primary" *ngIf="justUpdatedPlugin && (['homebridge', 'homebridge-config-ui-x'].includes(pluginName) || childBridges.length === 0)"
<button type="button" class="btn btn-primary" *ngIf="justUpdatedPlugin && !isDisabled && (['homebridge', 'homebridge-config-ui-x'].includes(pluginName) || childBridges.length === 0)"
(click)="onRestartHomebridgeClick()">
{{ 'plugins.manage.button_restart_now' | translate }}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class ManagePluginsModalComponent implements OnInit, OnDestroy {
@Input() targetVersion = 'latest';
@Input() latestVersion: string;
@Input() installedVersion: string;
@Input() isDisabled: boolean;
@Input() action: string;

public actionComplete = false;
Expand Down
1 change: 1 addition & 0 deletions ui/src/app/core/manage-plugins/manage-plugins.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class ManagePluginsService {
ref.componentInstance.targetVersion = targetVersion;
ref.componentInstance.latestVersion = plugin.latestVersion;
ref.componentInstance.installedVersion = plugin.installedVersion;
ref.componentInstance.isDisabled = plugin.disabled;
}

async upgradeHomebridge(homebridgePkg: any, targetVersion = 'latest') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,10 @@ export class PluginCardComponent implements OnInit {
ref.result.then(async () => {
try {
await this.$api.put(`/config-editor/plugin/${encodeURIComponent(plugin.name)}/disable`, {}).toPromise();
// mark as disabled
// Mark as disabled
plugin.disabled = true;
// stop all child bridges

// Stop all child bridges
if (this.hasChildBridges) {
this.doChildBridgeAction('stop');
}
Expand Down

0 comments on commit 8c71d6b

Please sign in to comment.