Skip to content

Commit 295ddcb

Browse files
authored
Merge branch 'master' into spring7
2 parents d914048 + c7822f6 commit 295ddcb

13 files changed

Lines changed: 254 additions & 41 deletions

File tree

.github/workflows/CI.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,12 @@ jobs:
6868
run: npm test -- --reporters mocha,coverage,coveralls
6969

7070
- name: Send coverage to Coveralls (parallel)
71-
uses: coverallsapp/github-action@master
71+
uses: coverallsapp/github-action@v2
7272
with:
73-
github-token: ${{ secrets.GITHUB_TOKEN }}
74-
parallel: true
75-
flag-name: run-${{ join(matrix.*, '-') }}
73+
github-token: ${{ secrets.GITHUB_TOKEN }}
74+
parallel: true
75+
flag-name: run-${{ join(matrix.*, '-') }}
76+
continue-on-error: true
7677

7778
test-back-end:
7879
runs-on: ubuntu-latest

web/client/components/catalog/__tests__/Catalog-test.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ describe('Test Catalog panel', () => {
5555
maxRecords: 12,
5656
text: '',
5757
options: {
58-
filters: undefined,
59-
sort: undefined,
58+
filters: {},
59+
sort: '-date',
6060
service: SERVICE
6161
}
6262
});
@@ -202,8 +202,8 @@ describe('Test Catalog panel', () => {
202202
maxRecords: 12,
203203
text: '',
204204
options: {
205-
filters: undefined,
206-
sort: undefined,
205+
filters: {},
206+
sort: '-date',
207207
service: SERVICE
208208
}
209209
});

web/client/components/catalog/datasets/Catalog.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ const Catalog = ({
150150
useEffect(() => {
151151
clearSelection?.();
152152
if (shouldAutoload(selectedService, services)) {
153-
search({ searchText });
153+
search({ searchText, filters, sort });
154154
}
155155
setShowFilters(false);
156156
}, [services, mode]);

web/client/components/catalog/datasets/Catalog.less

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@
9696

9797
.ms-catalog-header {
9898
gap: 2rem;
99+
padding-left: 1rem;
100+
padding-right: 1rem;
99101
border-bottom: 1px solid var(--ms-main-border-color);
100102
}
101103

@@ -141,6 +143,12 @@
141143
.ms-filter-accordion + .ms-filter-accordion {
142144
margin-top: 0.75rem;
143145
}
146+
147+
.ms-tabs {
148+
ul {
149+
margin-bottom: 1rem;
150+
}
151+
}
144152
}
145153

146154
.ms-catalog-service-editor-footer {

web/client/components/catalog/resources/FilterAccordion.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ const AccordionTitle = ({
2929
}) => {
3030

3131
return (
32-
<FlexBox gap="sm" onClick={onClick}>
32+
<FlexBox gap="sm" centerChildrenVertically onClick={onClick}>
33+
{loading
34+
? <Spinner/>
35+
: <Glyphicon glyph={`${expanded ? "bottom" : "next"}`}/>
36+
}
3337
<FlexBox.Fill>
3438
<Text strong>
3539
{children}
3640
<Button onClick={onClick} style={{ display: 'block', width: 0, height: 0, overflow: 'hidden', opacity: 0, padding: 0, margin: 0 }}/>
3741
</Text>
3842
</FlexBox.Fill>
39-
{loading
40-
? <Spinner/>
41-
: <Glyphicon glyph={`${expanded ? "bottom" : "back"}`}/>
42-
}
4343
</FlexBox>
4444
);
4545
};

web/client/epics/__tests__/catalog-test.js

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,9 @@ describe('catalog Epics', () => {
172172
type: "csw",
173173
url: "url",
174174
filter: "test"
175-
}
175+
},
176+
filters: {'filter{category.identifier.in}': ['environment']},
177+
sort: '-date'
176178
});
177179
done();
178180
}, {
@@ -186,7 +188,11 @@ describe('catalog Epics', () => {
186188
filter: "test"
187189
}
188190
},
189-
pageSize: 2
191+
pageSize: 2,
192+
searchOptions: {
193+
filters: {'filter{category.identifier.in}': ['environment']},
194+
sort: '-date'
195+
}
190196
},
191197
layers: {
192198
selected: ["TEST"],
@@ -245,16 +251,15 @@ describe('catalog Epics', () => {
245251
}, { controls: { metadataexplorer: { enabled: true } }});
246252
});
247253

248-
it('catalogCloseEpic should reset metadataexplorer panel to true', (done) => {
254+
it('catalogCloseEpic should preserve metadataexplorer panel', (done) => {
249255
const NUM_ACTIONS = 3;
250256
testEpic(catalogCloseEpic, NUM_ACTIONS, catalogClose(), (actions) => {
251257
expect(actions.length).toBe(NUM_ACTIONS);
252258
expect(actions[0].type).toBe(SET_CONTROL_PROPERTIES);
253259
expect(actions[0].control).toBe('metadataexplorer');
254260
expect(actions[0].properties).toEqual({
255261
enabled: false,
256-
group: null,
257-
panel: true
262+
group: null
258263
});
259264
done();
260265
}, {
@@ -308,6 +313,23 @@ describe('catalog Epics', () => {
308313
done();
309314
}, { });
310315
});
316+
it('recordSearchEpic preserves filters and sort in search options', (done) => {
317+
const NUM_ACTIONS = 2;
318+
const filters = {'filter{category.identifier.in}': ['environment']};
319+
testEpic(addTimeoutEpic(recordSearchEpic), NUM_ACTIONS, textSearch({
320+
format: "csw",
321+
url: "base/web/client/test-resources/csw/getRecordsResponseDC.xml",
322+
startPosition: 1,
323+
maxRecords: 1,
324+
text: "a",
325+
options: {filters, sort: '-date'}
326+
}), (actions) => {
327+
const recordsLoadedAction = actions.find(({type}) => type === RECORD_LIST_LOADED);
328+
expect(recordsLoadedAction.searchOptions.filters).toEqual(filters);
329+
expect(recordsLoadedAction.searchOptions.sort).toBe('-date');
330+
done();
331+
}, { });
332+
});
311333
it('recordSearchEpic with new service', (done) => {
312334
const NUM_ACTIONS = 7;
313335
const service = {type: "csw", url: "some_url"};

web/client/epics/__tests__/identify-test.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ import { configureMap } from '../../actions/config';
7474
import { changeVisualizationMode } from './../../actions/maptype';
7575
import { FORCE_UPDATE_MAP_LAYOUT } from '../../actions/maplayout';
7676
import { VisualizationModes } from '../../utils/MapTypeUtils';
77+
import ProjectionRegistry from '../../utils/ProjectionRegistry';
7778

7879
const TEST_MAP_STATE = {
7980
present: {
@@ -96,6 +97,13 @@ const TEST_MAP_STATE = {
9697
}
9798
};
9899

100+
const EPSG_32636_DEF = {
101+
code: 'EPSG:32636',
102+
def: '+proj=utm +zone=36 +datum=WGS84 +units=m +no_defs +type=crs',
103+
extent: [166021.44, 0.0, 833978.56, 9329005.18],
104+
worldExtent: [30.0, 0.0, 36.0, 84.0]
105+
};
106+
99107
describe('identify Epics', () => {
100108
it('getFeatureInfoOnFeatureInfoClick, no queriable layers', (done) => {
101109
const state = {
@@ -972,6 +980,63 @@ describe('identify Epics', () => {
972980
testEpic(zoomToVisibleAreaEpic, 2, sentActions, expectedAction, state);
973981
});
974982

983+
it('test center to visible area outside projection extent', (done) => {
984+
// remove previous hook
985+
registerHook('RESOLUTION_HOOK', undefined);
986+
ProjectionRegistry.register(EPSG_32636_DEF);
987+
988+
const state = {
989+
mapInfo: {
990+
centerToMarker: true
991+
},
992+
map: {
993+
present: {
994+
...TEST_MAP_STATE.present,
995+
projection: 'EPSG:32636'
996+
}
997+
},
998+
maplayout: {
999+
boundingMapRect: {
1000+
left: 500,
1001+
bottom: 250
1002+
}
1003+
},
1004+
projections: {
1005+
staticDefs: [EPSG_32636_DEF]
1006+
}
1007+
};
1008+
1009+
const sentActions = [featureInfoClick({ latlng: { lat: 43.7711, lng: 11.2486 } }), loadFeatureInfo()];
1010+
1011+
const expectedAction = actions => {
1012+
try {
1013+
expect(actions.length).toBe(2);
1014+
actions.map((action) => {
1015+
switch (action.type) {
1016+
case ZOOM_TO_POINT:
1017+
expect(action.zoom).toBe(4);
1018+
expect(Number.isFinite(action.pos.x)).toBe(true);
1019+
expect(Number.isFinite(action.pos.y)).toBe(true);
1020+
expect(action.crs).toBe('EPSG:4326');
1021+
break;
1022+
case UPDATE_CENTER_TO_MARKER:
1023+
expect(action.status).toBe('enabled');
1024+
break;
1025+
default:
1026+
expect(true).toBe(false);
1027+
}
1028+
});
1029+
ProjectionRegistry.unRegister(EPSG_32636_DEF.code);
1030+
done();
1031+
} catch (e) {
1032+
ProjectionRegistry.unRegister(EPSG_32636_DEF.code);
1033+
done(e);
1034+
}
1035+
};
1036+
1037+
testEpic(zoomToVisibleAreaEpic, 2, sentActions, expectedAction, state);
1038+
});
1039+
9751040
it('test no center to visible area', (done) => {
9761041

9771042
// remove previous hook

web/client/epics/__tests__/maplayout-test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,10 @@ describe('map layout epics', () => {
215215
const state = { controls: { metadataexplorer: { enabled: true, group: "parent" } } };
216216
testEpic(updateMapLayoutEpic, 1, setControlProperties("metadataexplorer", "enabled", true, "group", "parent"), epicResult(done), state);
217217
});
218+
it('metadataexplorer in dialog mode does not reserve right panel space', done => {
219+
const state = { controls: { metadataexplorer: { enabled: true, panel: false } } };
220+
testEpic(updateMapLayoutEpic, 1, setControlProperty("metadataexplorer", "panel", false), epicResult(done, 0), state);
221+
});
218222
it('userExtensions', (done) => {
219223
const state = { controls: { userExtensions: { enabled: true, group: "parent" } } };
220224
testEpic(updateMapLayoutEpic, 1, setControlProperties("userExtensions", "enabled", true, "group", "parent"), epicResult(done), state);

web/client/epics/catalog.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,9 @@ export default (API) => ({
154154
url,
155155
startPosition,
156156
maxRecords,
157-
text
157+
text,
158+
filters: options?.filters,
159+
sort: options?.sort
158160
}, result)]);
159161
})
160162
.startWith(isNewService ? savingService(true) : setLoading(true))
@@ -631,7 +633,7 @@ export default (API) => ({
631633
const metadataSource = metadataSourceSelector(state);
632634
const stashedService = stashedServiceSelector(state);
633635
return Rx.Observable.of(...([
634-
setControlProperties('metadataexplorer', "enabled", false, "group", null, "panel", true),
636+
setControlProperties('metadataexplorer', "enabled", false, "group", null),
635637
changeCatalogMode("view"),
636638
resetCatalog()
637639
].concat(metadataSource === 'backgroundSelector' ?

web/client/epics/identify.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ import {
4646
import { centerToMarkerSelector, getSelectedLayers, layersSelector, queryableLayersSelector, queryableSelectedLayersSelector, rawGroupsSelector, selectedNodesSelector } from '../selectors/layers';
4747
import { modeSelector, getAttributeFilters, isFeatureGridOpen } from '../selectors/featuregrid';
4848
import { spatialFieldSelector } from '../selectors/queryform';
49-
import { mapSelector, projectionDefsSelector, projectionSelector, isMouseMoveIdentifyActiveSelector } from '../selectors/map';
49+
import { mapSelector, projectionSelector, isMouseMoveIdentifyActiveSelector } from '../selectors/map';
5050
import { boundingMapRectSelector } from '../selectors/maplayout';
51-
import { centerToVisibleArea, isInsideVisibleArea, isPointInsideExtent, reprojectBbox} from '../utils/CoordinatesUtils';
51+
import { centerToVisibleArea, isInsideVisibleArea } from '../utils/CoordinatesUtils';
5252
import { floatingIdentifyDelaySelector } from '../selectors/localConfig';
5353
import { createControlEnabledSelector, measureSelector } from '../selectors/controls';
5454
import { localizedLayerStylesEnvSelector } from '../selectors/localizedLayerStyles';
@@ -272,11 +272,6 @@ export const zoomToVisibleAreaEpic = (action$, store) =>
272272
return Rx.Observable.from([updateCenterToMarker('disabled'), hideMapinfoMarker()]);
273273
}
274274
const map = mapSelector(state);
275-
const mapProjection = projectionSelector(state);
276-
const projectionDefs = projectionDefsSelector(state);
277-
const currentprojectionDefs = find(projectionDefs, {'code': mapProjection});
278-
const projectionExtent = currentprojectionDefs && currentprojectionDefs.extent;
279-
const reprojectExtent = projectionExtent && reprojectBbox(projectionExtent, mapProjection, "EPSG:4326");
280275
const boundingMapRect = boundingMapRectSelector(state);
281276
const coords = action.point && action.point && action.point.latlng;
282277
const resolution = getCurrentResolution(Math.round(map.zoom), 0, 21, 96);
@@ -300,9 +295,6 @@ export const zoomToVisibleAreaEpic = (action$, store) =>
300295
if (!map || !layoutBounds || !coords || action.point.cartographic || isFeatInsideVisibleArea || isMouseMoveIdentifyActiveSelector(state) || skipZooming) {
301296
return Rx.Observable.of(updateCenterToMarker('disabled'));
302297
}
303-
if (reprojectExtent && !isPointInsideExtent(coords, reprojectExtent)) {
304-
return Rx.Observable.empty();
305-
}
306298
const center = centerToVisibleArea(coords, map, layoutBounds, resolution);
307299
if (featureBbox && isQueryJustOneLayer) {
308300
return Rx.Observable.of(updateCenterToMarker('enabled'), zoomToExtent(featureBbox, center.crs));

0 commit comments

Comments
 (0)