Skip to content
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

Direct access to the grid from the toc #2085

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions web/client/actions/__tests__/featuregrid-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ const {
deleteGeometryFeature, DELETE_GEOMETRY_FEATURE,
clearChangeConfirmed, CLEAR_CHANGES_CONFIRMED,
deleteFeaturesConfirm, DELETE_SELECTED_FEATURES_CONFIRM,
openFeatureGrid, OPEN_FEATURE_GRID,
closeFeatureGrid, CLOSE_FEATURE_GRID,
closeFeatureGridConfirm, CLOSE_FEATURE_GRID_CONFIRM,
closeFeatureGridConfirmed, FEATURE_GRID_CLOSE_CONFIRMED
} = require('../featuregrid');

Expand Down Expand Up @@ -175,6 +178,21 @@ describe('Test correctness of featurgrid actions', () => {
expect(retval).toExist();
expect(retval.type).toBe(DELETE_SELECTED_FEATURES_CONFIRM);
});
it('Test openFeatureGrid', () => {
const retval = openFeatureGrid();
expect(retval).toExist();
expect(retval.type).toBe(OPEN_FEATURE_GRID);
});
it('Test closeFeatureGrid', () => {
const retval = closeFeatureGrid();
expect(retval).toExist();
expect(retval.type).toBe(CLOSE_FEATURE_GRID);
});
it('Test closeFeatureGridConfirm', () => {
const retval = closeFeatureGridConfirm();
expect(retval).toExist();
expect(retval.type).toBe(CLOSE_FEATURE_GRID_CONFIRM);
});
it('Test saveError', () => {
const retval = saveError();
expect(retval).toExist();
Expand Down
10 changes: 9 additions & 1 deletion web/client/actions/__tests__/layers-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var {
REFRESH_LAYERS,
LAYERS_REFRESHED,
LAYERS_REFRESH_ERROR,
BROWSE_DATA,
changeLayerProperties,
toggleNode,
sortNode,
Expand All @@ -39,7 +40,8 @@ var {
updateSettings,
refreshLayers,
layersRefreshed,
layersRefreshError
layersRefreshError,
browseData
} = require('../layers');
var {getLayerCapabilities} = require('../layerCapabilities');

Expand Down Expand Up @@ -223,4 +225,10 @@ describe('Test correctness of the layers actions', () => {
}
});
});
it('browseData', () => {
const layer = {id: "TEST", name: "test", url: "test"};
const action = browseData(layer);
expect(action.type).toBe(BROWSE_DATA);
expect(action.layer).toBe(layer);
});
});
8 changes: 1 addition & 7 deletions web/client/actions/__tests__/wfsquery-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ var {
QUERY_CREATE,
QUERY,
RESET_QUERY,
FEATURE_CLOSE,
layerSelectedForSearch,
featureTypeSelected,
featureTypeError,
Expand All @@ -30,8 +29,7 @@ var {
queryError,
createQuery,
query,
resetQuery,
featureClose
resetQuery
} = require('../wfsquery');

describe('wfsquery actions', () => {
Expand Down Expand Up @@ -97,8 +95,4 @@ describe('wfsquery actions', () => {
let {type} = resetQuery();
expect(type).toBe(RESET_QUERY);
});
it('featureClose', () => {
let {type} = featureClose();
expect(type).toBe(FEATURE_CLOSE);
});
});
27 changes: 24 additions & 3 deletions web/client/actions/featuregrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ const GEOMETRY_CHANGED = 'FEATUREGRID:GEOMETRY_CHANGED';
const DOCK_SIZE_FEATURES = 'DOCK_SIZE_FEATURES';
const TOGGLE_TOOL = 'FEATUREGRID:TOGGLE_TOOL';
const CUSTOMIZE_ATTRIBUTE = 'FEATUREGRID:CUSTOMIZE_ATTRIBUTE';
const CLOSE_GRID = 'FEATUREGRID:CLOSE_GRID';
const CLOSE_FEATURE_GRID_CONFIRM = 'ASK_CLOSE_FEATURE_GRID_CONFIRM';
const OPEN_FEATURE_GRID = 'FEATUREGRID:OPEN_GRID';
const CLOSE_FEATURE_GRID = 'FEATUREGRID:CLOSE_GRID';
const CLEAR_CHANGES_CONFIRMED = 'FEATUREGRID:CLEAR_CHANGES_CONFIRMED';
const FEATURE_GRID_CLOSE_CONFIRMED = 'FEATUREGRID:FEATURE_GRID_CLOSE_CONFIRMED';
const SET_PERMISSION = 'FEATUREGRID:SET_PERMISSION';
const DISABLE_TOOLBAR = 'FEATUREGRID:DISABLE_TOOLBAR';
const OPEN_ADVANCED_SEARCH = 'FEATUREGRID:ADVANCED_SEARCH';
const MODES = {
EDIT: "EDIT",
VIEW: "VIEW"
Expand Down Expand Up @@ -220,9 +223,19 @@ function saveError() {
type: SAVE_ERROR
};
}
function closeFeatureGridConfirm() {
return {
type: CLOSE_FEATURE_GRID_CONFIRM
};
}
function closeFeatureGrid() {
return {
type: CLOSE_GRID
type: CLOSE_FEATURE_GRID
};
}
function openFeatureGrid() {
return {
type: OPEN_FEATURE_GRID
};
}

Expand All @@ -238,6 +251,11 @@ function setPermission(permission) {
permission
};
}
function openAdvancedSearch() {
return {
type: OPEN_ADVANCED_SEARCH
};
}

module.exports = {
SELECT_FEATURES,
Expand Down Expand Up @@ -270,9 +288,12 @@ module.exports = {
DELETE_GEOMETRY, deleteGeometry,
DELETE_GEOMETRY_FEATURE, deleteGeometryFeature,
CLEAR_CHANGES_CONFIRMED, clearChangeConfirmed,
CLOSE_GRID, closeFeatureGrid,
CLOSE_FEATURE_GRID, closeFeatureGrid,
OPEN_FEATURE_GRID, openFeatureGrid,
CLOSE_FEATURE_GRID_CONFIRM, closeFeatureGridConfirm,
FEATURE_GRID_CLOSE_CONFIRMED, closeFeatureGridConfirmed,
DISABLE_TOOLBAR, disableToolbar,
OPEN_ADVANCED_SEARCH, openAdvancedSearch,
setLayer,
selectFeatures,
deselectFeatures,
Expand Down
11 changes: 9 additions & 2 deletions web/client/actions/layers.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const UPDATE_SETTINGS = 'UPDATE_SETTINGS';
const REFRESH_LAYERS = 'REFRESH_LAYERS';
const LAYERS_REFRESHED = 'LAYERS_REFRESHED';
const LAYERS_REFRESH_ERROR = 'LAYERS_REFRESH_ERROR';
const BROWSE_DATA = 'LAYERS:BROWSE_DATA';

function showSettings(node, nodeType, options) {
return {
Expand Down Expand Up @@ -175,11 +176,17 @@ function layersRefreshError(layers, error) {
error
};
}
function browseData(layer) {
return {
type: BROWSE_DATA,
layer
};
}

module.exports = {changeLayerProperties, changeGroupProperties, toggleNode, sortNode, removeNode, contextNode,
updateNode, layerLoading, layerLoad, layerError, addLayer, removeLayer, showSettings, hideSettings, updateSettings, refreshLayers,
layersRefreshed, layersRefreshError, refreshLayerVersion,
layersRefreshed, layersRefreshError, refreshLayerVersion, browseData,
CHANGE_LAYER_PROPERTIES, CHANGE_GROUP_PROPERTIES, TOGGLE_NODE, SORT_NODE,
REMOVE_NODE, UPDATE_NODE, LAYER_LOADING, LAYER_LOAD, LAYER_ERROR, ADD_LAYER, REMOVE_LAYER,
SHOW_SETTINGS, HIDE_SETTINGS, UPDATE_SETTINGS, CONTEXT_NODE, REFRESH_LAYERS, LAYERS_REFRESHED, LAYERS_REFRESH_ERROR
SHOW_SETTINGS, HIDE_SETTINGS, UPDATE_SETTINGS, CONTEXT_NODE, REFRESH_LAYERS, LAYERS_REFRESHED, LAYERS_REFRESH_ERROR, BROWSE_DATA
};
39 changes: 1 addition & 38 deletions web/client/actions/wfsquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,13 @@ const FEATURE_LOADED = 'FEATURE_LOADED';
const FEATURE_LOADING = 'FEATURE_LOADING';
const FEATURE_TYPE_ERROR = 'FEATURE_TYPE_ERROR';
const FEATURE_ERROR = 'FEATURE_ERROR';
const FEATURE_CLOSE = 'FEATURE_CLOSE';
const QUERY_CREATE = 'QUERY_CREATE';
const QUERY_RESULT = 'QUERY_RESULT';
const QUERY_ERROR = 'QUERY_ERROR';
const RESET_QUERY = 'RESET_QUERY';
const QUERY = 'QUERY';

const axios = require('../libs/ajax');
const {toggleControl, setControlProperty} = require('./controls');
const {changeDrawingStatus} = require('./draw');
const {reset} = require('./queryform');

function layerSelectedForSearch(id) {
return {
Expand Down Expand Up @@ -132,51 +128,18 @@ function resetQuery() {
};
}


function toggleQueryPanel(url, name, id) {
return (dispatch, getState) => {
if (getState().query.typeName !== name) {
dispatch(reset());
}
dispatch(changeDrawingStatus('clean', null, "queryform", []));
dispatch(featureTypeSelected(url, name));
dispatch(toggleControl('queryPanel', null));
dispatch(layerSelectedForSearch(id));
dispatch(setControlProperty('drawer', 'width', getState().controls.queryPanel.enabled ? 700 : 300));
};
}
function featureClose() {
return {
type: FEATURE_CLOSE
};
}

function closeResponse() {
return (dispatch, getState) => {
dispatch(featureClose());
let state = getState();
if (state.controls && state.controls.queryPanel && state.controls.drawer && !state.controls.drawer.enabled) {
dispatch(setControlProperty('drawer', 'enabled', true));
dispatch(setControlProperty('drawer', 'disabled', false));
}
};
}

module.exports = {
LAYER_SELECTED_FOR_SEARCH, layerSelectedForSearch,
FEATURE_TYPE_SELECTED, featureTypeSelected,
FEATURE_TYPE_LOADED, featureTypeLoaded,
FEATURE_TYPE_ERROR, featureTypeError,
FEATURE_ERROR, featureError,
FEATURE_CLOSE, featureClose,
QUERY_CREATE, createQuery,
QUERY_RESULT, querySearchResponse,
QUERY_ERROR, queryError,
RESET_QUERY, resetQuery,
QUERY, query,
FEATURE_LOADING, featureLoading,
FEATURE_LOADED, featureLoaded,
loadFeature,
toggleQueryPanel,
closeResponse
loadFeature
};
14 changes: 9 additions & 5 deletions web/client/components/TOC/DefaultLayer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class DefaultLayer extends React.Component {
retrieveLayerData: PropTypes.func,
onToggle: PropTypes.func,
onContextMenu: PropTypes.func,
onToggleQuerypanel: PropTypes.func,
onBrowseData: PropTypes.func,
onZoom: PropTypes.func,
onSettings: PropTypes.func,
onRefresh: PropTypes.func,
Expand Down Expand Up @@ -71,7 +71,7 @@ class DefaultLayer extends React.Component {
onSettings: () => {},
onRefresh: () => {},
retrieveLayerData: () => {},
onToggleQuerypanel: () => {},
onBrowseData: () => {},
activateRemoveLayer: false,
activateLegendTool: false,
activateSettingsTool: false,
Expand Down Expand Up @@ -150,13 +150,17 @@ class DefaultLayer extends React.Component {
if (this.props.activateQueryTool && this.props.node.search) {
tools.push(
<LayersTool key="toolquery"
tooltip="toc.searchFeatures"
tooltip="toc.browseData"
className="toc-queryTool"
node={this.props.node}
ref="target"
style={{"float": "right", cursor: "pointer"}}
glyph="search"
onClick={(node) => this.props.onToggleQuerypanel(node.search.url || node.url, node.name, node.id)}/>
glyph="features-grid"
onClick={(node) => this.props.onBrowseData({
url: node.search.url || node.url,
name: node.name,
id: node.id
})}/>
);
}
return (<div position="collapsible" className="collapsible-toc">
Expand Down
7 changes: 7 additions & 0 deletions web/client/components/data/featuregrid/toolbars/Toolbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ module.exports = ({events = {}, mode = "VIEW", selectedCount, hasChanges, hasGeo
visible={mode === "VIEW" && isEditingAllowed}
onClick={events.switchEditMode}
glyph="pencil"/>
<TButton
id="search"
tooltip={<Message msgId="featuregrid.toolbar.advancedFilter"/>}
disabled={disableToolbar}
visible={mode === "VIEW"}
onClick={events.showQueryPanel}
glyph="filter"/>
<TButton
id="back-view"
tooltip={<Message msgId="featuregrid.toolbar.quitEditMode"/>}
Expand Down
Loading