Skip to content

Commit 0f0fa44

Browse files
committed
chore: update linting styles
1 parent a4260e4 commit 0f0fa44

13 files changed

Lines changed: 195 additions & 131 deletions

File tree

src/app/components/header/header.component.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
*ngIf="searchType$ | async as searchType"
1414
class="header-buttons-input fx-col header-inner--layout"
1515
>
16-
1716
<app-dataset-header *ngIf="searchType === searchTypes.DATASET">
1817
</app-dataset-header>
1918

src/app/components/results-menu/scene-files/scene-files.component.spec.ts

Lines changed: 65 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,72 @@ import { provideHttpClientTesting } from '@angular/common/http/testing';
77
import { ToastrModule } from 'ngx-toastr';
88

99
describe('SceneFilesComponent', () => {
10-
let component: SceneFilesComponent;
11-
let fixture: ComponentFixture<SceneFilesComponent>;
12-
beforeEach(() => {
13-
TestBed.configureTestingModule({
14-
imports: [SceneFilesModule,
15-
ToastrModule.forRoot({
16-
positionClass: 'toast-bottom-right'
17-
})
18-
],
19-
providers: [
20-
provideMockStore(),
21-
provideHttpClient(),
22-
provideHttpClientTesting(),
23-
],
24-
});
10+
let component: SceneFilesComponent;
11+
let fixture: ComponentFixture<SceneFilesComponent>;
12+
beforeEach(() => {
13+
TestBed.configureTestingModule({
14+
imports: [
15+
SceneFilesModule,
16+
ToastrModule.forRoot({
17+
positionClass: 'toast-bottom-right',
18+
}),
19+
],
20+
providers: [
21+
provideMockStore(),
22+
provideHttpClient(),
23+
provideHttpClientTesting(),
24+
],
2525
});
26+
});
2627

27-
beforeEach(() => { fixture = TestBed.createComponent(SceneFilesComponent); component = fixture.componentInstance; fixture.detectChanges(); });
28+
beforeEach(() => {
29+
fixture = TestBed.createComponent(SceneFilesComponent);
30+
component = fixture.componentInstance;
31+
fixture.detectChanges();
32+
});
2833

29-
it('should create', () => { expect(component).toBeDefined(); });
34+
it('should create', () => {
35+
expect(component).toBeDefined();
36+
});
3037

31-
it('should be able to generate params for L2 GSLC equivalent of L1 RSLC products', () => expect(
32-
component.getNisarL2Params('NISAR_L1_PR_RSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001', 'RSLC')).toEqual(
33-
({
34-
granule_list: 'NISAR_L2_PR_GSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001'
35-
})
36-
)
37-
)
38-
it('should be able to generate params for L2 GUNW equivalent of L1 RUNW products', () => expect(
39-
component.getNisarL2Params('NISAR_L1_PR_RUNW_015_156_A_010_016_2000_SV_20230619T000803_20230619T000817_20230701T000803_20230701T000817_T00406_N_P_J_001', 'RUNW')).toEqual(
40-
({
41-
granule_list: 'NISAR_L2_PR_GUNW_015_156_A_010_016_2000_SV_20230619T000803_20230619T000817_20230701T000803_20230701T000817_T00406_N_P_J_001'
42-
})
43-
)
44-
)
45-
it('should be able to generate params for L2 GOFF equivalent of L1 ROFF products', () => expect(
46-
component.getNisarL2Params('NISAR_L1_PR_ROFF_039_002_D_123_040_4000_SH_20240403T084941_20240403T084954_20240415T084941_20240415T084954_T00408_N_P_J_001', 'ROFF')).toEqual(
47-
({
48-
granule_list: 'NISAR_L2_PR_GOFF_039_002_D_123_040_4000_SH_20240403T084941_20240403T084954_20240415T084941_20240415T084954_T00408_N_P_J_001'
49-
})
50-
)
51-
)
52-
it('should be able to generate params for L2 UR equivalent of L1 UR products', () => expect(
53-
component.getNisarL2Params('NISAR_L1_UR_ROFF_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_F_P_J_001', 'ROFF')).toEqual(
54-
({
55-
granule_list: 'NISAR_L2_UR_GOFF_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_F_P_J_001'
56-
})
57-
)
58-
)
59-
})
38+
it('should be able to generate params for L2 GSLC equivalent of L1 RSLC products', () =>
39+
expect(
40+
component.getNisarL2Params(
41+
'NISAR_L1_PR_RSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001',
42+
'RSLC',
43+
),
44+
).toEqual({
45+
granule_list:
46+
'NISAR_L2_PR_GSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001',
47+
}));
48+
it('should be able to generate params for L2 GUNW equivalent of L1 RUNW products', () =>
49+
expect(
50+
component.getNisarL2Params(
51+
'NISAR_L1_PR_RUNW_015_156_A_010_016_2000_SV_20230619T000803_20230619T000817_20230701T000803_20230701T000817_T00406_N_P_J_001',
52+
'RUNW',
53+
),
54+
).toEqual({
55+
granule_list:
56+
'NISAR_L2_PR_GUNW_015_156_A_010_016_2000_SV_20230619T000803_20230619T000817_20230701T000803_20230701T000817_T00406_N_P_J_001',
57+
}));
58+
it('should be able to generate params for L2 GOFF equivalent of L1 ROFF products', () =>
59+
expect(
60+
component.getNisarL2Params(
61+
'NISAR_L1_PR_ROFF_039_002_D_123_040_4000_SH_20240403T084941_20240403T084954_20240415T084941_20240415T084954_T00408_N_P_J_001',
62+
'ROFF',
63+
),
64+
).toEqual({
65+
granule_list:
66+
'NISAR_L2_PR_GOFF_039_002_D_123_040_4000_SH_20240403T084941_20240403T084954_20240415T084941_20240415T084954_T00408_N_P_J_001',
67+
}));
68+
it('should be able to generate params for L2 UR equivalent of L1 UR products', () =>
69+
expect(
70+
component.getNisarL2Params(
71+
'NISAR_L1_UR_ROFF_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_F_P_J_001',
72+
'ROFF',
73+
),
74+
).toEqual({
75+
granule_list:
76+
'NISAR_L2_UR_GOFF_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_F_P_J_001',
77+
}));
78+
});

src/app/components/results-menu/scene-files/scene-files.component.ts

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -530,20 +530,29 @@ export class SceneFilesComponent
530530
}),
531531
),
532532
);
533-
}else if(!!scene && scene.id?.startsWith('NISAR_L1')) {
534-
if (!Object.keys(L1L2BrowseCollectionMapping).includes(scene.metadata.productType)) {
535-
return of([])
533+
} else if (!!scene && scene.id?.startsWith('NISAR_L1')) {
534+
if (
535+
!Object.keys(L1L2BrowseCollectionMapping).includes(
536+
scene.metadata.productType,
537+
)
538+
) {
539+
return of([]);
536540
}
537-
538-
const queryParams = this.getNisarL2Params(scene.id, scene.metadata.productType)
539541

540-
return this.asfApiService.query<any>(queryParams).pipe(
541-
map((products) =>
542-
products?.results?.length > 0
543-
? this.productService.fromResponse(products).slice(0, 1)
544-
: [],
545-
)
542+
const queryParams = this.getNisarL2Params(
543+
scene.id,
544+
scene.metadata.productType,
546545
);
546+
547+
return this.asfApiService
548+
.query<any>(queryParams)
549+
.pipe(
550+
map((products) =>
551+
products?.results?.length > 0
552+
? this.productService.fromResponse(products).slice(0, 1)
553+
: [],
554+
),
555+
);
547556
} else {
548557
return of([]);
549558
}
@@ -552,7 +561,12 @@ export class SceneFilesComponent
552561

553562
public getNisarL2Params(productID: string, productType: string) {
554563
return {
555-
granule_list: productID.replaceAll(productType, L1L2BrowseCollectionMapping[productType].productType).replaceAll('L1', 'L2')
564+
granule_list: productID
565+
.replaceAll(
566+
productType,
567+
L1L2BrowseCollectionMapping[productType].productType,
568+
)
569+
.replaceAll('L1', 'L2'),
556570
};
557571
}
558572
public getProductSceneCount(products: SarviewsProduct[]) {

src/app/components/results-menu/scenes-list-header/scenes-list-header.component.html

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -564,27 +564,26 @@
564564
</button>
565565

566566
@let currentDatasetID = currentDatasetID$ | async;
567-
@if ( searchType === SearchTypes.DATASET
568-
&& (
569-
currentDatasetID === 'OPERA-S1'
570-
|| currentDatasetID === 'NISAR'
571-
|| currentDatasetID === 'SEASAT'
572-
)
573-
) {
574-
<button
575-
mat-menu-item
576-
[matMenuTriggerFor]="addAllProductsOfType"
577-
[matMenuTriggerData]="{
578-
productData: (productCountByType$ | async),
579-
}"
580-
>
581-
{{
582-
currentDatasetID === 'NISAR'
583-
? ('ADD_BY_FILE_TYPE' | translate)
584-
: ('ADD_BY_PRODUCT_TYPE' | translate)
585-
}}
586-
</button>
587-
}
567+
@if (
568+
searchType === SearchTypes.DATASET &&
569+
(currentDatasetID === 'OPERA-S1' ||
570+
currentDatasetID === 'NISAR' ||
571+
currentDatasetID === 'SEASAT')
572+
) {
573+
<button
574+
mat-menu-item
575+
[matMenuTriggerFor]="addAllProductsOfType"
576+
[matMenuTriggerData]="{
577+
productData: (productCountByType$ | async),
578+
}"
579+
>
580+
{{
581+
currentDatasetID === 'NISAR'
582+
? ('ADD_BY_FILE_TYPE' | translate)
583+
: ('ADD_BY_PRODUCT_TYPE' | translate)
584+
}}
585+
</button>
586+
}
588587
</mat-menu>
589588

590589
<mat-menu #addAllProductsOfType>

src/app/models/dataset.model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export interface Dataset {
3434
ascending: string;
3535
descending: string;
3636
};
37-
productTypeDisplays?: {[index: string]: string};
37+
productTypeDisplays?: Record<string, string>;
3838
}
3939

4040
export enum MissionDataset {

src/app/models/datasets/opera_s1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ export const opera_s1 = {
8080
incidence_angle: 'Incidence Angle GeoTIFF',
8181
rtc_anf_gamma0_to_beta0: 'RTC Gamm to Beta GeoTIFF',
8282
local_incidence_angle: 'Local Incidence Angle GeoTIFF',
83-
}
83+
},
8484
};

src/app/models/datasets/seasat.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export const seasat = {
2828
infoUrl: 'https://www.earthdata.nasa.gov/data/catalog/asf-seasat-l1-sar-1',
2929
citationUrl:
3030
'https://asf.alaska.edu/data-sets/sar-data-sets/seasat/seasat-how-to-cite/',
31-
productTypes: [
32-
],
31+
productTypes: [],
3332
beamModes: ['STD'],
3433
polarizations: ['HH'],
3534
subtypes: [],
@@ -42,6 +41,6 @@ export const seasat = {
4241
xml: 'ISO Metadata XML',
4342
kml: 'Metadata KML',
4443
qc_report: 'QC Report',
45-
jpg: 'Browse Image JPEG'
46-
}
44+
jpg: 'Browse Image JPEG',
45+
},
4746
};

src/app/services/browse-overlay.service.spec.ts

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { TestBed } from '@angular/core/testing';
33
import { BrowseOverlayService } from './browse-overlay.service';
44
import { provideMockStore } from '@ngrx/store/testing';
55

6-
76
describe('BrowseOverlayService', () => {
87
let service: BrowseOverlayService;
98

109
beforeEach(() => {
1110
TestBed.configureTestingModule({
12-
providers: [provideMockStore({})],
11+
providers: [provideMockStore({})],
1312
});
1413
service = TestBed.inject(BrowseOverlayService);
1514
});
@@ -19,25 +18,31 @@ describe('BrowseOverlayService', () => {
1918
});
2019

2120
it('should replace NISAR L1 RSLC browse urls with L2 GSLC browse', () => {
22-
const L1ProductUrl = 'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L1_RSLC_BETA_V1/NISAR_L1_PR_RSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001/NISAR_L1_PR_RSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001.png'
23-
const L2ProductUrl = 'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L2_GSLC_BETA_V1/NISAR_L2_PR_GSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001/NISAR_L2_PR_GSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001.png'
24-
expect(service.nisarL1ToL2BrowseImage(L1ProductUrl)).toBe(L2ProductUrl)
21+
const L1ProductUrl =
22+
'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L1_RSLC_BETA_V1/NISAR_L1_PR_RSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001/NISAR_L1_PR_RSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001.png';
23+
const L2ProductUrl =
24+
'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L2_GSLC_BETA_V1/NISAR_L2_PR_GSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001/NISAR_L2_PR_GSLC_088_039_D_114_2005_SHSH_A_20251114T222008_20251114T222017_T05000_N_P_J_001.png';
25+
expect(service.nisarL1ToL2BrowseImage(L1ProductUrl)).toBe(L2ProductUrl);
2526
});
2627

2728
it('should replace NISAR L1 RUNW browse urls with L2 GUNW browse', () => {
28-
const L1ProductUrl = 'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L1_RUNW_BETA_V1/NISAR_L1_PR_RUNW_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_N_P_J_001/NISAR_L1_PR_RUNW_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_N_P_J_001.png'
29-
const L2ProductUrl = 'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L2_GUNW_BETA_V1/NISAR_L2_PR_GUNW_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_N_P_J_001/NISAR_L2_PR_GUNW_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_N_P_J_001.png'
30-
expect(service.nisarL1ToL2BrowseImage(L1ProductUrl)).toBe(L2ProductUrl)
29+
const L1ProductUrl =
30+
'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L1_RUNW_BETA_V1/NISAR_L1_PR_RUNW_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_N_P_J_001/NISAR_L1_PR_RUNW_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_N_P_J_001.png';
31+
const L2ProductUrl =
32+
'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L2_GUNW_BETA_V1/NISAR_L2_PR_GUNW_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_N_P_J_001/NISAR_L2_PR_GUNW_039_002_D_121_040_7700_SH_20240403T084849_20240403T084905_20240415T084849_20240415T084905_T00408_N_P_J_001.png';
33+
expect(service.nisarL1ToL2BrowseImage(L1ProductUrl)).toBe(L2ProductUrl);
3134
});
3235

33-
it('should replace NISAR L1 ROFF browse urls with L2 GOFF browse', () => {
34-
const L1ProductUrl = 'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L1_ROFF_BETA_V1/NISAR_L1_PR_ROFF_039_002_D_122_040_7700_SH_20240403T084903_20240403T084938_20240415T084903_20240415T084938_T00408_N_P_J_001/NISAR_L1_PR_ROFF_039_002_D_122_040_7700_SH_20240403T084903_20240403T084938_20240415T084903_20240415T084938_T00408_N_P_J_001.png'
35-
const L2ProductUrl = 'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L2_GOFF_BETA_V1/NISAR_L2_PR_GOFF_039_002_D_122_040_7700_SH_20240403T084903_20240403T084938_20240415T084903_20240415T084938_T00408_N_P_J_001/NISAR_L2_PR_GOFF_039_002_D_122_040_7700_SH_20240403T084903_20240403T084938_20240415T084903_20240415T084938_T00408_N_P_J_001.png'
36-
expect(service.nisarL1ToL2BrowseImage(L1ProductUrl)).toBe(L2ProductUrl)
36+
it('should replace NISAR L1 ROFF browse urls with L2 GOFF browse', () => {
37+
const L1ProductUrl =
38+
'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L1_ROFF_BETA_V1/NISAR_L1_PR_ROFF_039_002_D_122_040_7700_SH_20240403T084903_20240403T084938_20240415T084903_20240415T084938_T00408_N_P_J_001/NISAR_L1_PR_ROFF_039_002_D_122_040_7700_SH_20240403T084903_20240403T084938_20240415T084903_20240415T084938_T00408_N_P_J_001.png';
39+
const L2ProductUrl =
40+
'https://nisar-test.asf.earthdatacloud.nasa.gov/BROWSE/NISAR_L2_GOFF_BETA_V1/NISAR_L2_PR_GOFF_039_002_D_122_040_7700_SH_20240403T084903_20240403T084938_20240415T084903_20240415T084938_T00408_N_P_J_001/NISAR_L2_PR_GOFF_039_002_D_122_040_7700_SH_20240403T084903_20240403T084938_20240415T084903_20240415T084938_T00408_N_P_J_001.png';
41+
expect(service.nisarL1ToL2BrowseImage(L1ProductUrl)).toBe(L2ProductUrl);
3742
});
3843

39-
it('should not modify NISAR L1 browse images `/assets/no-browse.png`', () => {
40-
const noBrowse = '/assets/no-browse.png'
41-
expect(service.nisarL1ToL2BrowseImage(noBrowse)).toBe(noBrowse)
44+
it('should not modify NISAR L1 browse images `/assets/no-browse.png`', () => {
45+
const noBrowse = '/assets/no-browse.png';
46+
expect(service.nisarL1ToL2BrowseImage(noBrowse)).toBe(noBrowse);
4247
});
4348
});

src/app/services/browse-overlay.service.ts

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ export class BrowseOverlayService {
116116
const feature = this.wktService.wktToFeature(wkt, 'EPSG:3857');
117117
const polygon = this.getPolygonFromFeature(feature, wkt);
118118

119-
let isNisarL1Browse = url.split('/').pop().startsWith('NISAR_L1')
119+
const isNisarL1Browse = url.split('/').pop().startsWith('NISAR_L1');
120120
if (isNisarL1Browse) {
121-
url = this.nisarL1ToL2BrowseImage(url)
121+
url = this.nisarL1ToL2BrowseImage(url);
122122
}
123123

124124
const source = this.createImageSource(url, polygon.getExtent());
@@ -140,17 +140,26 @@ export class BrowseOverlayService {
140140

141141
public nisarL1ToL2BrowseImage(url: string) {
142142
if (url === '/assets/no-browse.png') {
143-
return url
143+
return url;
144144
}
145145

146146
const fileName = url.split('/').pop();
147147
const metadata = fileName.split('_');
148148
const productType = metadata[3];
149-
const productionConfiguration = metadata[1]
149+
const productionConfiguration = metadata[1];
150150
const shortName = `NISAR_${productionConfiguration}_${productType}`;
151-
152-
const outputUrl = url.replaceAll(shortName, L1L2BrowseCollectionMapping[productType].collection).replaceAll(productType, L1L2BrowseCollectionMapping[productType].productType).replaceAll('L1', 'L2');
153-
return outputUrl
151+
152+
const outputUrl = url
153+
.replaceAll(
154+
shortName,
155+
L1L2BrowseCollectionMapping[productType].collection,
156+
)
157+
.replaceAll(
158+
productType,
159+
L1L2BrowseCollectionMapping[productType].productType,
160+
)
161+
.replaceAll('L1', 'L2');
162+
return outputUrl;
154163
}
155164

156165
public createGeotiffLayer(

0 commit comments

Comments
 (0)