Skip to content

Add tooltips for columns with names that don't match display names. #6781

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions tensorboard/webapp/runs/views/runs_table/runs_data_table_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ describe('runs_data_table', () => {
}).compileComponents();
});

afterAll(() => {
// These elements are being left in the dom from the tooltip. Removing them
// to prevent them from affecting other tests.
document
.querySelectorAll('.cdk-describedby-message-container')
.forEach((el) => {
el.remove();
});
});

it('renders', () => {
const fixture = createComponent({});
expect(
Expand Down
2 changes: 2 additions & 0 deletions tensorboard/webapp/widgets/data_table/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ tf_ng_module(
deps = [
":types",
"//tensorboard/webapp/angular:expect_angular_material_icon",
"//tensorboard/webapp/angular:expect_angular_material_tooltip",
"@npm//@angular/common",
"@npm//@angular/core",
],
Expand All @@ -126,6 +127,7 @@ tf_ng_module(
"//tensorboard/webapp/angular:expect_angular_material_button",
"//tensorboard/webapp/angular:expect_angular_material_icon",
"//tensorboard/webapp/angular:expect_angular_material_input",
"//tensorboard/webapp/angular:expect_angular_material_tooltip",
"@npm//@angular/common",
"@npm//@angular/core",
"@npm//@angular/forms",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
'selected': i === (selectedIndex$ | async)
}"
(click)="selectColumn(column)"
[matTooltip]="column.name"
[matTooltipDisabled]="column.name.localeCompare(column.displayName, undefined, {sensitivity: 'accent'}) === 0"
>
{{column.displayName}}
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {NgModule} from '@angular/core';
import {MatIconModule} from '@angular/material/icon';
import {MatInputModule} from '@angular/material/input';
import {MatButtonModule} from '@angular/material/button';
import {MatTooltipModule} from '@angular/material/tooltip';
import {ColumnSelectorComponent} from './column_selector_component';
import {FormsModule} from '@angular/forms';

Expand All @@ -29,6 +30,7 @@ import {FormsModule} from '@angular/forms';
MatInputModule,
MatButtonModule,
FormsModule,
MatTooltipModule,
],
exports: [ColumnSelectorComponent],
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
></mat-icon>
<div *ngSwitchDefault class="extra-right-padding"></div>

<span [ngClass]="getSpecialTypeClasses(header.type)"
<span
[ngClass]="getSpecialTypeClasses(header.type)"
[matTooltip]="header.name"
[matTooltipDisabled]="header.name.localeCompare(header.displayName, undefined, {sensitivity: 'accent'}) === 0"
>{{ header.displayName }}</span
>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ limitations under the License.
import {CommonModule} from '@angular/common';
import {NgModule} from '@angular/core';
import {MatIconModule} from '@angular/material/icon';
import {MatTooltipModule} from '@angular/material/tooltip';
import {DataTableHeaderComponent} from './data_table_header_component';

@NgModule({
declarations: [DataTableHeaderComponent],
exports: [DataTableHeaderComponent],
imports: [CommonModule, MatIconModule],
imports: [CommonModule, MatIconModule, MatTooltipModule],
})
export class DataTableHeaderModule {}
10 changes: 10 additions & 0 deletions tensorboard/webapp/widgets/data_table/data_table_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,16 @@ describe('data table', () => {
}).compileComponents();
});

afterAll(() => {
// These elements are being left in the dom from the tooltip. Removing them
// to prevent them from affecting other tests.
document
.querySelectorAll('.cdk-describedby-message-container')
.forEach((el) => {
el.remove();
});
});

function createComponent(input: {
headers?: ColumnHeader[];
sortingInfo?: SortingInfo;
Expand Down
Loading