diff --git a/packages/base/src/commands.ts b/packages/base/src/commands.ts index ea6c17773..a7892b2a1 100644 --- a/packages/base/src/commands.ts +++ b/packages/base/src/commands.ts @@ -4,16 +4,19 @@ import { PathExt } from '@jupyterlab/coreutils'; import { ITranslator } from '@jupyterlab/translation'; import { redoIcon, undoIcon } from '@jupyterlab/ui-components'; import { + IDict, IGeoJSONSource, IJGISFormSchemaRegistry, + IJGISLayer, IJGISLayerBrowserRegistry, - IJGISSource + IJGISSource, + IJupyterGISModel } from '@jupytergis/schema'; import { UUID } from '@lumino/coreutils'; import { Ajv } from 'ajv'; import * as geojson from 'geojson-schema/GeoJSON.json'; -import { DataErrorDialog, DialogAddDataSourceBody } from './formdialog'; +import { DataErrorDialog, DialogAddDataSourceBody, FormDialog } from './formdialog'; import { geoJSONIcon } from './icons'; import { LayerBrowserWidget } from './layerBrowser/layerBrowserDialog'; import { JupyterGISWidget } from './widget'; @@ -252,8 +255,6 @@ namespace Private { } }; - current.context.model.syncFormData(form); - FORM_SCHEMA['VectorLayer'].properties.source.enumNames = Object.values(sources); FORM_SCHEMA['VectorLayer'].properties.source.enum = Object.keys(sources); @@ -283,9 +284,6 @@ namespace Private { }; current.context.model.addLayer(UUID.uuid4(), layerModel); - }, - cancelButton: () => { - current.context.model.syncFormData(undefined); } }); await dialog.launch(); diff --git a/packages/base/src/panelview/formbuilder.tsx b/packages/base/src/panelview/formbuilder.tsx index 7ca52a2f0..40324b577 100644 --- a/packages/base/src/panelview/formbuilder.tsx +++ b/packages/base/src/panelview/formbuilder.tsx @@ -407,11 +407,6 @@ export class GeoJSONSourcePropertiesForm extends ObjectPropertiesForm { } }; - const internalData = this.state.internalData; - if (internalData) { - internalData.path = path; - } - this.props.model .readGeoJSON(path) .then(async geoJSONData => { @@ -422,11 +417,11 @@ export class GeoJSONSourcePropertiesForm extends ObjectPropertiesForm { extraErrors.path.__errors.push(error.message); }); } - this.setState({ extraErrors, internalData }); + this.setState({ extraErrors }); }) .catch(e => { extraErrors.path.__errors = ['Invalid path']; - this.setState({ extraErrors, internalData }); + this.setState({ extraErrors }); }); }