From be6147aff20893e808620b0e998a615386b71061 Mon Sep 17 00:00:00 2001 From: Stephen Cui <229063661@qq.com> Date: Tue, 9 Nov 2021 10:56:43 +0800 Subject: [PATCH 001/260] chore(lint): fix lint error by prettier scan --- frontend/src/app/assets/fonts/iconfont.css | 63 +- .../assets/theme/echarts_default_theme.json | 599 +++++++++--------- .../Customize/DataReferencePanel.tsx | 3 +- .../ValueConditionConfiguration.tsx | 2 +- .../SortAction/SortAction.tsx | 2 +- .../ChartPresentPanel/ChartPresentPanel.tsx | 4 +- .../MannualRangeTimeSelector.tsx | 2 +- .../RecommendRangeTimeSelector.tsx | 2 +- .../components/WidgetCore/VideoBox/index.tsx | 2 +- .../FilterDate/CustomTimeSetter.tsx | 2 +- .../FilterDate/FilterDateCondition.tsx | 2 +- .../WidgetFilterForm/FilterFacade.tsx | 2 +- .../SettingItem/BasicSet/ImageUpload.tsx | 2 +- .../BoardEditor/components/SubMaskLayer.tsx | 3 +- .../src/app/pages/MainPage/Navbar/index.tsx | 5 - .../ControllerPanel/ControllerPanel.tsx | 2 +- .../MainPage/pages/VizPage/slice/index.ts | 25 +- .../SharePage/ChartPreviewBoardForShare.tsx | 2 +- 18 files changed, 346 insertions(+), 378 deletions(-) diff --git a/frontend/src/app/assets/fonts/iconfont.css b/frontend/src/app/assets/fonts/iconfont.css index 540eaf92a..3a970302b 100644 --- a/frontend/src/app/assets/fonts/iconfont.css +++ b/frontend/src/app/assets/fonts/iconfont.css @@ -1,12 +1,12 @@ @font-face { - font-family: "iconfont"; + font-family: 'iconfont'; src: url('iconfont.woff2?t=1634279056926') format('woff2'), - url('iconfont.woff?t=1634279056926') format('woff'), - url('iconfont.ttf?t=1634279056926') format('truetype'); + url('iconfont.woff?t=1634279056926') format('woff'), + url('iconfont.ttf?t=1634279056926') format('truetype'); } .iconfont { - font-family: "iconfont" !important; + font-family: 'iconfont' !important; font-size: 20px; line-height: 20px; font-style: normal; @@ -15,110 +15,109 @@ } .icon-chart:before { - content: "\e635"; + content: '\e635'; } .icon-area-chart:before { - content: "\e654"; + content: '\e654'; } .icon-areachart:before { - content: "\ebc7"; + content: '\ebc7'; } .icon-fsux_tubiao_ditu:before { - content: "\e610"; + content: '\e610'; } .icon-ditu:before { - content: "\e72e"; + content: '\e72e'; } .icon-fsux_tubiao_ciyun:before { - content: "\e60f"; + content: '\e60f'; } .icon-fsux_tubiao_shuangzhoutu:before { - content: "\e60d"; + content: '\e60d'; } .icon-fsux_tubiao_loudoutu:before { - content: "\e60e"; + content: '\e60e'; } .icon-fsux_tubiao_bingtu:before { - content: "\e60a"; + content: '\e60a'; } .icon-fsux_tubiao_bingtu1:before { - content: "\e60b"; + content: '\e60b'; } .icon-fsux_tubiao_nandingmeiguitu:before { - content: "\e60c"; + content: '\e60c'; } .icon-fsux_zhexiantu:before { - content: "\e608"; + content: '\e608'; } .icon-sandiantu:before { - content: "\e7a0"; + content: '\e7a0'; } .icon-fsux_tubiao_zhuzhuangtu:before { - content: "\e601"; + content: '\e601'; } .icon-fsux_tubiao_duijizhuzhuangtu:before { - content: "\e602"; + content: '\e602'; } .icon-fsux_tubiao_duijizhuzhuangtu1:before { - content: "\e603"; + content: '\e603'; } .icon-fsux_tubiao_zhuzhuangtu1:before { - content: "\e604"; + content: '\e604'; } .icon-fsux_tubiao_baifenbiduijizhuzhuangtu:before { - content: "\e605"; + content: '\e605'; } .icon-fsux_tubiao_baifenbiduijitiaoxingtu:before { - content: "\e606"; + content: '\e606'; } .icon-fenzubiao:before { - content: "\e799"; + content: '\e799'; } .icon-mingxibiao:before { - content: "\e79a"; + content: '\e79a'; } .icon-fanpaiqi:before { - content: "\e7a2"; + content: '\e7a2'; } .icon-fasongyoujian:before { - content: "\e600"; + content: '\e600'; } .icon-shujukupeizhi:before { - content: "\e65f"; + content: '\e65f'; } .icon-24gf-table:before { - content: "\eb12"; + content: '\eb12'; } .icon-xietongzhihuidaping:before { - content: "\e631"; + content: '\e631'; } .icon-users1:before { - content: "\e92e"; + content: '\e92e'; } - diff --git a/frontend/src/app/assets/theme/echarts_default_theme.json b/frontend/src/app/assets/theme/echarts_default_theme.json index 330fdfa66..e9c4e378e 100644 --- a/frontend/src/app/assets/theme/echarts_default_theme.json +++ b/frontend/src/app/assets/theme/echarts_default_theme.json @@ -1,393 +1,368 @@ - { "color": [ - "#298ffe", - "#dae9ff", - "#fe705a", - "#ffdcdc", - "#751adb", - "#8663d7", - "#15AD31", - "#FAD414", - "#E62412" + "#298ffe", + "#dae9ff", + "#fe705a", + "#ffdcdc", + "#751adb", + "#8663d7", + "#15AD31", + "#FAD414", + "#E62412" ], "backgroundColor": "rgba(0, 0, 0, 0)", "textStyle": {}, "title": { - "textStyle": { - "color": "#464646" - }, - "subtextStyle": { - "color": "#6E7079" - } + "textStyle": { + "color": "#464646" + }, + "subtextStyle": { + "color": "#6E7079" + } }, "line": { - "itemStyle": { - "borderWidth": 1 - }, - "lineStyle": { - "width": 2 - }, - "symbolSize": 4, - "symbol": "emptyCircle", - "smooth": false + "itemStyle": { + "borderWidth": 1 + }, + "lineStyle": { + "width": 2 + }, + "symbolSize": 4, + "symbol": "emptyCircle", + "smooth": false }, "radar": { - "itemStyle": { - "borderWidth": 1 - }, - "lineStyle": { - "width": 2 - }, - "symbolSize": 4, - "symbol": "emptyCircle", - "smooth": false + "itemStyle": { + "borderWidth": 1 + }, + "lineStyle": { + "width": 2 + }, + "symbolSize": 4, + "symbol": "emptyCircle", + "smooth": false }, "bar": { - "itemStyle": { - "barBorderWidth": 0, - "barBorderColor": "#ccc" - } + "itemStyle": { + "barBorderWidth": 0, + "barBorderColor": "#ccc" + } }, "pie": { - "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" - } + "itemStyle": { + "borderWidth": 0, + "borderColor": "#ccc" + } }, "scatter": { - "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" - } + "itemStyle": { + "borderWidth": 0, + "borderColor": "#ccc" + } }, "boxplot": { - "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" - } + "itemStyle": { + "borderWidth": 0, + "borderColor": "#ccc" + } }, "parallel": { - "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" - } + "itemStyle": { + "borderWidth": 0, + "borderColor": "#ccc" + } }, "sankey": { - "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" - } + "itemStyle": { + "borderWidth": 0, + "borderColor": "#ccc" + } }, "funnel": { - "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" - } + "itemStyle": { + "borderWidth": 0, + "borderColor": "#ccc" + } }, "gauge": { - "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" - } + "itemStyle": { + "borderWidth": 0, + "borderColor": "#ccc" + } }, "candlestick": { - "itemStyle": { - "color": "#eb5454", - "color0": "#47b262", - "borderColor": "#eb5454", - "borderColor0": "#47b262", - "borderWidth": 1 - } + "itemStyle": { + "color": "#eb5454", + "color0": "#47b262", + "borderColor": "#eb5454", + "borderColor0": "#47b262", + "borderWidth": 1 + } }, "graph": { - "itemStyle": { - "borderWidth": 0, - "borderColor": "#ccc" - }, - "lineStyle": { - "width": 1, - "color": "#aaa" - }, - "symbolSize": 4, - "symbol": "emptyCircle", - "smooth": false, - "color": [ - "#5470c6", - "#91cc75", - "#fac858", - "#ee6666", - "#73c0de", - "#3ba272", - "#fc8452", - "#9a60b4", - "#ea7ccc" - ], - "label": { - "color": "#eee" - } + "itemStyle": { + "borderWidth": 0, + "borderColor": "#ccc" + }, + "lineStyle": { + "width": 1, + "color": "#aaa" + }, + "symbolSize": 4, + "symbol": "emptyCircle", + "smooth": false, + "color": [ + "#5470c6", + "#91cc75", + "#fac858", + "#ee6666", + "#73c0de", + "#3ba272", + "#fc8452", + "#9a60b4", + "#ea7ccc" + ], + "label": { + "color": "#eee" + } }, "map": { + "itemStyle": { + "areaColor": "#eee", + "borderColor": "#444", + "borderWidth": 0.5 + }, + "label": { + "color": "#000" + }, + "emphasis": { "itemStyle": { - "areaColor": "#eee", - "borderColor": "#444", - "borderWidth": 0.5 + "areaColor": "rgba(255,215,0,0.8)", + "borderColor": "#444", + "borderWidth": 1 }, "label": { - "color": "#000" - }, - "emphasis": { - "itemStyle": { - "areaColor": "rgba(255,215,0,0.8)", - "borderColor": "#444", - "borderWidth": 1 - }, - "label": { - "color": "rgb(100,0,0)" - } + "color": "rgb(100,0,0)" } + } }, "geo": { + "itemStyle": { + "areaColor": "#eee", + "borderColor": "#444", + "borderWidth": 0.5 + }, + "label": { + "color": "#000" + }, + "emphasis": { "itemStyle": { - "areaColor": "#eee", - "borderColor": "#444", - "borderWidth": 0.5 + "areaColor": "rgba(255,215,0,0.8)", + "borderColor": "#444", + "borderWidth": 1 }, "label": { - "color": "#000" - }, - "emphasis": { - "itemStyle": { - "areaColor": "rgba(255,215,0,0.8)", - "borderColor": "#444", - "borderWidth": 1 - }, - "label": { - "color": "rgb(100,0,0)" - } + "color": "rgb(100,0,0)" } + } }, "categoryAxis": { - "axisLine": { - "show": true, - "lineStyle": { - "color": "#6E7079" - } - }, - "axisTick": { - "show": true, - "lineStyle": { - "color": "#6E7079" - } - }, - "axisLabel": { - "show": true, - "color": "#6E7079" - }, - "splitLine": { - "show": false, - "lineStyle": { - "color": [ - "#E0E6F1" - ] - } - }, - "splitArea": { - "show": false, - "areaStyle": { - "color": [ - "rgba(250,250,250,0.2)", - "rgba(210,219,238,0.2)" - ] - } + "axisLine": { + "show": true, + "lineStyle": { + "color": "#6E7079" + } + }, + "axisTick": { + "show": true, + "lineStyle": { + "color": "#6E7079" } + }, + "axisLabel": { + "show": true, + "color": "#6E7079" + }, + "splitLine": { + "show": false, + "lineStyle": { + "color": ["#E0E6F1"] + } + }, + "splitArea": { + "show": false, + "areaStyle": { + "color": ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"] + } + } }, "valueAxis": { - "axisLine": { - "show": false, - "lineStyle": { - "color": "#6E7079" - } - }, - "axisTick": { - "show": false, - "lineStyle": { - "color": "#6E7079" - } - }, - "axisLabel": { - "show": true, - "color": "#6E7079" - }, - "splitLine": { - "show": true, - "lineStyle": { - "color": [ - "#E0E6F1" - ] - } - }, - "splitArea": { - "show": false, - "areaStyle": { - "color": [ - "rgba(250,250,250,0.2)", - "rgba(210,219,238,0.2)" - ] - } + "axisLine": { + "show": false, + "lineStyle": { + "color": "#6E7079" } + }, + "axisTick": { + "show": false, + "lineStyle": { + "color": "#6E7079" + } + }, + "axisLabel": { + "show": true, + "color": "#6E7079" + }, + "splitLine": { + "show": true, + "lineStyle": { + "color": ["#E0E6F1"] + } + }, + "splitArea": { + "show": false, + "areaStyle": { + "color": ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"] + } + } }, "logAxis": { - "axisLine": { - "show": false, - "lineStyle": { - "color": "#6E7079" - } - }, - "axisTick": { - "show": false, - "lineStyle": { - "color": "#6E7079" - } - }, - "axisLabel": { - "show": true, - "color": "#6E7079" - }, - "splitLine": { - "show": true, - "lineStyle": { - "color": [ - "#E0E6F1" - ] - } - }, - "splitArea": { - "show": false, - "areaStyle": { - "color": [ - "rgba(250,250,250,0.2)", - "rgba(210,219,238,0.2)" - ] - } + "axisLine": { + "show": false, + "lineStyle": { + "color": "#6E7079" + } + }, + "axisTick": { + "show": false, + "lineStyle": { + "color": "#6E7079" + } + }, + "axisLabel": { + "show": true, + "color": "#6E7079" + }, + "splitLine": { + "show": true, + "lineStyle": { + "color": ["#E0E6F1"] + } + }, + "splitArea": { + "show": false, + "areaStyle": { + "color": ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"] } + } }, "timeAxis": { - "axisLine": { - "show": true, - "lineStyle": { - "color": "#6E7079" - } - }, - "axisTick": { - "show": true, - "lineStyle": { - "color": "#6E7079" - } - }, - "axisLabel": { - "show": true, - "color": "#6E7079" - }, - "splitLine": { - "show": false, - "lineStyle": { - "color": [ - "#E0E6F1" - ] - } - }, - "splitArea": { - "show": false, - "areaStyle": { - "color": [ - "rgba(250,250,250,0.2)", - "rgba(210,219,238,0.2)" - ] - } + "axisLine": { + "show": true, + "lineStyle": { + "color": "#6E7079" + } + }, + "axisTick": { + "show": true, + "lineStyle": { + "color": "#6E7079" + } + }, + "axisLabel": { + "show": true, + "color": "#6E7079" + }, + "splitLine": { + "show": false, + "lineStyle": { + "color": ["#E0E6F1"] } + }, + "splitArea": { + "show": false, + "areaStyle": { + "color": ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"] + } + } }, "toolbox": { + "iconStyle": { + "borderColor": "#999" + }, + "emphasis": { "iconStyle": { - "borderColor": "#999" - }, - "emphasis": { - "iconStyle": { - "borderColor": "#666" - } + "borderColor": "#666" } + } }, "legend": { - "textStyle": { - "color": "#333" - } + "textStyle": { + "color": "#333" + } }, "tooltip": { - "axisPointer": { - "lineStyle": { - "color": "#ccc", - "width": 1 - }, - "crossStyle": { - "color": "#ccc", - "width": 1 - } + "axisPointer": { + "lineStyle": { + "color": "#ccc", + "width": 1 + }, + "crossStyle": { + "color": "#ccc", + "width": 1 } + } }, "timeline": { - "lineStyle": { - "color": "#DAE1F5", - "width": 2 - }, + "lineStyle": { + "color": "#DAE1F5", + "width": 2 + }, + "itemStyle": { + "color": "#A4B1D7", + "borderWidth": 1 + }, + "controlStyle": { + "color": "#A4B1D7", + "borderColor": "#A4B1D7", + "borderWidth": 1 + }, + "checkpointStyle": { + "color": "#316bf3", + "borderColor": "fff" + }, + "label": { + "color": "#A4B1D7" + }, + "emphasis": { "itemStyle": { - "color": "#A4B1D7", - "borderWidth": 1 + "color": "#FFF" }, "controlStyle": { - "color": "#A4B1D7", - "borderColor": "#A4B1D7", - "borderWidth": 1 - }, - "checkpointStyle": { - "color": "#316bf3", - "borderColor": "fff" + "color": "#A4B1D7", + "borderColor": "#A4B1D7", + "borderWidth": 1 }, "label": { - "color": "#A4B1D7" - }, - "emphasis": { - "itemStyle": { - "color": "#FFF" - }, - "controlStyle": { - "color": "#A4B1D7", - "borderColor": "#A4B1D7", - "borderWidth": 1 - }, - "label": { - "color": "#A4B1D7" - } + "color": "#A4B1D7" } + } }, "visualMap": { - "color": [ - "#bf444c", - "#d88273", - "#f6efa6" - ] + "color": ["#bf444c", "#d88273", "#f6efa6"] }, "dataZoom": { - "handleSize": "undefined%", - "textStyle": {} + "handleSize": "undefined%", + "textStyle": {} }, "markPoint": { + "label": { + "color": "#eee" + }, + "emphasis": { "label": { - "color": "#eee" - }, - "emphasis": { - "label": { - "color": "#eee" - } + "color": "#eee" } + } } } diff --git a/frontend/src/app/components/FormGenerator/Customize/DataReferencePanel.tsx b/frontend/src/app/components/FormGenerator/Customize/DataReferencePanel.tsx index 65e2cb01e..5b9a73834 100644 --- a/frontend/src/app/components/FormGenerator/Customize/DataReferencePanel.tsx +++ b/frontend/src/app/components/FormGenerator/Customize/DataReferencePanel.tsx @@ -370,5 +370,4 @@ const DataReferencePanel: FC> = memo( export default DataReferencePanel; -const StyledDataReferencePanel = styled.div` -`; +const StyledDataReferencePanel = styled.div``; diff --git a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/ValueConditionConfiguration.tsx b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/ValueConditionConfiguration.tsx index af4d6bf24..2055a8b50 100644 --- a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/ValueConditionConfiguration.tsx +++ b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/ValueConditionConfiguration.tsx @@ -16,9 +16,9 @@ * limitations under the License. */ +import useI18NPrefix, { I18NComponentProps } from 'app/hooks/useI18NPrefix'; import MultiFilterRow from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterAction/MultiFilterRow'; import SingleFilterRow from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterAction/SingleFilterRow'; -import useI18NPrefix, { I18NComponentProps } from 'app/hooks/useI18NPrefix'; import { FilterConditionType } from 'app/pages/ChartWorkbenchPage/models/ChartConfig'; import { FC, memo, useState } from 'react'; import ChartFilterCondition, { diff --git a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/SortAction/SortAction.tsx b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/SortAction/SortAction.tsx index 5b3dfd032..83684175c 100644 --- a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/SortAction/SortAction.tsx +++ b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/SortAction/SortAction.tsx @@ -18,8 +18,8 @@ import { CheckOutlined } from '@ant-design/icons'; import { Col, Menu, Radio, Row, Space } from 'antd'; -import DraggableList from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/SortAction/DraggableList'; import useI18NPrefix from 'app/hooks/useI18NPrefix'; +import DraggableList from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/SortAction/DraggableList'; import { ChartDataSectionField, SortActionType, diff --git a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartPresentPanel/ChartPresentPanel.tsx b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartPresentPanel/ChartPresentPanel.tsx index 10852b8b3..0cd2fcdaa 100644 --- a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartPresentPanel/ChartPresentPanel.tsx +++ b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartPresentPanel/ChartPresentPanel.tsx @@ -17,10 +17,10 @@ */ import { Table } from 'antd'; -import useResizeObserver from 'app/hooks/useResizeObserver'; -import ChartTools from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTools'; import useI18NPrefix from 'app/hooks/useI18NPrefix'; import useMount from 'app/hooks/useMount'; +import useResizeObserver from 'app/hooks/useResizeObserver'; +import ChartTools from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTools'; import Chart from 'app/pages/ChartWorkbenchPage/models/Chart'; import ChartConfig from 'app/pages/ChartWorkbenchPage/models/ChartConfig'; import ChartDataset from 'app/pages/ChartWorkbenchPage/models/ChartDataset'; diff --git a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTimeSelector/MannualRangeTimeSelector.tsx b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTimeSelector/MannualRangeTimeSelector.tsx index 4f4e4c7df..4612944e8 100644 --- a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTimeSelector/MannualRangeTimeSelector.tsx +++ b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTimeSelector/MannualRangeTimeSelector.tsx @@ -17,8 +17,8 @@ */ import { Row, Space } from 'antd'; -import TimeConfigContext from 'app/pages/ChartWorkbenchPage/contexts/TimeConfigContext'; import useI18NPrefix, { I18NComponentProps } from 'app/hooks/useI18NPrefix'; +import TimeConfigContext from 'app/pages/ChartWorkbenchPage/contexts/TimeConfigContext'; import { FilterCondition, FilterConditionType, diff --git a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTimeSelector/RecommendRangeTimeSelector.tsx b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTimeSelector/RecommendRangeTimeSelector.tsx index 70e82b98a..10e68f95e 100644 --- a/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTimeSelector/RecommendRangeTimeSelector.tsx +++ b/frontend/src/app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartTimeSelector/RecommendRangeTimeSelector.tsx @@ -17,8 +17,8 @@ */ import { Radio, Row, Space } from 'antd'; -import TimeConfigContext from 'app/pages/ChartWorkbenchPage/contexts/TimeConfigContext'; import useI18NPrefix, { I18NComponentProps } from 'app/hooks/useI18NPrefix'; +import TimeConfigContext from 'app/pages/ChartWorkbenchPage/contexts/TimeConfigContext'; import { FilterCondition } from 'app/pages/ChartWorkbenchPage/models/ChartConfig'; import { convertRelativeTimeRange } from 'app/utils/time'; import { RECOMMEND_TIME } from 'globalConstants'; diff --git a/frontend/src/app/pages/DashBoardPage/components/WidgetCore/VideoBox/index.tsx b/frontend/src/app/pages/DashBoardPage/components/WidgetCore/VideoBox/index.tsx index 19c70b3af..54f3b8c93 100644 --- a/frontend/src/app/pages/DashBoardPage/components/WidgetCore/VideoBox/index.tsx +++ b/frontend/src/app/pages/DashBoardPage/components/WidgetCore/VideoBox/index.tsx @@ -87,7 +87,7 @@ const VideoWidget: React.FC = () => { - ); + ); switch (mediaType) { case 'video': diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterDate/CustomTimeSetter.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterDate/CustomTimeSetter.tsx index 16e098d5e..a438c60bf 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterDate/CustomTimeSetter.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterDate/CustomTimeSetter.tsx @@ -17,8 +17,8 @@ */ import { DatePicker, Form, FormInstance, InputNumber, Select } from 'antd'; -import { RelativeOrExactTime } from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/Constant'; import useI18NPrefix from 'app/hooks/useI18NPrefix'; +import { RelativeOrExactTime } from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/Constant'; import { TIME_DIRECTION, TIME_UNIT_OPTIONS } from 'globalConstants'; import { FC, memo, useCallback } from 'react'; diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterDate/FilterDateCondition.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterDate/FilterDateCondition.tsx index 77b03c9f4..1cdf1b406 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterDate/FilterDateCondition.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterDate/FilterDateCondition.tsx @@ -17,8 +17,8 @@ */ import { Form, FormInstance, Radio } from 'antd'; -import { ControllerFacadeTypes } from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/Constant'; import useI18NPrefix from 'app/hooks/useI18NPrefix'; +import { ControllerFacadeTypes } from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/Constant'; import { ChartDataViewFieldType } from 'app/pages/ChartWorkbenchPage/models/ChartDataView'; import { FilterOperatorType, diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterFacade.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterFacade.tsx index e50505acf..d685e9f32 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterFacade.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/FilterFacade.tsx @@ -17,8 +17,8 @@ */ import { Form, FormInstance, InputNumber, Select } from 'antd'; -import { ControllerFacadeTypes } from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/Constant'; import useI18NPrefix from 'app/hooks/useI18NPrefix'; +import { ControllerFacadeTypes } from 'app/pages/ChartWorkbenchPage/components/ChartOperationPanel/components/ChartFieldAction/FilterControlPanel/Constant'; import { ChartDataViewFieldCategory, ChartDataViewFieldType, diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/SlideSetting/SettingItem/BasicSet/ImageUpload.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/SlideSetting/SettingItem/BasicSet/ImageUpload.tsx index 418541316..a5cd0dfac 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/SlideSetting/SettingItem/BasicSet/ImageUpload.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/SlideSetting/SettingItem/BasicSet/ImageUpload.tsx @@ -157,5 +157,5 @@ const Wrapper = styled.div` `; const Placeholder = styled.p` - color: ${p => p.theme.textColorLight} + color: ${p => p.theme.textColorLight}; `; diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/SubMaskLayer.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/SubMaskLayer.tsx index 0eaaffa6d..f506c37c7 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/SubMaskLayer.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/SubMaskLayer.tsx @@ -42,7 +42,8 @@ const SubMaskLayer: React.FC = ({ } }, [dispatch, selected, widgetId], - ); + ); + const doubleClick = useCallback(() => { // if (widgetType === 'chart') return; dispatch( diff --git a/frontend/src/app/pages/MainPage/Navbar/index.tsx b/frontend/src/app/pages/MainPage/Navbar/index.tsx index dda53c40f..dcda81448 100644 --- a/frontend/src/app/pages/MainPage/Navbar/index.tsx +++ b/frontend/src/app/pages/MainPage/Navbar/index.tsx @@ -1,17 +1,12 @@ import { BankFilled, - DatabaseFilled, ExportOutlined, FormOutlined, FunctionOutlined, ProfileOutlined, - ProjectFilled, SafetyCertificateFilled, - ScheduleFilled, SettingFilled, SettingOutlined, - TabletFilled, - TeamOutlined, UserOutlined, } from '@ant-design/icons'; import { List, Menu, Tooltip } from 'antd'; diff --git a/frontend/src/app/pages/MainPage/pages/VizPage/ChartPreview/components/ControllerPanel/ControllerPanel.tsx b/frontend/src/app/pages/MainPage/pages/VizPage/ChartPreview/components/ControllerPanel/ControllerPanel.tsx index 68766600f..15bb47a38 100644 --- a/frontend/src/app/pages/MainPage/pages/VizPage/ChartPreview/components/ControllerPanel/ControllerPanel.tsx +++ b/frontend/src/app/pages/MainPage/pages/VizPage/ChartPreview/components/ControllerPanel/ControllerPanel.tsx @@ -50,7 +50,7 @@ const ControllerPanel: FC<{ view?: BackendChart['view']; chartConfig?: ChartConfig; onChange: (type, payload) => void; -}> = memo(({ viewId,view, chartConfig, onChange }) => { +}> = memo(({ viewId, view, chartConfig, onChange }) => { const [filters, setFilters] = useState([]); useEffect(() => { const newFilters = (chartConfig?.datas || []) diff --git a/frontend/src/app/pages/MainPage/pages/VizPage/slice/index.ts b/frontend/src/app/pages/MainPage/pages/VizPage/slice/index.ts index 9d5095cae..80dcf6061 100644 --- a/frontend/src/app/pages/MainPage/pages/VizPage/slice/index.ts +++ b/frontend/src/app/pages/MainPage/pages/VizPage/slice/index.ts @@ -523,19 +523,18 @@ const slice = createSlice({ }; }, ); - builder - .addCase(updateFilterAndFetchDataset.fulfilled, (state, action) => { - const index = state.chartPreviews?.findIndex( - c => c.backendChartId === action.payload?.backendChartId, - ); - if (index < 0) { - return; - } - state.chartPreviews[index] = { - ...state.chartPreviews[index], - version: uuidv4(), - }; - }); + builder.addCase(updateFilterAndFetchDataset.fulfilled, (state, action) => { + const index = state.chartPreviews?.findIndex( + c => c.backendChartId === action.payload?.backendChartId, + ); + if (index < 0) { + return; + } + state.chartPreviews[index] = { + ...state.chartPreviews[index], + version: uuidv4(), + }; + }); builder.addMatcher(isRejected, (_, action) => { if (isMySliceAction(action, slice.name)) { diff --git a/frontend/src/app/pages/SharePage/ChartPreviewBoardForShare.tsx b/frontend/src/app/pages/SharePage/ChartPreviewBoardForShare.tsx index 7927aeabd..fc2d5b065 100644 --- a/frontend/src/app/pages/SharePage/ChartPreviewBoardForShare.tsx +++ b/frontend/src/app/pages/SharePage/ChartPreviewBoardForShare.tsx @@ -17,8 +17,8 @@ */ import { VizHeader } from 'app/components/VizHeader'; -import useResizeObserver from 'app/hooks/useResizeObserver'; import useMount from 'app/hooks/useMount'; +import useResizeObserver from 'app/hooks/useResizeObserver'; import Chart from 'app/pages/ChartWorkbenchPage/models/Chart'; import ChartManager from 'app/pages/ChartWorkbenchPage/models/ChartManager'; import { CSSProperties, FC, memo, useState } from 'react'; From 5ea39ae8a5e6751e12190e28edbc6c32b0700dc6 Mon Sep 17 00:00:00 2001 From: Stephen Cui <229063661@qq.com> Date: Tue, 9 Nov 2021 11:36:30 +0800 Subject: [PATCH 002/260] chore(chart): remove logs --- frontend/src/app/hooks/useFieldActionModal.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/app/hooks/useFieldActionModal.tsx b/frontend/src/app/hooks/useFieldActionModal.tsx index 597b45547..436d69e79 100644 --- a/frontend/src/app/hooks/useFieldActionModal.tsx +++ b/frontend/src/app/hooks/useFieldActionModal.tsx @@ -94,7 +94,6 @@ function useFieldActionModal({ i18nPrefix }: I18NComponentProps) { ) => { const currentConfig = dataConfig.rows?.find(c => c.uid === columnUid); let _modalSize = StateModalSize.Middle; - console.log(actionType); if (actionType === ChartDataSectionFieldActionType.Colorize) { _modalSize = StateModalSize.Small; } else if (actionType === ChartDataSectionFieldActionType.ColorizeSingle) { From f5fd4ed92cb22271fafc3df025eb25b256c6d125 Mon Sep 17 00:00:00 2001 From: ParkerJX Date: Tue, 9 Nov 2021 11:51:23 +0800 Subject: [PATCH 003/260] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=BC=80=E5=90=AF=20gzip=20=E5=8E=8B?= =?UTF-8?q?=E7=BC=A9=EF=BC=8C=E5=8A=A0=E5=BF=AB=E8=AF=B7=E6=B1=82=E5=92=8C?= =?UTF-8?q?=E5=93=8D=E5=BA=94=E9=80=9F=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 配置文件默认开启 gzip 压缩,加快请求和响应速度 --- config/application-config.yml.example | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/application-config.yml.example b/config/application-config.yml.example index 9f67ec43d..fa5a073c1 100644 --- a/config/application-config.yml.example +++ b/config/application-config.yml.example @@ -38,6 +38,12 @@ spring: server: port: { PORT } address: { IP } + + # 开启 gzip 压缩,加快请求和响应速度 + compression: + enabled: true + mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/* + datart: server: @@ -58,4 +64,4 @@ datart: screenshot: timeout-seconds: 60 webdriver-type: CHROME - webdriver-path: { Web Driver Path } \ No newline at end of file + webdriver-path: { Web Driver Path } From 5eb0820921de090300989a85a681ab0e9c8e68ed Mon Sep 17 00:00:00 2001 From: "761302945@qq.com" <761302945@qq.com> Date: Tue, 9 Nov 2021 12:00:11 +0800 Subject: [PATCH 004/260] fix: http data provider response parser param error --- .../src/main/java/datart/data/provider/HttpDataProvider.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/data-providers/http-data-provider/src/main/java/datart/data/provider/HttpDataProvider.java b/data-providers/http-data-provider/src/main/java/datart/data/provider/HttpDataProvider.java index 4a38d7ca3..eb49053c3 100644 --- a/data-providers/http-data-provider/src/main/java/datart/data/provider/HttpDataProvider.java +++ b/data-providers/http-data-provider/src/main/java/datart/data/provider/HttpDataProvider.java @@ -121,7 +121,10 @@ private HttpRequestParam convert2RequestParam(Map config) throws httpRequestParam.setContentType(config.getOrDefault(CONTENT_TYPE, "application/json").toString()); - String parserName = config.getOrDefault(RESPONSE_PARSER, DEFAULT_PARSER).toString(); + String parserName = config.get(RESPONSE_PARSER).toString(); + if (StringUtils.isBlank(parserName)) { + parserName = DEFAULT_PARSER; + } Class aClass = (Class) Class.forName(parserName); From b56b817fea4992b37ef4964fccd84b01e7043dd9 Mon Sep 17 00:00:00 2001 From: xieliuduo Date: Tue, 9 Nov 2021 12:35:29 +0800 Subject: [PATCH 005/260] fix(widget): update widget with chart #181 --- .../pages/BoardEditor/components/ChartEditor.tsx | 1 + .../components/FilterWidgetPanel/index.tsx | 2 +- .../pages/BoardEditor/slice/actions.ts | 7 +++++++ .../DashBoardPage/pages/BoardEditor/slice/thunk.ts | 10 ++++++++-- .../app/pages/DashBoardPage/slice/asyncActions.ts | 4 ++-- .../src/app/pages/DashBoardPage/utils/widget.ts | 13 +++++++++++-- 6 files changed, 30 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/ChartEditor.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/ChartEditor.tsx index d8be0e84d..b7ece96b3 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/ChartEditor.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/ChartEditor.tsx @@ -125,6 +125,7 @@ export const ChartEditor: React.FC = ({ registerChartEvents(currentChart); setChart(currentChart); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [backendChart]); const handleChartChange = (c: Chart) => { diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/index.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/index.tsx index 1bbbd7d5a..cb166240c 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/index.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/index.tsx @@ -152,13 +152,13 @@ const FilterWidgetPanel: React.FC = memo(props => { nextRelatedViews.push({ ...oldViewItem }); } else { const view = viewMap[viewId]; + if (!view) return; const relatedView: RelatedView = { viewId: view.id, filterFieldCategory: ChartDataViewFieldCategory.Field, fieldValue: '', fieldValueType: ChartDataViewFieldType.STRING, }; - nextRelatedViews.push(relatedView); } } diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/actions.ts b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/actions.ts index 917c8b1b6..8e636003a 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/actions.ts +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/actions.ts @@ -199,6 +199,13 @@ export const editWrapChartWidget = (props: { widgetId: string; dataChart: DataChart; view: ChartDataView }) => async (dispatch, getState) => { const { dataChart, view, widgetId } = props; + const editBoard = getState().editBoard as HistoryEditBoard; + const widgetMap = editBoard.stack.present.widgetRecord; + const curWidget = widgetMap[widgetId]; + const nextWidget = produce(curWidget, draft => { + draft.viewIds = [dataChart.viewId]; + }); + dispatch(editBoardStackActions.updateWidget(nextWidget)); const dataCharts = [dataChart]; const viewViews = [view]; dispatch(boardActions.setDataChartMap(dataCharts)); diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/thunk.ts b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/thunk.ts index de39fdcd8..4ba885d51 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/thunk.ts +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/slice/thunk.ts @@ -104,12 +104,16 @@ export const fetchEditBoardDetail = createAsyncThunk< const { datacharts: serverDataCharts, views: serverViews, widgets } = data; // TODO // const wrapedChart = getWidgetMapByServer(widgets); - const { widgetMap, wrappedDataCharts } = getWidgetMapByServer(widgets); + const dataCharts: DataChart[] = getDataChartsByServer(serverDataCharts); + const { widgetMap, wrappedDataCharts } = getWidgetMapByServer( + widgets, + dataCharts, + ); const widgetInfoMap = getWidgetInfoMapByServer(widgets); const widgetIds = widgets.map(w => w.id); const boardInfo = getInitBoardInfo(dashboard.id, widgetIds); // datacharts - const dataCharts: DataChart[] = getDataChartsByServer(serverDataCharts); + const allDataCharts: DataChart[] = dataCharts.concat(wrappedDataCharts); dispatch(boardActions.updateDataChartMap(allDataCharts)); @@ -249,6 +253,7 @@ export const addDataChartWidgets = createAsyncThunk< boardType: boardType, dataChartId: dcId, dataChartConfig: dataChartMap[dcId], + viewId: dataChartMap[dcId].viewId, subType: 'dataChart', }); return widget; @@ -283,6 +288,7 @@ export const addWrapChartWidget = createAsyncThunk< dashboardId: boardId, boardType: boardType, dataChartId: chartId, + viewId: view.id, dataChartConfig: dataChart, subType: 'widgetChart', }); diff --git a/frontend/src/app/pages/DashBoardPage/slice/asyncActions.ts b/frontend/src/app/pages/DashBoardPage/slice/asyncActions.ts index 9bc2ddd5d..92e0be67c 100644 --- a/frontend/src/app/pages/DashBoardPage/slice/asyncActions.ts +++ b/frontend/src/app/pages/DashBoardPage/slice/asyncActions.ts @@ -48,9 +48,10 @@ export const handleServerBoardAction = const { datacharts, views: serverViews, widgets: serverWidgets } = data; const widgetIds = serverWidgets.map(w => w.id); - + const dataCharts: DataChart[] = getDataChartsByServer(datacharts); const { widgetMap, wrappedDataCharts } = getWidgetMapByServer( serverWidgets, + dataCharts, filterSearchMap, ); @@ -59,7 +60,6 @@ export const handleServerBoardAction = if (renderMode === 'schedule') { boardInfo = getScheduleBoardInfo(boardInfo, widgetMap); } - const dataCharts: DataChart[] = getDataChartsByServer(datacharts); const allDataCharts: DataChart[] = dataCharts.concat(wrappedDataCharts); const viewViews = getChartDataView(serverViews, allDataCharts); diff --git a/frontend/src/app/pages/DashBoardPage/utils/widget.ts b/frontend/src/app/pages/DashBoardPage/utils/widget.ts index bd1dd9328..311ff7f16 100644 --- a/frontend/src/app/pages/DashBoardPage/utils/widget.ts +++ b/frontend/src/app/pages/DashBoardPage/utils/widget.ts @@ -68,6 +68,7 @@ export const createDataChartWidget = (opt: { boardType: BoardType; dataChartId: string; dataChartConfig: DataChart; + viewId: string; subType: WidgetContentChartType; }) => { const content = createChartWidgetContent(opt.subType); @@ -80,6 +81,7 @@ export const createDataChartWidget = (opt: { const widget: Widget = createWidget({ dashboardId: opt.dashboardId, datachartId: opt.dataChartId, + viewIds: opt.viewId ? [opt.viewId] : [], config: widgetConf, }); return widget; @@ -349,17 +351,24 @@ export const createFilterWidget = (params: { // TODO chart widget export const getWidgetMapByServer = ( widgets: ServerWidget[], + dataCharts: DataChart[], filterSearchParamsMap?: FilterSearchParamsWithMatch, ) => { const filterSearchParams = filterSearchParamsMap?.params, isMatchByName = filterSearchParamsMap?.isMatchByName; - - // const dataChart + const dataChartMap = dataCharts.reduce((acc, cur) => { + acc[cur.id] = cur; + return acc; + }, {} as Record); const widgetMap = widgets.reduce((acc, cur) => { + const viewIds = cur.datachartId + ? [dataChartMap[cur.datachartId].viewId] + : cur.viewIds; let widget: Widget = { ...cur, config: JSON.parse(cur.config), relations: convertWidgetRelationsToObj(cur.relations), + viewIds, }; acc[cur.id] = widget; From 33971d24478fe9ef18a95857a7e5825c6c9582c3 Mon Sep 17 00:00:00 2001 From: xieliuduo Date: Mon, 1 Nov 2021 11:37:38 +0800 Subject: [PATCH 006/260] refactor(sharePage): sharePage render by vizType --- .../app/pages/DashBoardPage/slice/thunk.ts | 3 - .../src/app/pages/SharePage/SharePage.tsx | 73 +++++++++++++------ 2 files changed, 49 insertions(+), 27 deletions(-) diff --git a/frontend/src/app/pages/DashBoardPage/slice/thunk.ts b/frontend/src/app/pages/DashBoardPage/slice/thunk.ts index c0dc923e1..becf2ed71 100644 --- a/frontend/src/app/pages/DashBoardPage/slice/thunk.ts +++ b/frontend/src/app/pages/DashBoardPage/slice/thunk.ts @@ -96,15 +96,12 @@ export const fetchBoardDetailInShare = createAsyncThunk< password: vizToken.password, }, }); - dispatch(shareActions.setVizType(data.vizType)); - dispatch( shareActions.setExecuteTokenMap({ executeToken: data.executeToken, }), ); const serverBoard = data.vizDetail as ServerDashboard; - dispatch( handleServerBoardAction({ data: serverBoard, diff --git a/frontend/src/app/pages/SharePage/SharePage.tsx b/frontend/src/app/pages/SharePage/SharePage.tsx index 8a1338e6a..cd45006d3 100644 --- a/frontend/src/app/pages/SharePage/SharePage.tsx +++ b/frontend/src/app/pages/SharePage/SharePage.tsx @@ -45,6 +45,7 @@ import { selectNeedPassword, selectShareExecuteTokenMap, selectSharePassword, + selectShareVizType, } from './slice/selectors'; import { fetchShareVizInfo } from './slice/thunks'; import { StoryPlayerForShare } from './StoryPlayerForShare'; @@ -65,6 +66,7 @@ export function SharePage() { const chartPreview = useSelector(selectChartPreview); const shareBoard = useSelector(selectShareBoard); const shareStory = useSelector(selectShareStoryBoard); + const vizType = useSelector(selectShareVizType); const shareToken = useRouteQuery({ key: 'token', @@ -110,6 +112,19 @@ export function SharePage() { ); }; + useMount(() => { + if (Boolean(usePassword)) { + const previousPassword = persistence.session.get(shareToken); + if (previousPassword) { + fetchShareVizInfoImpl(shareToken, previousPassword, searchParams); + } else { + dispatch(actions.saveNeedPassword(true)); + } + } else { + fetchShareVizInfoImpl(shareToken, undefined, searchParams); + } + }); + const onLoadShareTask = useMemo(() => { const clientId = localStorage.getItem(StorageKeys.ShareClientId); if (clientId) { @@ -176,31 +191,41 @@ export function SharePage() { fetchShareVizInfoImpl(shareToken, sharePassword); }} /> + {!Boolean(needPassword) && ( + <> + {/* dataChart */} + {vizType === 'DATACHART' && + chartPreview && + chartPreview?.backendChart && ( + + + + )} - {!Boolean(needPassword) && chartPreview && chartPreview?.backendChart && ( - - - - )} - {!Boolean(needPassword) && shareBoard && !shareStory && ( - - )} - {!Boolean(needPassword) && shareStory && ( - + {/* dashboard */} + {vizType === 'DASHBOARD' && shareBoard && ( + + )} + + {/* story */} + {vizType === 'STORYBOARD' && shareStory && ( + + )} + )} ); From 6b33cd058f2459e05579cbde6c4b1af38aebf7dc Mon Sep 17 00:00:00 2001 From: xieliuduo Date: Mon, 1 Nov 2021 11:46:02 +0800 Subject: [PATCH 007/260] refactor(board): del useless code --- .../pages/BoardEditor/FreeEditor/WorkSpace.tsx | 14 ++++++-------- .../Dashboard/FreeDashboard/FreeBoardCore.tsx | 18 ++++++++---------- .../app/pages/StoryBoardPage/Editor/index.tsx | 4 ---- .../app/pages/StoryBoardPage/Player/index.tsx | 4 ---- 4 files changed, 14 insertions(+), 26 deletions(-) diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/FreeEditor/WorkSpace.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/FreeEditor/WorkSpace.tsx index dd1e9cb94..3ca7e4080 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/FreeEditor/WorkSpace.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/FreeEditor/WorkSpace.tsx @@ -37,7 +37,7 @@ const WorkSpace: React.FC = () => { const { width: boardWidth, height: boardHeight, scaleMode } = config; const layoutWidgetMap = useSelector(selectLayoutWidgetMap); const sortedLayoutWidgets = Object.values(layoutWidgetMap).sort( - (a, b) => b.config.index - a.config.index, + (a, b) => a.config.index - b.config.index, ); const [rect, refGridBackground] = useClientRect(); const { @@ -58,13 +58,11 @@ const WorkSpace: React.FC = () => { ref={refGridBackground} > - {sortedLayoutWidgets - .sort((a, b) => a.config.index - b.config.index) - .map(widgetConfig => ( - - - - ))} + {sortedLayoutWidgets.map(widgetConfig => ( + + + + ))} diff --git a/frontend/src/app/pages/DashBoardPage/pages/Dashboard/FreeDashboard/FreeBoardCore.tsx b/frontend/src/app/pages/DashBoardPage/pages/Dashboard/FreeDashboard/FreeBoardCore.tsx index d301ffce7..168b269d9 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/Dashboard/FreeDashboard/FreeBoardCore.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/Dashboard/FreeDashboard/FreeBoardCore.tsx @@ -44,7 +44,7 @@ const FreeBoardCore: React.FC = memo( ); const widgetConfigs = useMemo(() => { return Object.values(widgetConfigRecords).sort((w1, w2) => { - return w2.config.index - w1.config.index; + return w1.config.index - w2.config.index; }); }, [widgetConfigRecords]); @@ -66,15 +66,13 @@ const FreeBoardCore: React.FC = memo( scaleMode, ); const boardChildren = useMemo(() => { - return widgetConfigs - .sort((a, b) => a.config.index - b.config.index) - .map(item => { - return ( - - - - ); - }); + return widgetConfigs.map(item => { + return ( + + + + ); + }); }, [widgetConfigs]); const { gridRef } = useBoardWidthHeight(); return ( diff --git a/frontend/src/app/pages/StoryBoardPage/Editor/index.tsx b/frontend/src/app/pages/StoryBoardPage/Editor/index.tsx index 1e03d3de4..e37a78714 100644 --- a/frontend/src/app/pages/StoryBoardPage/Editor/index.tsx +++ b/frontend/src/app/pages/StoryBoardPage/Editor/index.tsx @@ -71,10 +71,6 @@ export const StoryEditor: React.FC<{ return sortedPages; }, [pageMap]); - useEffect(() => { - // dispatch(getStoryDetail(storyId)); - }, [dispatch, storyId]); - const changePage = useCallback( e => { const { indexh: slideIdx } = e; diff --git a/frontend/src/app/pages/StoryBoardPage/Player/index.tsx b/frontend/src/app/pages/StoryBoardPage/Player/index.tsx index ae04c1529..a84e4a674 100644 --- a/frontend/src/app/pages/StoryBoardPage/Player/index.tsx +++ b/frontend/src/app/pages/StoryBoardPage/Player/index.tsx @@ -66,10 +66,6 @@ export const StoryPlayer: React.FC<{ storyId: string }> = memo( return sortedPages; }, [pageMap]); - useEffect(() => { - // dispatch(getStoryDetail(storyId)); - }, [dispatch, storyId]); - const changePage = useCallback( e => { const { indexh: slideIdx } = e; From 7bd542d9c3dfc181e8725e5afc63999d97e0be8a Mon Sep 17 00:00:00 2001 From: xieliuduo Date: Mon, 8 Nov 2021 10:28:28 +0800 Subject: [PATCH 008/260] feat: add variable filter --- .../models/ChartHttpRequest.ts | 1 + .../components/BoardProvider.tsx | 1 + .../WidgetCore/DataChartWidget/index.tsx | 1 + .../FilterWIdget/WidgetFilterCore.tsx | 2 +- .../DashBoardPage/contexts/BoardContext.ts | 3 +- .../FilterWidgetPanel/RelatedViewForm.tsx | 38 +++--- .../WidgetFilterForm/AssistViewFields.tsx | 108 ++++++++++++++++++ .../WidgetFilterForm/FilterCustomOptions.tsx | 1 - .../WidgetFilterForm/OperatorValues.tsx | 59 +++++++--- .../components/FilterWidgetPanel/index.tsx | 6 +- .../components/FilterWidgetPanel/types.ts | 2 +- .../components/FilterWidgetPanel/utils.ts | 2 +- .../pages/BoardEditor/slice/thunk.ts | 11 +- .../app/pages/DashBoardPage/slice/thunk.ts | 9 +- .../app/pages/DashBoardPage/slice/types.ts | 16 +-- .../app/pages/DashBoardPage/utils/board.ts | 25 +--- .../app/pages/DashBoardPage/utils/index.ts | 31 +++-- .../app/pages/DashBoardPage/utils/widget.ts | 10 ++ .../pages/SharePage/StoryPlayerForShare.tsx | 2 +- 19 files changed, 237 insertions(+), 91 deletions(-) create mode 100644 frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/WidgetFilterForm/AssistViewFields.tsx diff --git a/frontend/src/app/pages/ChartWorkbenchPage/models/ChartHttpRequest.ts b/frontend/src/app/pages/ChartWorkbenchPage/models/ChartHttpRequest.ts index ebf70f419..7c2d24046 100644 --- a/frontend/src/app/pages/ChartWorkbenchPage/models/ChartHttpRequest.ts +++ b/frontend/src/app/pages/ChartWorkbenchPage/models/ChartHttpRequest.ts @@ -51,6 +51,7 @@ export type ChartRequest = { cacheExpires?: number; concurrencyControl?: boolean; concurrencyControlMode?: string; + params?: Record; }; export type ChartRequestFilter = { diff --git a/frontend/src/app/pages/DashBoardPage/components/BoardProvider.tsx b/frontend/src/app/pages/DashBoardPage/components/BoardProvider.tsx index 8edad03b9..8e6390c75 100644 --- a/frontend/src/app/pages/DashBoardPage/components/BoardProvider.tsx +++ b/frontend/src/app/pages/DashBoardPage/components/BoardProvider.tsx @@ -53,6 +53,7 @@ export const BoardProvider: FC<{ name: board.name, boardId: board.id, status: board.status, + queryVariables: board.queryVariables, renderMode, boardType: board.config.type, editing: editing, diff --git a/frontend/src/app/pages/DashBoardPage/components/WidgetCore/DataChartWidget/index.tsx b/frontend/src/app/pages/DashBoardPage/components/WidgetCore/DataChartWidget/index.tsx index 309860b34..4e5250bc8 100644 --- a/frontend/src/app/pages/DashBoardPage/components/WidgetCore/DataChartWidget/index.tsx +++ b/frontend/src/app/pages/DashBoardPage/components/WidgetCore/DataChartWidget/index.tsx @@ -56,6 +56,7 @@ export const DataChartWidget: React.FC = memo(() => { if (!params) { return; } + console.log('params', params); widgetChartClick(widgetRef.current, params); }, [widgetChartClick], diff --git a/frontend/src/app/pages/DashBoardPage/components/WidgetCore/FilterWIdget/WidgetFilterCore.tsx b/frontend/src/app/pages/DashBoardPage/components/WidgetCore/FilterWIdget/WidgetFilterCore.tsx index 4e0cfefe8..debbee64a 100644 --- a/frontend/src/app/pages/DashBoardPage/components/WidgetCore/FilterWIdget/WidgetFilterCore.tsx +++ b/frontend/src/app/pages/DashBoardPage/components/WidgetCore/FilterWIdget/WidgetFilterCore.tsx @@ -61,7 +61,7 @@ export const WidgetFilterCore: React.FC<{ id: string }> = memo(({ id }) => { ); const { aggregate, - assistViewField, + assistViewFields, filterDate, filterFacade, filterValues, diff --git a/frontend/src/app/pages/DashBoardPage/contexts/BoardContext.ts b/frontend/src/app/pages/DashBoardPage/contexts/BoardContext.ts index ef6694b61..6e281bb17 100644 --- a/frontend/src/app/pages/DashBoardPage/contexts/BoardContext.ts +++ b/frontend/src/app/pages/DashBoardPage/contexts/BoardContext.ts @@ -17,7 +17,7 @@ */ import { createContext } from 'react'; -import { BoardType, VizRenderMode } from '../slice/types'; +import { BoardType, Dashboard, VizRenderMode } from '../slice/types'; export interface BoardContextProps { name: string; renderMode?: VizRenderMode; @@ -31,6 +31,7 @@ export interface BoardContextProps { allowDownload?: boolean; allowShare?: boolean; allowManage?: boolean; + queryVariables: Dashboard['queryVariables']; // methods renderedWidgetById: (wid: string) => void; } diff --git a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/RelatedViewForm.tsx b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/RelatedViewForm.tsx index bd293399f..bd06a165b 100644 --- a/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/RelatedViewForm.tsx +++ b/frontend/src/app/pages/DashBoardPage/pages/BoardEditor/components/FilterWidgetPanel/RelatedViewForm.tsx @@ -28,6 +28,7 @@ import ChartDataView, { ChartDataViewFieldType, } from 'app/pages/ChartWorkbenchPage/models/ChartDataView'; import { RelatedView } from 'app/pages/DashBoardPage/slice/types'; +import { Variable } from 'app/pages/MainPage/pages/VariablePage/slice/types'; import React, { memo, useCallback } from 'react'; import styled from 'styled-components/macro'; @@ -36,12 +37,13 @@ export interface RelatedViewFormProps { form: FormInstance | undefined; fieldValueType: ChartDataViewFieldType; onChangeFieldProps: (views?: RelatedView[]) => void; + queryVariables: Variable[]; } const Option = Select.Option; const RadioButton = Radio.Button; const RadioGroup = Radio.Group; export const RelatedViewForm: React.FC = memo( - ({ viewMap, form, onChangeFieldProps }) => { + ({ viewMap, form, onChangeFieldProps, queryVariables }) => { //renderOptions const renderOptions = useCallback( (index: number) => { @@ -53,18 +55,27 @@ export const RelatedViewForm: React.FC = memo( relatedViews[index].filterFieldCategory === ChartDataViewFieldCategory.Variable ) { - // return viewMap[relatedView.viewId].variables?.map - // TODO - return [ - , - , - ]; + // 变量 + return queryVariables + .filter(v => { + return v.viewId === relatedViews[index].viewId || !v.viewId; + }) + .map(item => ( + + )); } else { - // ChartDataViewFieldCategory.Field or other + // 字段 return viewMap?.[relatedViews[index].viewId]?.meta?.map(item => (