Skip to content

Commit 7fa3c5e

Browse files
authored
feat: update maps to use the new proxy service endpoints (flagged) (#4397)
1 parent efa2f78 commit 7fa3c5e

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

.gitignore

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ yarn-error.log
2828
/public/test.*
2929

3030
# oats generated routes
31-
src/client/generatedRoutes.ts
31+
src/client/annotationdRoutes.ts
3232
src/client/cloudPrivRoutes.ts
33-
src/client/unityRoutes.ts
3433
src/client/flowsRoutes.ts
35-
src/client/notebooksRoutes.ts
36-
src/client/annotationdRoutes.ts
37-
src/client/mapsdRoutes.ts
34+
src/client/fluxdocsdRoutes.ts
35+
src/client/generatedRoutes.ts
3836
src/client/managedFunctionsRoutes.ts
37+
src/client/mapsdRoutes.ts
38+
src/client/notebooksRoutes.ts
3939
src/client/pinnedItemRoutes.ts
40-
src/client/fluxdocsdRoutes.ts
41-
src/client/subscriptionsRoutes.ts
40+
src/client/subscriptionsRoutes.ts
41+
src/client/uiproxydRoutes.ts
42+
src/client/unityRoutes.ts

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
"generate": "export SHA=b983e6ecc75f9b9852401e5585f2706890b10bb3 && export REMOTE=https://raw.githubusercontent.com/influxdata/openapi/${SHA}/ && yarn generate-meta",
5656
"generate-local": "export REMOTE=../openapi/ && yarn generate-meta",
5757
"generate-meta": "if [ -z \"${CLOUD_URL}\" ]; then yarn generate-meta-oss; else yarn generate-meta-cloud; fi",
58-
"generate-meta-oss": "yarn oss-api && yarn notebooks && yarn unity && yarn annotations-oss && yarn pinned && yarn mapsd-oss && yarn cloudPriv && yarn fluxdocs && yarn subscriptions-oss",
59-
"generate-meta-cloud": "yarn cloud-api && yarn notebooks && yarn unity && yarn annotations && yarn cloudPriv && yarn pinned && yarn mapsd && yarn fluxdocs && yarn subscriptions",
58+
"generate-meta-oss": "yarn oss-api && yarn notebooks && yarn unity && yarn annotations-oss && yarn pinned && yarn mapsd-oss && yarn uiproxyd-oss && yarn cloudPriv && yarn fluxdocs && yarn subscriptions-oss",
59+
"generate-meta-cloud": "yarn cloud-api && yarn notebooks && yarn unity && yarn annotations && yarn cloudPriv && yarn pinned && yarn mapsd && yarn uiproxyd && yarn fluxdocs && yarn subscriptions",
6060
"oss": "oats ${REMOTE}contracts/oss-diff.yml > ./src/client/ossRoutes.ts",
6161
"cloud": "oats ${REMOTE}contracts/cloud-diff.yml > ./src/client/cloudRoutes.ts",
6262
"common": "oats ${REMOTE}contracts/common.yml > ./src/client/commonRoutes.ts",
@@ -69,6 +69,8 @@
6969
"annotations-oss": "oats ${REMOTE}contracts/priv/annotationd-oss.yml > ./src/client/annotationdRoutes.ts",
7070
"mapsd-oss": "touch ./src/client/mapsdRoutes.ts",
7171
"mapsd": "oats ${REMOTE}contracts/mapsd.yml > ./src/client/mapsdRoutes.ts",
72+
"uiproxyd-oss": "touch ./src/client/uiproxydRoutes.ts",
73+
"uiproxyd": "oats ${REMOTE}contracts/uiproxyd.yml > ./src/client/uiproxydRoutes.ts",
7274
"subscriptions": "oats ${REMOTE}contracts/priv/nifid.yml > ./src/client/subscriptionsRoutes.ts",
7375
"subscriptions-oss": "touch ./src/client/subscriptionsRoutes.ts",
7476
"pinned": "oats ${REMOTE}contracts/priv/pinneditemsd.yml > ./src/client/pinnedItemRoutes.ts",

src/visualization/types/Map/view.test.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
jest.mock(
2+
'src/client/uiproxydRoutes',
3+
() => {
4+
return {
5+
getMapToken: () => ({
6+
token: 'token',
7+
}),
8+
}
9+
},
10+
{virtual: true}
11+
)
12+
113
jest.mock(
214
'src/client/mapsdRoutes',
315
() => {
@@ -48,7 +60,7 @@ jest.mock('src/shared/constants/index', () => ({
4860
describe('Map component renders', () => {
4961
it('returns with helpful error message when map service is down', () => {
5062
jest.mock(
51-
'src/client/mapsdRoutes',
63+
'src/client/uiproxydRoutes',
5264
() => {
5365
throw new Error('Service Unavailable')
5466
},

src/visualization/types/Map/view.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ import {VisualizationProps} from 'src/visualization'
1111
import {getGeoCoordinates} from 'src/shared/utils/vis'
1212
import {event} from 'src/cloud/utils/reporting'
1313
import {CLOUD} from 'src/shared/constants'
14+
import {isFlagEnabled} from 'src/shared/utils/featureFlag'
15+
1416
let getMapToken = null
1517

1618
if (CLOUD) {
1719
getMapToken = require('src/client/mapsdRoutes').getMapToken
20+
if (isFlagEnabled('uiproxyd')) {
21+
getMapToken = require('src/client/uiproxydRoutes').getMapToken
22+
}
1823
}
1924

2025
interface Props extends VisualizationProps {

0 commit comments

Comments
 (0)