Skip to content

Commit ec985fd

Browse files
committed
fix webmapv3 iPortalProxyUrl取不到值的问题
1 parent 6b1f8c3 commit ec985fd

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

src/common/mapping/WebMapV3.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export function createWebMapV3Extending(SuperClass, { MapManager, mapRepo, crsMa
315315
}
316316
return (url, resourceType) => {
317317
if (resourceType === 'Tile') {
318-
const withCredentials = this.options.iportalServiceProxyUrl && url.indexOf(this.options.iportalServiceProxyUrl) >= 0;
318+
const withCredentials = this.options.iportalServiceProxyUrlPrefix && url.indexOf(this.options.iportalServiceProxyUrlPrefix) >= 0;
319319
return {
320320
url: url,
321321
credentials: withCredentials ? 'include' : undefined,

src/common/mapping/utils/L7LayerUtil.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ export function L7LayerUtil(config) {
426426
}
427427

428428
function isIportalProxyServiceUrl(url, options) {
429-
return options.iportalServiceProxyUrl && url.indexOf(options.iportalServiceProxyUrl) >= 0;
429+
return options.iportalServiceProxyUrlPrefix && url.indexOf(options.iportalServiceProxyUrlPrefix) >= 0;
430430
}
431431

432432
function handleWithRequestOptions(url, options) {

test/common/mapping/utils/L7LayerUtilSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ describe('L7LayerUtil', () => {
517517
...addOptions.options,
518518
withCredentials: false,
519519
server: '/iportal/',
520-
iportalServiceProxyUrl: 'http://localhost:8195/portalproxy'
520+
iportalServiceProxyUrlPrefix: 'http://localhost:8195/portalproxy'
521521
}
522522
};
523523
const spy = spyOn(nextOptions.map, 'addLayer').and.callThrough();

test/mapboxgl/mapping/WebMapV3Spec.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('mapboxgl-webmap3.0', () => {
105105
});
106106
mapstudioWebmap = new WebMap(id, {
107107
server: server,
108-
iportalServiceProxyUrl: 'initialize_raster'
108+
iportalServiceProxyUrlPrefix: 'initialize_raster'
109109
});
110110
expect(mapstudioWebmap.credentialKey).toBeUndefined();
111111
expect(mapstudioWebmap.credentialValue).toBeUndefined();
@@ -172,7 +172,7 @@ describe('mapboxgl-webmap3.0', () => {
172172
mapstudioWebmap = new WebMapV3(mapInfo, {
173173
server: server,
174174
target: 'map',
175-
iportalServiceProxyUrl: 'mapId is JSON'
175+
iportalServiceProxyUrlPrefix: 'mapId is JSON'
176176
});
177177
mapstudioWebmap.initializeMap(mapInfo);
178178

@@ -256,7 +256,7 @@ describe('mapboxgl-webmap3.0', () => {
256256
mapstudioWebmap = new WebMap(nextMapInfo, {
257257
server: server,
258258
target: 'map',
259-
iportalServiceProxyUrl: 'projection is 4490 and include mapbox-gl-enhance'
259+
iportalServiceProxyUrlPrefix: 'projection is 4490 and include mapbox-gl-enhance'
260260
});
261261

262262
mapstudioWebmap.on('mapcreatesucceeded', ({ map }) => {
@@ -342,7 +342,7 @@ describe('mapboxgl-webmap3.0', () => {
342342
mapstudioWebmap = new WebMapV3(mapInfo, {
343343
server: server,
344344
target: 'map',
345-
iportalServiceProxyUrl: 'overlayLayersManager'
345+
iportalServiceProxyUrlPrefix: 'overlayLayersManager'
346346
});
347347
mapstudioWebmap.initializeMap(mapInfo);
348348

@@ -500,7 +500,7 @@ describe('mapboxgl-webmap3.0', () => {
500500
mapstudioWebmap = new WebMapV3(mapInfo, {
501501
server: server,
502502
target: 'map',
503-
iportalServiceProxyUrl: 'exclude source and layer'
503+
iportalServiceProxyUrlPrefix: 'exclude source and layer'
504504
});
505505
mapstudioWebmap.initializeMap(mapInfo);
506506

@@ -733,14 +733,14 @@ describe('mapboxgl-webmap3.0', () => {
733733
});
734734
const spyTest = spyOn(MapManagerUtil, 'default').and.callFake(mbglmap);
735735
const mapInfo = JSON.parse(mapstudioWebMap_raster);
736-
const iportalServiceProxyUrl = 'http://localhost:8195/portalproxy';
736+
const iportalServiceProxyUrlPrefix = 'http://localhost:8195/portalproxy';
737737
const tileCustomRequestHeaders = { 'Authorization': 'test token' };
738738
mapstudioWebmap = new WebMap(mapInfo, {
739739
server: server,
740740
target: 'map',
741-
iportalServiceProxyUrl,
741+
iportalServiceProxyUrlPrefix,
742742
tileTransformRequest: (url) => {
743-
if (url.includes(iportalServiceProxyUrl)) {
743+
if (url.includes(iportalServiceProxyUrlPrefix)) {
744744
return { headers: tileCustomRequestHeaders };
745745
}
746746
}

test/maplibregl/mapping/WebMapV3Spec.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('maplibregl-webmap3.0', () => {
105105
});
106106
mapstudioWebmap = new WebMap(id, {
107107
server: server,
108-
iportalServiceProxyUrl: 'initialize_raster'
108+
iportalServiceProxyUrlPrefix: 'initialize_raster'
109109
});
110110
expect(mapstudioWebmap.credentialKey).toBeUndefined();
111111
expect(mapstudioWebmap.credentialValue).toBeUndefined();
@@ -172,7 +172,7 @@ describe('maplibregl-webmap3.0', () => {
172172
mapstudioWebmap = new WebMapV3(mapInfo, {
173173
server: server,
174174
target: 'map',
175-
iportalServiceProxyUrl: 'mapId is JSON'
175+
iportalServiceProxyUrlPrefix: 'mapId is JSON'
176176
});
177177
mapstudioWebmap.initializeMap(mapInfo);
178178

@@ -256,7 +256,7 @@ describe('maplibregl-webmap3.0', () => {
256256
mapstudioWebmap = new WebMap(nextMapInfo, {
257257
server: server,
258258
target: 'map',
259-
iportalServiceProxyUrl: 'projection is 4490 and include maplibre-gl-enhance'
259+
iportalServiceProxyUrlPrefix: 'projection is 4490 and include maplibre-gl-enhance'
260260
});
261261

262262
mapstudioWebmap.on('mapcreatesucceeded', ({ map }) => {
@@ -342,7 +342,7 @@ describe('maplibregl-webmap3.0', () => {
342342
mapstudioWebmap = new WebMapV3(mapInfo, {
343343
server: server,
344344
target: 'map',
345-
iportalServiceProxyUrl: 'overlayLayersManager'
345+
iportalServiceProxyUrlPrefix: 'overlayLayersManager'
346346
});
347347
mapstudioWebmap.initializeMap(mapInfo);
348348

@@ -500,7 +500,7 @@ describe('maplibregl-webmap3.0', () => {
500500
mapstudioWebmap = new WebMapV3(mapInfo, {
501501
server: server,
502502
target: 'map',
503-
iportalServiceProxyUrl: 'exclude source and layer'
503+
iportalServiceProxyUrlPrefix: 'exclude source and layer'
504504
});
505505
mapstudioWebmap.initializeMap(mapInfo);
506506

@@ -732,14 +732,14 @@ describe('maplibregl-webmap3.0', () => {
732732
});
733733
const spyTest = spyOn(MapManagerUtil, 'default').and.callFake(mbglmap);
734734
const mapInfo = JSON.parse(mapstudioWebMap_raster);
735-
const iportalServiceProxyUrl = 'http://localhost:8195/portalproxy';
735+
const iportalServiceProxyUrlPrefix = 'http://localhost:8195/portalproxy';
736736
const tileCustomRequestHeaders = { 'Authorization': 'test token' };
737737
mapstudioWebmap = new WebMap(mapInfo, {
738738
server: server,
739739
target: 'map',
740-
iportalServiceProxyUrl,
740+
iportalServiceProxyUrlPrefix,
741741
tileTransformRequest: (url) => {
742-
if (url.includes(iportalServiceProxyUrl)) {
742+
if (url.includes(iportalServiceProxyUrlPrefix)) {
743743
return { headers: tileCustomRequestHeaders };
744744
}
745745
}

0 commit comments

Comments
 (0)