add create entity plugin
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
"@backstage/plugin-hello-world": "0.0.0",
|
||||
"@backstage/plugin-home-page": "0.0.0",
|
||||
"@backstage/plugin-login": "0.0.0",
|
||||
"@backstage/plugin-create-entity": "0.0.0",
|
||||
"@react-workspaces/react-scripts": "^3.3.0-alpha-08",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.3.2",
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
import { BackstageTheme, createApp, InfoCard } from '@backstage/core';
|
||||
import HomePagePlugin from '@backstage/plugin-home-page';
|
||||
import {
|
||||
BackstageTheme,
|
||||
createApp,
|
||||
InfoCard,
|
||||
} from '@backstage/core';
|
||||
//import PageHeader from './components/PageHeader';
|
||||
import { LoginComponent } from '@backstage/plugin-login';
|
||||
import HomePagePlugin from '@backstage/plugin-home-page';
|
||||
import CreateEntityPlugin from '@backstage/plugin-create-entity';
|
||||
import { CssBaseline, makeStyles, ThemeProvider } from '@material-ui/core';
|
||||
import React, { FC } from 'react';
|
||||
import { BrowserRouter as Router } from 'react-router-dom';
|
||||
@@ -60,6 +65,7 @@ const app = createApp();
|
||||
|
||||
app.registerEntityKind(...entities);
|
||||
app.registerPlugin(HomePagePlugin);
|
||||
app.registerPlugin(CreateEntityPlugin);
|
||||
|
||||
const AppComponent = app.build();
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Welcome to your create-entity plugin!
|
||||
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
...require('@spotify/web-scripts/config/jest.config.js'),
|
||||
setupFilesAfterEnv: ['../jest.setup.ts'],
|
||||
};
|
||||
@@ -0,0 +1 @@
|
||||
import '@testing-library/jest-dom/extend-expect';
|
||||
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@backstage/plugin-create-entity",
|
||||
"version": "0.0.0",
|
||||
"main": "src/index.ts",
|
||||
"main:src": "src/index.ts",
|
||||
"devDependencies": {
|
||||
"@backstage/core": "0.0.0",
|
||||
"@backstage/protobuf-definitions": "0.0.0",
|
||||
"@spotify/web-scripts": "^6.0.0",
|
||||
"@testing-library/jest-dom": "^4.2.4",
|
||||
"@testing-library/react": "^9.3.2",
|
||||
"@testing-library/user-event": "^7.1.2",
|
||||
"@types/jest": "^24.0.0",
|
||||
"@types/node": "^12.0.0",
|
||||
"@types/react": "^16.9.0",
|
||||
"@types/react-dom": "^16.9.0",
|
||||
"react": "^16.12.0",
|
||||
"react-dom": "^16.12.0",
|
||||
"@material-ui/core": "^4.9.1",
|
||||
"@material-ui/icons": "^4.9.1"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "web-scripts lint",
|
||||
"test": "web-scripts test"
|
||||
},
|
||||
"license": "Apache-2.0"
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
import { render } from '@testing-library/react';
|
||||
import CreateEntityPage from './CreateEntityPage';
|
||||
|
||||
describe('CreateEntityPage', () => {
|
||||
it('should render', () => {
|
||||
const rendered = render(<CreateEntityPage />);
|
||||
expect(rendered.getByText('Hello!')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
import React, { FC, Fragment } from 'react';
|
||||
import { InfoCard } from '@backstage/core';
|
||||
import { IdentityClient, GetUserRequest } from "@backstage/protocol-definitions/generated/identity/v1/identity_pb_service";
|
||||
|
||||
const client = new IdentityClient("http://localhost:8080");
|
||||
const req = new GetUserRequest();
|
||||
req.setUsername("johndoe");
|
||||
client.getUser(req, (err, user) => {
|
||||
console.log(err);
|
||||
console.log(user);
|
||||
});
|
||||
|
||||
const CreateEntityPage: FC<{}> = () => {
|
||||
return (
|
||||
<Fragment>
|
||||
<InfoCard title="Create New ..."></InfoCard>
|
||||
</Fragment>
|
||||
);
|
||||
};
|
||||
|
||||
export default CreateEntityPage;
|
||||
@@ -0,0 +1 @@
|
||||
export { default } from './CreateEntityPage';
|
||||
@@ -0,0 +1,2 @@
|
||||
export { default } from './plugin';
|
||||
export { default as CreateEntityPage } from './components/CreateEntityPage';
|
||||
@@ -0,0 +1,7 @@
|
||||
import plugin from './plugin';
|
||||
|
||||
describe('create-entity', () => {
|
||||
it('should export plugin', () => {
|
||||
expect(plugin).toBeDefined();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
import { createPlugin } from '@backstage/core';
|
||||
import CreateEntityPage from './components/CreateEntityPage';
|
||||
|
||||
export default createPlugin({
|
||||
id: 'create-entity',
|
||||
register({ router }) {
|
||||
router.registerRoute('/create', CreateEntityPage);
|
||||
},
|
||||
});
|
||||
@@ -15730,6 +15730,13 @@ ts-pnp@1.1.5, ts-pnp@^1.1.2:
|
||||
resolved "https://registry.npmjs.org/ts-pnp/-/ts-pnp-1.1.5.tgz#840e0739c89fce5f3abd9037bb091dbff16d9dec"
|
||||
integrity sha512-ti7OGMOUOzo66wLF3liskw6YQIaSsBgc4GOAlWRnIEj8htCxJUxskanMUoJOD6MDCRAXo36goXJZch+nOS0VMA==
|
||||
|
||||
ts-protoc-gen@^0.12.0:
|
||||
version "0.12.0"
|
||||
resolved "https://registry.npmjs.org/ts-protoc-gen/-/ts-protoc-gen-0.12.0.tgz#932e5738f14b67e7202825b06f8c548cb7d8ef34"
|
||||
integrity sha512-V7jnICJxKqalBrnJSMTW5tB9sGi48gOC325bfcM7TDNUItVOlaMM//rQmuo49ybipk/SyJTnWXgtJnhHCevNJw==
|
||||
dependencies:
|
||||
google-protobuf "^3.6.1"
|
||||
|
||||
tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0:
|
||||
version "1.10.0"
|
||||
resolved "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a"
|
||||
|
||||
Reference in New Issue
Block a user