Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Share Entry Point & Add Shart Chart Drill Through #1641

Merged
merged 5 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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