Skip to content

Commit

Permalink
fix: lazily create metadata (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw authored and zhaoyongjie committed Nov 26, 2021
1 parent 7ca247c commit ede2e92
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { t } from '@superset-ui/translation';
import { ChartMetadata } from '@superset-ui/chart';
import thumbnail from './images/thumbnail.png';

export default function createMetadata(useLegacyApi = false) {
return new ChartMetadata({
description: '',
name: t('Line Chart'),
thumbnail,
useLegacyApi,
});
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ChartPlugin } from '@superset-ui/chart';
import metadata from './metadata';
import transformProps from './transformProps';
import createMetadata from './createMetadata';
import buildQuery from './buildQuery';
import ChartFormData from './ChartFormData';

Expand All @@ -9,7 +9,7 @@ export default class LineChartPlugin extends ChartPlugin<ChartFormData> {
super({
buildQuery,
loadChart: () => import('./Line'),
metadata,
metadata: createMetadata(),
transformProps,
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ChartPlugin } from '@superset-ui/chart';
import metadata from './metadata';
import transformProps from './transformProps';
import createMetadata from '../createMetadata';

export default class LineChartPlugin extends ChartPlugin {
constructor() {
super({
loadChart: () => import('../Line'),
metadata,
metadata: createMetadata(true),
transformProps,
});
}
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit ede2e92

Please sign in to comment.