-
Notifications
You must be signed in to change notification settings - Fork 11
feat: show exit calls break up on hover on exit calls cell in trace list #756
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
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c13757a
feat: show exit calls break up on hover on exit calls cell in trace list
itssharmasandeep 040f804
Merge branch 'main' into exit-calls
itssharmasandeep b92bbea
fix: addressing pull request comments
itssharmasandeep d56cb57
fix: lint errors
itssharmasandeep 1f2f9d1
fix: addressing review commnet
itssharmasandeep 5d5126d
Merge branch 'main' into exit-calls
itssharmasandeep 1c394d6
chore: using composite specification
itssharmasandeep 0584eb7
fix: lint errors and tests
itssharmasandeep 541751a
fix: lint errors
itssharmasandeep b0c8c46
Merge branch 'main' into exit-calls
itssharmasandeep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
...hared/components/table/data-cell/exit-calls/exit-calls-table-cell-renderer.component.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| @import 'color-palette'; | ||
| @import 'font'; | ||
|
|
||
| .exit-calls-count { | ||
| @include body-1-regular($gray-7); | ||
| } | ||
|
|
||
| .api-callee-name-count { | ||
| display: flex; | ||
| align-items: center; | ||
| justify-content: space-between; | ||
| padding: 2px; | ||
|
|
||
| .api-callee-name { | ||
| @include ellipsis-overflow(); | ||
| max-width: 200px; | ||
| font-size: 13.5px; | ||
| color: $gray-2; | ||
| } | ||
|
|
||
| .api-callee-count { | ||
| color: white; | ||
| font-size: 15px; | ||
| margin-left: 50px; | ||
| } | ||
| } | ||
|
|
||
| .remaining-api-callee { | ||
| font-size: 13.5px; | ||
| padding: 2px; | ||
| } | ||
43 changes: 43 additions & 0 deletions
43
...ed/components/table/data-cell/exit-calls/exit-calls-table-cell-renderer.component.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { TooltipDirective } from '@hypertrace/components'; | ||
| import { TableCellNoOpParser, tableCellProviders, tableCellRowDataProvider } from '@hypertrace/components'; | ||
| import { createComponentFactory } from '@ngneat/spectator/jest'; | ||
| import { MockComponent } from 'ng-mocks'; | ||
| import { ExitCallsTableCellRendererComponent } from './exit-calls-table-cell-renderer.component'; | ||
|
|
||
| describe('Exit Calls table cell renderer component', () => { | ||
| const buildComponent = createComponentFactory({ | ||
| component: ExitCallsTableCellRendererComponent, | ||
| providers: [ | ||
| tableCellProviders( | ||
| { | ||
| id: 'test' | ||
| }, | ||
| new TableCellNoOpParser(undefined!) | ||
| ) | ||
| ], | ||
| declarations: [MockComponent(TooltipDirective)], | ||
| shallow: true | ||
| }); | ||
|
|
||
| test('should render a number as expected', () => { | ||
| const spectator = buildComponent({ | ||
| providers: [tableCellRowDataProvider({ apiExitCalls: 1 })] | ||
| }); | ||
|
|
||
| expect(spectator.query('.exit-calls-count')).toHaveText('1'); | ||
| expect(spectator.query(TooltipDirective)).toExist(); | ||
| }); | ||
|
|
||
| test('testing getMaxShowAPICalleeNameCount function', () => { | ||
| const value = { | ||
| key1: '1', | ||
| key2: '2' | ||
| }; | ||
| const spectator = buildComponent({ | ||
| providers: [tableCellRowDataProvider({ apiExitCalls: 2, apiCalleeNameCount: value })] | ||
| }); | ||
|
|
||
| expect(spectator.component.getMaxShowAPICalleeNameCount(value)).toMatchObject(value); | ||
| expect(spectator.component.totalCountOfDifferentAPICallee).toBe(2); | ||
| }); | ||
| }); |
84 changes: 84 additions & 0 deletions
84
.../shared/components/table/data-cell/exit-calls/exit-calls-table-cell-renderer.component.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import { ChangeDetectionStrategy, Component, Inject, OnInit } from '@angular/core'; | ||
| import { | ||
| CoreTableCellParserType, | ||
| TableCellAlignmentType, | ||
| TableCellParserBase, | ||
| TableCellRenderer, | ||
| TableCellRendererBase, | ||
| TableColumnConfig, | ||
| TABLE_CELL_DATA, | ||
| TABLE_COLUMN_CONFIG, | ||
| TABLE_COLUMN_INDEX, | ||
| TABLE_DATA_PARSER, | ||
| TABLE_ROW_DATA | ||
| } from '@hypertrace/components'; | ||
| import { Trace } from '@hypertrace/distributed-tracing'; | ||
| import { ExploreValue } from '@hypertrace/observability'; | ||
|
|
||
| export const EXIT_CALLS_CELL = 'EXIT_CALLS_CELL'; | ||
itssharmasandeep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| @Component({ | ||
| selector: 'exit-calls-table-cell-renderer', | ||
itssharmasandeep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| styleUrls: ['./exit-calls-table-cell-renderer.component.scss'], | ||
| changeDetection: ChangeDetectionStrategy.OnPush, | ||
| template: ` | ||
| <div class="exit-calls-cell" [htTooltip]="exitCallsTooltip"> | ||
| <span class="exit-calls-count">{{ this.apiExitCalls }}</span> | ||
|
|
||
| <ng-template #exitCallsTooltip> | ||
| <ng-container *ngIf="this.apiExitCalls > 0"> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: This is an if-else use case. You can clean this up like below. There are many examples in the codebase. |
||
| <div *ngFor="let item of this.apiCalleeNameCount | keyvalue" class="api-callee-name-count"> | ||
| <span class="api-callee-name">{{ item.key }}</span> | ||
| <span class="api-callee-count">{{ item.value }}</span> | ||
| </div> | ||
| <div | ||
| *ngIf="this.totalCountOfDifferentAPICallee > this.maxShowAPICalleeNameCount" | ||
| class="remaining-api-callee" | ||
| > | ||
| and {{ this.totalCountOfDifferentAPICallee - this.maxShowAPICalleeNameCount }} more | ||
| </div> | ||
| </ng-container> | ||
| <ng-container *ngIf="this.apiExitCalls <= 0" class="no-exit-calls">No exit calls</ng-container> | ||
| </ng-template> | ||
| </div> | ||
| ` | ||
| }) | ||
| @TableCellRenderer({ | ||
| type: EXIT_CALLS_CELL, | ||
| alignment: TableCellAlignmentType.Left, | ||
| parser: CoreTableCellParserType.NoOp | ||
| }) | ||
| export class ExitCallsTableCellRendererComponent extends TableCellRendererBase<ExploreValue, any> implements OnInit { | ||
| public readonly apiCalleeNameCount: any; | ||
itssharmasandeep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public readonly apiExitCalls: number; | ||
| public readonly maxShowAPICalleeNameCount: number = 10; | ||
itssharmasandeep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| public totalCountOfDifferentAPICallee!: number; | ||
|
|
||
| public constructor( | ||
| @Inject(TABLE_COLUMN_CONFIG) columnConfig: TableColumnConfig, | ||
| @Inject(TABLE_COLUMN_INDEX) index: number, | ||
| @Inject(TABLE_DATA_PARSER) parser: TableCellParserBase<ExploreValue, Trace, unknown>, | ||
| @Inject(TABLE_CELL_DATA) cellData: ExploreValue, | ||
itssharmasandeep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| @Inject(TABLE_ROW_DATA) rowData: Trace | ||
| ) { | ||
| super(columnConfig, index, parser, cellData, rowData); | ||
| this.apiCalleeNameCount = this.getMaxShowAPICalleeNameCount(rowData.apiCalleeNameCount); | ||
itssharmasandeep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| this.apiExitCalls = Number(rowData.apiExitCalls); | ||
aaron-steinfeld marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public getMaxShowAPICalleeNameCount(apiCalleeNameCount: any): any { | ||
| if (apiCalleeNameCount) { | ||
| const showAPICalleeNameCount: any = {}; | ||
| let count = 0; | ||
| Object.keys(apiCalleeNameCount).forEach((key: string) => { | ||
itssharmasandeep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (count < this.maxShowAPICalleeNameCount) { | ||
| showAPICalleeNameCount[key] = apiCalleeNameCount[key]; | ||
| count++; | ||
| } | ||
| }); | ||
| this.totalCountOfDifferentAPICallee = Object.keys(apiCalleeNameCount).length; | ||
itssharmasandeep marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return showAPICalleeNameCount; | ||
| } | ||
| return {}; | ||
| } | ||
| } | ||
16 changes: 12 additions & 4 deletions
16
...cts/observability/src/shared/components/table/observability-table-cell-renderer.module.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,28 @@ | ||
| import { CommonModule } from '@angular/common'; | ||
| import { NgModule } from '@angular/core'; | ||
| import { TableModule } from '@hypertrace/components'; | ||
| import { TableModule, TooltipModule } from '@hypertrace/components'; | ||
| import { BackendIconTableCellParser } from './data-cell/backend-icon/backend-icon-table-cell-parser'; | ||
| import { BackendIconTableCellRendererComponent } from './data-cell/backend-icon/backend-icon-table-cell-renderer.component'; | ||
| import { BackendIconTableCellRendererModule } from './data-cell/backend-icon/backend-icon-table-cell-renderer.module'; | ||
| import { EntityTableCellParser } from './data-cell/entity/entity-table-cell-parser'; | ||
| import { EntityTableCellRendererComponent } from './data-cell/entity/entity-table-cell-renderer.component'; | ||
| import { EntityTableCellRendererModule } from './data-cell/entity/entity-table-cell-renderer.module'; | ||
| import { ExitCallsTableCellRendererComponent } from './data-cell/exit-calls/exit-calls-table-cell-renderer.component'; | ||
|
|
||
| @NgModule({ | ||
| imports: [ | ||
| CommonModule, | ||
| TableModule.withCellParsers([EntityTableCellParser, BackendIconTableCellParser]), | ||
| TableModule.withCellRenderers([EntityTableCellRendererComponent, BackendIconTableCellRendererComponent]), | ||
| TableModule.withCellRenderers([ | ||
| EntityTableCellRendererComponent, | ||
| BackendIconTableCellRendererComponent, | ||
| ExitCallsTableCellRendererComponent | ||
| ]), | ||
| EntityTableCellRendererModule, | ||
| BackendIconTableCellRendererModule | ||
| ] | ||
| BackendIconTableCellRendererModule, | ||
| TooltipModule | ||
| ], | ||
| declarations: [ExitCallsTableCellRendererComponent], | ||
| exports: [ExitCallsTableCellRendererComponent] | ||
| }) | ||
| export class ObservabilityTableCellRendererModule {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.