From d71af1edb54f99d1fc843303ba532b8a9a08bae1 Mon Sep 17 00:00:00 2001 From: Leszek Pietrzak Date: Thu, 6 May 2021 18:32:39 +0100 Subject: [PATCH 1/3] split huge repots file into smaller files --- jsapp/js/app.es6 | 2 +- jsapp/js/components/reports.es6 | 1174 ----------------- .../components/reports/chartColorsPicker.es6 | 62 + .../js/components/reports/chartTypePicker.es6 | 57 + .../components/reports/customReportForm.es6 | 95 ++ .../reports/questionGraphSettings.es6 | 136 ++ .../js/components/reports/reportContents.es6 | 151 +++ .../reports/reportStyleSettings.es6 | 182 +++ jsapp/js/components/reports/reportTable.es6 | 108 ++ .../{ => reports}/reportViewItem.es6 | 192 +-- jsapp/js/components/reports/reports.es6 | 557 ++++++++ .../components/reports/reportsConstants.es6 | 100 ++ jsapp/js/constants.es6 | 10 - 13 files changed, 1496 insertions(+), 1330 deletions(-) delete mode 100644 jsapp/js/components/reports.es6 create mode 100644 jsapp/js/components/reports/chartColorsPicker.es6 create mode 100644 jsapp/js/components/reports/chartTypePicker.es6 create mode 100644 jsapp/js/components/reports/customReportForm.es6 create mode 100644 jsapp/js/components/reports/questionGraphSettings.es6 create mode 100644 jsapp/js/components/reports/reportContents.es6 create mode 100644 jsapp/js/components/reports/reportStyleSettings.es6 create mode 100644 jsapp/js/components/reports/reportTable.es6 rename jsapp/js/components/{ => reports}/reportViewItem.es6 (65%) create mode 100644 jsapp/js/components/reports/reports.es6 create mode 100644 jsapp/js/components/reports/reportsConstants.es6 diff --git a/jsapp/js/app.es6 b/jsapp/js/app.es6 index f89247bb0b..7be85ffec9 100644 --- a/jsapp/js/app.es6 +++ b/jsapp/js/app.es6 @@ -35,7 +35,7 @@ import { import MyLibraryRoute from 'js/components/library/myLibraryRoute'; import PublicCollectionsRoute from 'js/components/library/publicCollectionsRoute'; import AssetRoute from 'js/components/library/assetRoute'; -import Reports from './components/reports'; +import Reports from './components/reports/reports'; import FormLanding from './components/formLanding'; import FormSummary from './components/formSummary'; import FormSubScreens from './components/formSubScreens'; diff --git a/jsapp/js/components/reports.es6 b/jsapp/js/components/reports.es6 deleted file mode 100644 index d5742162b6..0000000000 --- a/jsapp/js/components/reports.es6 +++ /dev/null @@ -1,1174 +0,0 @@ -import React from 'react'; -import reactMixin from 'react-mixin'; -import autoBind from 'react-autobind'; -import Reflux from 'reflux'; -import _ from 'underscore'; -import {dataInterface} from '../dataInterface'; -import Checkbox from 'js/components/common/checkbox'; -import Radio from 'js/components/common/radio'; -import {actions} from '../actions'; -import {bem} from '../bem'; -import {stores} from '../stores'; -import ui from '../ui'; -import mixins from '../mixins'; -import DocumentTitle from 'react-document-title'; -import { txtid } from '../../xlform/src/model.utils'; -import alertify from 'alertifyjs'; - -import ReportViewItem from './reportViewItem'; - -import { - assign, - launchPrinting -} from 'utils'; -import {REPORT_STYLES} from 'js/constants'; - -let reportStyles = [ - REPORT_STYLES.vertical, - REPORT_STYLES.donut, - REPORT_STYLES.area, - REPORT_STYLES.horizontal, - REPORT_STYLES.pie, - REPORT_STYLES.line, -]; - -class ChartTypePicker extends React.Component { - constructor(props) { - super(props); - autoBind(this); - } - defaultReportStyleChange (e) { - this.props.onChange({ - default: true, - }, { - report_type: e.currentTarget.value || 'bar' - }); - } - render () { - var radioButtons = reportStyles.map(function(style, i){ - return ( - - - - - ); - }, this); - - return ( - - {radioButtons} - - ); - } -} - -let reportColorSets = [ - { - label: 'set1', - colors: [ - 'rgba(52, 106, 200, 0.8)', - 'rgba(252, 74, 124, 0.8)', - 'rgba(250, 213, 99, 0.8)', - 'rgba(113, 230, 33, 0.8)', - 'rgba(78, 203, 255, 0.8)', - 'rgba(253, 190, 76, 0.8)', - 'rgba(77, 124, 244, 0.8)', - 'rgba(33, 231, 184, 0.8)' - ] - }, - { - label: 'set2', - colors: [ - 'rgba(40, 106, 163, 0.8)', - 'rgba(69, 137, 197, 0.8)', - 'rgba(0, 123, 234, 0.8)', - 'rgba(0, 134, 255, 0.8)', - 'rgba(50, 159, 255, 0.8)', - 'rgba(100, 182, 255, 0.8)', - 'rgba(141, 200, 255, 0.8)', - 'rgba(192, 224, 255, 0.8)' - ] - }, - { - label: 'set3', - colors: [ - 'rgba(39, 69, 255, 0.8)', - 'rgba(34, 122, 233, 0.8)', - 'rgba(46, 145, 243, 0.8)', - 'rgba(92, 173, 255, 0.8)', - 'rgba(148, 200, 255, 0.8)', - 'rgba(31, 174, 228, 0.8)', - 'rgba(25, 214, 209, 0.8)', - 'rgba(28, 234, 225, 0.8)' - ] - }, - { - label: 'set4', - colors: [ - 'rgba(253, 35, 4, 0.8)', - 'rgba(253, 104, 97, 0.8)', - 'rgba(232, 65, 14, 0.8)', - 'rgba(253, 146, 72, 0.8)', - 'rgba(233, 139, 3, 0.8)', - 'rgba(253, 215, 114, 0.8)', - 'rgba(254, 227, 159, 0.8)', - 'rgba(253, 146, 72, 0.8)' - ] - }, - { - label: 'set5', - colors: [ - 'rgba(63, 63, 63, 1)', - 'rgba(90, 90, 90, 1)', - 'rgba(107, 107, 107, 1)', - 'rgba(128, 128, 128, 1)', - 'rgba(151, 151, 151, 1)', - 'rgba(169, 169, 169, 1)', - 'rgba(196, 196, 196, 1)', - 'rgba(178, 179, 190, 1)' - ] - } -]; - -class ChartColorsPicker extends React.Component { - constructor(props) { - super(props); - autoBind(this); - } - defaultReportColorsChange (e) { - this.props.onChange({ - default: true, - }, { - report_colors: reportColorSets[e.currentTarget.value].colors || reportColorSets[0].colors - }); - } - defaultValue (set, index) { - if (this.props.defaultStyle.report_colors === undefined && index === 0) - return true; - - return JSON.stringify(this.props.defaultStyle.report_colors) === JSON.stringify(set.colors); - } - render () { - var radioButtons = reportColorSets.map(function(set, index){ - return ( - - -