diff --git a/superset-frontend/src/components/DvtProfileMenu/dvtProfileMenuData.ts b/superset-frontend/src/components/DvtProfileMenu/dvtProfileMenuData.ts index 5b785052eb86b..bbd95c189eb42 100644 --- a/superset-frontend/src/components/DvtProfileMenu/dvtProfileMenuData.ts +++ b/superset-frontend/src/components/DvtProfileMenu/dvtProfileMenuData.ts @@ -14,7 +14,7 @@ const DvtProfileMenuData: DvtProfileMenuDataProps[] = [ { title: t('Security'), menu: [ - { label: t('List Users'), link: '/users/list/' }, + { label: t('List Users'), link: '/user/list/' }, { label: t('List Roles'), link: '/role/list/' }, { label: t('Row Level Security'), diff --git a/superset-frontend/src/components/DvtRange/dvt-range.module.tsx b/superset-frontend/src/components/DvtRange/dvt-range.module.tsx index 6155581ac1b49..d18121fe9d481 100644 --- a/superset-frontend/src/components/DvtRange/dvt-range.module.tsx +++ b/superset-frontend/src/components/DvtRange/dvt-range.module.tsx @@ -28,6 +28,7 @@ const StyledRange = styled.div` display: flex; flex-direction: column; gap: 8px; + padding: 0 10px; `; const StyledPopper = styled.div` @@ -88,7 +89,7 @@ const StyledRangePopover = styled.div` const StyledRangeLabel = styled.label` font-weight: 600; - color: ${({ theme }) => theme.colors.dvt.text.label}; + color: ${({ theme }) => theme.colors.grayscale.dark2}; `; export { diff --git a/superset-frontend/src/components/DvtSidebar/dvtSidebarData.ts b/superset-frontend/src/components/DvtSidebar/dvtSidebarData.ts index 24193cee82d4d..e7b0c78f78dd6 100644 --- a/superset-frontend/src/components/DvtSidebar/dvtSidebarData.ts +++ b/superset-frontend/src/components/DvtSidebar/dvtSidebarData.ts @@ -353,6 +353,13 @@ const DvtSidebarData: SidebarDataProps[] = [ label: t('LABEL COLUMN'), active: 'linear_regression', }, + { + placeholder: t('Training Data Ratio'), + name: 'training_data_ratio', + label: t('TRAINING DATA RATIO'), + active: 'linear_regression', + status: 'range', + }, { placeholder: t('EPSİLON'), name: 'epsilon', diff --git a/superset-frontend/src/components/DvtSidebar/index.tsx b/superset-frontend/src/components/DvtSidebar/index.tsx index 3036b599f9797..0d6f0f10db6f7 100644 --- a/superset-frontend/src/components/DvtSidebar/index.tsx +++ b/superset-frontend/src/components/DvtSidebar/index.tsx @@ -34,6 +34,7 @@ import DvtInputSelect from '../DvtInputSelect'; import DvtDargCardList from '../DvtDragCardList'; import DvtCollapse from '../DvtCollapse'; import Icon from '../Icons/Icon'; +import DvtRange from '../DvtRange'; import { StyledDvtSidebar, StyledDvtSidebarHeader, @@ -474,6 +475,7 @@ const DvtSidebar: React.FC = ({ pathName, minWidth }) => { 'featureColumn', 'groupColumn', 'labelColumn', + 'training_data_ratio', ], }, { @@ -891,6 +893,30 @@ const DvtSidebar: React.FC = ({ pathName, minWidth }) => { typeDesign="chartsForm" /> )} + {data.status === 'range' && + data.active === + newTrainedTableSelector.algorithm.value && ( + { + updateProperty( + sidebarDataFindPathname.key, + data.name, + value, + ); + }} + label={data.label} + important + popoverDirection="top" + /> + )} {data.status === 'datepicker' && ( { max_bubble_size: { label: '25', value: '25' }, color_picker: { r: 0, g: 122, b: 135, a: 1 }, color_scheme: { label: 'Superset Colors', id: 'supersetColors' }, + truncateYAxis: true, }); const [chartApiUrl, setChartApiUrl] = useState(''); // const [exploreJsonUrl, setExploreJsonUrl] = useState(''); @@ -272,7 +273,7 @@ const DvtChart = () => { direction: 'desc', }); - const onlyExploreJson = ['heatmap', 'dist_bar', 'world_map']; + const onlyExploreJson = ['heatmap', 'dist_bar', 'world_map', 'histogram']; useEffect(() => { if (selectedVizType) { @@ -898,6 +899,9 @@ const DvtChart = () => { label: getFormData.max_bubble_size, value: getFormData.max_bubble_size, }, + truncateYAxis: getFormData?.truncateYAxis + ? getFormData.truncateYAxis + : false, }); setChartStatus('loading'); @@ -1184,6 +1188,16 @@ const DvtChart = () => { const checkObjectOrNullArrayFormation = (value: any) => Object.entries(value).map(i => (i[1] ? Number(i[1]) : null)); + const yAxisBoundsOnValueCharts = [ + 'echarts_timeseries_line', + 'echarts_timeseries_bar', + 'echarts_area', + 'echarts_timeseries_scatter', + 'bubble_v2', + 'heatmap', + 'dist_bar', + ]; + const formDataObj = { datasource: { id: selectedChart?.form_data?.url_params?.datasource_id, @@ -1281,10 +1295,10 @@ const DvtChart = () => { y_axis_format: active === 'heatmap' ? values.y_axis_format.value : 'SMART_NUMBER', truncateXAxis: true, - y_axis_bounds: - active === 'heatmap' - ? checkObjectOrNullArrayFormation(values.y_axis_bounds) - : [null, null], + truncateYAxis: values.truncateYAxis, + y_axis_bounds: yAxisBoundsOnValueCharts.includes(active) + ? checkObjectOrNullArrayFormation(values.y_axis_bounds) + : [null, null], extra_form_data: {}, force: false, result_format: 'json', @@ -1342,7 +1356,6 @@ const DvtChart = () => { time_compare: values.time_compare, time_compare_b: values.time_compare_b, tooltipSortByMetric: undefined, - truncateYAxis: active === 'echarts_timeseries_scatter' ? true : undefined, xAxisBounds: undefined, xAxisForceCategorical: undefined, xAxisLabelRotation: undefined, @@ -1474,6 +1487,7 @@ const DvtChart = () => { secondary_metric: metricsFormation('secondary_metric')[0], y_axis_bounds_secondary: [null, null], y_axis_format_secondary: 'SMART_NUMBER', + link_length: 5, }, queries: [ { @@ -1764,13 +1778,16 @@ const DvtChart = () => { } if (chartFullPromise.error) { setChartStatus('failed'); + const errorOrMessage = onlyExploreJson.includes(active) + ? 'error' + : 'message'; if (chartFullPromise.error?.errors) { setChartData(chartFullPromise.error.errors); - } else if (chartFullPromise.error?.message) { + } else if (chartFullPromise.error?.[errorOrMessage]) { setChartData([ { - error: chartFullPromise.error.message, - message: chartFullPromise.error.message, + error: chartFullPromise.error[errorOrMessage], + message: chartFullPromise.error[errorOrMessage], }, ]); } @@ -1969,8 +1986,8 @@ const DvtChart = () => { ); }; - const DataOrCustomize = chartTabs.value === 'customize' ? [] : DvtChartData; - // chartTabs.value === 'customize' ? DvtChartCustomize : DvtChartData; + const DataOrCustomize = + chartTabs.value === 'customize' ? DvtChartCustomize : DvtChartData; useEffect( () => () => { diff --git a/superset-frontend/src/pages/DvtDashboardEdit/index.tsx b/superset-frontend/src/pages/DvtDashboardEdit/index.tsx index b9da70c4957d8..a992fe477a26e 100644 --- a/superset-frontend/src/pages/DvtDashboardEdit/index.tsx +++ b/superset-frontend/src/pages/DvtDashboardEdit/index.tsx @@ -242,6 +242,7 @@ function DvtDashboardList() { const firstOrThenAddPosition = newRow ? position : firstCreatePosition; const gridChildren = firstOrThenAddPosition.GRID_ID.children; const indexBefore = gridChildren.indexOf(rowBefore); + const indexDropMove = gridChildren.indexOf(jsonDropMoveId); if (jsonDropNew) { setPosition({ @@ -263,15 +264,22 @@ function DvtDashboardList() { (v: string) => v !== jsonDropMoveId, ); + const minusIndexBefore = + indexBefore === -1 + ? gridChildren.length + : indexDropMove < indexBefore + ? indexBefore - 1 + : indexBefore; + setPosition({ ...firstOrThenAddPosition, GRID_ID: { ...firstOrThenAddPosition.GRID_ID, children: rowIdRemovedGridChildren - .slice(0, indexBefore) + .slice(0, minusIndexBefore) .concat( jsonDropMoveId, - rowIdRemovedGridChildren.slice(indexBefore), + rowIdRemovedGridChildren.slice(minusIndexBefore), ), }, }); @@ -566,7 +574,7 @@ function DvtDashboardList() { [], ); - console.log(position); + // console.log(position); return ( diff --git a/superset-frontend/src/pages/DvtNewTrainedTable/index.tsx b/superset-frontend/src/pages/DvtNewTrainedTable/index.tsx index b73a702dc6f6e..cfca7bcfe9331 100644 --- a/superset-frontend/src/pages/DvtNewTrainedTable/index.tsx +++ b/superset-frontend/src/pages/DvtNewTrainedTable/index.tsx @@ -84,6 +84,9 @@ function DvtNewTainedTable() { label_column: newTainedTableAddSelector.labelColumn?.value ? newTainedTableAddSelector.labelColumn?.value : undefined, + training_data_ratio: newTainedTableAddSelector.training_data_ratio + ? newTainedTableAddSelector.training_data_ratio + : undefined, }, } : { @@ -154,6 +157,7 @@ function DvtNewTainedTable() { { key: 'featureColumn' }, { key: 'groupColumn' }, { key: 'labelColumn' }, + { key: 'training_data_ratio' }, ]; useEffect(() => {