From 2a1c55f02217e72eecd955c16c8dbcab7ac74ede Mon Sep 17 00:00:00 2001 From: Vladyslav Date: Fri, 10 Apr 2020 15:04:55 +0300 Subject: [PATCH] [2.5] Revert change JSON form (#2598) * Revert change * Revert file --- .../components/react/json-form-ace-editor.jsx | 6 ++--- .../app/components/react/json-form-array.jsx | 2 +- .../components/react/json-form-fieldset.jsx | 2 +- .../react/json-form-schema-form.jsx | 26 +++++++------------ ui/src/app/components/react/json-form.scss | 3 --- 5 files changed, 15 insertions(+), 24 deletions(-) diff --git a/ui/src/app/components/react/json-form-ace-editor.jsx b/ui/src/app/components/react/json-form-ace-editor.jsx index 966419b3fe..2329bbddf7 100644 --- a/ui/src/app/components/react/json-form-ace-editor.jsx +++ b/ui/src/app/components/react/json-form-ace-editor.jsx @@ -83,9 +83,9 @@ class ThingsboardAceEditor extends React.Component { fixAceEditor(editor); } - onToggleFull(groupId) { + onToggleFull() { this.setState({ isFull: !this.state.isFull }); - this.props.onToggleFullscreen(groupId); + this.props.onToggleFullscreen(); this.updateAceEditorSize = true; } @@ -140,7 +140,7 @@ class ThingsboardAceEditor extends React.Component {
- this.onToggleFull(this.props.groupId)}/> +
diff --git a/ui/src/app/components/react/json-form-fieldset.jsx b/ui/src/app/components/react/json-form-fieldset.jsx index 4e078d72e2..f668ba774c 100644 --- a/ui/src/app/components/react/json-form-fieldset.jsx +++ b/ui/src/app/components/react/json-form-fieldset.jsx @@ -19,7 +19,7 @@ class ThingsboardFieldSet extends React.Component { render() { let forms = this.props.form.items.map(function(form, index){ - return this.props.builder(form, this.props.groupId, this.props.model, index, this.props.onChange, this.props.onColorClick, this.props.onIconClick, this.props.onToggleFullscreen, this.props.mapper, this.props.builder); + return this.props.builder(form, this.props.model, index, this.props.onChange, this.props.onColorClick, this.props.onIconClick, this.props.onToggleFullscreen, this.props.mapper, this.props.builder); }.bind(this)); return ( diff --git a/ui/src/app/components/react/json-form-schema-form.jsx b/ui/src/app/components/react/json-form-schema-form.jsx index 2172ac3640..04970f601b 100644 --- a/ui/src/app/components/react/json-form-schema-form.jsx +++ b/ui/src/app/components/react/json-form-schema-form.jsx @@ -40,9 +40,6 @@ class ThingsboardSchemaForm extends React.Component { constructor(props) { super(props); - this.state = { - groupId: null, - }; this.mapper = { 'number': ThingsboardNumber, @@ -88,15 +85,12 @@ class ThingsboardSchemaForm extends React.Component { this.props.onIconClick(event); } - onToggleFullscreen(groupId) { - this.setState({ - groupId: groupId - }); + onToggleFullscreen() { this.props.onToggleFullscreen(); } - builder(form, groupId, model, index, onChange, onColorClick, onIconClick, onToggleFullscreen, mapper) { + builder(form, model, index, onChange, onColorClick, onIconClick, onToggleFullscreen, mapper) { var type = form.type; let Field = this.mapper[type]; if(!Field) { @@ -109,21 +103,21 @@ class ThingsboardSchemaForm extends React.Component { return null; } } - return + return } - createSchema(theForm, groupId) { + createSchema(theForm) { let merged = utils.merge(this.props.schema, theForm, this.props.ignore, this.props.option); let mapper = this.mapper; if(this.props.mapper) { mapper = _.merge(this.mapper, this.props.mapper); } let forms = merged.map(function(form, index) { - return this.builder(form, groupId, this.props.model, index, this.onChange, this.onColorClick, this.onIconClick, this.onToggleFullscreen, mapper); + return this.builder(form, this.props.model, index, this.onChange, this.onColorClick, this.onIconClick, this.onToggleFullscreen, mapper); }.bind(this)); let formClass = 'SchemaForm'; - if (this.props.isFullscreen && groupId === this.state.groupId) { + if (this.props.isFullscreen) { formClass += ' SchemaFormFullscreen'; } @@ -136,7 +130,7 @@ class ThingsboardSchemaForm extends React.Component { if(this.props.groupInfoes&&this.props.groupInfoes.length>0){ let content=[]; for(let info of this.props.groupInfoes){ - let forms = this.createSchema(this.props.form[info.formIndex], info.formIndex); + let forms = this.createSchema(this.props.form[info.formIndex]); let item = ; content.push(item); } @@ -166,8 +160,8 @@ class ThingsboardSchemaGroup extends React.Component{ render() { let theCla = "pull-right fa fa-chevron-down md-toggle-icon"+(this.state.showGroup?"":" tb-toggled") return (
-
{this.props.info.GroupTitle}
-
{this.props.forms}
-
); +
{this.props.info.GroupTitle}
+
{this.props.forms}
+ ); } } diff --git a/ui/src/app/components/react/json-form.scss b/ui/src/app/components/react/json-form.scss index 91c14d51ff..85825abf42 100644 --- a/ui/src/app/components/react/json-form.scss +++ b/ui/src/app/components/react/json-form.scss @@ -24,15 +24,12 @@ $input-label-float-scale: .75 !default; .tb-fullscreen { [name="ReactSchemaForm"] { .SchemaForm { - display: none; - &.SchemaFormFullscreen { position: absolute; top: 0; right: 0; bottom: 0; left: 0; - display: block; > div:not(.fullscreen-form-field) { display: none !important;