mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge remote-tracking branch 'origin/devel' into devel
This commit is contained in:
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: io.cloudbeaver.connect.provider.sample;singleton:=true
|
||||
Bundle-Version: 1.0.29.qualifier
|
||||
Bundle-Release-Date: 20210531
|
||||
Bundle-Version: 1.0.30.qualifier
|
||||
Bundle-Release-Date: 20210621
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.connect.provider.sample</artifactId>
|
||||
<version>1.0.29-SNAPSHOT</version>
|
||||
<version>1.0.30-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: io.cloudbeaver.product.ce;singleton:=true
|
||||
Bundle-Version: 21.0.3.qualifier
|
||||
Bundle-Release-Date: 20210531
|
||||
Bundle-Version: 21.0.4.qualifier
|
||||
Bundle-Release-Date: 20210621
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.product.ce</artifactId>
|
||||
<version>21.0.3-SNAPSHOT</version>
|
||||
<version>21.0.4-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -2,8 +2,8 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Base JDBC drivers
|
||||
Bundle-SymbolicName: io.cloudbeaver.resources.drivers.base;singleton:=true
|
||||
Bundle-Version: 1.0.26.qualifier
|
||||
Bundle-Release-Date: 20210531
|
||||
Bundle-Version: 1.0.27.qualifier
|
||||
Bundle-Release-Date: 20210621
|
||||
Bundle-Vendor: DBeaver Corp
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Automatic-Module-Name: io.cloudbeaver.resources.drivers.base
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.resources.drivers.base</artifactId>
|
||||
<version>1.0.26-SNAPSHOT</version>
|
||||
<version>1.0.27-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
||||
|
||||
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: io.cloudbeaver.server;singleton:=true
|
||||
Bundle-Version: 21.0.3.qualifier
|
||||
Bundle-Release-Date: 20210531
|
||||
Bundle-Version: 21.0.4.qualifier
|
||||
Bundle-Release-Date: 20210621
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Activator: io.cloudbeaver.server.WebPlatformActivator
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.server</artifactId>
|
||||
<version>21.0.3-SNAPSHOT</version>
|
||||
<version>21.0.4-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: io.cloudbeaver.service.admin;singleton:=true
|
||||
Bundle-Version: 1.0.25.qualifier
|
||||
Bundle-Release-Date: 20210531
|
||||
Bundle-Version: 1.0.26.qualifier
|
||||
Bundle-Release-Date: 20210621
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.service.admin</artifactId>
|
||||
<version>1.0.25-SNAPSHOT</version>
|
||||
<version>1.0.26-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: io.cloudbeaver.service.auth;singleton:=true
|
||||
Bundle-Version: 1.0.25.qualifier
|
||||
Bundle-Release-Date: 20210531
|
||||
Bundle-Version: 1.0.26.qualifier
|
||||
Bundle-Release-Date: 20210621
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.service.auth</artifactId>
|
||||
<version>1.0.25-SNAPSHOT</version>
|
||||
<version>1.0.26-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: io.cloudbeaver.service.data.transfer;singleton:=true
|
||||
Bundle-Version: 1.0.26.qualifier
|
||||
Bundle-Release-Date: 20210531
|
||||
Bundle-Version: 1.0.27.qualifier
|
||||
Bundle-Release-Date: 20210621
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.service.data.transfer</artifactId>
|
||||
<version>1.0.26-SNAPSHOT</version>
|
||||
<version>1.0.27-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -3,8 +3,8 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: io.cloudbeaver.service.metadata;singleton:=true
|
||||
Bundle-Version: 1.0.29.qualifier
|
||||
Bundle-Release-Date: 20210531
|
||||
Bundle-Version: 1.0.30.qualifier
|
||||
Bundle-Release-Date: 20210621
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.service.metadata</artifactId>
|
||||
<version>1.0.29-SNAPSHOT</version>
|
||||
<version>1.0.30-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<feature
|
||||
id="io.cloudbeaver.ce.drivers.feature"
|
||||
label="Cloudbeaver CE 3rd Party Drivers"
|
||||
version="1.0.49.qualifier"
|
||||
version="1.0.50.qualifier"
|
||||
provider-name="DBeaver Corp">
|
||||
|
||||
<plugin id="io.cloudbeaver.resources.drivers.base" download-size="0" install-size="0" version="0.0.0"/>
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.ce.drivers.feature</artifactId>
|
||||
<version>1.0.49-SNAPSHOT</version>
|
||||
<version>1.0.50-SNAPSHOT</version>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
</project>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<feature
|
||||
id="io.cloudbeaver.product.ce.feature"
|
||||
label="%featureName"
|
||||
version="21.0.3.qualifier"
|
||||
version="21.0.4.qualifier"
|
||||
provider-name="%providerName"
|
||||
plugin="io.cloudbeaver.product.ce">
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.product.ce.feature</artifactId>
|
||||
<version>21.0.3-SNAPSHOT</version>
|
||||
<version>21.0.4-SNAPSHOT</version>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<feature
|
||||
id="io.cloudbeaver.sample.feature"
|
||||
label="%featureName"
|
||||
version="1.0.29.qualifier"
|
||||
version="1.0.30.qualifier"
|
||||
provider-name="%providerName">
|
||||
|
||||
<description>
|
||||
|
||||
@@ -9,6 +9,6 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.sample.feature</artifactId>
|
||||
<version>1.0.29-SNAPSHOT</version>
|
||||
<version>1.0.30-SNAPSHOT</version>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
</project>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<feature
|
||||
id="io.cloudbeaver.server.feature"
|
||||
label="%featureName"
|
||||
version="21.0.3.qualifier"
|
||||
version="21.0.4.qualifier"
|
||||
provider-name="%providerName"
|
||||
plugin="io.cloudbeaver.server">
|
||||
|
||||
|
||||
@@ -10,6 +10,6 @@
|
||||
<relativePath>../</relativePath>
|
||||
</parent>
|
||||
<artifactId>io.cloudbeaver.server.feature</artifactId>
|
||||
<version>21.0.3-SNAPSHOT</version>
|
||||
<version>21.0.4-SNAPSHOT</version>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
</project>
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@
|
||||
|
||||
<properties>
|
||||
<dbeaver-product>CloudBeaver CE</dbeaver-product>
|
||||
<dbeaver-version>21.0.3</dbeaver-version>
|
||||
<dbeaver-version>21.0.4</dbeaver-version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?pde version="3.5"?>
|
||||
|
||||
<product name="Cloudbeaver Provided Sample" uid="io.cloudbeaver.provided.sample.product" id="io.cloudbeaver.provided.sample.product" application="io.cloudbeaver.server.standalone" version="21.0.3.qualifier" useFeatures="true" includeLaunchers="false">
|
||||
<product name="Cloudbeaver Provided Sample" uid="io.cloudbeaver.provided.sample.product" id="io.cloudbeaver.provided.sample.product" application="io.cloudbeaver.server.standalone" version="21.0.4.qualifier" useFeatures="true" includeLaunchers="false">
|
||||
|
||||
<configIni use="default">
|
||||
</configIni>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
<version>21.0.3-SNAPSHOT</version>
|
||||
<version>21.0.4-SNAPSHOT</version>
|
||||
<artifactId>provided-sample</artifactId>
|
||||
<packaging>eclipse-repository</packaging>
|
||||
<name>Cloudbeaver Provided Sample Product</name>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<?pde version="3.5"?>
|
||||
|
||||
<product name="CloudBeaver ce Server" uid="io.cloudbeaver.product" id="io.cloudbeaver.product.ce.product"
|
||||
application="io.cloudbeaver.product.ce.application" version="21.0.3.qualifier" useFeatures="true"
|
||||
application="io.cloudbeaver.product.ce.application" version="21.0.4.qualifier" useFeatures="true"
|
||||
includeLaunchers="false">
|
||||
|
||||
<configIni use="default">
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../</relativePath>
|
||||
</parent>
|
||||
<version>21.0.3-SNAPSHOT</version>
|
||||
<version>21.0.4-SNAPSHOT</version>
|
||||
<artifactId>web-server</artifactId>
|
||||
<packaging>eclipse-repository</packaging>
|
||||
<name>Cloudbeaver Server Product</name>
|
||||
|
||||
@@ -11,25 +11,35 @@ import { useState, useEffect } from 'react';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
|
||||
export interface ComplexLoaderProps<T> {
|
||||
interface IComplexLoaderData<T> {
|
||||
promise: Promise<T> | undefined;
|
||||
data: T | undefined;
|
||||
error: Error | undefined;
|
||||
loader: () => Promise<T>;
|
||||
}
|
||||
|
||||
export interface ComplexLoaderProps<T> {
|
||||
loader: IComplexLoaderData<T>;
|
||||
placeholder: React.ReactElement;
|
||||
keepLoading?: boolean;
|
||||
children: (content: T) => JSX.Element;
|
||||
}
|
||||
|
||||
export const ComplexLoader: React.FC<ComplexLoaderProps<any>> = function ComplexLoader(props) {
|
||||
const [content, setContent] = useState<unknown | null>(null);
|
||||
const [content, setContent] = useState<unknown | null>(props.loader.data);
|
||||
const notificationService = useService(NotificationService);
|
||||
|
||||
useEffect(() => {
|
||||
let unmounted = false;
|
||||
|
||||
if (!content) {
|
||||
props
|
||||
.loader
|
||||
.loader()
|
||||
.then(value => !unmounted && setContent(value))
|
||||
.catch(exception => !unmounted && notificationService.logException(exception, 'Can\'t load resource'));
|
||||
}
|
||||
|
||||
return () => {
|
||||
unmounted = true;
|
||||
};
|
||||
@@ -41,3 +51,35 @@ export const ComplexLoader: React.FC<ComplexLoaderProps<any>> = function Complex
|
||||
|
||||
return props.children(content);
|
||||
};
|
||||
|
||||
export function createComplexLoader<T>(loader: () => Promise<T>): IComplexLoaderData<T> {
|
||||
return {
|
||||
promise: undefined,
|
||||
data: undefined,
|
||||
error: undefined,
|
||||
async loader() {
|
||||
if (this.data !== undefined) {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
if (this.error) {
|
||||
throw this.error;
|
||||
}
|
||||
|
||||
if (this.promise) {
|
||||
return await this.promise;
|
||||
}
|
||||
|
||||
this.promise = loader();
|
||||
|
||||
try {
|
||||
this.data = await this.promise;
|
||||
return this.data;
|
||||
} catch (exception) {
|
||||
this.error = exception;
|
||||
|
||||
throw exception;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { ComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
import { ComplexLoader, createComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
|
||||
async function loader() {
|
||||
const loader = createComplexLoader(async function loader() {
|
||||
const { ReactSanitizedHTML } = await import('./ReactSanitizedHTML');
|
||||
return { ReactSanitizedHTML };
|
||||
}
|
||||
});
|
||||
|
||||
interface Props {
|
||||
html: string;
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import { ComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
import { ComplexLoader, createComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
|
||||
import type { ICodeEditorProps } from './ICodeEditorProps';
|
||||
|
||||
async function loader() {
|
||||
const loader = createComplexLoader(async function loader() {
|
||||
const { CodeEditor } = await import('./CodeEditor');
|
||||
return { CodeEditor };
|
||||
}
|
||||
});
|
||||
|
||||
export const CodeEditorLoader: React.FC<ICodeEditorProps> = function CodeEditorLoader(props) {
|
||||
return (
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import { ComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
import { ComplexLoader, createComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
import type { IDatabaseDataModel } from '@cloudbeaver/plugin-data-viewer';
|
||||
|
||||
interface Props {
|
||||
@@ -17,10 +17,10 @@ interface Props {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
async function loader() {
|
||||
const loader = createComplexLoader(async function loader() {
|
||||
const { DataGridTable } = await import('./DataGridTable');
|
||||
return { DataGridTable };
|
||||
}
|
||||
});
|
||||
|
||||
export const DataGridLoader: React.FC<Props> = observer(function DataGridLoader({
|
||||
tableModel, resultIndex, className,
|
||||
|
||||
+49
-16
@@ -8,6 +8,7 @@
|
||||
|
||||
import { makeObservable, observable } from 'mobx';
|
||||
|
||||
import { Executor, IExecutor } from '@cloudbeaver/core-executor';
|
||||
import { ResultDataFormat } from '@cloudbeaver/core-sdk';
|
||||
|
||||
import { DatabaseDataAction } from '../../DatabaseDataAction';
|
||||
@@ -15,7 +16,7 @@ import type { IDatabaseDataEditorActionsData } from '../../IDatabaseDataEditor';
|
||||
import type { IDatabaseDataSource } from '../../IDatabaseDataSource';
|
||||
import type { IDatabaseResultSet } from '../../IDatabaseResultSet';
|
||||
import { databaseDataAction } from '../DatabaseDataActionDecorator';
|
||||
import type { IDatabaseDataEditAction } from '../IDatabaseDataEditAction';
|
||||
import type { IDatabaseDataEditAction, IDatabaseDataEditActionData } from '../IDatabaseDataEditAction';
|
||||
import { DocumentDataAction } from './DocumentDataAction';
|
||||
import type { IDatabaseDataDocument } from './IDatabaseDataDocument';
|
||||
import type { IDocumentElementKey } from './IDocumentElementKey';
|
||||
@@ -25,12 +26,14 @@ export class DocumentEditAction extends DatabaseDataAction<any, IDatabaseResultS
|
||||
implements IDatabaseDataEditAction<IDocumentElementKey, IDatabaseDataDocument, IDatabaseResultSet> {
|
||||
static dataFormat = ResultDataFormat.Document;
|
||||
|
||||
readonly action: IExecutor<IDatabaseDataEditActionData<IDocumentElementKey, IDatabaseDataDocument>>;
|
||||
readonly editedElements: Map<number, IDatabaseDataDocument>;
|
||||
|
||||
constructor(source: IDatabaseDataSource<any, IDatabaseResultSet>, result: IDatabaseResultSet) {
|
||||
super(source, result);
|
||||
this.editedElements = new Map();
|
||||
this.resetEditedElements = this.resetEditedElements.bind(this);
|
||||
this.action = new Executor();
|
||||
|
||||
makeObservable(this, {
|
||||
editedElements: observable,
|
||||
@@ -54,9 +57,28 @@ export class DocumentEditAction extends DatabaseDataAction<any, IDatabaseResultS
|
||||
return !this.compare(value, this.get(key));
|
||||
}
|
||||
|
||||
set(key: IDocumentElementKey, value: IDatabaseDataDocument): void {
|
||||
set(key: IDocumentElementKey, value: IDatabaseDataDocument, prevValue?: IDatabaseDataDocument): void {
|
||||
if (!prevValue) {
|
||||
prevValue = this.get(key);
|
||||
|
||||
if (!prevValue) {
|
||||
prevValue = this.getAction(DocumentDataAction)
|
||||
.get(key.index);
|
||||
}
|
||||
}
|
||||
|
||||
this.editedElements.set(key.index, value);
|
||||
|
||||
this.action.execute({
|
||||
type: 'edit',
|
||||
resultId: this.result.id,
|
||||
value: {
|
||||
key: key,
|
||||
prevValue,
|
||||
value,
|
||||
},
|
||||
});
|
||||
|
||||
// TODO: remove
|
||||
this.source
|
||||
.getEditor(this.resultIndex)
|
||||
@@ -66,25 +88,25 @@ export class DocumentEditAction extends DatabaseDataAction<any, IDatabaseResultS
|
||||
}
|
||||
|
||||
setData(key: IDocumentElementKey, value: string): void {
|
||||
const edited = this.editedElements.get(key.index);
|
||||
let previousValue = this.get(key);
|
||||
|
||||
if (edited) {
|
||||
edited.data = value;
|
||||
this.set(key, edited);
|
||||
return;
|
||||
if (!previousValue) {
|
||||
previousValue = this.getAction(DocumentDataAction)
|
||||
.get(key.index);
|
||||
}
|
||||
|
||||
const sourceValue = this.getAction(DocumentDataAction)
|
||||
.get(key.index);
|
||||
|
||||
if (!sourceValue) {
|
||||
if (!previousValue) {
|
||||
throw new Error('Source value not found');
|
||||
}
|
||||
|
||||
this.set(key, {
|
||||
...sourceValue,
|
||||
data: value,
|
||||
});
|
||||
this.set(
|
||||
key,
|
||||
{
|
||||
...previousValue,
|
||||
data: value,
|
||||
},
|
||||
previousValue
|
||||
);
|
||||
}
|
||||
|
||||
get(key: IDocumentElementKey): IDatabaseDataDocument | undefined {
|
||||
@@ -94,6 +116,12 @@ export class DocumentEditAction extends DatabaseDataAction<any, IDatabaseResultS
|
||||
revert(key: IDocumentElementKey): void {
|
||||
this.editedElements.delete(key.index);
|
||||
|
||||
this.action.execute({
|
||||
type: 'revert',
|
||||
resultId: this.result.id,
|
||||
value: { key: key },
|
||||
});
|
||||
|
||||
// TODO: remove
|
||||
this.source
|
||||
.getEditor(this.resultIndex)
|
||||
@@ -102,16 +130,21 @@ export class DocumentEditAction extends DatabaseDataAction<any, IDatabaseResultS
|
||||
|
||||
clear(): void {
|
||||
this.editedElements.clear();
|
||||
this.action.execute({
|
||||
type: 'revert',
|
||||
resultId: this.result.id,
|
||||
});
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
this.clear();
|
||||
// TODO: remove
|
||||
this.source.editor?.actions.removeHandler(this.resetEditedElements);
|
||||
}
|
||||
|
||||
private resetEditedElements(action: IDatabaseDataEditorActionsData) {
|
||||
if (action.resultId === this.result.id && action.type === 'cancel') {
|
||||
this.editedElements.delete(action.row);
|
||||
this.revert({ index: action.row });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+15
@@ -6,11 +6,26 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import type { IExecutor } from '@cloudbeaver/core-executor';
|
||||
|
||||
import type { IDatabaseDataAction } from '../IDatabaseDataAction';
|
||||
import type { IDatabaseDataResult } from '../IDatabaseDataResult';
|
||||
|
||||
export interface IDatabaseDataEditActionValue<TKey, TValue> {
|
||||
key: TKey;
|
||||
value?: TValue;
|
||||
prevValue?: TValue;
|
||||
}
|
||||
|
||||
export interface IDatabaseDataEditActionData<TKey, TValue> {
|
||||
type: 'edit' | 'revert';
|
||||
resultId: string;
|
||||
value?: IDatabaseDataEditActionValue<TKey, TValue>;
|
||||
}
|
||||
|
||||
export interface IDatabaseDataEditAction<TKey, TValue, TResult extends IDatabaseDataResult>
|
||||
extends IDatabaseDataAction<any, TResult> {
|
||||
readonly action: IExecutor<IDatabaseDataEditActionData<TKey, TValue>>;
|
||||
isEdited: () => boolean;
|
||||
isElementEdited: (key: TKey) => boolean;
|
||||
set: (key: TKey, value: TValue) => void;
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
*/
|
||||
|
||||
import type { TabContainerPanelComponent } from '@cloudbeaver/core-blocks';
|
||||
import { createComplexLoader, TabContainerPanelComponent } from '@cloudbeaver/core-blocks';
|
||||
import { ComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
import type { IDataValuePanelProps, IDatabaseResultSet } from '@cloudbeaver/plugin-data-viewer';
|
||||
|
||||
async function loader() {
|
||||
const loader = createComplexLoader(async function loader() {
|
||||
const { GISValuePresentation } = await import('./GISValuePresentation');
|
||||
return { GISValuePresentation };
|
||||
}
|
||||
});
|
||||
|
||||
export const GISViewer: TabContainerPanelComponent<IDataValuePanelProps<any, IDatabaseResultSet>> = function GISViewer({ model, resultIndex }) {
|
||||
return (
|
||||
|
||||
+3
-3
@@ -8,15 +8,15 @@
|
||||
|
||||
import { observer } from 'mobx-react-lite';
|
||||
|
||||
import { ComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
import { ComplexLoader, createComplexLoader, Loader } from '@cloudbeaver/core-blocks';
|
||||
|
||||
import type { ISQLCodeEditorProps } from './ISQLCodeEditorProps';
|
||||
import type { SQLCodeEditorController } from './SQLCodeEditorController';
|
||||
|
||||
async function loader() {
|
||||
const loader = createComplexLoader(async function loader() {
|
||||
const { SQLCodeEditor } = await import('./SQLCodeEditor');
|
||||
return { SQLCodeEditor };
|
||||
}
|
||||
});
|
||||
|
||||
export const SQLCodeEditorLoader = observer<ISQLCodeEditorProps, SQLCodeEditorController>(function SQLCodeEditorLoader(props, ref) {
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@cloudbeaver/product-default",
|
||||
"sideEffects": false,
|
||||
"version": "21.0.3",
|
||||
"version": "21.0.4",
|
||||
"description": "",
|
||||
"license": "Apache-2.0",
|
||||
"main": "lib/index.js",
|
||||
|
||||
Reference in New Issue
Block a user