-
Notifications
You must be signed in to change notification settings - Fork 416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata Explorer first implementation #585
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
0c27157
first metadata explorer implementation
offtherailz 75e2335
Fixes #552 Handle properly the new props (#563)
567e364
Fixes #550 Mouse position plugin improvements (#561)
c762f42
fix #565. Fixed react-color dependency to the working one (#566)
offtherailz 4745e02
Fixes #567: added copy to clipboard to mouseposition example (#568)
mbarto bbd33fa
Fixes #545 Disable locate button if permission denied (#569)
041f7a6
Fixes #570: cesium wms single tile layer not working when multiple ur…
mbarto dae781c
fix #572. Toolbar uses cfg from localconfig (#573)
offtherailz 2f377df
fix #574 (#575)
offtherailz 900ef2f
finalized csw
offtherailz 6388fde
Merge branch 'master' of https://github.com/geosolutions-it/MapStore2…
offtherailz c250215
Merge branch 'master' of https://github.com/geosolutions-it/MapStore2…
offtherailz 11eeb59
add configuration
offtherailz 66f30d4
merged to master
offtherailz 8ef4b79
generalization of catalog components
offtherailz 5cbfbe4
restored dependencies for ogc-schemas
offtherailz c3d7829
fixed test and copyright info
offtherailz 045ad61
improved performance for catalog selector
offtherailz bb0659e
clean up, dependency improvements and configurable items
offtherailz 821e41c
fixed typo
offtherailz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* Copyright 2016, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
const expect = require('expect'); | ||
const {getRecords} = require('../catalog'); | ||
describe('Test correctness of the catalog actions', () => { | ||
|
||
it('getRecords ISO Metadata Profile', (done) => { | ||
getRecords('base/web/client/test-resources/csw/getRecordsResponseISO.xml', 1, 1)((actionResult) => { | ||
try { | ||
let result = actionResult && actionResult.result; | ||
expect(result).toExist(); | ||
expect(result.records).toExist(); | ||
expect(result.records.length).toBe(1); | ||
done(); | ||
} catch(ex) { | ||
done(ex); | ||
} | ||
}); | ||
}); | ||
it('getRecords Dublin Core', (done) => { | ||
getRecords('base/web/client/test-resources/csw/getRecordsResponseDC.xml', 1, 2)((actionResult) => { | ||
try { | ||
let result = actionResult && actionResult.result; | ||
expect(result).toExist(); | ||
expect(result.records).toExist(); | ||
expect(result.records.length).toBe(2); | ||
let rec0 = result.records[0]; | ||
expect(rec0.dc).toExist(); | ||
expect(rec0.dc.URI).toExist(); | ||
expect(rec0.dc.URI[0]); | ||
let uri = rec0.dc.URI[0]; | ||
expect(uri.name).toExist(); | ||
expect(uri.value).toExist(); | ||
expect(uri.description).toExist(); | ||
done(); | ||
} catch(ex) { | ||
done(ex); | ||
} | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Copyright 2016, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
var API = require('../api/CSW'); | ||
|
||
const RECORD_LIST_LOADED = 'RECORD_LIST_LOADED'; | ||
const RECORD_LIST_LOAD_ERROR = 'RECORD_LIST_LOAD_ERROR'; | ||
|
||
function recordsLoaded(options, result) { | ||
return { | ||
type: RECORD_LIST_LOADED, | ||
searchOptions: options, | ||
result: result | ||
}; | ||
} | ||
|
||
function recordsLoadError(e) { | ||
return { | ||
type: RECORD_LIST_LOAD_ERROR, | ||
error: e | ||
}; | ||
} | ||
function getRecords(url, startPosition = 1, maxRecords, filter, options) { | ||
return (dispatch /* , getState */) => { | ||
// TODO auth (like) let opts = GeoStoreApi.getAuthOptionsFromState(getState(), {params: {start: 0, limit: 20}, baseURL: geoStoreUrl }); | ||
API.getRecords(url, startPosition, maxRecords, filter, options).then((result) => { | ||
dispatch(recordsLoaded({ | ||
url, | ||
startPosition, | ||
maxRecords, | ||
filter | ||
}, result)); | ||
}).catch((e) => { | ||
dispatch(recordsLoadError(e)); | ||
}); | ||
}; | ||
} | ||
function textSearch(url, startPosition, maxRecords, text, options) { | ||
return (dispatch /* , getState */) => { | ||
// TODO auth (like) let opts = GeoStoreApi.getAuthOptionsFromState(getState(), {params: {start: 0, limit: 20}, baseURL: geoStoreUrl }); | ||
API.textSearch(url, startPosition, maxRecords, text, options).then((result) => { | ||
dispatch(recordsLoaded({ | ||
url, | ||
startPosition, | ||
maxRecords, | ||
text | ||
}, result)); | ||
}).catch((e) => { | ||
dispatch(recordsLoadError(e)); | ||
}); | ||
}; | ||
} | ||
|
||
module.exports = {RECORD_LIST_LOADED, RECORD_LIST_LOAD_ERROR, getRecords, textSearch}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/** | ||
* Copyright 2016, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
const axios = require('../libs/ajax'); | ||
|
||
const {CSW, marshaller, unmarshaller} = require('../utils/ogc/CSW'); | ||
const {Filter} = require('../utils/ogc/Filter'); | ||
|
||
const _ = require('lodash'); | ||
|
||
|
||
/** | ||
* API for local config | ||
*/ | ||
var Api = { | ||
getRecords: function(url, startPosition, maxRecords, filter) { | ||
let body = marshaller.marshalString({ | ||
name: "csw:GetRecords", | ||
value: CSW.getRecords(startPosition, maxRecords, filter) | ||
}); | ||
return axios.post(url, body, { headers: { | ||
'Content-Type': 'application/xml' | ||
}}).then( | ||
(response) => { | ||
if (response ) { | ||
let json = unmarshaller.unmarshalString(response.data); | ||
if (json && json.name && json.name.localPart === "GetRecordsResponse" && json.value && json.value.searchResults) { | ||
let rawResult = json.value; | ||
let rawRecords = rawResult.searchResults.abstractRecord || rawResult.searchResults.any; | ||
let result = { | ||
numberOfRecordsMatched: rawResult.searchResults.numberOfRecordsMatched, | ||
numberOfRecordsReturned: rawResult.searchResults.numberOfRecordsReturned, | ||
nextRecord: rawResult.searchResults.nextRecord | ||
// searchStatus: rawResult.searchStatus | ||
}; | ||
let records = []; | ||
|
||
if (rawRecords) { | ||
for (let i = 0; i < rawRecords.length; i++) { | ||
let rawRec = rawRecords[i].value; | ||
let obj = { | ||
dateStamp: rawRec.dateStamp && rawRec.dateStamp.date, | ||
fileIdentifier: rawRec.fileIdentifier && rawRec.fileIdentifier.characterString && rawRec.fileIdentifier.characterString.value, | ||
identificationInfo: rawRec.abstractMDIdentification && rawRec.abstractMDIdentification.value | ||
}; | ||
if (rawRec.boundingBox) { | ||
let bbox; | ||
let crs; | ||
let el; | ||
if (Array.isArray(rawRec.boundingBox)) { | ||
el = _.head(rawRec.boundingBox); | ||
} else { | ||
el = rawRec.boundingBox; | ||
} | ||
if (el && el.value) { | ||
let lc = el.value.lowerCorner; | ||
let uc = el.value.upperCorner; | ||
bbox = [lc[1], lc[0], uc[1], uc[0]]; | ||
// TODO parse the extent's crs | ||
let crsCode = el.value.crs.split(":::")[1]; | ||
if (crsCode === "WGS 1984") { | ||
crs = "EPSG:4326"; | ||
} else if (crsCode) { | ||
// TODO check is valid EPSG code | ||
crs = "EPSG:" + crsCode; | ||
} else { | ||
crs = "EPSG:4326"; | ||
} | ||
} | ||
obj.boundingBox = { | ||
extent: bbox, | ||
crs: crs | ||
}; | ||
|
||
} | ||
let dcElement = rawRec.dcElement; | ||
if (dcElement) { | ||
let dc = { | ||
}; | ||
for (let j = 0; j < dcElement.length; j++) { | ||
let dcel = dcElement[j]; | ||
let elName = dcel.name.localPart; | ||
let finalEl = {}; | ||
/* Some services (e.g. GeoServer ) support http://schemas.opengis.net/csw/2.0.2/record.xsd only | ||
* Usually they publish the WMS URL at dct:"references" with scheme=OGC:WMS | ||
* So we place references as they are. | ||
*/ | ||
if (elName === "references" && dcel.value) { | ||
let urlString = dcel.value.content && dcel.value.content[0] || dcel.value.content || dcel.value; | ||
|
||
finalEl = { | ||
value: urlString, | ||
scheme: dcel.value.scheme | ||
}; | ||
} else { | ||
finalEl = dcel.value.content && dcel.value.content[0] || dcel.value.content || dcel.value; | ||
} | ||
|
||
if (dc[elName] && Array.isArray(dc[elName])) { | ||
dc[elName].push(finalEl); | ||
} else if (dc[elName]) { | ||
dc[elName] = [dc[elName], finalEl]; | ||
} else { | ||
dc[elName] = finalEl; | ||
} | ||
} | ||
obj.dc = dc; | ||
|
||
} | ||
records.push(obj); | ||
|
||
} | ||
} | ||
result.records = records; | ||
return result; | ||
} | ||
} | ||
return null; | ||
|
||
}); | ||
}, | ||
textSearch: function(url, startPosition, maxRecords, text) { | ||
// creates a request like this: | ||
// <ogc:PropertyName>apiso:AnyText</ogc:PropertyName><ogc:Literal>%a%</ogc:Literal></ogc:PropertyIsLike> | ||
let filter = null; | ||
if (text) { | ||
let ops = Filter.propertyIsLike("csw:AnyText", "%" + text + "%"); | ||
filter = Filter.filter(ops); | ||
} | ||
return Api.getRecords(url, startPosition, maxRecords, filter); | ||
} | ||
}; | ||
|
||
module.exports = Api; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/** | ||
* Copyright 2016, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
const React = require('react'); | ||
|
||
const {Grid, Row, Col} = require('react-bootstrap'); | ||
|
||
const RecordItem = require('./RecordItem'); | ||
|
||
|
||
const RecordGrid = React.createClass({ | ||
propTypes: { | ||
recordItem: React.PropTypes.element, | ||
catalogURL: React.PropTypes.string, | ||
onZoomToExtent: React.PropTypes.func, | ||
onLayerAdd: React.PropTypes.func, | ||
records: React.PropTypes.array, | ||
style: React.PropTypes.object | ||
}, | ||
getDefaultProps() { | ||
return { | ||
records: [], | ||
onLayerAdd: () => {} | ||
}; | ||
}, | ||
renderRecordItem(record) { | ||
let Item = this.props.recordItem || RecordItem; | ||
return ( | ||
<Col xs={12} sm={6} md={6} lg={6} key={record.identifier}> | ||
<Item | ||
onLayerAdd={this.props.onLayerAdd} | ||
onZoomToExtent={this.props.onZoomToExtent} | ||
catalogURL={this.props.catalogURL} | ||
record={record} | ||
style={{height: "215px", maxHeight: "215px"}}/> | ||
</Col> | ||
); | ||
}, | ||
render() { | ||
if (this.props.records) { | ||
let mapsList = this.props.records instanceof Array ? this.props.records : [this.props.records]; | ||
return ( | ||
<Grid className="record-grid" style={this.props.style}> | ||
<Row> | ||
{mapsList.map(this.renderRecordItem)} | ||
</Row> | ||
</Grid> | ||
); | ||
} | ||
|
||
return null; | ||
} | ||
}); | ||
|
||
module.exports = RecordGrid; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make this pluggable, overridable with a prop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can make it, but we need to include RecordGrid as a part of the recordgrid to make it really configurable from config.js files.