Skip to content

Commit 77d0403

Browse files
added possibility to open row in new tab for major grids
1 parent c6e0c46 commit 77d0403

21 files changed

+76
-34
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aquality-tracking-ui",
3-
"version": "1.4.4",
3+
"version": "1.4.5",
44
"scripts": {
55
"ng": "ng",
66
"start": "ng serve",

src/app/elements/table-filter/table-filter.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ export class TableFilterComponent implements OnInit, AfterViewInit, OnDestroy, O
734734
const canClick = notInlineEditorButton || (notClickableElement && notEditable);
735735

736736
if (canClick) {
737-
if ($event.ctrlKey || $event.metaKey) {
737+
if (typeof this.urlGenerator == 'function' && ($event.ctrlKey || $event.metaKey)) {
738738
const url = this.urlGenerator(entity);
739739
window.open(`/#${url}`, '_blank');
740740
} else {
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<app-modal *ngIf="tbCols && !hideModal" [title]="removeModalTitle" [message]="removeModalMessage" [type]="'warning'" [buttons]="[{name:'yes', execute:true }, {name:'no', execute:false}]"
22
(execute)="execute($event)" (closed)="wasClosed()">
33
</app-modal>
4-
<table-filter id="users-table" *ngIf="tbCols" [data]="users" [queryParams]="true" [columns]="tbCols" [hide]="hideVal" (rowClick)="rowClicked($event)" (customEvent)="resetPassword()" [allowCreate]="true" [allowDelete]="true" (dataChange)="updateUser($event)"
5-
(action)="handleAction($event)" (createEntity)="createEntityChange($event)"></table-filter>
4+
<table-filter id="users-table" *ngIf="tbCols" [data]="users" [queryParams]="true" [columns]="tbCols" [hide]="hideVal"
5+
(rowClick)="rowClicked($event)" (customEvent)="resetPassword()" [allowCreate]="true"
6+
[allowDelete]="true" (dataChange)="updateUser($event)" (action)="handleAction($event)"
7+
(createEntity)="createEntityChange($event)"></table-filter>

src/app/pages/audit/audit-list/audit.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ <h2>Audits Dashboard</h2>
2222
</div>
2323
<div *ngIf="stats && auditors && columns && services" class="col-sm-12 no-padding">
2424
<table-filter [data]="stats" [rowColors]="rowColors" [columns]="columns" [defaultSortBy]="defSort"
25-
[queryParams]="true" (rowClick)="rowClicked($event)" rowsOnPage="20"></table-filter>
25+
[queryParams]="true" [urlGenerator]="generateAuditUrl" (rowClick)="rowClicked($event)" rowsOnPage="20"></table-filter>
2626
</div>

src/app/pages/audit/audit-list/audit.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,12 @@ export class AuditComponent implements OnInit {
9898
BlobUtils.download(result.blob, filename);
9999
}
100100

101-
rowClicked($event) {
102-
this.router.navigate([`/audit/${$event.id}`]);
101+
generateAuditUrl(entity: AuditStat) {
102+
return`/audit/${entity.id}`;
103+
}
104+
105+
rowClicked($event: AuditStat) {
106+
this.router.navigate([this.generateAuditUrl($event)]);
103107
}
104108

105109
createColumns() {

src/app/pages/customer/customer-list/customer.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ <h2>Customers Dashboard</h2>
1313

1414
<div class="col-sm-12 no-padding">
1515
<table-filter *ngIf="customers && columns" [data]="customers" [columns]="columns" [defaultSortBy]="defSort"
16-
(action)="handleAction($event)" [allowDelete]="allowCreate" [queryParams]="true" (rowClick)="rowClicked($event)"
17-
rowsOnPage="20"></table-filter>
16+
(action)="handleAction($event)" [allowDelete]="allowCreate" [queryParams]="true" [urlGenerator]="generateCustomerUrl"
17+
(rowClick)="rowClicked($event)" rowsOnPage="20"></table-filter>
1818
</div>

src/app/pages/customer/customer-list/customer.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,12 @@ export class CustomerComponent implements OnInit {
6262
];
6363
}
6464

65-
rowClicked($event) {
66-
this.router.navigate([`/customer/${$event.id}`]);
65+
generateCustomerUrl(entity: Customer) {
66+
return`/customer/${entity.id}`;
67+
}
68+
69+
rowClicked($event: Customer) {
70+
this.router.navigate([this.generateCustomerUrl($event)]);
6771
}
6872

6973
handleAction($event) {

src/app/pages/project/issue/issue-list/issue-list.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ <h2 id="issues-list">Issues</h2>
1616
<issue-create-modal *ngIf="!hideCreateModal" (execute)="execute($event)" (closed)="wasClosed()" [resolutions]="resolutions" [users]="users"
1717
[existingIssues]="issues"></issue-create-modal>
1818
<table-filter id="issues-table" *ngIf="issues && columns" [data]="issues" [columns]="columns"
19-
[hiddenColumns]="hiddenColumns" [defaultSortBy]="defSort" [queryParams]="true"
19+
[hiddenColumns]="hiddenColumns" [defaultSortBy]="defSort" [queryParams]="true" [urlGenerator]="generateIssueUrl"
2020
(dataChange)="updateIssue($event)" (rowClick)="rowClicked($event)" rowsOnPage="20"
2121
(filterLookupChange)="handleFilterLookupChange($event)">
2222
</table-filter>

src/app/pages/project/issue/issue-list/issue-list.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,12 @@ export class IssueListComponent implements OnInit {
142142
this.hideCreateModal = true;
143143
}
144144

145-
rowClicked(issue: Issue) {
146-
return this.router.navigate([`/project/${this.route.snapshot.params['projectId']}/issue/${issue.id}`]);
145+
generateIssueUrl(entity: Issue) {
146+
return `/project/${this.route.snapshot.params['projectId']}/issue/${entity.id}`;
147+
}
148+
149+
rowClicked($event: Issue) {
150+
return this.router.navigate([this.generateIssueUrl($event)]);
147151
}
148152

149153
private async updateList() {

src/app/pages/project/milestone/list-milestone/list-milestone.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ <h2 id="milestones-list">Milestones</h2>
99

1010
<table-filter id="milestones-table" *ngIf="milestones && columns" [data]="milestones" [columns]="columns" [defaultSortBy]="defSort"
1111
(action)="handleAction($event)" [queryParams]="true" [allowDelete]="canEdit" [allowCreate]="canEdit"
12-
(dataChange)="updateMilestone($event)" (rowClick)="rowClicked($event)" rowsOnPage="20"></table-filter>
12+
[urlGenerator]="generateMilestoneUrl" (dataChange)="updateMilestone($event)" (rowClick)="rowClicked($event)"
13+
rowsOnPage="20"></table-filter>
1314
</div>

0 commit comments

Comments
 (0)