CB-3197 add interface comments (#2018)

* CB-3197 add interface comments

* CB-3197 make comments cleaner

* CB-3197 add comment for the indeterminateSelected

* CB-3197 fix code style

---------

Co-authored-by: Alexey <wrouds@gmail.com>
This commit is contained in:
alex
2023-09-28 13:46:02 +03:00
committed by GitHub
co-authored by Alexey
parent 571d6b7c0a
commit 713082215f
8 changed files with 17 additions and 1 deletions
@@ -11,6 +11,7 @@ export interface ITreeNodeState {
disabled?: boolean;
loading?: boolean;
selected?: boolean;
/** It is true when the node is neither selected nor unselected, used to indicate a mixed or partial selection in a group of sub-options */
indeterminateSelected?: boolean;
externalExpanded?: boolean;
expanded?: boolean;
@@ -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 {
@@ -16,12 +16,15 @@ 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 value by which the number of loaded rows will be increased when loading the next data portion */
readonly countGain: number;
readonly onOptionsChange: IExecutor;
@@ -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;
}
@@ -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;
}
@@ -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;
@@ -80,6 +83,8 @@ export interface IDatabaseDataSource<TOptions, TResult extends IDatabaseDataResu
setExecutionContext: (context: IConnectionExecutionContext | null) => this;
retry: () => Promise<void>;
/** Allows to perform an asynchronous action on the data source, this action will wait previous action to finish and save or load requests.
* The data source will have a loading and disabled state while performing an action */
runTask: <T>(task: () => Promise<T>) => Promise<T>;
requestData: () => Promise<void> | void;
refreshData: () => Promise<void> | void;
@@ -99,6 +99,7 @@ interface Props {
resultIndex: number | undefined;
presentationId: string | undefined;
valuePresentationId: string | null | undefined;
/** Display data in simple mode, some features will be hidden or disabled */
simple?: boolean;
context?: IDataContext;
className?: string;
@@ -43,9 +43,12 @@ import { IElementsTreeOptions, useElementsTree } from './useElementsTree';
import { useElementsTreeFolderExplorer } from './useElementsTreeFolderExplorer';
export interface ElementsTreeProps extends IElementsTreeOptions, React.PropsWithChildren {
/** Specifies the root path for the tree. ROOT_NODE_PATH will be used if not defined */
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;
className?: string;
settingsElements?: PlaceholderElement<IElementsTreeSettingsProps>[];
@@ -71,6 +71,7 @@ export interface IElementsTreeOptions {
renderers?: IElementsTreeCustomRenderer[];
nodeInfoTransformers?: IElementsTreeCustomNodeInfo[];
expandStateGetters?: IElementsTreeNodeExpandInfoGetter[];
/** Allows to pass external state. It can be used to manipulate a tree state from the outside or to store it in an external state */
localState?: MetadataMap<string, ITreeNodeState>;
getChildren: (id: string) => string[] | undefined;
loadChildren: (id: string, manual: boolean) => Promise<boolean>;