Merge branch 'main' into develop

This commit is contained in:
navaneeth 2021-12-10 14:49:51 +05:30
commit e4f7da59c1
4 changed files with 18 additions and 17 deletions

View file

@ -1 +1 @@
0.11.0 0.11.1

View file

@ -2,6 +2,7 @@ import React, { createRef } from 'react';
import { datasourceService, dataqueryService, appService, authenticationService } from '@/_services'; import { datasourceService, dataqueryService, appService, authenticationService } from '@/_services';
import { DndProvider } from 'react-dnd'; import { DndProvider } from 'react-dnd';
import { HTML5Backend } from 'react-dnd-html5-backend'; import { HTML5Backend } from 'react-dnd-html5-backend';
import { defaults } from 'lodash';
import { Container } from './Container'; import { Container } from './Container';
import { CustomDragLayer } from './CustomDragLayer'; import { CustomDragLayer } from './CustomDragLayer';
import { LeftSidebar } from './LeftSidebar'; import { LeftSidebar } from './LeftSidebar';
@ -52,6 +53,15 @@ class Editor extends React.Component {
}; };
} }
this.defaultDefinition = {
components: {},
globalSettings: {
hideHeader: false,
canvasMaxWidth: 1292,
canvasBackgroundColor: props.darkMode ? '#2f3c4c' : '#edeff5',
},
};
this.state = { this.state = {
currentUser: authenticationService.currentUserValue, currentUser: authenticationService.currentUserValue,
app: {}, app: {},
@ -69,14 +79,7 @@ class Editor extends React.Component {
zoomLevel: 1.0, zoomLevel: 1.0,
currentLayout: 'desktop', currentLayout: 'desktop',
deviceWindowWidth: 450, deviceWindowWidth: 450,
appDefinition: { appDefinition: this.defaultDefinition,
components: {},
globalSettings: {
hideHeader: false,
canvasMaxWidth: 1292,
canvasBackgroundColor: props.darkMode ? '#2f3c4c' : '#edeff5',
},
},
currentState: { currentState: {
queries: {}, queries: {},
components: {}, components: {},
@ -245,13 +248,13 @@ class Editor extends React.Component {
const appId = this.props.match.params.id; const appId = this.props.match.params.id;
appService.getApp(appId).then((data) => { appService.getApp(appId).then((data) => {
const dataDefinition = data.definition || {}; const dataDefinition = defaults(data.definition, this.defaultDefinition);
this.setState( this.setState(
{ {
app: data, app: data,
isLoading: false, isLoading: false,
editingVersion: data.editing_version, editingVersion: data.editing_version,
appDefinition: { ...this.state.appDefinition, ...dataDefinition }, appDefinition: dataDefinition,
slug: data.slug, slug: data.slug,
}, },
() => { () => {
@ -265,7 +268,7 @@ class Editor extends React.Component {
}; };
setAppDefinitionFromVersion = (version) => { setAppDefinitionFromVersion = (version) => {
this.appDefinitionChanged(version.definition || {}); this.appDefinitionChanged(defaults(version.definition, this.defaultDefinition));
this.setState({ this.setState({
editingVersion: version, editingVersion: version,
}); });

View file

@ -28,7 +28,6 @@ export const LeftSidebar = ({
globalSettingsChanged, globalSettingsChanged,
globalSettings, globalSettings,
}) => { }) => {
console.log('11', globalSettings);
const router = useRouter(); const router = useRouter();
const [showLeaveDialog, setShowLeaveDialog] = useState(false); const [showLeaveDialog, setShowLeaveDialog] = useState(false);
return ( return (

View file

@ -74,7 +74,6 @@ class SaveAndPreview extends React.Component {
editVersion = (version) => () => { editVersion = (version) => () => {
this.props.setAppDefinitionFromVersion(version); this.props.setAppDefinitionFromVersion(version);
this.props.fetchApp();
}; };
saveVersion = (versionId) => { saveVersion = (versionId) => {
@ -190,7 +189,7 @@ class SaveAndPreview extends React.Component {
</div> </div>
<div className="col-auto"> <div className="col-auto">
<button <button
className="btn btn-sm text-muted font-500 color-primary" className="btn btn-sm color-primary font-500 color-primary"
onClick={() => this.saveVersion(version.id)} onClick={() => this.saveVersion(version.id)}
disabled={ disabled={
savingVersionId === version.id || savingVersionId === version.id ||
@ -200,14 +199,14 @@ class SaveAndPreview extends React.Component {
{savingVersionId === version.id ? 'saving...' : 'save'} {savingVersionId === version.id ? 'saving...' : 'save'}
</button> </button>
<button <button
className="btn btn btn-sm mx-2 text-muted" className="btn btn btn-sm mx-2 color-primary"
onClick={this.editVersion(version)} onClick={this.editVersion(version)}
disabled={this.props.editingVersionId === version.id} disabled={this.props.editingVersionId === version.id}
> >
edit edit
</button> </button>
<a <a
className="btn btn btn-sm mx text-muted" className="btn btn btn-sm mx color-primary"
href={`/applications/${appId}/versions/${version.id}`} href={`/applications/${appId}/versions/${version.id}`}
target="_blank" target="_blank"
rel="noreferrer" rel="noreferrer"