mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-01-01 07:11:23 +00:00
* Update contracts for new all resource messages * Add timestamp to token message signature * Reconstruct resource tree with databases and collections parsed from token dictionary keys * Create FabricDatabase and FabricCollection to turn off interaction * Remove unnecessary FabricCollection derived class * Handle resource tokens * Bug fix * Fix linting issues * Fix update document * Fix partitition keys * Remove special case for FabricDatabase tree node * Modify readCollections to follow normal flow with Fabric * Move fabric databases refresh to data access and remove special case in Explorer * Revert Explorer.tsx changes * Disable database context menu and delete container context menu * Remove create database/container button for Fabric * Fix format * Renew token logic * Parallelize read collections calls to speed up * Disable readDatabaseOffer, because it is too slow for now * Reduce TOKEN_VALIDITY_MS a bit to make sure renewal happens before expiration. Receving new tokens new refreshes databases * Add container element for Main app in HTML * Do not handle "openTab" message anymore * Fix style of main div * Simplify conditional load of the fabric .css * Fix format * Fix tsc can't find dynamic less import --------- Co-authored-by: Armando Trejo Oliver <artrejo@microsoft.com>
78 lines
1.8 KiB
TypeScript
78 lines
1.8 KiB
TypeScript
import { AuthorizationToken, MessageTypes } from "./MessageTypes";
|
|
|
|
export type FabricMessage =
|
|
| {
|
|
type: "newContainer";
|
|
databaseName: string;
|
|
}
|
|
| {
|
|
type: "initialize";
|
|
message: {
|
|
endpoint: string | undefined;
|
|
databaseId: string | undefined;
|
|
resourceTokens: unknown | undefined;
|
|
resourceTokensTimestamp: number | undefined;
|
|
error: string | undefined;
|
|
};
|
|
}
|
|
| {
|
|
type: "authorizationToken";
|
|
message: {
|
|
id: string;
|
|
error: string | undefined;
|
|
data: AuthorizationToken | undefined;
|
|
};
|
|
}
|
|
| {
|
|
type: "allResourceTokens";
|
|
message: {
|
|
endpoint: string | undefined;
|
|
databaseId: string | undefined;
|
|
resourceTokens: unknown | undefined;
|
|
resourceTokensTimestamp: number | undefined;
|
|
};
|
|
};
|
|
|
|
export type DataExploreMessage =
|
|
| "ready"
|
|
| {
|
|
type: MessageTypes.TelemetryInfo;
|
|
data: {
|
|
action: "LoadDatabases";
|
|
actionModifier: "success" | "start";
|
|
defaultExperience: "SQL";
|
|
};
|
|
}
|
|
| {
|
|
type: MessageTypes.GetAuthorizationToken;
|
|
id: string;
|
|
params: GetCosmosTokenMessageOptions[];
|
|
}
|
|
| {
|
|
type: MessageTypes.GetAllResourceTokens;
|
|
};
|
|
|
|
export type GetCosmosTokenMessageOptions = {
|
|
verb: "connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace";
|
|
resourceType: "" | "dbs" | "colls" | "docs" | "sprocs" | "pkranges";
|
|
resourceId: string;
|
|
};
|
|
|
|
export type CosmosDBTokenResponse = {
|
|
token: string;
|
|
date: string;
|
|
};
|
|
|
|
export type CosmosDBConnectionInfoResponse = {
|
|
endpoint: string;
|
|
databaseId: string;
|
|
resourceTokens: unknown;
|
|
};
|
|
|
|
export interface FabricDatabaseConnectionInfo {
|
|
endpoint: string;
|
|
databaseId: string;
|
|
resourceTokens: { [resourceId: string]: string };
|
|
resourceTokensTimestamp: number;
|
|
}
|