Skip to content

Commit

Permalink
improvements to bridge settings flow
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Nov 15, 2023
1 parent eb7bb1a commit 32c3a87
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ <h5 class="primary-text">
</div>
<div class="modal-footer justify-content-between">
<div class="text-left">
<button type="button" class="btn btn-elegant" data-dismiss="modal" (click)="activeModal.close('Dismiss')"
*ngIf="configBlocks.length">
<button type="button" class="btn btn-elegant" data-dismiss="modal" (click)="activeModal.close('Dismiss')">
{{ 'form.button_close' | translate }}
</button>
</div>
Expand All @@ -122,16 +121,15 @@ <h5 class="primary-text">
<i [ngClass]="plugin.links.homepage | externalLinkIcon"></i>
</a>
</div>
<div class="text-center" *ngIf="!configBlocks.length">
<button type="button" class="btn btn-elegant" data-dismiss="modal" (click)="activeModal.close('Dismiss')">
{{ 'form.button_close' | translate }}
</button>
</div>
<div class="text-center" *ngIf="!configBlocks.length"></div>
<div class="text-right">
<button type="button" class="btn btn-primary" (click)="save()" [disabled]="saveInProgress"
*ngIf="configBlocks.length">
{{ 'form.button_save' | translate }} <i *ngIf="saveInProgress" class="fas fa-fw fa-spinner fa-pulse"></i>
</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" (click)="openPluginConfig()" *ngIf="!configBlocks.length">
{{ 'plugins.button_settings' | translate }}
</button>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { ToastrService } from 'ngx-toastr';
import { ApiService } from '@/app/core/api.service';
import { ManagePluginsService } from '@/app/core/manage-plugins/manage-plugins.service';
import { NotificationService } from '@/app/core/notification.service';
import { SettingsService } from '@/app/core/settings.service';

Expand All @@ -29,6 +30,7 @@ export class BridgePluginsModalComponent implements OnInit {
public $settings: SettingsService,
private $notification: NotificationService,
private $api: ApiService,
private $plugins: ManagePluginsService,
private $toastr: ToastrService,
private $translate: TranslateService,
) { }
Expand Down Expand Up @@ -107,6 +109,18 @@ export class BridgePluginsModalComponent implements OnInit {
}
}

openPluginConfig() {
// Close the existing modal
this.activeModal.close();

// Open the plugin config modal
this.$plugins.settings({
name: this.plugin.name,
settingsSchema: true,
links: {},
});
}

async restartChildBridge(username: string) {
this.restartInProgress[username] = true;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ <h5 class="modal-title">
[translate]="'plugins.manage.message_thanks_for_updating_restart_child_bridges'">
Please restart the plugin's child bridges for the changes to apply.
</p>
<div class="text-center">
<button type="button" class="btn btn-primary" *ngIf="!['homebridge', 'homebridge-config-ui-x'].includes(plugin.name) && 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="['homebridge', 'homebridge-config-ui-x'].includes(plugin.name) || childBridges.length === 0" (click)="onRestartHomebridgeClick()"
[translate]="'plugins.manage.button_restart_now'">Restart Homebridge</button>
</div>
</div>

<div class="modal-body" style="min-height: 110px;" [hidden]="justSavedAndExited">
Expand Down Expand Up @@ -92,5 +83,21 @@ <h5 class="modal-title">
</button>
</div>
</div>
<div class="modal-footer" [hidden]="!justSavedAndExited"></div>
<div class="modal-footer justify-content-between" [hidden]="!justSavedAndExited">
<div class="text-left">
<button type="button" class="btn btn-elegant" data-dismiss="modal" (click)="activeModal.close('Dismiss')">
{{ 'form.button_close' | translate }}
</button>
</div>
<div class="text-center"></div>
<div class="text-right">
<button type="button" class="btn btn-primary" *ngIf="!['homebridge', 'homebridge-config-ui-x'].includes(plugin.name) && 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="['homebridge', 'homebridge-config-ui-x'].includes(plugin.name) || childBridges.length === 0" (click)="onRestartHomebridgeClick()"
[translate]="'plugins.manage.button_restart_now'">Restart Homebridge</button>
</div>
</div>
</div>

0 comments on commit 32c3a87

Please sign in to comment.