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.
Merge branch 'feature/data-explorer' into feature/data-explorer-clean
- Loading branch information
Showing
20 changed files
with
234 additions
and
43 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
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
27 changes: 27 additions & 0 deletions
27
src/plugins/discover/public/application/view_components/canvas/canvas.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,27 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { AppMountParameters } from '../../../../../../core/public'; | ||
import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public'; | ||
import { DiscoverServices } from '../../../build_services'; | ||
import { TopNav } from './top_nav'; | ||
|
||
interface CanvasProps { | ||
opts: { | ||
setHeaderActionMenu: AppMountParameters['setHeaderActionMenu']; | ||
}; | ||
} | ||
|
||
export const Canvas = ({ opts }: CanvasProps) => { | ||
const { services } = useOpenSearchDashboards<DiscoverServices>(); | ||
|
||
return ( | ||
<div> | ||
<TopNav opts={opts} /> | ||
Canvas | ||
</div> | ||
); | ||
}; |
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
79 changes: 79 additions & 0 deletions
79
src/plugins/discover/public/application/view_components/canvas/top_nav.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,79 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React, { useEffect, useState } from 'react'; | ||
import { i18n } from '@osd/i18n'; | ||
import { AppMountParameters } from '../../../../../../core/public'; | ||
import { NEW_DISCOVER_APP, PLUGIN_ID } from '../../../../common'; | ||
import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public'; | ||
import { DiscoverServices } from '../../../build_services'; | ||
import { IndexPattern } from '../../../opensearch_dashboards_services'; | ||
|
||
export interface TopNavProps { | ||
opts: { | ||
setHeaderActionMenu: AppMountParameters['setHeaderActionMenu']; | ||
}; | ||
} | ||
|
||
export const TopNav = ({ opts }: TopNavProps) => { | ||
const { | ||
services: { | ||
uiSettings, | ||
navigation: { | ||
ui: { TopNavMenu }, | ||
}, | ||
core: { | ||
application: { navigateToApp }, | ||
}, | ||
data, | ||
}, | ||
} = useOpenSearchDashboards<DiscoverServices>(); | ||
const [indexPatterns, setIndexPatterns] = useState<IndexPattern[] | undefined>(undefined); | ||
|
||
useEffect(() => { | ||
if (uiSettings.get(NEW_DISCOVER_APP) === false) { | ||
const path = window.location.hash; | ||
navigateToApp('discoverLegacy', { | ||
replace: true, | ||
path, | ||
}); | ||
} | ||
|
||
return () => {}; | ||
}, [navigateToApp, uiSettings]); | ||
|
||
useEffect(() => { | ||
const getDefaultIndexPattern = async () => { | ||
await data.indexPatterns.ensureDefaultIndexPattern(); | ||
const indexPattern = await data.indexPatterns.getDefault(); | ||
|
||
setIndexPatterns(indexPattern ? [indexPattern] : undefined); | ||
}; | ||
|
||
getDefaultIndexPattern(); | ||
}, [data.indexPatterns]); | ||
|
||
return ( | ||
<TopNavMenu | ||
appName={PLUGIN_ID} | ||
config={[ | ||
{ | ||
label: i18n.translate('discover.localMenu.legacyDiscoverTitle', { | ||
defaultMessage: 'Legacy Discover', | ||
}), | ||
run: async () => { | ||
await uiSettings.set(NEW_DISCOVER_APP, false); | ||
window.location.reload(); | ||
}, | ||
emphasize: true, | ||
}, | ||
]} | ||
showSearchBar | ||
useDefaultBehaviors | ||
setMenuMountPoint={opts.setHeaderActionMenu} | ||
indexPatterns={indexPatterns} | ||
/> | ||
); | ||
}; |
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
10 changes: 10 additions & 0 deletions
10
src/plugins/discover/public/application/view_components/panel/panel.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,10 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
export const Panel = () => { | ||
return <div>Side Panel</div>; | ||
}; |
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
Oops, something went wrong.