Shubham | Add. Form for manifest data

This commit is contained in:
Kuamr Shubham
2020-04-28 12:21:05 +05:30
parent 6607795ef7
commit 02f67d0fff
3 changed files with 36 additions and 9 deletions

View File

@@ -6,6 +6,8 @@
"@jsonforms/core": "^2.3.2",
"@jsonforms/material-renderers": "^2.3.2",
"@jsonforms/react": "^2.3.2",
"@material-ui/core": "^4.9.12",
"@material-ui/icons": "^4.9.1",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
@@ -15,6 +17,7 @@
"@types/react-dom": "^16.9.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-redux": "^7.2.0",
"react-scripts": "3.4.0",
"typescript": "~3.7.2"
},

View File

@@ -0,0 +1,21 @@
import * as React from 'react';
import { shallow } from 'enzyme';
import Form from "./Form";
import {TextField} from "@material-ui/core";
import {render} from "react-dom";
import {JsonForms} from "@jsonforms/react";
describe('show depoloyment manifest page', () => {
it('should render show-deployment-manifest fields', () => {
const wrapper = shallow(<Form />);
const manifestId = wrapper.find({ name: 'manifestId' });
expect(wrapper.containsAllMatchingElements([
<JsonForms />,
])).toBe(true);
});
});

View File

@@ -1,32 +1,35 @@
import * as React from 'react';
import schema from './../schema/jsonSchema.json';
import uiSchema from './../schema/uiSchema.json';
import {JsonForms} from "@jsonforms/react";
import jsonSchema from '../../schema/jsonSchema.json';
import uiSchema from '../../schema/uiSchema.json';
import {
JsonForms,
JsonFormsDispatch,
JsonFormsReduxContext
} from '@jsonforms/react';
import {
materialCells,
materialRenderers
} from '@jsonforms/material-renderers';
const data :any ={
const data: any = {
version: ''
}
const Form = () => {
const [displayDataAsString, setDisplayDataAsString] = React.useState('');
const [standaloneData, setStandaloneData] = React.useState(data);
return (
<div >
<div>
<JsonForms
schema={schema}
schema={jsonSchema}
uischema={uiSchema}
data={standaloneData}
renderers={[
...materialRenderers,
//register custom renderer
]}
cells={materialCells}
onChange={({ errors, data }) => setStandaloneData(data)}
onChange={({errors, data}) => setStandaloneData(data)}
/>
</div>
);