Skip to content
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

WFNEWS-2277 : Use redirect for links to event page and formatting #1989

Merged
merged 1 commit into from
Jun 26, 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
8 changes: 4 additions & 4 deletions client/wfnews-war/src/main/angular/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ import { VideoPanelComponent } from './components/public-incident-page/incident-
import { AreaRestrictionHeaderComponent } from './components/public-incident-page/incident-info-header/area-restriction-header/area-restriction-header.component';
import { BanHeaderComponent } from './components/public-incident-page/incident-info-header/ban-header/ban-header.component';
import { DangerRatingHeaderComponent } from './components/public-incident-page/incident-info-header/danger-rating-header/danger-rating-header.component';
import { IncidentHeaderPanel } from './components/public-incident-page/incident-info-header/incident-header-panel.component';
import { IncidentHeaderPanelComponent } from './components/public-incident-page/incident-info-header/incident-header-panel.component';
import { IncidentInfoPanelMobileComponent } from './components/public-incident-page/incident-info-panel-mobile/incident-info-panel-mobile.component';
import { IncidentInfoPanel } from './components/public-incident-page/incident-info-panel/incident-info-panel.component';
import { IncidentInfoPanelComponent } from './components/public-incident-page/incident-info-panel/incident-info-panel.component';
import { IncidentMapsPanelMobileComponent } from './components/public-incident-page/incident-maps-panel-mobile/incident-maps-panel-mobile.component';
import { IncidentMapsPanel } from './components/public-incident-page/incident-maps-panel/incident-maps-panel.component';
import { IncidentOverviewPanelMobileComponent } from './components/public-incident-page/incident-overview-panel-mobile/incident-overview-panel-mobile.component';
Expand Down Expand Up @@ -374,8 +374,8 @@ export const DATE_FORMATS = {
PanelWildfireStageOfControlContainerDesktop,
PublicIncidentPage,
IncidentGalleryPanel,
IncidentHeaderPanel,
IncidentInfoPanel,
IncidentHeaderPanelComponent,
IncidentInfoPanelComponent,
IncidentMapsPanel,
IncidentOverviewPanel,
SummaryPanel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { MapUtilityService } from '@app/components/preview-panels/map-share-service';
import { AGOLService } from '@app/services/AGOL-service';
import { CapacitorService } from '@app/services/capacitor-service';
import { CommonUtilityService } from '@app/services/common-utility.service';
import { ResourcesRoutes, formatDate, getActiveMap, hidePanel, showPanel } from '@app/utils';

Expand All @@ -11,30 +12,32 @@ import { ResourcesRoutes, formatDate, getActiveMap, hidePanel, showPanel } from
styleUrls: ['./area-restriction-preview.component.scss']
})
export class AreaRestrictionPreviewComponent {
public data;
formatDate = formatDate;

constructor(
private router: Router,
private agolService: AGOLService,
private commonUtilityService: CommonUtilityService,
private mapUtilityService: MapUtilityService
) {}
formatDate = formatDate;
public data;
private mapUtilityService: MapUtilityService,
private capacitorService: CapacitorService,
) { }

setContent(data) {
this.data = data.properties;
}

closePanel() {
hidePanel('desktop-preview');
}
goBack(){
showPanel('identify-panel-wrapper')

goBack() {
showPanel('identify-panel-wrapper');
hidePanel('desktop-preview');
}

enterFullDetail(){

enterFullDetail() {
const url = this.router.serializeUrl(
this.router.createUrlTree([ResourcesRoutes.PUBLIC_EVENT], {
queryParams: {
Expand All @@ -45,34 +48,28 @@ export class AreaRestrictionPreviewComponent {
},
}),
);
window.open(url, '_blank');
this.capacitorService.redirect(url, true);
}

zoomIn(level?: number, polygon?: boolean){
zoomIn(level?: number, polygon?: boolean) {
const viewer = getActiveMap().$viewer;
let long;
let lat;
this.data;
this.agolService
.getAreaRestrictions(
`NAME='${this.data.NAME}'`,
null,
{
returnGeometry: true,
},
)
.toPromise()
.then((response) => {
if (response?.features?.length > 0 && response?.features[0].geometry?.rings?.length > 0){
const polygonData = this.commonUtilityService.extractPolygonData(response.features[0].geometry.rings);
if (polygonData?.length) {
this.mapUtilityService.fixPolygonToMap(polygonData, response.features[0].geometry.rings);

}
}
});
.getAreaRestrictions(
`NAME='${this.data.NAME}'`,
null,
{
returnGeometry: true,
},
)
.toPromise()
.then((response) => {
if (response?.features?.length > 0 && response?.features[0].geometry?.rings?.length > 0) {
const polygonData = this.commonUtilityService.extractPolygonData(response.features[0].geometry.rings);
if (polygonData?.length) {
this.mapUtilityService.fixPolygonToMap(polygonData, response.features[0].geometry.rings);
}
}
});
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { MapUtilityService } from '@app/components/preview-panels/map-share-service';
import { AGOLService } from '@app/services/AGOL-service';
import { CapacitorService } from '@app/services/capacitor-service';
import { CommonUtilityService } from '@app/services/common-utility.service';
import { ResourcesRoutes, formatDate, getActiveMap, hidePanel, showPanel } from '@app/utils';

Expand All @@ -12,28 +13,31 @@ import { ResourcesRoutes, formatDate, getActiveMap, hidePanel, showPanel } from
})
export class DangerRatingPreviewComponent {

public data;
formatDate = formatDate;

constructor(
private router: Router,
private agolService: AGOLService,
private commonUtilityService: CommonUtilityService,
private mapUtilityService: MapUtilityService
) {}
private mapUtilityService: MapUtilityService,
private capacitorService: CapacitorService,
) { }


public data;
formatDate = formatDate
setContent(data) {
this.data = data.properties;
}

closePanel() {
closePanel() {
hidePanel('desktop-preview');
}
goBack(){
showPanel('identify-panel-wrapper')
goBack() {
showPanel('identify-panel-wrapper');
hidePanel('desktop-preview');
}

enterFullDetail(){
enterFullDetail() {
const url = this.router.serializeUrl(
this.router.createUrlTree([ResourcesRoutes.PUBLIC_EVENT], {
queryParams: {
Expand All @@ -44,44 +48,43 @@ export class DangerRatingPreviewComponent {
},
}),
);
window.open(url, '_blank');
this.capacitorService.redirect(url, true);
}

zoomIn(level?: number, polygon?: boolean){
zoomIn(level?: number, polygon?: boolean) {
const viewer = getActiveMap().$viewer;
let long;
let lat;
this.data;
this.agolService
.getDangerRatings(
`PROT_DR_SYSID ='${this.data.PROT_DR_SYSID}'`,
null,
{
returnGeometry: true,
},
)
.toPromise()
.then((response) => {
if (response?.features?.length > 0 && response?.features[0].geometry?.rings?.length > 0){
const polygonData = this.commonUtilityService.extractPolygonData(response.features[0].geometry.rings);
if (polygonData?.length) {
this.mapUtilityService.fixPolygonToMap(polygonData, response.features[0].geometry.rings);
.getDangerRatings(
`PROT_DR_SYSID ='${this.data.PROT_DR_SYSID}'`,
null,
{
returnGeometry: true,
},
)
.toPromise()
.then((response) => {
if (response?.features?.length > 0 && response?.features[0].geometry?.rings?.length > 0) {
const polygonData = this.commonUtilityService.extractPolygonData(response.features[0].geometry.rings);
if (polygonData?.length) {
this.mapUtilityService.fixPolygonToMap(polygonData, response.features[0].geometry.rings);

}
}
});
}
}
});
}


displayDangerRatingDes(danger) {
switch (danger) {
case 'Extreme':
// eslint-disable-next-line max-len
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be removed

return 'Extremely high risk of fire starting. Forest fuels are extremely dry and the fire risk is very serious. Fires can start easily, spread rapidly, and challenge fire suppression efforts. Forest activities may be restricted.';
case 'High':
return 'Serious risk of fire starting. Forest fuels are very dry and extreme caution must be used.';
case 'Moderate':
return 'Moderate risk of fire starting. Forest fuels are dry and caution should be exercised in forested areas.';
case 'Low':
// eslint-disable-next-line max-len
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And this line

return 'Low risk of fire starting. Fires are unlikely to involve deeper fuel layers or larger fuels. Fire is still possible, so be prepared for conditions to change.';
case 'Very Low':
return 'Very low risk of fire starting.';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { AGOLService } from '@app/services/AGOL-service';
import { CapacitorService } from '@app/services/capacitor-service';
import { CommonUtilityService } from '@app/services/common-utility.service';
import { ResourcesRoutes, hidePanel, showPanel, convertToDateTimeTimeZone, getActiveMap } from '@app/utils';
import { ResourcesRoutes, convertToDateTimeTimeZone, hidePanel, showPanel } from '@app/utils';
import { MapUtilityService } from '../map-share-service';

@Component({
Expand All @@ -12,15 +13,17 @@ import { MapUtilityService } from '../map-share-service';
})
export class EvacuationsPreviewComponent {

public data;
convertToDateTimeTimeZone = convertToDateTimeTimeZone;

constructor(
private router: Router,
private agolService: AGOLService,
private commonUtilityService: CommonUtilityService,
private mapUtilityService: MapUtilityService
) {}
private mapUtilityService: MapUtilityService,
private capacitorService: CapacitorService,
) { }

convertToDateTimeTimeZone = convertToDateTimeTimeZone;
public data;
setContent(data) {
this.data = data.properties;
this.zoomIn();
Expand All @@ -29,12 +32,12 @@ export class EvacuationsPreviewComponent {
closePanel() {
hidePanel('desktop-preview');
}
goBack(){
showPanel('identify-panel-wrapper')

goBack() {
showPanel('identify-panel-wrapper');
hidePanel('desktop-preview');
}

displayEvacTitle(item) {
let prefix = null;
if (item?.ORDER_ALERT_STATUS === 'Alert') {
Expand All @@ -45,8 +48,8 @@ export class EvacuationsPreviewComponent {
return prefix + item?.EVENT_NAME;
}

enterFullDetail(){
if(this.data) {
enterFullDetail() {
if (this.data) {
const url = this.router.serializeUrl(
this.router.createUrlTree([ResourcesRoutes.PUBLIC_EVENT], {
queryParams: {
Expand All @@ -57,24 +60,24 @@ export class EvacuationsPreviewComponent {
},
}),
);
window.open(url, '_blank');
this.capacitorService.redirect(url, true);
}
}

zoomIn(){
zoomIn() {
this.agolService
.getEvacOrdersByEventNumber(this.data.EVENT_NUMBER, {
returnGeometry: true,
})
.toPromise()
.then((response) => {
if (response?.features?.length > 0 && response?.features[0].geometry?.rings?.length > 0){
const polygonData = this.commonUtilityService.extractPolygonData(response.features[0].geometry.rings);
if (polygonData?.length) {
this.mapUtilityService.fixPolygonToMap(polygonData, response.features[0].geometry.rings);
}
}
});
.getEvacOrdersByEventNumber(this.data.EVENT_NUMBER, {
returnGeometry: true,
})
.toPromise()
.then((response) => {
if (response?.features?.length > 0 && response?.features[0].geometry?.rings?.length > 0) {
const polygonData = this.commonUtilityService.extractPolygonData(response.features[0].geometry.rings);
if (polygonData?.length) {
this.mapUtilityService.fixPolygonToMap(polygonData, response.features[0].geometry.rings);
}
}
});
}

}
Loading
Loading