@@ -10,44 +10,71 @@ import {
1010import { addDataToLayer , footprintLayerStyle } from '../utils/mapHelper'
1111
1212export async function SearchService ( searchParams , productData , apiKey ) {
13- // {
14- // "id": "cc4a6b70-d45b-415b-b7ea-0f636fdc9a2d",
15- // "product_id": "maxar",
16- // "opportunity_request": {
17- // "datetime": "2025-04-03T10:28:47.935480+00:00/2025-04-03T10:28:47.935484+00:00",
18- // "geometry": {
19- // "type": "Point",
20- // "coordinates": [
21- // 0.0,
22- // 0.0
23- // ]
24- // },
25- // "filter": null,
26- // "next": null,
27- // "limit": 10
28- // },
29- // "status": {
30- // "timestamp": "2025-04-03T10:28:47.935549Z",
31- // "status_code": "completed",
32- // "reason_code": null,
33- // "reason_text": null,
34- // "links": []
35- // },
36- // "links": [
37- // {
38- // "href": "https://apps.euspaceimaging.com/test/internal/tara/api/v1/feasibility/cc4a6b70-d45b-415b-b7ea-0f636fdc9a2d",
39- // "rel": "feasibility"
40- // },
41- // {
42- // "href": "http://apps.euspaceimaging.com/test/internal/stapi/searches/opportunities/cc4a6b70-d45b-415b-b7ea-0f636fdc9a2d",
43- // "rel": "self",
44- // "type": "application/json"
45- // }
46- // ]
47- // }
13+ const opportunities = [ {
14+ id : 'cc4a6b70-d45b-415b-b7ea-0f636fdc9a2d' ,
15+ product_id : 'maxar' ,
16+ opportunity_request : {
17+ datetime :
18+ '2025-04-03T10:28:47.935480+00:00/2025-04-03T10:28:47.935484+00:00' ,
19+ geometry : {
20+ type : 'Point' ,
21+ coordinates : [ 0.0 , 0.0 ]
22+ } ,
23+ filter : null ,
24+ next : null ,
25+ limit : 10
26+ } ,
27+ status : {
28+ timestamp : '2025-04-03T10:28:47.935549Z' ,
29+ status_code : 'completed' ,
30+ reason_code : null ,
31+ reason_text : null ,
32+ links : [ ]
33+ } ,
34+ links : [
35+ {
36+ href : 'https://apps.euspaceimaging.com/test/internal/tara/api/v1/feasibility/cc4a6b70-d45b-415b-b7ea-0f636fdc9a2d' ,
37+ rel : 'feasibility'
38+ } ,
39+ {
40+ href : 'http://apps.euspaceimaging.com/test/internal/stapi/searches/opportunities/cc4a6b70-d45b-415b-b7ea-0f636fdc9a2d' ,
41+ rel : 'self' ,
42+ type : 'application/json'
43+ }
44+ ]
45+ } ]
46+ console . log ( opportunities [ 0 ] . opportunity_request )
47+ const featureHack = {
48+ type : 'FeatureCollection' ,
49+ features : [ ]
50+ }
51+ for ( const [ key , value ] of Object . entries ( opportunities ) ) {
52+ featureHack . features . push ( {
53+ type : 'Feature' ,
54+ properties : { id : value . id } ,
55+ geometry : value . opportunity_request . geometry
56+ } )
57+ }
58+
59+
60+ console . log ( featureHack )
61+
62+ store . dispatch ( setSearchResults ( featureHack ) )
63+ store . dispatch ( setmappedScenes ( featureHack ) )
64+ const options = {
65+ style : footprintLayerStyle
66+ }
67+ store . dispatch ( setSearchLoading ( false ) )
68+
69+ addDataToLayer ( featureHack , 'searchResultsLayer' , options , true )
70+ // store.dispatch(setClickResults(fakeOpportunities.features))
71+ store . dispatch ( settabSelected ( 'details' ) )
72+ store . dispatch ( sethasLeftPanelTabChanged ( true ) )
73+
74+ return
75+
76+ /// ///////
4877 console . log ( 'REQUEST' , searchParams )
49- // TODO: PUT ENDPOINT HERE
50- // check for selected product and map endpoint
5178 await fetch ( productData . providerBaseUrl + '/products/maxar/opportunities' , {
5279 method : 'POST' ,
5380 headers : {
0 commit comments