forked from opensearch-project/OpenSearch-Dashboards
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[VisBuilder Integration] Add initial setup and migrate state management
Signed-off-by: ananzh <[email protected]>
- Loading branch information
Showing
101 changed files
with
4,811 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
export const PLUGIN_ID = 'vis-builder-new'; | ||
export const PLUGIN_NAME = 'VisBuilderNew'; | ||
export const VISUALIZE_ID = 'visualize'; | ||
export const EDIT_PATH = '/edit'; | ||
export const VIS_BUILDER_CHART_TYPE = 'VisBuilderNew'; | ||
|
||
export { | ||
VisBuilderSavedObjectAttributes, | ||
VISBUILDER_SAVED_OBJECT, | ||
} from './vis_builder_saved_object_attributes'; |
21 changes: 21 additions & 0 deletions
21
src/plugins/vis_builder_new/common/vis_builder_saved_object_attributes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { SavedObjectAttributes } from '../../../core/types'; | ||
|
||
export const VISBUILDER_SAVED_OBJECT = 'visualization-visbuilder-new'; | ||
|
||
export interface VisBuilderSavedObjectAttributes extends SavedObjectAttributes { | ||
title: string; | ||
description?: string; | ||
visualizationState?: string; | ||
updated_at?: string; | ||
styleState?: string; | ||
uiState?: string; | ||
version: number; | ||
searchSourceFields?: { | ||
index?: string; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { schema, TypeOf } from '@osd/config-schema'; | ||
|
||
export const configSchema = schema.object({ | ||
enabled: schema.boolean({ defaultValue: true }), | ||
}); | ||
|
||
export type ConfigSchema = TypeOf<typeof configSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"id": "visBuilder-new", | ||
"version": "1.0.0", | ||
"opensearchDashboardsVersion": "opensearchDashboards", | ||
"server": true, | ||
"ui": true, | ||
"requiredPlugins": [ | ||
"dashboard", | ||
"data", | ||
"embeddable", | ||
"expressions", | ||
"navigation", | ||
"savedObjects", | ||
"visualizations", | ||
"uiActions", | ||
"dataExplorer" | ||
], | ||
"requiredBundles": [ | ||
"charts", | ||
"opensearchDashboardsReact", | ||
"opensearchDashboardsUtils", | ||
"visDefaultEditor", | ||
"visTypeVislib" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
@mixin scrollNavParent($template-row: none) { | ||
display: grid; | ||
min-height: 0; | ||
|
||
@if $template-row != "none" { | ||
grid-template-rows: $template-row; | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/plugins/vis_builder_new/public/application/_variables.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
@import "@elastic/eui/src/global_styling/variables/header"; | ||
@import "@elastic/eui/src/global_styling/variables/form"; | ||
|
||
$osdHeaderOffset: $euiHeaderHeightCompensation; | ||
$vbLeftNavWidth: 462px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
@import "variables"; | ||
|
||
.vbLayout { | ||
padding: 0; | ||
display: grid; | ||
grid-template: | ||
"topNav topNav" min-content | ||
"leftNav workspaceNav" 1fr / #{$vbLeftNavWidth} 1fr; | ||
height: calc(100vh - #{$osdHeaderOffset}); | ||
|
||
&__resizeContainer { | ||
min-height: 0; | ||
background-color: $euiColorEmptyShade; | ||
} | ||
|
||
&__resizeButton { | ||
transform: translateX(-$euiSizeM / 2); | ||
} | ||
} | ||
|
||
.headerIsExpanded .vbLayout { | ||
height: calc(100vh - #{$osdHeaderOffset * 2}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useEffect } from 'react'; | ||
import { I18nProvider } from '@osd/i18n/react'; | ||
import { EuiPage, EuiResizableContainer } from '@elastic/eui'; | ||
import { useLocation } from 'react-router-dom'; | ||
// import { DragDropProvider } from './utils/drag_drop/drag_drop_context'; | ||
// import { LeftNav } from './components/left_nav'; | ||
// import { TopNav } from './components/top_nav'; | ||
// import { Workspace } from './components/workspace'; | ||
// import { RightNav } from './components/right_nav'; | ||
import { useOpenSearchDashboards } from '../../../opensearch_dashboards_react/public'; | ||
import { VisBuilderServices } from '../types'; | ||
import { syncQueryStateWithUrl } from '../../../data/public'; | ||
|
||
import './app.scss'; | ||
|
||
export const VisBuilderApp = () => { | ||
const { | ||
services: { | ||
data: { query }, | ||
osdUrlStateStorage, | ||
}, | ||
} = useOpenSearchDashboards<VisBuilderServices>(); | ||
const { pathname } = useLocation(); | ||
|
||
useEffect(() => { | ||
// syncs `_g` portion of url with query services | ||
const { stop } = syncQueryStateWithUrl(query, osdUrlStateStorage); | ||
|
||
return () => stop(); | ||
|
||
// this effect should re-run when pathname is changed to preserve querystring part, | ||
// so the global state is always preserved | ||
}, [query, osdUrlStateStorage, pathname]); | ||
|
||
// Render the application DOM. | ||
return ( | ||
<I18nProvider> | ||
{/* <DragDropProvider> | ||
<EuiPage className="vbLayout"> | ||
<TopNav /> | ||
<LeftNav /> | ||
<EuiResizableContainer className="vbLayout__resizeContainer"> | ||
{(EuiResizablePanel, EuiResizableButton) => ( | ||
<> | ||
<EuiResizablePanel | ||
className="vbLayout__workspaceResize" | ||
paddingSize="none" | ||
initialSize={80} | ||
minSize="300px" | ||
mode="main" | ||
> | ||
<Workspace /> | ||
</EuiResizablePanel> | ||
<EuiResizableButton className="vbLayout__resizeButton" /> | ||
<EuiResizablePanel | ||
className="vbLayout__rightNavResize" | ||
paddingSize="none" | ||
initialSize={20} | ||
minSize="250px" | ||
mode={[ | ||
'collapsible', | ||
{ | ||
position: 'top', | ||
}, | ||
]} | ||
id="vbRightResize" | ||
> | ||
<RightNav /> | ||
</EuiResizablePanel> | ||
</> | ||
)} | ||
</EuiResizableContainer> | ||
</EuiPage> | ||
</DragDropProvider>*/} | ||
</I18nProvider> | ||
); | ||
}; | ||
|
||
export { Option } from './components/option'; |
8 changes: 8 additions & 0 deletions
8
src/plugins/vis_builder_new/public/application/components/option.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.vbOption { | ||
background-color: $euiColorEmptyShade; | ||
padding: $euiSizeM; | ||
|
||
& &__panel { | ||
background-color: $euiColorLightestShade; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/plugins/vis_builder_new/public/application/components/option.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { EuiAccordion, EuiHorizontalRule, EuiPanel, EuiSpacer } from '@elastic/eui'; | ||
import React, { FC } from 'react'; | ||
import './option.scss'; | ||
|
||
interface Props { | ||
title: string; | ||
initialIsOpen?: boolean; | ||
} | ||
|
||
export const Option: FC<Props> = ({ title, children, initialIsOpen = false }) => { | ||
return ( | ||
<> | ||
<EuiAccordion | ||
id={title} | ||
buttonContent={title} | ||
className="vbOption" | ||
initialIsOpen={initialIsOpen} | ||
data-test-subj={`vbOption-${title.replace(/\s+/g, '-')}`} | ||
> | ||
<EuiSpacer size="s" /> | ||
<EuiPanel color="subdued" className="vbOption__panel"> | ||
{children} | ||
</EuiPanel> | ||
</EuiAccordion> | ||
<EuiHorizontalRule margin="none" /> | ||
</> | ||
); | ||
}; |
Oops, something went wrong.