Skip to content

Commit

Permalink
CB-3197 add interface comments
Browse files Browse the repository at this point in the history
  • Loading branch information
devnaumov committed Sep 25, 2023
1 parent 6eaafd6 commit c2899e0
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import { CaptureViewContext, useDataContext } from '@cloudbeaver/core-view';
import { DataPresentationComponent, IDatabaseResultSet, TableViewerLoader } from '@cloudbeaver/plugin-data-viewer';

import { DATA_CONTEXT_DV_DDM_RS_GROUPING } from './DataContext/DATA_CONTEXT_DV_DDM_RS_GROUPING';
import { DEFAULT_GROUPING_QUERY_OPERATION } from './DEFAULT_GROUPING_QUERY_OPERATION';
import type { IGroupingQueryState } from './IGroupingQueryState';
import { useGroupingData } from './useGroupingData';
import { useGroupingDataModel } from './useGroupingDataModel';
import { useGroupingDnDColumns } from './useGroupingDnDColumns';
import { DEFAULT_GROUPING_QUERY_OPERATION } from './DEFAULT_GROUPING_QUERY_OPERATION';

const styles = css`
drop-area {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@ export interface IRequestEventData<TOptions = any, TResult extends IDatabaseData
model: IDatabaseDataModel<TOptions, TResult>;
}

/** Represents an interface for interacting with a database. It is used for managing and requesting data. */
export interface IDatabaseDataModel<TOptions = any, TResult extends IDatabaseDataResult = IDatabaseDataResult> {
readonly id: string;
readonly name: string | null;
readonly source: IDatabaseDataSource<TOptions, TResult>;
/** Holds metadata about a data request. */
readonly requestInfo: IRequestInfo;
readonly supportedDataFormats: ResultDataFormat[];
/**
* Represents the count of records loaded from the database per request.
* It can be updated using the setCountGain method.
*/
readonly countGain: number;

readonly onOptionsChange: IExecutor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export interface IDatabaseDataOptions {
connectionKey: IConnectionInfoParams;
schema?: string;
catalog?: string;
/** A raw string representation of the query filter conditions ("id=4") */
whereFilter: string;
/** A complex object that can represent filters and sorting options of the result set */
constraints: SqlDataFilterConstraint[];
readLogs?: boolean;
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface IRequestInfo {
readonly originalQuery: string;
readonly requestDuration: number;
readonly requestMessage: string;
/** A string representation of the filters constraints applied to the data request. Also returns as it is in case of whereFilter */
readonly requestFilter: string;
readonly source: string | null;
}
Expand All @@ -30,11 +31,13 @@ export interface IDatabaseDataSource<TOptions, TResult extends IDatabaseDataResu
readonly access: DatabaseDataAccessMode;
readonly dataFormat: ResultDataFormat;
readonly supportedDataFormats: ResultDataFormat[];
/** Indicates whether database supports filtering and sorting via constraints */
readonly constraintsAvailable: boolean;
readonly actions: IDatabaseDataActions<TOptions, TResult>;
readonly results: TResult[];
readonly offset: number;
readonly count: number;
/** Options of the previous request */
readonly prevOptions: Readonly<TOptions> | null;
readonly options: TOptions | null;
readonly requestInfo: IRequestInfo;
Expand Down Expand Up @@ -80,6 +83,7 @@ export interface IDatabaseDataSource<TOptions, TResult extends IDatabaseDataResu
setExecutionContext: (context: IConnectionExecutionContext | null) => this;

retry: () => Promise<void>;
/** Allows to execute task after request or save action is done */
runTask: <T>(task: () => Promise<T>) => Promise<T>;
requestData: () => Promise<void> | void;
refreshData: () => Promise<void> | void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ interface Props {
resultIndex: number | undefined;
presentationId: string | undefined;
valuePresentationId: string | null | undefined;
/** Hide tools panel from Table Viewer */
simple?: boolean;
context?: IDataContext;
className?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,18 @@ const oldStyles = css`
`;

export interface ElementsTreeProps extends IElementsTreeOptions, React.PropsWithChildren {
/**
* Specifies the root node for the elements tree, if applicable.
*/
root?: string;
selectionTree?: boolean;
/**
* Specifies a custom control component for navigation tree.
*/
control?: NavTreeControlComponent;
/**
* A placeholder component to be displayed when the elements tree is empty.
*/
emptyPlaceholder?: React.FC;
big?: boolean;
style?: ComponentStyle;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export interface IElementsTreeOptions {
renderers?: IElementsTreeCustomRenderer[];
nodeInfoTransformers?: IElementsTreeCustomNodeInfo[];
expandStateGetters?: IElementsTreeNodeExpandInfoGetter[];
/**
* A field that stores the state of the node in the local storage. Ensuring that the state persists after a page refresh.
*/
localState?: MetadataMap<string, ITreeNodeState>;
getChildren: (id: string) => string[] | undefined;
loadChildren: (id: string, manual: boolean) => Promise<boolean>;
Expand Down

0 comments on commit c2899e0

Please sign in to comment.