Skip to content

Commit 5683318

Browse files
Profiler Teamcopybara-github
authored andcommitted
Add support for extra options in the capture profile dialog.
This change allows users to add arbitrary key-value pairs as extra options when initiating a profile capture. PiperOrigin-RevId: 813385389
1 parent da1a3cc commit 5683318

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

frontend/app/components/capture_profile/capture_profile_dialog/capture_profile_dialog.ng.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,20 @@
116116
/>
117117
</mat-form-field>
118118
</div>
119+
120+
<div>
121+
Extra Options:
122+
<div *ngFor="let option of extraOptions; let i = index">
123+
<mat-form-field>
124+
<input matInput placeholder="Key" [(ngModel)]="option.key" />
125+
</mat-form-field>
126+
<mat-form-field>
127+
<input matInput placeholder="Value" [(ngModel)]="option.value" />
128+
</mat-form-field>
129+
<button mat-button (click)="removeExtraOption(i)">Remove</button>
130+
</div>
131+
<button mat-button (click)="addExtraOption()">Add Option</button>
132+
</div>
119133
</mat-expansion-panel>
120134
</div>
121135
</mat-dialog-content>

frontend/app/components/capture_profile/capture_profile_dialog/capture_profile_dialog.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export class CaptureProfileDialog {
2424
deviceTracerLevel = '1';
2525
pythonTracerLevel = '0';
2626
delay = 0;
27+
extraOptions: Array<{key: string, value: string}> = [];
2728

2829
constructor(private readonly dialogRef:
2930
MatDialogRef<CaptureProfileDialog>) {}
@@ -47,10 +48,19 @@ export class CaptureProfileDialog {
4748
deviceTracerLevel: Number(this.deviceTracerLevel),
4849
pythonTracerLevel: Number(this.pythonTracerLevel),
4950
delay: this.delay,
51+
extraOptions: this.extraOptions,
5052
});
5153
}
5254

5355
close() {
5456
this.dialogRef.close();
5557
}
58+
59+
addExtraOption() {
60+
this.extraOptions.push({key: '', value: ''});
61+
}
62+
63+
removeExtraOption(index: number) {
64+
this.extraOptions.splice(index, 1);
65+
}
5666
}

0 commit comments

Comments
 (0)