-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add multi-query support (#2644)
- Loading branch information
1 parent
961a9de
commit 2237f66
Showing
15 changed files
with
467 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
1 change: 0 additions & 1 deletion
1
src/app/features/location/location-input/location-input.component.scss
This file contains 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,4 +1,3 @@ | ||
|
||
:host { | ||
pointer-events: auto; | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
33 changes: 33 additions & 0 deletions
33
src/app/features/reporting/reporting/sql-v2-table/sql-v2-table.component.html
This file contains 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,33 @@ | ||
<table | ||
mat-table | ||
[dataSource]="dataSource" | ||
class="data-table" | ||
i18n-aria-label="Label for table showing report result" | ||
aria-label="Table showing the report results" | ||
> | ||
<ng-container matColumnDef="Name"> | ||
<th mat-header-cell *matHeaderCellDef i18n>Name</th> | ||
<td | ||
mat-cell | ||
*matCellDef="let row" | ||
[style.padding-left.px]="16 + row.level * 20" | ||
> | ||
{{ row.key }} | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="Count"> | ||
<th mat-header-cell *matHeaderCellDef i18n>Count</th> | ||
<td mat-cell *matCellDef="let row"> | ||
{{ row.value }} | ||
</td> | ||
</ng-container> | ||
|
||
<tr mat-header-row *matHeaderRowDef="columns; index as i"></tr> | ||
<tr | ||
mat-row | ||
class="row" | ||
*matRowDef="let row; columns: columns; index as i" | ||
[ngClass]="{ 'bg-even': i % 2 === 0 }" | ||
></tr> | ||
</table> |
12 changes: 12 additions & 0 deletions
12
src/app/features/reporting/reporting/sql-v2-table/sql-v2-table.component.scss
This file contains 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,12 @@ | ||
.data-table { | ||
width: 100%; | ||
line-height: 1.5; | ||
} | ||
|
||
.row:hover { | ||
background: #ececec; | ||
} | ||
|
||
.bg-even { | ||
background: #fafafa; | ||
} |
29 changes: 29 additions & 0 deletions
29
src/app/features/reporting/reporting/sql-v2-table/sql-v2-table.component.spec.ts
This file contains 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,29 @@ | ||
import { ComponentFixture, TestBed } from "@angular/core/testing"; | ||
|
||
import { SqlV2TableComponent } from "./sql-v2-table.component"; | ||
import { CoreTestingModule } from "../../../../utils/core-testing.module"; | ||
import { HttpClient } from "@angular/common/http"; | ||
import { of } from "rxjs"; | ||
|
||
describe("SqlV2TableComponent", () => { | ||
let component: SqlV2TableComponent; | ||
let fixture: ComponentFixture<SqlV2TableComponent>; | ||
let mockHttp: jasmine.SpyObj<HttpClient>; | ||
|
||
beforeEach(async () => { | ||
mockHttp = jasmine.createSpyObj(["get"]); | ||
mockHttp.get.and.returnValue(of(undefined)); | ||
await TestBed.configureTestingModule({ | ||
imports: [SqlV2TableComponent, CoreTestingModule], | ||
providers: [{ provide: HttpClient, useValue: mockHttp }], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(SqlV2TableComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it("should create", () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
48 changes: 48 additions & 0 deletions
48
src/app/features/reporting/reporting/sql-v2-table/sql-v2-table.component.ts
This file contains 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,48 @@ | ||
import { Component, inject, Input, OnInit } from "@angular/core"; | ||
import { SqlReport } from "../../report-config"; | ||
import { JsonPipe, NgClass, NgForOf } from "@angular/common"; | ||
import { MatTableDataSource, MatTableModule } from "@angular/material/table"; | ||
import { MatSortModule } from "@angular/material/sort"; | ||
import { | ||
SqlReportRow, | ||
SqlReportService, | ||
} from "../../sql-report/sql-report.service"; | ||
import { Logging } from "../../../../core/logging/logging.service"; | ||
|
||
@Component({ | ||
selector: "app-sql-v2-table", | ||
standalone: true, | ||
imports: [MatTableModule, MatSortModule, NgClass], | ||
templateUrl: "./sql-v2-table.component.html", | ||
styleUrl: "./sql-v2-table.component.scss", | ||
}) | ||
export class SqlV2TableComponent implements OnInit { | ||
sqlReportService = inject(SqlReportService); | ||
|
||
@Input() report: SqlReport; | ||
|
||
@Input() set reportData(value: any[]) { | ||
this.data = this.formatData(value); | ||
} | ||
|
||
isError = false; | ||
|
||
dataSource = new MatTableDataSource(); | ||
columns: string[] = ["Name", "Count"]; | ||
|
||
data: SqlReportRow[] = []; | ||
|
||
ngOnInit(): void { | ||
this.dataSource.data = this.data; | ||
} | ||
|
||
private formatData(value: any[]) { | ||
this.isError = false; | ||
try { | ||
return this.sqlReportService.flattenData(value); | ||
} catch (error) { | ||
Logging.error(error); | ||
this.isError = true; | ||
} | ||
} | ||
} |
Oops, something went wrong.