From e68c5575a5c0eacd2ceaaf2267da0a40c8c58fd6 Mon Sep 17 00:00:00 2001 From: Miriam Date: Fri, 1 Oct 2021 10:54:48 +0200 Subject: [PATCH] #35: create index, help and reducers files create index File for the visualization with all Components and Imports, create the empty Help File and define config props and data actions handler in reducers --- ui/src/visualizations/File-Evolution/help.js | 10 +++++++ ui/src/visualizations/File-Evolution/index.js | 17 ++++++++++++ .../File-Evolution/reducers/config.js | 27 +++++++++++++++++++ .../File-Evolution/reducers/data.js | 23 ++++++++++++++++ .../File-Evolution/reducers/index.js | 10 +++++++ 5 files changed, 87 insertions(+) create mode 100644 ui/src/visualizations/File-Evolution/help.js create mode 100644 ui/src/visualizations/File-Evolution/index.js create mode 100644 ui/src/visualizations/File-Evolution/reducers/config.js create mode 100644 ui/src/visualizations/File-Evolution/reducers/data.js create mode 100644 ui/src/visualizations/File-Evolution/reducers/index.js diff --git a/ui/src/visualizations/File-Evolution/help.js b/ui/src/visualizations/File-Evolution/help.js new file mode 100644 index 00000000..364520b8 --- /dev/null +++ b/ui/src/visualizations/File-Evolution/help.js @@ -0,0 +1,10 @@ +'use strict'; + +import cx from 'classnames'; +import styles from './styles.scss'; + +export default () => ( +
+

File Evolution Help

+
+); diff --git a/ui/src/visualizations/File-Evolution/index.js b/ui/src/visualizations/File-Evolution/index.js new file mode 100644 index 00000000..d324dc00 --- /dev/null +++ b/ui/src/visualizations/File-Evolution/index.js @@ -0,0 +1,17 @@ +'use strict'; + +import ChartComponent from './chart'; +import ConfigComponent from './config.js'; +import HelpComponent from './help.js'; +import saga from './sagas'; +import reducer from './reducers'; + +export default { + id: 'fileEvolution', + label: 'File Evolution', + saga, + reducer, + ChartComponent, + ConfigComponent, + HelpComponent +}; diff --git a/ui/src/visualizations/File-Evolution/reducers/config.js b/ui/src/visualizations/File-Evolution/reducers/config.js new file mode 100644 index 00000000..c0faae26 --- /dev/null +++ b/ui/src/visualizations/File-Evolution/reducers/config.js @@ -0,0 +1,27 @@ +'use strict'; + +import { handleActions } from 'redux-actions'; +import _ from 'lodash'; + +export default handleActions( + { + SET_COMMIT_BOX_WIDTH: (state, action) => _.assign({}, state, { commitBoxWidth: action.payload }), + SET_COMMIT_BOX_HEIGHT: (state, action) => _.assign({}, state, { commitBoxHeight: action.payload }), + SET_COMMIT_BOX_COLOR: (state, action) => _.assign({}, state, { commitBoxColor: action.payload }), + SET_SELECTED_AUTHORS: (state, action) => _.assign({}, state, { selectedAuthors: [...action.payload] }), + SET_SELECTED_BRANCHES: (state, action) => _.assign({}, state, { selectedBranches: [...action.payload] }), + SET_SHOW_COMMIT_DATE: (state, action) => _.assign({}, state, { showCommitDate: action.payload }), + SET_SHOW_COMMIT_MESSAGE: (state, action) => _.assign({}, state, { showCommitMessage: action.payload }), + SET_SHOW_COMMIT_AUTHOR: (state, action) => _.assign({}, state, { showCommitAuthor: action.payload }) + }, + { + commitBoxWidth: 100, + commitBoxHeight: 100, + commitBoxColor: 'author', + selectedAuthors: [], + selectedBranches: [], + showCommitDate: true, + showCommitMessage: 'header', + showCommitAuthor: false + } +); diff --git a/ui/src/visualizations/File-Evolution/reducers/data.js b/ui/src/visualizations/File-Evolution/reducers/data.js new file mode 100644 index 00000000..ea8662b0 --- /dev/null +++ b/ui/src/visualizations/File-Evolution/reducers/data.js @@ -0,0 +1,23 @@ +'use strict'; + +import { handleActions } from 'redux-actions'; +import _ from 'lodash'; + +export default handleActions( + { + REQUEST_FILE_EVOLUTION_DATA: state => _.assign({}, state, { isFetching: true }), + RECEIVE_FILE_EVOLUTION_DATA: (state, action) => { + console.log(action.payload); + return _.assign({}, state, { + data: action.payload, + isFetching: false, + receivedAt: action.meta.receivedAt + }); + } + }, + { + data: {}, + lastFetched: null, + isFetching: null + } +); diff --git a/ui/src/visualizations/File-Evolution/reducers/index.js b/ui/src/visualizations/File-Evolution/reducers/index.js new file mode 100644 index 00000000..ff9fb456 --- /dev/null +++ b/ui/src/visualizations/File-Evolution/reducers/index.js @@ -0,0 +1,10 @@ +'use strict'; + +import config from './config.js'; +import data from './data.js'; +import { combineReducers } from 'redux'; + +export default combineReducers({ + data, + config +});