Skip to content

Commit 4e2c7a6

Browse files
Mihai Budiuryzhyk
authored andcommitted
generate correct ids
1 parent f981939 commit 4e2c7a6

File tree

2 files changed

+21
-7
lines changed
  • rust/template/ddlog_profiler/profiler_ui

2 files changed

+21
-7
lines changed

rust/template/ddlog_profiler/profiler_ui/ui.js

Lines changed: 11 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/template/ddlog_profiler/profiler_ui/ui.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ class ProfileTable implements IHtmlElement {
425425
protected getId(row: Partial<ProfileRow>): string | null {
426426
if (row.opid == null)
427427
return null;
428-
return this.name.replace(/\s/g, "_").toLowerCase() + "_" + row.opid.toString();
428+
return this.name.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase() + "_" + row.opid.toString();
429429
}
430430

431431
protected addDataRow(indent: number, rowIndex: number, row: Partial<ProfileRow>,
@@ -444,6 +444,7 @@ class ProfileTable implements IHtmlElement {
444444
short_descr: row.short_descr === undefined ? "" : row.short_descr
445445
};
446446

447+
let id = this.getId(safeRow);
447448
for (let k of this.displayedColumns) {
448449
let key = k as keyof ProfileRow;
449450
let value = safeRow[key];
@@ -495,7 +496,10 @@ class ProfileTable implements IHtmlElement {
495496
cell.classList.add("clickable");
496497
cell.onclick = () => this.expand(indent + 1, trow, cell, children, histogramStart);
497498
}
498-
cell.id = this.getId(safeRow)!;
499+
if (id != null) {
500+
cell.id = id!;
501+
cell.title = id;
502+
}
499503
}
500504
if ((k === "size" && this.showMemHistogram) || (k == "cpu_us" && this.showCpuHistogram)) {
501505
// Add an adjacent cell for the histogram
@@ -677,11 +681,14 @@ class ProfileTable implements IHtmlElement {
677681
}
678682

679683
protected expandPath(path: string[]): void {
680-
for (let p of path.reverse()) {
684+
path.reverse();
685+
for (let p of path) {
681686
let elem = document.getElementById(p)!;
682687
elem.click();
683688
elem.parentElement!.classList.add("highlight");
684689
}
690+
let last = document.getElementById(path[path.length - 1]);
691+
last!.scrollIntoView();
685692
}
686693

687694
/**

0 commit comments

Comments
 (0)