Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint await issues - # 1628 #1708

Closed
Closed
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b8484c6
trigger attach-artifacts
donavanbecker Nov 11, 2023
c1734bb
Update th.json (#1688)
tomzt Nov 11, 2023
a8dceae
test plugin logs
bwp91 Nov 11, 2023
d271f6e
Update Attach Artifacts.yml
donavanbecker Nov 11, 2023
84cb480
Update log.service.ts
bwp91 Nov 11, 2023
2e2d557
Update log.service.ts
bwp91 Nov 11, 2023
f85fc32
Update log.service.ts
bwp91 Nov 11, 2023
c42a1af
Update log.service.ts
bwp91 Nov 11, 2023
907b619
Update log.service.ts
bwp91 Nov 11, 2023
cc6125b
Update log.service.ts
bwp91 Nov 11, 2023
aebd335
Update log.service.ts
bwp91 Nov 11, 2023
75681e0
Update log.service.ts
bwp91 Nov 11, 2023
5e095f5
Update log.service.ts
bwp91 Nov 11, 2023
e671ae4
Update log.service.ts
bwp91 Nov 12, 2023
dc3ed22
Update log.service.ts
bwp91 Nov 12, 2023
a40c883
Update log.service.ts
bwp91 Nov 12, 2023
3dde65e
fix
bwp91 Nov 12, 2023
fd1a742
Update log.service.ts
bwp91 Nov 12, 2023
0337bce
Update log.service.ts
bwp91 Nov 12, 2023
39e17cf
update de.json (#1694)
Staubgeborener Nov 12, 2023
1c7be0c
clean up, try downgrade xterm
bwp91 Nov 12, 2023
382e206
reset xterm, fix labels
bwp91 Nov 12, 2023
d7a1951
layout fix (#1690)
mkz212 Nov 12, 2023
695f419
reorganise restart section
bwp91 Nov 12, 2023
43d8564
fix
bwp91 Nov 12, 2023
824ef9c
restart child bridge after save setting custom ui
bwp91 Nov 12, 2023
71ad624
consistent modal footers
bwp91 Nov 12, 2023
f4a67b7
quick fixes
bwp91 Nov 12, 2023
40033fd
more consistency
bwp91 Nov 12, 2023
80c737d
updates
bwp91 Nov 12, 2023
0707937
restart cb after settings ui update
bwp91 Nov 12, 2023
b47a762
fix (revert) extractNodejs tar extract
bwp91 Nov 13, 2023
0e57693
up
bwp91 Nov 13, 2023
c15c4b0
await lint issues resolved
NorthernMan54 Nov 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test plugin logs
bwp91 committed Nov 11, 2023
commit a8dceaef1a12c52e16b10cac548cf835ce9953fd
7 changes: 7 additions & 0 deletions ui/package-lock.json

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

1 change: 1 addition & 0 deletions ui/package.json
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@
"@angular/language-service": "^14.3.0",
"@fortawesome/fontawesome-free": "^6.4.2",
"@types/emoji-js": "^3.5.2",
"@types/file-saver": "^2.0.7",
"@types/node": "^18.18.9",
"@types/qrcode": "^1.5.5",
"@types/semver": "^7.5.5",
18 changes: 15 additions & 3 deletions ui/src/app/core/log.service.ts
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@
private webLinksAddon: WebLinksAddon;
private resize: Subject<any>;
private elementResize: Subject<any> | undefined;
private pluginName: string;

constructor(
private $ws: WsService,
@@ -26,7 +27,10 @@
startTerminal(
targetElement: ElementRef,
termOpts: ITerminalOptions = {},
elementResize?: Subject<any>) {
elementResize?: Subject<any>,
pluginName?: string,
) {
this.pluginName = pluginName;

// handle element resize events
this.elementResize = elementResize;
@@ -75,8 +79,16 @@
});

// subscribe to incoming data events from server to client
this.io.socket.on('stdout', data => {
this.term.write(data);
this.io.socket.on('stdout', (data: string) => {
if (this.pluginName) {
const regexPattern = new RegExp(`\\[.+?\] \\[(${pluginName})\].+?\\n`, 'g');

Check failure

Code scanning / CodeQL

Useless regular-expression character escape High

The escape sequence ']' is equivalent to just ']', so the sequence may still represent a meta-character when it is used in a
regular expression
.

Check failure

Code scanning / CodeQL

Useless regular-expression character escape High

The escape sequence ']' is equivalent to just ']', so the sequence may still represent a meta-character when it is used in a
regular expression
.
(data.match(regexPattern) || []).forEach((line: string) => {
this.term.write(line + '\r');
console.log(line);
});
} else {
this.term.write(data);
}
});

// handle resize events from the client
2 changes: 2 additions & 0 deletions ui/src/app/core/manage-plugins/manage-plugins.module.ts
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ import { NodeUpdateRequiredModalComponent } from './node-update-required-modal/n
import { ManualPluginConfigModalComponent } from './manual-plugin-config-modal/manual-plugin-config-modal.component';
import { SelectPreviousVersionComponent } from './select-previous-version/select-previous-version.component';
import { BridgePluginsModalComponent } from './bridge-plugins-modal/bridge-plugins-modal.component';
import { PluginLogModalComponent } from '@/app/core/manage-plugins/plugin-log-modal/plugin-log-modal.component';

@NgModule({
declarations: [
@@ -28,6 +29,7 @@ import { BridgePluginsModalComponent } from './bridge-plugins-modal/bridge-plugi
ManualPluginConfigModalComponent,
SelectPreviousVersionComponent,
BridgePluginsModalComponent,
PluginLogModalComponent,
],
imports: [
CommonModule,
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Logs: {{ plugin.displayName || plugin.name }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"
(click)="activeModal.dismiss('Cross click')">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body d-flex flex-row flex-grow-1 w-100">
<div #pluginlogoutput class="w-100 bg-black plugin-log-output terminal align-self-end w-100 h-100 mb-1 p-2"></div>

</div>
<div class="modal-footer">

</div>
</div>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import {
Component,
ElementRef,
HostListener,
Input,
OnDestroy,
OnInit,
ViewChild,
} from '@angular/core';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { ToastrService } from 'ngx-toastr';

import { ApiService } from '@/app/core/api.service';
import { TranslateService } from '@ngx-translate/core';
import { LogService } from '@/app/core/log.service';
import { Subject } from 'rxjs';

@Component({
selector: 'app-plugin-log-modal',
templateUrl: './plugin-log-modal.component.html',
styleUrls: ['./plugin-log-modal.component.scss'],
})
export class PluginLogModalComponent implements OnInit, OnDestroy {
@Input() plugin: any;
@ViewChild('pluginlogoutput', { static: true }) termTarget: ElementRef;
private resizeEvent = new Subject();

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

ngOnInit(): void {
this.getPluginLog();
}

@HostListener('window:resize', ['$event'])
onWindowResize(event) {
this.resizeEvent.next(undefined);
}

getPluginLog() {
// Get the plugin name as configured in the config file
this.$api.get(`/config-editor/plugin/${this.plugin.name}`).subscribe(
(result) => {
const logAlias = this.plugin.name === 'homebridge-config-ui-x' ? 'Homebridge UI' : result[0].name;
this.$log.startTerminal(this.termTarget, {}, this.resizeEvent, logAlias);
},
(err) => {
this.$toastr.error(`${err.error.message || err.message}`, this.$translate.instant('toast.title_error'));
this.activeModal.dismiss();
},
);
}

ngOnDestroy() {
this.$log.destroyTerminal();
}
}
Original file line number Diff line number Diff line change
@@ -112,6 +112,10 @@ <h4 class="card-title mb-0">
<i class="fas fa-fw fa-fw fa-history"></i>
{{ 'plugins.manage.message_install_alternate_version' | translate }}
</button>
<button ngbDropdownItem (click)="viewPluginLog(plugin)">
<i class="fas fa-fw fa-fw fa-wave-square"></i>
View Plugin Logs (Beta)
</button>
<button ngbDropdownItem (click)="$plugin.bridgeSettings(plugin)"
*ngIf="plugin.installedVersion && plugin.name !== 'homebridge-config-ui-x' && canManageBridgeSettings">
<i class="fas fa-fw fa-fw fa-project-diagram"></i> {{ 'child_bridge.label_bridge_settings' | translate }}
10 changes: 10 additions & 0 deletions ui/src/app/modules/plugins/plugin-card/plugin-card.component.ts
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@ import { MobileDetectService } from '@/app/core/mobile-detect.service';
import { ConfirmComponent } from '@/app/core/components/confirm/confirm.component';
import { DonateModalComponent } from '@/app/modules/plugins/donate-modal/donate-modal.component';
import { InformationComponent } from '@/app/core/components/information/information.component';
import { PluginLogModalComponent } from '@/app/core/manage-plugins/plugin-log-modal/plugin-log-modal.component';

@Component({
selector: 'app-plugin-card',
@@ -155,6 +156,15 @@ export class PluginCardComponent implements OnInit {
});
}

viewPluginLog(plugin: any) {
const ref = this.$modal.open(PluginLogModalComponent, {
size: 'xl',
backdrop: 'static',
});

ref.componentInstance.plugin = plugin;
}

async doChildBridgeAction(action: 'stop' | 'start' | 'restart') {
this.childBridgeRestartInProgress = true;
try {
2 changes: 1 addition & 1 deletion ui/src/i18n/th.json
Original file line number Diff line number Diff line change
@@ -351,7 +351,7 @@
"status.widget.systeminfo.label_ipv4": "IPv4",
"status.widget.systeminfo.label_ipv6": "IPv6",
"status.widget.systeminfo.label_no": "ไม่",
"status.widget.systeminfo.label_nodejs_path": พาธของ Node.js",
"status.widget.systeminfo.label_nodejs_path": "พาธของ Node.js",
"status.widget.systeminfo.label_nodejs_version": "รุ่นของ Node.js",
"status.widget.systeminfo.label_os": "ระบบปฏิบัติการ",
"status.widget.systeminfo.label_plugin_path": "เส้นทางปลั๊กอิน",