-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added feature to clear cached accessories when using hb-service
- Loading branch information
Showing
29 changed files
with
277 additions
and
3 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.
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
31 changes: 31 additions & 0 deletions
31
ui/src/app/core/reset-cached-accessories-modal/reset-cached-accessories-modal.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,31 @@ | ||
<div class="modal-content"> | ||
<div class="modal-header"> | ||
<h5 class="modal-title" [translate]="'reset.title_clear_cached_accessories'">Clear Cached Accessories</h5> | ||
<button type="button" class="close" data-dismiss="modal" aria-label="Close" | ||
(click)="activeModal.dismiss('Cross click')"> | ||
<span aria-hidden="true">×</span> | ||
</button> | ||
</div> | ||
<div class="modal-body"> | ||
<h3 class="text-center primary-text" [translate]="'reset.title_warning'">Warning</h3> | ||
<p class="text-center grey-text" [translate]="'reset.message_action_is_irreversible'">This action is irreversible. | ||
Please read carefully before proceeding.</p> | ||
<ul> | ||
<li [translate]="'reset.message_remove_cached_accessories'"> | ||
This action will remove all cached accessories from your Homebridge instance. | ||
</li> | ||
<li [translate]="'reset.accessories_will_may_need_to_be_reconfigured'"> | ||
After performing this action some accessories may need to be reconfigured in HomeKit or re-added to your | ||
automations. | ||
</li> | ||
</ul> | ||
<div class="text-center"> | ||
<button type="button" class="btn btn-elegant" data-dismiss="modal" (click)="onResetCachedAccessoriesClick()" | ||
[disabled]="clicked" [translate]="'reset.title_clear_cached_accessories'">Clear Cached Accessories</button> | ||
</div> | ||
</div> | ||
<div class="modal-footer"> | ||
<button type="button" class="btn btn-primary" data-dismiss="modal" (click)="activeModal.dismiss('Cross click')" | ||
[translate]="'form.button_close'">Close</button> | ||
</div> | ||
</div> |
Empty file.
36 changes: 36 additions & 0 deletions
36
ui/src/app/core/reset-cached-accessories-modal/reset-cached-accessories-modal.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,36 @@ | ||
import { Component } 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'; | ||
import { ApiService } from '../api.service'; | ||
|
||
@Component({ | ||
selector: 'app-reset-cached-accessories-modal', | ||
templateUrl: './reset-cached-accessories-modal.component.html', | ||
styleUrls: ['./reset-cached-accessories-modal.component.scss'], | ||
}) | ||
export class ResetCachedAccessoriesModalComponent { | ||
public clicked: boolean; | ||
|
||
constructor( | ||
public activeModal: NgbActiveModal, | ||
public toastr: ToastrService, | ||
private translate: TranslateService, | ||
private $route: Router, | ||
private $api: ApiService, | ||
) { } | ||
|
||
onResetCachedAccessoriesClick() { | ||
this.clicked = true; | ||
return this.$api.put('/server/reset-cached-accessories', {}).subscribe( | ||
data => { | ||
this.toastr.success(this.translate.instant('reset.toast_clear_cached_accessories_success'), this.translate.instant('toast.title_success')); | ||
this.activeModal.close(); | ||
}, | ||
async err => { | ||
this.toastr.error(this.translate.instant('reset.toast_failed_to_reset'), 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
Oops, something went wrong.