Skip to content

Commit c1ea247

Browse files
authored
Merge pull request #860 from bcgov/oleks
DSS-1060, DSS-1074
2 parents 8c7867b + f8e30fb commit c1ea247

File tree

4 files changed

+41
-13
lines changed

4 files changed

+41
-13
lines changed

frontend/src/app/features/components/listings-table/aggregated-listings-table/aggregated-listings-table.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ <h2 class="title">Aggregated Listings</h2>
110110
<td>
111111
<div class="host-name">
112112
{{ row.primaryHostNm }}
113-
<i *ngIf="row.hasMultipleProperties" pTooltip="This Host May have Multiple Properties."
113+
<i *ngIf="row.hasMultipleProperties" (click)="onMultihostClicked(row)"
114+
pTooltip="This Host May have Multiple Properties."
114115
class="multi-host multihost-icon"></i>
115116
</div>
116117
</td>

frontend/src/app/features/components/listings-table/aggregated-listings-table/aggregated-listings-table.component.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
gap: 12px;
180180

181181
.multihost-icon {
182+
cursor: pointer;
182183
width: 24px;
183184
height: 24px;
184185
background-image: url(../../../../../assets/images/house-blue.svg);

frontend/src/app/features/components/listings-table/aggregated-listings-table/aggregated-listings-table.component.ts

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ export class AggregatedListingsTableComponent implements OnInit {
186186
}
187187
}
188188

189+
onMultihostClicked(group: AggregatedListingTableRow) {
190+
this.clearFilters();
191+
this.searchColumn = 'hostName';
192+
this.searchTerm = group.primaryHostNm;
193+
this.onSearch();
194+
}
195+
189196
onSort(property: string): void {
190197
if (this.sort) {
191198
if (this.sort.prop === property) {
@@ -306,17 +313,7 @@ export class AggregatedListingsTableComponent implements OnInit {
306313
}
307314

308315
onClearFilters(): void {
309-
this.filterPersistenceService.listingFilter = {
310-
byLocation: {
311-
isBusinessLicenceRequired: '',
312-
isPrincipalResidenceRequired: '',
313-
},
314-
community: 0,
315-
byStatus: {},
316-
};
317-
318-
this.initFilters();
319-
this.isFilterOpened = false;
316+
this.clearFilters();
320317
this.onSearch();
321318
}
322319

@@ -370,6 +367,20 @@ export class AggregatedListingsTableComponent implements OnInit {
370367
this.onSearch();
371368
}
372369

370+
private clearFilters(): void {
371+
this.filterPersistenceService.listingFilter = {
372+
byLocation: {
373+
isBusinessLicenceRequired: '',
374+
isPrincipalResidenceRequired: '',
375+
},
376+
community: 0,
377+
byStatus: {},
378+
};
379+
380+
this.initFilters();
381+
this.isFilterOpened = false;
382+
}
383+
373384
private getListings(selectedPageNumber: number = 1): void {
374385
this.loaderService.loadingStart();
375386

frontend/src/app/features/components/send-compliance-order/send-compliance-order.component.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class SendComplianceOrderComponent implements OnInit {
135135
this.loaderService.loadingStart();
136136
this.complianceService.sendComplianceOrdersPreview(this.submissionArray).subscribe({
137137
next: (preview) => {
138-
this.previewText = preview.content;
138+
this.previewText = this.fixBrokenLinksInAPreview(preview.content);
139139
this.showPreviewDialog = true;
140140
},
141141
complete: () => {
@@ -172,6 +172,21 @@ export class SendComplianceOrderComponent implements OnInit {
172172
this.showPreviewDialog = false;
173173
}
174174

175+
private fixBrokenLinksInAPreview(content: string): string {
176+
const parser = new DOMParser();
177+
const doc = parser.parseFromString(content, 'text/html');
178+
const links = doc.querySelectorAll('a');
179+
180+
links.forEach(link => {
181+
const href = link.getAttribute('href');
182+
if (href && !/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(href)) {
183+
link.setAttribute('href', 'http://' + href);
184+
}
185+
});
186+
187+
return doc.body.innerHTML;
188+
}
189+
175190
private cloakParams(): void {
176191
var newURL = location.href.split("?")[0];
177192
window.history.pushState('object', document.title, newURL);

0 commit comments

Comments
 (0)