-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create Plugin: Code split scaffolded apps (#1072)
- Loading branch information
Showing
32 changed files
with
124 additions
and
76 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
1 change: 0 additions & 1 deletion
1
packages/create-plugin/templates/app/src/components/App/index.tsx
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/create-plugin/templates/app/src/components/AppConfig/AppConfig.test.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
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
1 change: 0 additions & 1 deletion
1
packages/create-plugin/templates/app/src/components/AppConfig/index.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,26 @@ | ||
import React, { Suspense, lazy } from 'react'; | ||
import { AppPlugin, type AppRootProps } from '@grafana/data'; | ||
import { LoadingPlaceholder } from '@grafana/ui'; | ||
import type { AppConfigProps } from './components/AppConfig/AppConfig'; | ||
|
||
const LazyApp = lazy(() => import('./components/App/App')); | ||
const LazyAppConfig = lazy(() => import('./components/AppConfig/AppConfig')); | ||
|
||
const App = (props: AppRootProps) => ( | ||
<Suspense fallback={<LoadingPlaceholder text="" />}> | ||
<LazyApp {...props} /> | ||
</Suspense> | ||
); | ||
|
||
const AppConfig = (props: AppConfigProps) => ( | ||
<Suspense fallback={<LoadingPlaceholder text="" />}> | ||
<LazyAppConfig {...props} /> | ||
</Suspense> | ||
); | ||
|
||
export const plugin = new AppPlugin<{}>().setRootPage(App).addConfigPage({ | ||
title: 'Configuration', | ||
icon: 'cog', | ||
body: AppConfig, | ||
id: 'configuration', | ||
}); |
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 was deleted.
Oops, something went wrong.
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
18 changes: 9 additions & 9 deletions
18
packages/create-plugin/templates/scenes-app/src/components/App/App.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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import React from 'react'; | ||
import { AppRootProps } from '@grafana/data'; | ||
import { PluginPropsContext } from '../../utils/utils.plugin'; | ||
import { Routes } from '../Routes'; | ||
import { Routes } from '../Routes/Routes'; | ||
|
||
export class App extends React.PureComponent<AppRootProps> { | ||
render() { | ||
return ( | ||
<PluginPropsContext.Provider value={this.props}> | ||
<Routes /> | ||
</PluginPropsContext.Provider> | ||
); | ||
} | ||
function App(props: AppRootProps) { | ||
return ( | ||
<PluginPropsContext.Provider value={props}> | ||
<Routes /> | ||
</PluginPropsContext.Provider> | ||
); | ||
} | ||
|
||
export default App; |
1 change: 0 additions & 1 deletion
1
packages/create-plugin/templates/scenes-app/src/components/App/index.tsx
This file was deleted.
Oops, something went wrong.
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
1 change: 0 additions & 1 deletion
1
packages/create-plugin/templates/scenes-app/src/components/AppConfig/index.tsx
This file was deleted.
Oops, something went wrong.
10 changes: 5 additions & 5 deletions
10
packages/create-plugin/templates/scenes-app/src/components/Routes/Routes.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
1 change: 0 additions & 1 deletion
1
packages/create-plugin/templates/scenes-app/src/components/Routes/index.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
packages/create-plugin/templates/scenes-app/src/module.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,26 @@ | ||
import React, { Suspense, lazy } from 'react'; | ||
import { AppPlugin, type AppRootProps } from '@grafana/data'; | ||
import { LoadingPlaceholder } from '@grafana/ui'; | ||
import type { AppConfigProps } from './components/AppConfig/AppConfig'; | ||
|
||
const LazyApp = lazy(() => import('./components/App/App')); | ||
const LazyAppConfig = lazy(() => import('./components/AppConfig/AppConfig')); | ||
|
||
const App = (props: AppRootProps) => ( | ||
<Suspense fallback={<LoadingPlaceholder text="" />}> | ||
<LazyApp {...props} /> | ||
</Suspense> | ||
); | ||
|
||
const AppConfig = (props: AppConfigProps) => ( | ||
<Suspense fallback={<LoadingPlaceholder text="" />}> | ||
<LazyAppConfig {...props} /> | ||
</Suspense> | ||
); | ||
|
||
export const plugin = new AppPlugin<{}>().setRootPage(App).addConfigPage({ | ||
title: 'Configuration', | ||
icon: 'cog', | ||
body: AppConfig, | ||
id: 'configuration', | ||
}); |
4 changes: 3 additions & 1 deletion
4
packages/create-plugin/templates/scenes-app/src/pages/HelloWorld/HelloWorld.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 |
---|---|---|
@@ -1,8 +1,10 @@ | ||
import React from 'react'; | ||
import { getScene } from './helloWorldScene'; | ||
|
||
export const HelloWorldPluginPage = () => { | ||
const HelloWorld = () => { | ||
const scene = getScene(); | ||
|
||
return <scene.Component model={scene} />; | ||
}; | ||
|
||
export default HelloWorld; |
1 change: 0 additions & 1 deletion
1
packages/create-plugin/templates/scenes-app/src/pages/HelloWorld/index.tsx
This file was deleted.
Oops, something went wrong.
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
1 change: 0 additions & 1 deletion
1
packages/create-plugin/templates/scenes-app/src/pages/Home/index.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.