Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
} @else {
<!-- Title bar at the top. -->
@if (showTitleBar) {
<title-bar (titleClicked)="titleClicked.emit()">
<title-bar (titleClicked)="titleClicked.emit()" (nodeStylerOpened)="nodeStylerOpened.emit()">
<ng-content></ng-content>
</title-bar>
}
Expand Down
15 changes: 12 additions & 3 deletions src/ui/src/components/visualizer/model_graph_visualizer_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ export abstract class ModelGraphVisualizerBase
/** Triggered when the double clicked node is changed. */
@Output() readonly doubleClickedNodeChanged = new EventEmitter<NodeInfo>();

/** Triggered when the node search shortcut (Ctrl/Cmd+F) is pressed. */
@Output() readonly nodeSearchTriggered = new EventEmitter<void>();

/** Triggered when the node styler dialog is opened. */
@Output() readonly nodeStylerOpened = new EventEmitter<void>();

curProcessedModelGraph?: ModelGraph;
ready = false;

Expand Down Expand Up @@ -262,10 +268,13 @@ export abstract class ModelGraphVisualizerBase
}
// Press ctrl/cmd+f for search.
else if (event.key === 'f' && (event.ctrlKey || event.metaKey)) {
if (!this.config?.hideTitleBar) {
event.preventDefault();
if (!inInputElement()) {
if (!this.config?.hideTitleBar) {
event.preventDefault();
}
this.nodeSearchTriggered.emit();
this.appService.searchKeyClicked.next({});
}
this.appService.searchKeyClicked.next({});
}
}

Expand Down
5 changes: 5 additions & 0 deletions src/ui/src/components/visualizer/node_styler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {CommonModule} from '@angular/common';
import {
ChangeDetectionStrategy,
Component,
EventEmitter,
Output,
ViewContainerRef,
signal,
} from '@angular/core';
Expand Down Expand Up @@ -48,6 +50,8 @@ import {NodeStylerService} from './node_styler_service';
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NodeStyler {
@Output() readonly nodeStylerOpened = new EventEmitter<void>();

readonly hasNonEmptyNodeStylerRules;
readonly dialogOpened = signal<boolean>(false);

Expand All @@ -62,6 +66,7 @@ export class NodeStyler {

handleClickOpenDialog() {
this.dialogOpened.set(true);
this.nodeStylerOpened.emit();

const dialogRef = this.dialog.open(NodeStylerDialog, {
width: '800px',
Expand Down
2 changes: 1 addition & 1 deletion src/ui/src/components/visualizer/title_bar.ng.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<div class="divider tighter-right"></div>

<node-styler></node-styler>
<node-styler (nodeStylerOpened)="nodeStylerOpened.emit()"></node-styler>

<div class="icons-container">
<a href="https://github.com/google-ai-edge/model-explorer" target="_blank">
Expand Down
1 change: 1 addition & 0 deletions src/ui/src/components/visualizer/title_bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ let ndpId = 0;
})
export class TitleBar {
@Output() readonly titleClicked = new EventEmitter<void>();
@Output() readonly nodeStylerOpened = new EventEmitter<void>();

private readonly appService = inject(AppService);
private readonly dialog = inject(MatDialog);
Expand Down
Loading