cosmos-explorer/src/Contracts/ActionContracts.ts
Laurent Nguyen 73d2686025
Restore open collection tabs: Query, Documents, Settings (#2004)
* Persist query multiple query texts

* Save multiple query tab histories

* Save and restore states for QueryTab and DocumentsTab for SQL and Mongo

* Enable Collection Scale/Settings restore

* Persist documents tab current filter

* Fix DocumentsTab conflict resolve mistake

* Remove unused variable

* Fix e2e test

* Fix e2e localStorage reference

* Try clearing local storage via playwright page

* Clear local storage after opening page

* Move restore flag behind feature flag. Whitelist restorable tabs in for Fabric. Restore e2e tests.

* Fix typo

* Fix: avoid setting undefined for preferredSize for the <Allotment.Pane>

* Add comments

* Move restore tabs after knockout configure step from Explorer constructor (which could be called multiple times)
2024-11-28 11:18:55 +01:00

88 lines
1.6 KiB
TypeScript

/**
* Data Explorer tab kinds
*/
export enum TabKind {
SQLDocuments,
MongoDocuments,
SchemaAnalyzer,
TableEntities,
Graph,
SQLQuery,
ScaleSettings,
MongoQuery,
}
/**
* Data Explorer pane kinds
*/
export enum PaneKind {
AddCollection,
CassandraAddCollection,
DeleteCollection,
DeleteDatabase,
GlobalSettings,
AdHocAccess,
SwitchDirectory,
}
/**
* Parameters to pass to DataExplorer in order to have it perform a given action
*/
export interface DataExplorerAction {
actionType: ActionType | string;
}
/**
* Open tab action
*/
export interface OpenTab extends DataExplorerAction {
tabKind: TabKind | string;
}
/**
* Open collection tab action
*/
export interface OpenCollectionTab extends OpenTab {
databaseResourceId: string;
collectionResourceId: string;
}
/**
* Open query tab action
*/
export interface OpenQueryTab extends OpenCollectionTab {
query: QueryInfo;
splitterDirection?: "vertical" | "horizontal";
queryViewSizePercent?: number;
}
/**
* Query info will be looked at in the order given in this interface (i.e. if text is provided, everything else is ignored)
*/
export interface QueryInfo {
text?: string;
partitionKeys?: string[];
}
/**
* Open pane action
*/
export interface OpenPane extends DataExplorerAction {
paneKind: PaneKind | string;
}
export interface OpenSampleNotebook extends DataExplorerAction {
path: string;
}
/**
* The types of actions that the DataExplorer supports performing upon opening.
*/
export enum ActionType {
OpenTab,
OpenCollectionTab,
OpenPane,
TransmitCachedData,
OpenSampleNotebook,
}