Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Commit

Permalink
Feat: Enable warnings when values are overwritten in registries (#107)
Browse files Browse the repository at this point in the history
* enable warning

* add warning

* fix order
  • Loading branch information
kristw authored and zhaoyongjie committed Nov 26, 2021
1 parent 11378a4 commit 0f5e88e
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Registry, makeSingleton } from '@superset-ui/core';
import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core';

class ChartBuildQueryRegistry extends Registry {
constructor() {
super({ name: 'ChartBuildQuery' });
super({ name: 'ChartBuildQuery', overwritePolicy: OverwritePolicy.WARN });
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Registry, makeSingleton } from '@superset-ui/core';
import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core';

class ChartComponentRegistry extends Registry {
constructor() {
super({ name: 'ChartComponent' });
super({ name: 'ChartComponent', overwritePolicy: OverwritePolicy.WARN });
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Registry, makeSingleton } from '@superset-ui/core';
import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core';

class ChartMetadataRegistry extends Registry {
constructor() {
super({ name: 'ChartMetadata' });
super({ name: 'ChartMetadata', overwritePolicy: OverwritePolicy.WARN });
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Registry, makeSingleton } from '@superset-ui/core';
import { Registry, makeSingleton, OverwritePolicy } from '@superset-ui/core';

class ChartTransformPropsRegistry extends Registry {
constructor() {
super({ name: 'ChartTransformProps' });
super({ name: 'ChartTransformProps', overwritePolicy: OverwritePolicy.WARN });
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { RegistryWithDefaultKey } from '@superset-ui/core';
import { RegistryWithDefaultKey, OverwritePolicy } from '@superset-ui/core';

export default class ColorSchemeRegistry<T> extends RegistryWithDefaultKey<T> {
constructor() {
super({
name: 'ColorScheme',
overwritePolicy: OverwritePolicy.WARN,
setFirstItemAsDefault: true,
});
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegistryWithDefaultKey } from '@superset-ui/core';
import { RegistryWithDefaultKey, OverwritePolicy } from '@superset-ui/core';
import createD3NumberFormatter from './factories/createD3NumberFormatter';
import NumberFormats from './NumberFormats';
import NumberFormatter from './NumberFormatter';
Expand All @@ -11,6 +11,7 @@ export default class NumberFormatterRegistry extends RegistryWithDefaultKey<
super({
initialDefaultKey: NumberFormats.SI,
name: 'NumberFormatter',
overwritePolicy: OverwritePolicy.WARN,
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { RegistryWithDefaultKey } from '@superset-ui/core';
import { RegistryWithDefaultKey, OverwritePolicy } from '@superset-ui/core';
import TimeFormats, { LOCAL_PREFIX } from './TimeFormats';
import createD3TimeFormatter from './factories/createD3TimeFormatter';
import TimeFormatter from './TimeFormatter';
Expand All @@ -11,6 +11,7 @@ export default class TimeFormatterRegistry extends RegistryWithDefaultKey<
super({
initialDefaultKey: TimeFormats.DATABASE_DATETIME,
name: 'TimeFormatter',
overwritePolicy: OverwritePolicy.WARN,
});
}

Expand Down

0 comments on commit 0f5e88e

Please sign in to comment.