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.
[D&D] Adds Bar line and Area charts to Wizard (opensearch-project#2266)…
… (opensearch-project#2291) Description * Adds Bar line and Area charts to Wizard * Adds resizable right nav to Wizard * E2E tests for bar chart and chart switching Issues Resolved: opensearch-project#1616 opensearch-project#1617 opensearch-project#1618 Co-authored-by: Josh Romero <rmerqg@amazon.com> Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>
- Loading branch information
1 parent
3e7e41d
commit 1ab0f0a
Showing
51 changed files
with
1,094 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
INLINE_RUNTIME_CHUNK=false |
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,7 @@ | ||
module.exports = { | ||
root: true, | ||
extends: ['@elastic/eslint-config-kibana', 'plugin:@elastic/eui/recommended'], | ||
rules: { | ||
'@osd/eslint/require-license-header': 'off', | ||
}, | ||
}; |
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,7 @@ | ||
{ | ||
"prefix": "googleAnalytic", | ||
"paths": { | ||
"googleAnalytic": "." | ||
}, | ||
"translations": ["translations/ja-JP.json"] | ||
} |
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,11 @@ | ||
# googleAnalytic | ||
|
||
A OpenSearch Dashboards plugin | ||
|
||
--- | ||
|
||
## Development | ||
|
||
See the [OpenSearch Dashboards contributing | ||
guide](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/CONTRIBUTING.md) for instructions | ||
setting up your development environment. |
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,2 @@ | ||
export const PLUGIN_ID = 'googleAnalytic'; | ||
export const PLUGIN_NAME = 'googleAnalytic'; |
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 @@ | ||
{ | ||
"id": "googleAnalytic", | ||
"version": "1.0.0", | ||
"opensearchDashboardsVersion": "opensearchDashboards", | ||
"server": false, | ||
"ui": true, | ||
"requiredPlugins": ["navigation"], | ||
"optionalPlugins": [] | ||
} |
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,29 @@ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import ReactGA from 'react-ga'; | ||
import { AppMountParameters, CoreStart } from '../../../core/public'; | ||
import { AppPluginStartDependencies } from './types'; | ||
import { GoogleAnalyticApp } from './components/app'; | ||
|
||
const TRACKING_ID = 'UA-20742809-1'; // YOUR_OWN_TRACKING_ID | ||
// eslint-disable-next-line no-console | ||
console.log('huanji debug'); | ||
ReactGA.initialize(TRACKING_ID); | ||
|
||
export const renderApp = ( | ||
{ notifications, http }: CoreStart, | ||
{ navigation }: AppPluginStartDependencies, | ||
{ appBasePath, element }: AppMountParameters | ||
) => { | ||
ReactDOM.render( | ||
<GoogleAnalyticApp | ||
basename={appBasePath} | ||
notifications={notifications} | ||
http={http} | ||
navigation={navigation} | ||
/>, | ||
element | ||
); | ||
|
||
return () => ReactDOM.unmountComponentAtNode(element); | ||
}; |
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,108 @@ | ||
import React, { useState } from 'react'; | ||
import { i18n } from '@osd/i18n'; | ||
import { FormattedMessage, I18nProvider } from '@osd/i18n/react'; | ||
import { BrowserRouter as Router } from 'react-router-dom'; | ||
|
||
import { | ||
EuiButton, | ||
EuiHorizontalRule, | ||
EuiPage, | ||
EuiPageBody, | ||
EuiPageContent, | ||
EuiPageContentBody, | ||
EuiPageContentHeader, | ||
EuiPageHeader, | ||
EuiTitle, | ||
EuiText, | ||
} from '@elastic/eui'; | ||
|
||
import { CoreStart } from '../../../../core/public'; | ||
import { NavigationPublicPluginStart } from '../../../navigation/public'; | ||
|
||
import { PLUGIN_ID, PLUGIN_NAME } from '../../common'; | ||
|
||
interface GoogleAnalyticAppDeps { | ||
basename: string; | ||
notifications: CoreStart['notifications']; | ||
http: CoreStart['http']; | ||
navigation: NavigationPublicPluginStart; | ||
} | ||
|
||
export const GoogleAnalyticApp = ({ | ||
basename, | ||
notifications, | ||
http, | ||
navigation, | ||
}: GoogleAnalyticAppDeps) => { | ||
// Use React hooks to manage state. | ||
const [timestamp, setTimestamp] = useState<string | undefined>(); | ||
|
||
const onClickHandler = () => { | ||
setTimestamp(new Date().toISOString()); | ||
notifications.toasts.addSuccess(PLUGIN_NAME); | ||
}; | ||
|
||
// Render the application DOM. | ||
// Note that `navigation.ui.TopNavMenu` is a stateful component exported on the `navigation` plugin's start contract. | ||
return ( | ||
<Router basename={basename}> | ||
<I18nProvider> | ||
<> | ||
<navigation.ui.TopNavMenu | ||
appName={PLUGIN_ID} | ||
showSearchBar={true} | ||
useDefaultBehaviors={true} | ||
/> | ||
<EuiPage restrictWidth="1000px"> | ||
<EuiPageBody component="main"> | ||
<EuiPageHeader> | ||
<EuiTitle size="l"> | ||
<h1> | ||
<FormattedMessage | ||
id="googleAnalytic.helloWorldText" | ||
defaultMessage="{name}" | ||
values={{ name: PLUGIN_NAME }} | ||
/> | ||
</h1> | ||
</EuiTitle> | ||
</EuiPageHeader> | ||
<EuiPageContent> | ||
<EuiPageContentHeader> | ||
<EuiTitle> | ||
<h2> | ||
<FormattedMessage | ||
id="googleAnalytic.congratulationsTitle" | ||
defaultMessage="Congratulations, you have successfully created a new OpenSearch Dashboards Plugin!" | ||
/> | ||
</h2> | ||
</EuiTitle> | ||
</EuiPageContentHeader> | ||
<EuiPageContentBody> | ||
<EuiText> | ||
<p> | ||
<FormattedMessage | ||
id="googleAnalytic.content" | ||
defaultMessage="Look through the generated code and check out the plugin development documentation." | ||
/> | ||
</p> | ||
<EuiHorizontalRule /> | ||
<p> | ||
<FormattedMessage | ||
id="googleAnalytic.timestampText" | ||
defaultMessage="Last timestamp: {time}" | ||
values={{ time: timestamp ? timestamp : 'Unknown' }} | ||
/> | ||
</p> | ||
<EuiButton type="primary" size="s" onClick={onClickHandler}> | ||
<FormattedMessage id="googleAnalytic.buttonText" defaultMessage="Click me" /> | ||
</EuiButton> | ||
</EuiText> | ||
</EuiPageContentBody> | ||
</EuiPageContent> | ||
</EuiPageBody> | ||
</EuiPage> | ||
</> | ||
</I18nProvider> | ||
</Router> | ||
); | ||
}; |
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 @@ | ||
console.log('from hack'); | ||
debugger | ||
|
||
import ReactGA from 'react-ga'; | ||
try { | ||
const TRACKING_ID = 'UA-20742809-1'; // YOUR_OWN_TRACKING_ID | ||
ReactGA.initialize(TRACKING_ID); | ||
|
||
ReactGA.pageview(window.location.pathname + window.location.search); | ||
} catch (e) { | ||
console.error(e); | ||
} |
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 @@ | ||
/* stylelint-disable no-empty-source */ |
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 @@ | ||
import './index.scss'; | ||
|
||
import { GoogleAnalyticPlugin } from './plugin'; | ||
|
||
// This exports static code and TypeScript types, | ||
// as well as, OpenSearch Dashboards Platform `plugin()` initializer. | ||
export function plugin() { | ||
return new GoogleAnalyticPlugin(); | ||
} | ||
export { GoogleAnalyticPluginSetup, GoogleAnalyticPluginStart } from './types'; |
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,47 @@ | ||
import { i18n } from '@osd/i18n'; | ||
import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '../../../core/public'; | ||
import { | ||
GoogleAnalyticPluginSetup, | ||
GoogleAnalyticPluginStart, | ||
AppPluginStartDependencies, | ||
} from './types'; | ||
import { PLUGIN_NAME } from '../common'; | ||
|
||
import './hacks.js'; | ||
|
||
export class GoogleAnalyticPlugin | ||
implements Plugin<GoogleAnalyticPluginSetup, GoogleAnalyticPluginStart> { | ||
public setup(core: CoreSetup): GoogleAnalyticPluginSetup { | ||
// Register an application into the side navigation menu | ||
core.application.register({ | ||
id: 'googleAnalytic', | ||
title: PLUGIN_NAME, | ||
async mount(params: AppMountParameters) { | ||
// Load application bundle | ||
const { renderApp } = await import('./application'); | ||
// Get start services as specified in opensearch_dashboards.json | ||
const [coreStart, depsStart] = await core.getStartServices(); | ||
// Render the application | ||
return renderApp(coreStart, depsStart as AppPluginStartDependencies, params); | ||
}, | ||
}); | ||
|
||
// Return methods that should be available to other plugins | ||
return { | ||
getGreeting() { | ||
return i18n.translate('googleAnalytic.greetingText', { | ||
defaultMessage: 'Hello from {name}!', | ||
values: { | ||
name: PLUGIN_NAME, | ||
}, | ||
}); | ||
}, | ||
}; | ||
} | ||
|
||
public start(core: CoreStart): GoogleAnalyticPluginStart { | ||
return {}; | ||
} | ||
|
||
public stop() {} | ||
} |
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,11 @@ | ||
import { NavigationPublicPluginStart } from '../../navigation/public'; | ||
|
||
export interface GoogleAnalyticPluginSetup { | ||
getGreeting: () => string; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface GoogleAnalyticPluginStart {} | ||
|
||
export interface AppPluginStartDependencies { | ||
navigation: NavigationPublicPluginStart; | ||
} |
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
Oops, something went wrong.