This is an automated email from the ASF dual-hosted git repository. vogievetsky pushed a commit to branch explore_source in repository https://gitbox.apache.org/repos/asf/druid.git
commit bd8d8a27056debfa2b4a78ddd46a3c9edb8d00eb Author: Vadim Ogievetsky <[email protected]> AuthorDate: Tue Aug 13 14:54:46 2024 -0700 highlight --- .../models/highlight.ts} | 47 +--------------------- web-console/src/modules/models/index.ts | 1 + .../highlight-store/highlight-store.ts | 43 +------------------- 3 files changed, 3 insertions(+), 88 deletions(-) diff --git a/web-console/src/views/explore-view/highlight-store/highlight-store.ts b/web-console/src/modules/models/highlight.ts similarity index 58% copy from web-console/src/views/explore-view/highlight-store/highlight-store.ts copy to web-console/src/modules/models/highlight.ts index 4de8c4bd7b5..528ed9a25af 100644 --- a/web-console/src/views/explore-view/highlight-store/highlight-store.ts +++ b/web-console/src/modules/models/highlight.ts @@ -16,9 +16,7 @@ * limitations under the License. */ -import { createStore } from 'zustand'; - -interface Highlight { +export interface Highlight { /** * The label of the highlight. */ @@ -60,46 +58,3 @@ interface Highlight { */ data?: any; } - -interface HighlightState { - /** - * The current highlight. - */ - highlight: Highlight | undefined; - - /** - * Sets the highlight. - * @param highlight the highlight to set - */ - setHighlight: (highlight: Highlight) => void; - - /** - * Drops the highlight. - */ - dropHighlight: () => void; - - /** - * Updates the highlight. - * @param highlight the highlight to update (only the properties to update) - * @returns the updated highlight, or undefined if there's no highlight in the store - */ - updateHighlight: (highlight: Partial<Highlight>) => Highlight | undefined; -} - -/** - * A lightweight store for the highlight. - */ -export const highlightStore = createStore<HighlightState>((set, get) => ({ - highlight: undefined, - setHighlight: highlight => set({ highlight }), - dropHighlight: () => set({ highlight: undefined }), - updateHighlight: highlight => { - set(state => { - if (!state.highlight) return state; - - return { highlight: { ...state.highlight, ...highlight } }; - }); - - return get().highlight; - }, -})); diff --git a/web-console/src/modules/models/index.ts b/web-console/src/modules/models/index.ts index d43307119a7..66c4b8226e1 100644 --- a/web-console/src/modules/models/index.ts +++ b/web-console/src/modules/models/index.ts @@ -17,6 +17,7 @@ */ export * from './expression-meta'; +export * from './highlight'; export * from './measure'; export * from './parameter'; export * from './query-source'; diff --git a/web-console/src/views/explore-view/highlight-store/highlight-store.ts b/web-console/src/views/explore-view/highlight-store/highlight-store.ts index 4de8c4bd7b5..1f479f8c5c3 100644 --- a/web-console/src/views/explore-view/highlight-store/highlight-store.ts +++ b/web-console/src/views/explore-view/highlight-store/highlight-store.ts @@ -18,48 +18,7 @@ import { createStore } from 'zustand'; -interface Highlight { - /** - * The label of the highlight. - */ - label: string; - - /** - * The x coordinate of the highlight. - */ - x: number; - - /** - * The y coordinate of the highlight. - */ - y: number; - - /** - * Optional x offset for the highlight (useful for scrolling offset) - */ - offsetX?: number; - - /** - * Optional y offset for the highlight (useful for scrolling offset) - */ - offsetY?: number; - - /** - * Called when the highlight is dropped (when the "cancel" button is clicked) - */ - onDrop: () => void; - - /** - * Called when the highlight is saved (when the "save" button is clicked) - * @param highlight The highlight to save - */ - onSave?: (highlight: Highlight) => void; - - /** - * Optional data attached to the highlight. - */ - data?: any; -} +import type { Highlight } from '../../../modules'; interface HighlightState { /** --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
