Skip to content

Commit

Permalink
feat(core): expand native filter hook and add chart metadata fields (a…
Browse files Browse the repository at this point in the history
…pache#943)

* refactor: update setExtraFormData hook / change isNativeFilter Property / remove native filters

* refactor: clear storybook

* refactor: update type place

* refactor: add dasourceCount property

* refactor: fix CR notes
  • Loading branch information
simcha90 authored and zhaoyongjie committed Nov 26, 2021
1 parent 74d02a3 commit 25a98fb
Show file tree
Hide file tree
Showing 25 changed files with 25 additions and 1,101 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Behavior } from '../types/Base';

interface LookupTable {
[key: string]: boolean;
}
Expand All @@ -7,11 +9,12 @@ export interface ChartMetadataConfig {
canBeAnnotationTypes?: string[];
credits?: string[];
description?: string;
datasourceCount?: number;
show?: boolean;
supportedAnnotationTypes?: string[];
thumbnail: string;
useLegacyApi?: boolean;
isNativeFilter?: boolean;
behaviors?: Behavior[];
}

export default class ChartMetadata {
Expand All @@ -33,7 +36,9 @@ export default class ChartMetadata {

useLegacyApi: boolean;

isNativeFilter: boolean;
behaviors: Behavior[];

datasourceCount: number;

constructor(config: ChartMetadataConfig) {
const {
Expand All @@ -45,7 +50,8 @@ export default class ChartMetadata {
supportedAnnotationTypes = [],
thumbnail,
useLegacyApi = false,
isNativeFilter = false,
behaviors = [],
datasourceCount = 1,
} = config;

this.name = name;
Expand All @@ -65,7 +71,8 @@ export default class ChartMetadata {
this.supportedAnnotationTypes = supportedAnnotationTypes;
this.thumbnail = thumbnail;
this.useLegacyApi = useLegacyApi;
this.isNativeFilter = isNativeFilter;
this.behaviors = behaviors;
this.datasourceCount = datasourceCount;
}

canBeAnnotationType(type: string): boolean {
Expand All @@ -82,7 +89,8 @@ export default class ChartMetadata {
supportedAnnotationTypes: this.supportedAnnotationTypes,
thumbnail: this.thumbnail,
useLegacyApi: this.useLegacyApi,
isNativeFilter: this.isNativeFilter,
behaviors: this.behaviors,
datasourceCount: this.datasourceCount,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,19 @@ import { ExtraFormData } from '../../query';

export type HandlerFunction = (...args: unknown[]) => void;

export enum Behavior {
CROSS_FILTER = 'CROSS_FILTER',
NATIVE_FILTER = 'NATIVE_FILTER',
}

export type SetExtraFormDataHook = {
(extraFormData: ExtraFormData): void;
({
extraFormData,
currentState: { value },
}: {
extraFormData: ExtraFormData;
currentState: { value: any; [key: string]: any };
}): void;
};

export interface PlainObject {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 25a98fb

Please sign in to comment.