Skip to content

Commit

Permalink
generate correct ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihai Budiu authored and ryzhyk committed Dec 8, 2021
1 parent f981939 commit 4e2c7a6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
15 changes: 11 additions & 4 deletions rust/template/ddlog_profiler/profiler_ui/ui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions rust/template/ddlog_profiler/profiler_ui/ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ class ProfileTable implements IHtmlElement {
protected getId(row: Partial<ProfileRow>): string | null {
if (row.opid == null)
return null;
return this.name.replace(/\s/g, "_").toLowerCase() + "_" + row.opid.toString();
return this.name.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase() + "_" + row.opid.toString();
}

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

let id = this.getId(safeRow);
for (let k of this.displayedColumns) {
let key = k as keyof ProfileRow;
let value = safeRow[key];
Expand Down Expand Up @@ -495,7 +496,10 @@ class ProfileTable implements IHtmlElement {
cell.classList.add("clickable");
cell.onclick = () => this.expand(indent + 1, trow, cell, children, histogramStart);
}
cell.id = this.getId(safeRow)!;
if (id != null) {
cell.id = id!;
cell.title = id;
}
}
if ((k === "size" && this.showMemHistogram) || (k == "cpu_us" && this.showCpuHistogram)) {
// Add an adjacent cell for the histogram
Expand Down Expand Up @@ -677,11 +681,14 @@ class ProfileTable implements IHtmlElement {
}

protected expandPath(path: string[]): void {
for (let p of path.reverse()) {
path.reverse();
for (let p of path) {
let elem = document.getElementById(p)!;
elem.click();
elem.parentElement!.classList.add("highlight");
}
let last = document.getElementById(path[path.length - 1]);
last!.scrollIntoView();
}

/**
Expand Down

0 comments on commit 4e2c7a6

Please sign in to comment.