Skip to content

Commit 241bdeb

Browse files
AleksanderBodurrikirjs
authored andcommitted
feat(devtools): create an info snackbar when a user logs a property
Previously there is no feedback when clicking this button in Angular DevTools itself, which can produce some confusion if the user does not have the browser console open as well, or if they accidentally turned on some filtering in the browser console. Now Angular Devtools uses mat snack bar to inform the user that the task was successful
1 parent a6d7ee0 commit 241bdeb

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-tab/property-view/property-view-body/property-view-body.component.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import {MatIcon} from '@angular/material/icon';
2020
import {MatTooltip} from '@angular/material/tooltip';
2121
import {MatExpansionModule} from '@angular/material/expansion';
22+
import {MatSnackBar, MatSnackBarModule} from '@angular/material/snack-bar';
2223

2324
import {DebugSignalGraphNode, DirectivePosition} from '../../../../../../../../protocol';
2425
import {
@@ -41,13 +42,15 @@ import {FlatNode} from '../../../../../shared/object-tree-explorer/object-tree-t
4142
MatIcon,
4243
MatTooltip,
4344
MatExpansionModule,
45+
MatSnackBarModule,
4446
DocsRefButtonComponent,
4547
DependencyViewerComponent,
4648
ObjectTreeExplorerComponent,
4749
],
4850
changeDetection: ChangeDetectionStrategy.OnPush,
4951
})
5052
export class PropertyViewBodyComponent {
53+
private readonly _snackBar = inject(MatSnackBar);
5154
private readonly signalGraph = inject(SignalGraphManager);
5255
protected readonly supportedApis = inject(SUPPORTED_APIS);
5356

@@ -104,6 +107,9 @@ export class PropertyViewBodyComponent {
104107
logValue(e: Event, node: FlatNode): void {
105108
e.stopPropagation();
106109
this.controller().logValue(node);
110+
this._snackBar.open(`Logged value of '${node.prop.name}' to the console`, 'Dismiss', {
111+
duration: 2000,
112+
});
107113
}
108114

109115
handleInspect(node: FlatNode): void {

0 commit comments

Comments
 (0)