-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
78b0a41
commit dce2b1f
Showing
31 changed files
with
1,486 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
const SET_EDITOR_AVAILABLE = "DASHBOARD:SET_AVAILABLE"; | ||
const SET_EDITING = "DASHBOARD:SET_EDITING"; | ||
const SHOW_CONNECTIONS = "DASHBOARD:SHOW_CONNECTIONS"; | ||
module.exports = { | ||
SET_EDITING, | ||
setEditing: (editing) => ({type: SET_EDITING, editing }), | ||
SET_EDITOR_AVAILABLE, | ||
setEditorAvailable: available => ({type: SET_EDITOR_AVAILABLE, available}) | ||
setEditorAvailable: available => ({type: SET_EDITOR_AVAILABLE, available}), | ||
SHOW_CONNECTIONS, | ||
triggerShowConnections: show => ({ type: SHOW_CONNECTIONS, show}) | ||
}; |
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
18 changes: 18 additions & 0 deletions
18
web/client/components/widgets/enhancers/withGroupColor.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,18 @@ | ||
/* | ||
* 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 {withProps} = require('recompose'); | ||
const {get, head} = require('lodash'); | ||
const getGroupColor = groups => get(head(groups, ({ color }) => color), 'color'); | ||
/** | ||
* get the first color found in widget groups array. | ||
*/ | ||
module.exports = withProps(({ groups, showGroupColor, headerStyle = {borderTop: "3px solid rgba(0,0,0,0)", transition: "border-color .5s ease-out"} }) => ({ | ||
headerStyle: showGroupColor && groups && getGroupColor(groups) | ||
? { ...headerStyle, borderTop: `3px solid ${getGroupColor(groups)}` } | ||
: headerStyle | ||
})); |
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
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
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
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
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
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,31 @@ | ||
/* | ||
* 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 expect = require('expect'); | ||
const { setEditorAvailable, setEditing, triggerShowConnections } = require('../../actions/dashboard'); | ||
const { insertWidget, updateWidget, deleteWidget } = require('../../actions/widgets'); | ||
const dashboard = require('../dashboard'); | ||
describe('Test the dashboard reducer', () => { | ||
it('setEditorAvailable action', () => { | ||
const state = dashboard({}, setEditorAvailable( true )); | ||
expect(state.editor.available).toBe(true); | ||
}); | ||
it('setEditing', () => { | ||
const state = dashboard({}, setEditing(true)); | ||
expect(state.editing).toBe(true); | ||
}); | ||
it('disable editing on insert/update/delete', () => { | ||
expect(dashboard({ editing: true }, insertWidget({})).editing).toBeFalsy(); | ||
expect(dashboard({ editing: true }, updateWidget({})).editing).toBeFalsy(); | ||
expect(dashboard({ editing: true }, deleteWidget({})).editing).toBeFalsy(); | ||
}); | ||
it('triggerShowConnections', () => { | ||
const state = dashboard({}, triggerShowConnections(true)); | ||
expect(state.showConnections).toBe(true); | ||
}); | ||
|
||
}); |
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.