Skip to content

Commit

Permalink
Merge branch 'beta-4.52.3' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Staubgeborener authored Nov 12, 2023
2 parents b51037a + 0337bce commit 6f5fc7e
Show file tree
Hide file tree
Showing 12 changed files with 175 additions and 44 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/Attach Artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Manually Attach Artifacts ( If the automation fails )
run-name: Manually Attach Artifacts against ${{ github.event.inputs.tag }}

on:
repository_dispatch:
types: [attach-artifacts]
workflow_dispatch:
inputs:
tag:
Expand All @@ -18,6 +20,10 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: 20.x

- name: Get previous tag
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"

# Sanity check to ensure that release tags don't start with a 'v' version prefix but adhere to the X.Y.Z format
- name: Check for Tag name Format
Expand All @@ -30,7 +36,7 @@ jobs:
- name: Install package
run: |
export npm_config_prefix=$(pwd)/package
npm install -g homebridge-config-ui-x@${{ github.event.inputs.tag }}
npm install -g homebridge-config-ui-x@$${{ needs.analyze-tags.outputs.previous-tag }}
- name: Remove invalid node-pty node-gyp run
run: |
Expand All @@ -39,11 +45,11 @@ jobs:
- name: Create Bundle
run: |
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz > SHASUMS256.txt
shasum -a 256 homebridge-config-ui-x-${{ needs.analyze-tags.outputs.previous-tag }}.tar.gz > SHASUMS256.txt
- name: Attach Bundle
uses: AButler/[email protected]
with:
files: 'homebridge-config-ui-x-${{ github.event.inputs.tag }}.tar.gz;SHASUMS256.txt'
files: 'homebridge-config-ui-x-${{ needs.analyze-tags.outputs.previous-tag }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.event.inputs.tag }}
8 changes: 3 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ jobs:
tar -C $(pwd)/package --owner=0 --group=0 --format=posix -czvf homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz .
shasum -a 256 homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz > SHASUMS256.txt
- name: Attach Bundle
uses: AButler/upload-release-assets@v2.0
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
files: 'homebridge-config-ui-x-${{ github.event.release.tag_name }}.tar.gz;SHASUMS256.txt'
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-tag: ${{ github.event.release.tag_name }}
event-type: attach-artifacts
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
Expand Up @@ -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",
Expand Down
31 changes: 28 additions & 3 deletions ui/src/app/core/log.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class LogService {
private webLinksAddon: WebLinksAddon;
private resize: Subject<any>;
private elementResize: Subject<any> | undefined;
private pluginName: string;

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

// handle element resize events
this.elementResize = elementResize;
Expand Down Expand Up @@ -75,8 +79,29 @@ export class LogService {
});

// 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 lines = data.split('\n');
let includeNextLine = false;

lines.forEach((line) => {
if (includeNextLine) {
if (line.match(/36m\[.*?]/)) {
includeNextLine = false;
} else {
this.term.write(line + '\r\n');
return;
}
}

if (line.includes(`36m[${this.pluginName}]`)) {
this.term.write(line + '\r\n');
includeNextLine = true;
}
});
} else {
this.term.write(data);
}
});

// handle resize events from the client
Expand Down
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
Expand Up @@ -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: [
Expand All @@ -28,6 +29,7 @@ import { BridgePluginsModalComponent } from './bridge-plugins-modal/bridge-plugi
ManualPluginConfigModalComponent,
SelectPreviousVersionComponent,
BridgePluginsModalComponent,
PluginLogModalComponent,
],
imports: [
CommonModule,
Expand Down
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/${encodeURIComponent(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
Expand Up @@ -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 }}
Expand Down
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
Expand Up @@ -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',
Expand Down Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 6f5fc7e

Please sign in to comment.