-
Notifications
You must be signed in to change notification settings - Fork 410
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added details editor styles filters and attributes (#2867)
- Loading branch information
1 parent
af77da7
commit d5eb5a2
Showing
39 changed files
with
972 additions
and
165 deletions.
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
24 changes: 24 additions & 0 deletions
24
web/client/components/manager/rulesmanager/AttributeAccessSelect.jsx
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,24 @@ | ||
/** | ||
* Copyright 2018, 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 Select = require('react-select'); | ||
const defaultOptions = [ | ||
{value: 'NONE', label: "NONE"}, | ||
{value: 'READONLY', label: 'READ ONLY'}, | ||
{value: 'READWRITE', label: 'READ WRITE'} | ||
]; | ||
|
||
module.exports = ({options = defaultOptions, attribute, value, onChange = () => {}}) => ( | ||
<Select | ||
name={`sel-${attribute.name}`} | ||
clearable={false} | ||
searchable={false} | ||
onChange={({value: access}) => onChange({"name": attribute.name, access})} | ||
value={value} | ||
options={options}/> | ||
); |
49 changes: 49 additions & 0 deletions
49
web/client/components/manager/rulesmanager/AvailableStyles.jsx
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,49 @@ | ||
/** | ||
* Copyright 2018, 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 StylesList = require('./StylesList'); | ||
const Message = require("../../I18N/Message"); | ||
const Filter = require("../../misc/Filter"); | ||
const Portal = require("../../misc/Portal"); | ||
const {Col, Button, ButtonGroup} = require("react-bootstrap"); | ||
const ResizableModal = require("../../misc/ResizableModal"); | ||
const BorderLayout = require("../../layout/BorderLayout"); | ||
|
||
module.exports = ({styles = [], selectedStyles = [], onSelectionChange = () => {}, show = false, stylesFilter = '', filterPlaceholder = "Filter styles...", clearAll= () => {}, selectAll = () => {}, onFilter = () => {}, onClose = () => {}}) => { | ||
const filteredStyle = stylesFilter && stylesFilter.length > 0 && styles.filter(st => st.title.toLowerCase().match(stylesFilter && stylesFilter.toLowerCase())) || styles; | ||
return ( | ||
<Portal> | ||
<div className="rules-manager-modal"> | ||
<ResizableModal | ||
title={<Message msgId="rulesmanager.avstyle"/>} | ||
show={show} | ||
onClose={onClose} | ||
> | ||
<span className="ms-style-modal"> | ||
<BorderLayout | ||
header={<span> | ||
<Filter filterPlaceholder={filterPlaceholder} filterText={stylesFilter || ''} onFilter={onFilter}/> | ||
<Col className="text-center"> | ||
<ButtonGroup> | ||
<Button bsStyle="primary" bsSize="sm" onClick={clearAll}> | ||
<Message msgId="rulesmanager.clearbtn"/> | ||
</Button> | ||
<Button bsStyle="primary" bsSize="sm" onClick={selectAll}> | ||
<Message msgId="rulesmanager.selectbtn"/> | ||
</Button> | ||
</ButtonGroup> | ||
</Col> | ||
</span>}> | ||
<StylesList styles={filteredStyle} selectedStyles={selectedStyles} onSelectionChange={onSelectionChange}/> | ||
</BorderLayout> | ||
</span> | ||
</ResizableModal> | ||
</div> | ||
</Portal>); | ||
}; | ||
|
36 changes: 36 additions & 0 deletions
36
web/client/components/manager/rulesmanager/DefaultStyle.jsx
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,36 @@ | ||
/** | ||
* Copyright 2018, 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 StylesList = require('./StylesList'); | ||
const Message = require("../../I18N/Message"); | ||
const Filter = require("../../misc/Filter"); | ||
const Portal = require("../../misc/Portal"); | ||
const ResizableModal = require("../../misc/ResizableModal"); | ||
const BorderLayout = require("../../layout/BorderLayout"); | ||
|
||
module.exports = ({styles = [], selectedStyles = [], onSelectionChange = () => {}, show = false, stylesFilter = '', filterPlaceholder = "", onFilter = () => {}, onClose = () => {}}) => { | ||
const filteredStyle = stylesFilter && stylesFilter.length > 0 && styles.filter(st => st.title.toLowerCase().match(stylesFilter && stylesFilter.toLowerCase())) || styles; | ||
return ( | ||
<Portal> | ||
<div className="rules-manager-modal"> | ||
<ResizableModal | ||
title={<Message msgId="rulesmanager.defstyle"/>} | ||
show={show} | ||
onClose={onClose} | ||
> | ||
<span className="ms-style-modal"> | ||
<BorderLayout | ||
header={<span><Filter filterPlaceholder={filterPlaceholder} filterText={stylesFilter} onFilter={onFilter}/></span>}> | ||
<StylesList styles={filteredStyle} selectedStyles={selectedStyles} onSelectionChange={onSelectionChange}/> | ||
</BorderLayout> | ||
</span> | ||
</ResizableModal> | ||
</div> | ||
</Portal>); | ||
}; | ||
|
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,32 @@ | ||
/** | ||
* Copyright 2018, 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 {Glyphicon} = require('react-bootstrap'); | ||
const SideCard = require('../../misc/cardgrids/SideCard'); | ||
|
||
module.exports = ({styles = [], selectedStyles = [], onSelectionChange = () => {}, className = ""}) => { | ||
return (<span> | ||
{styles.map((r, idx) => { | ||
const isSelected = selectedStyles.filter(st => st === r.name).length > 0; | ||
return ( | ||
<div key={idx}> | ||
<SideCard | ||
preview={<Glyphicon glyph={r.preview || 'geoserver'} />} | ||
className={`ms-sm ${isSelected ? 'ms-selected' : ''} ${className}`} | ||
title={r.title} | ||
description={''} | ||
caption={r._abstract || ''} | ||
onClick={() => { | ||
const newSelection = isSelected && selectedStyles.filter( s => s !== r.name) || selectedStyles.concat(r.name); | ||
onSelectionChange(newSelection); | ||
}}/> | ||
</div> | ||
); | ||
})} | ||
</span>); | ||
}; |
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
24 changes: 24 additions & 0 deletions
24
web/client/components/manager/rulesmanager/enhancers/filterstyles.js
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,24 @@ | ||
/** | ||
* Copyright 2018, 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 {compose, withStateHandlers, defaultProps} = require("recompose"); | ||
const withLocal = require("../../../misc/enhancers/localizedProps"); | ||
|
||
module.exports = compose( | ||
defaultProps({ | ||
filterPlaceholder: "rulesmanager.placeholders.filter" | ||
}), | ||
withStateHandlers(({} | ||
) => ({}), | ||
{ | ||
onFilter: () => (stylesFilter) => ({ | ||
stylesFilter | ||
}) | ||
|
||
}), | ||
withLocal("filterPlaceholder") | ||
); |
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
Oops, something went wrong.