Skip to content

Commit 571a6a6

Browse files
authored
Add tooltips for columns with names that don't match display names. (#6781)
Add tooltips for hparam column names when the name does not match the display name (using case-insentive comparison).
1 parent a0bddaf commit 571a6a6

File tree

7 files changed

+32
-2
lines changed

7 files changed

+32
-2
lines changed

tensorboard/webapp/runs/views/runs_table/runs_data_table_test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ describe('runs_data_table', () => {
133133
}).compileComponents();
134134
});
135135

136+
afterAll(() => {
137+
// These elements are being left in the dom from the tooltip. Removing them
138+
// to prevent them from affecting other tests.
139+
document
140+
.querySelectorAll('.cdk-describedby-message-container')
141+
.forEach((el) => {
142+
el.remove();
143+
});
144+
});
145+
136146
it('renders', () => {
137147
const fixture = createComponent({});
138148
expect(

tensorboard/webapp/widgets/data_table/BUILD

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ tf_ng_module(
106106
deps = [
107107
":types",
108108
"//tensorboard/webapp/angular:expect_angular_material_icon",
109+
"//tensorboard/webapp/angular:expect_angular_material_tooltip",
109110
"@npm//@angular/common",
110111
"@npm//@angular/core",
111112
],
@@ -126,6 +127,7 @@ tf_ng_module(
126127
"//tensorboard/webapp/angular:expect_angular_material_button",
127128
"//tensorboard/webapp/angular:expect_angular_material_icon",
128129
"//tensorboard/webapp/angular:expect_angular_material_input",
130+
"//tensorboard/webapp/angular:expect_angular_material_tooltip",
129131
"@npm//@angular/common",
130132
"@npm//@angular/core",
131133
"@npm//@angular/forms",

tensorboard/webapp/widgets/data_table/column_selector_component.ng.html

+2
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
'selected': i === (selectedIndex$ | async)
4040
}"
4141
(click)="selectColumn(column)"
42+
[matTooltip]="column.name"
43+
[matTooltipDisabled]="column.name.localeCompare(column.displayName, undefined, {sensitivity: 'accent'}) === 0"
4244
>
4345
{{column.displayName}}
4446
</button>

tensorboard/webapp/widgets/data_table/column_selector_module.ts

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {NgModule} from '@angular/core';
1818
import {MatIconModule} from '@angular/material/icon';
1919
import {MatInputModule} from '@angular/material/input';
2020
import {MatButtonModule} from '@angular/material/button';
21+
import {MatTooltipModule} from '@angular/material/tooltip';
2122
import {ColumnSelectorComponent} from './column_selector_component';
2223
import {FormsModule} from '@angular/forms';
2324

@@ -29,6 +30,7 @@ import {FormsModule} from '@angular/forms';
2930
MatInputModule,
3031
MatButtonModule,
3132
FormsModule,
33+
MatTooltipModule,
3234
],
3335
exports: [ColumnSelectorComponent],
3436
})

tensorboard/webapp/widgets/data_table/data_table_header_component.ng.html

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
></mat-icon>
2828
<div *ngSwitchDefault class="extra-right-padding"></div>
2929

30-
<span [ngClass]="getSpecialTypeClasses(header.type)"
30+
<span
31+
[ngClass]="getSpecialTypeClasses(header.type)"
32+
[matTooltip]="header.name"
33+
[matTooltipDisabled]="header.name.localeCompare(header.displayName, undefined, {sensitivity: 'accent'}) === 0"
3134
>{{ header.displayName }}</span
3235
>
3336
</div>

tensorboard/webapp/widgets/data_table/data_table_header_module.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ limitations under the License.
1616
import {CommonModule} from '@angular/common';
1717
import {NgModule} from '@angular/core';
1818
import {MatIconModule} from '@angular/material/icon';
19+
import {MatTooltipModule} from '@angular/material/tooltip';
1920
import {DataTableHeaderComponent} from './data_table_header_component';
2021

2122
@NgModule({
2223
declarations: [DataTableHeaderComponent],
2324
exports: [DataTableHeaderComponent],
24-
imports: [CommonModule, MatIconModule],
25+
imports: [CommonModule, MatIconModule, MatTooltipModule],
2526
})
2627
export class DataTableHeaderModule {}

tensorboard/webapp/widgets/data_table/data_table_test.ts

+10
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,16 @@ describe('data table', () => {
119119
}).compileComponents();
120120
});
121121

122+
afterAll(() => {
123+
// These elements are being left in the dom from the tooltip. Removing them
124+
// to prevent them from affecting other tests.
125+
document
126+
.querySelectorAll('.cdk-describedby-message-container')
127+
.forEach((el) => {
128+
el.remove();
129+
});
130+
});
131+
122132
function createComponent(input: {
123133
headers?: ColumnHeader[];
124134
sortingInfo?: SortingInfo;

0 commit comments

Comments
 (0)