Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Commit

Permalink
fix: lazily create metadata (#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
kristw authored Apr 26, 2019
1 parent 9cf6f86 commit 2fef425
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 21 deletions.
12 changes: 12 additions & 0 deletions packages/superset-ui-preset-chart-xy/src/Line/createMetadata.ts
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,
});
}
4 changes: 2 additions & 2 deletions packages/superset-ui-preset-chart-xy/src/Line/index.ts
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
4 changes: 2 additions & 2 deletions packages/superset-ui-preset-chart-xy/src/Line/legacy/index.ts
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.

11 changes: 0 additions & 11 deletions packages/superset-ui-preset-chart-xy/src/Line/metadata.ts

This file was deleted.

0 comments on commit 2fef425

Please sign in to comment.