Skip to content

Commit

Permalink
Fix #10294 fix arcgis layer grouping bug (#10356)
Browse files Browse the repository at this point in the history
  • Loading branch information
Igi-ID authored May 31, 2024
1 parent 6bef5bd commit 909d495
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
5 changes: 3 additions & 2 deletions web/client/api/catalog/ArcGIS.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function validateUrl(serviceUrl) {
return false;
}

const recordToLayer = (record) => {
const recordToLayer = (record, { layerBaseConfig }) => {
if (!record) {
return null;
}
Expand All @@ -38,7 +38,8 @@ const recordToLayer = (record) => {
options: {
layers: record.layers
}
})
}),
...layerBaseConfig
};
};

Expand Down
37 changes: 35 additions & 2 deletions web/client/api/catalog/__tests__/ArcGIS-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ describe('Test ArcGIS Catalog API', () => {
url: "base/web/client/test-resources/arcgis/arcgis-test-data.json"
};
try {
const layer = getLayerFromRecord( testRecord );
const { type, url, name, title, visibility } = layer;
const layer = getLayerFromRecord( testRecord, { layerBaseConfig: { group: undefined } } );
const { type, url, name, title, visibility, group } = layer;

expect(type).toBeTruthy();
expect(type).toBe('arcgis');
Expand All @@ -73,6 +73,39 @@ describe('Test ArcGIS Catalog API', () => {
expect(title).toBe(testRecord.title);

expect(visibility).toBeTruthy();

expect(group).toBe(undefined);
} catch (e) {
done(e);
}
done();
});
it('should get layer from record while a group is selected', (done) => {
const testRecord = {
name: 1,
title: "Outreach",
url: "base/web/client/test-resources/arcgis/arcgis-test-data.json"
};
const _selectedGroup = 'test_group';
try {
const layer = getLayerFromRecord( testRecord, { layerBaseConfig: { group: _selectedGroup } } );
const { type, url, name, title, visibility, group } = layer;

expect(type).toBeTruthy();
expect(type).toBe('arcgis');

expect(url).toBeTruthy();
expect(url).toBe(testRecord.url);

expect(name).toBeTruthy();
expect(name).toBe(`${testRecord.name}`);

expect(title).toBeTruthy();
expect(title).toBe(testRecord.title);

expect(visibility).toBeTruthy();

expect(group).toBe(_selectedGroup);
} catch (e) {
done(e);
}
Expand Down

0 comments on commit 909d495

Please sign in to comment.