Skip to content

Commit

Permalink
Merge pull request #1641 from Cuiyansong/master
Browse files Browse the repository at this point in the history
Refactor Share Entry Point & Add Shart Chart Drill Through
  • Loading branch information
qxqzx13 authored Jul 13, 2022
2 parents 1de8da0 + af57e79 commit 3b1ccec
Show file tree
Hide file tree
Showing 42 changed files with 763 additions and 626 deletions.
6 changes: 3 additions & 3 deletions frontend/craco.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ const {
const rewireEntries = [
{
name: 'shareChart',
entry: path.resolve(__dirname, './src/shareChart.tsx'),
entry: path.resolve(__dirname, './src/shareChart.entry.ts'),
outPath: 'shareChart.html',
},
{
name: 'shareDashboard',
entry: path.resolve(__dirname, './src/shareDashboard.tsx'),
entry: path.resolve(__dirname, './src/shareDashboard.entry.ts'),
outPath: 'shareDashboard.html',
},
{
name: 'shareStoryPlayer',
entry: path.resolve(__dirname, './src/shareStoryPlayer.tsx'),
entry: path.resolve(__dirname, './src/shareStoryPlayer.entry.ts'),
outPath: 'shareStoryPlayer.html',
},
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { getSystemInfo, logout, setLoggedInUser } from './slice/thunks';

registerTheme('default', echartsDefaultTheme);

export function App() {
export function AppRouter() {
const dispatch = useDispatch();
const { i18n } = useTranslation();
const logged = !!getToken();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ const DrillThroughPanel: FC<ItemLayoutProps<ChartStyleConfig>> = memo(
layout="horizontal"
size="middle"
>
<Form.Item label={t('drillThrough.rule.title')} name="rule">
<Form.Item
label={t('drillThrough.rule.title')}
name="rule"
tooltip={t('drillThrough.rule.tip')}
>
<Button type="link" onClick={handleAddRule}>
{t('drillThrough.rule.addRule')}
</Button>
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/app/hooks/useChartInteractions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ const useChartInteractions = (props: {
computedFields,
aggregation,
chartConfig,
isJumpUrlOnly,
}) => {
if (drillThroughSetting) {
const sourceChartFilters = new ChartDataRequestBuilder(
Expand All @@ -175,13 +176,19 @@ const useChartInteractions = (props: {
const hasNoSelectedItems = isEmptyArray(
clickEventParams?.selectedItems,
);

if (hasNoSelectedItems) {
return;
}

(drillThroughSetting?.rules || [])
.filter(rule => rule.event === targetEvent)
.filter(rule => isEmpty(ruleId) || rule.id === ruleId)
.filter(
rule =>
!isJumpUrlOnly ||
rule?.category === InteractionCategory.JumpToUrl,
)
.forEach(rule => {
const clickFilters = buildClickEventBaseFilters(
clickEventParams?.selectedItems?.map(item => item?.data?.rowData),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ export const InteractionI18N = {
title: '跳转设置',
rule: {
title: '规则设置',
tip: '分享页仅支持跳转到URL一种方式',
addRule: '+ 点击新建',
inputUrl: '请输入URL',
header: {
Expand Down Expand Up @@ -210,6 +211,7 @@ export const InteractionI18N = {
title: 'Drill Through',
rule: {
title: 'Rule',
tip: 'Drill through only support jump to url',
addRule: '+ Add New',
inputUrl: 'Please input url',
header: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,6 @@ const ChartPreviewBoard: FC<{
<StyledChartDrillPathsContainer>
<ChartDrillPaths chartConfig={chartPreview?.chartConfig!} />
</StyledChartDrillPathsContainer>
<StyledChartDrillPathsContainer />
</ChartDrillContext.Provider>
</PreviewBlock>
{viewDetailPanelContextHolder}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@
* limitations under the License.
*/

export { default as ChartPreview } from './ChartPreview';
export { default as ChartPreviewBoard } from './ChartPreviewBoard';
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ResourceTypes,
VizResourceSubTypes,
} from '../../PermissionPage/constants';
import { ChartPreview } from '../ChartPreview';
import { ChartPreviewBoard } from '../ChartPreview';
import { FolderViewModel, VizTab } from '../slice/types';

interface VizContainerProps {
Expand Down Expand Up @@ -70,7 +70,7 @@ export const VizContainer = memo(
break;
case 'DATACHART':
content = (
<ChartPreview
<ChartPreviewBoard
key={id}
backendChartId={id}
orgId={orgId}
Expand Down
Loading

0 comments on commit 3b1ccec

Please sign in to comment.