mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-28 05:11:31 +00:00
Compare commits
5 Commits
migrate/Qu
...
tsStrict/f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4ddf46f370 | ||
|
|
a8bc821dec | ||
|
|
1394aae944 | ||
|
|
1e32838f60 | ||
|
|
1e0a0b73e0 |
@@ -54,11 +54,11 @@ export const SET_HOVERED_CELL = "SET_HOVERED_CELL";
|
|||||||
export interface SetHoveredCellAction {
|
export interface SetHoveredCellAction {
|
||||||
type: "SET_HOVERED_CELL";
|
type: "SET_HOVERED_CELL";
|
||||||
payload: {
|
payload: {
|
||||||
cellId: CellId;
|
cellId?: CellId;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export const setHoveredCell = (payload: { cellId: CellId }): SetHoveredCellAction => {
|
export const setHoveredCell = (payload: { cellId?: CellId }): SetHoveredCellAction => {
|
||||||
return {
|
return {
|
||||||
type: SET_HOVERED_CELL,
|
type: SET_HOVERED_CELL,
|
||||||
payload,
|
payload,
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import { SnapshotRequest } from "./NotebookComponent/types";
|
|||||||
import { NotebookContainerClient } from "./NotebookContainerClient";
|
import { NotebookContainerClient } from "./NotebookContainerClient";
|
||||||
import { NotebookContentClient } from "./NotebookContentClient";
|
import { NotebookContentClient } from "./NotebookContentClient";
|
||||||
import { SchemaAnalyzerNotebook } from "./SchemaAnalyzer/SchemaAnalyzerUtils";
|
import { SchemaAnalyzerNotebook } from "./SchemaAnalyzer/SchemaAnalyzerUtils";
|
||||||
|
import { useNotebook } from "./useNotebook";
|
||||||
|
|
||||||
type NotebookPaneContent = string | ImmutableNotebook;
|
type NotebookPaneContent = string | ImmutableNotebook;
|
||||||
|
|
||||||
@@ -110,6 +111,7 @@ export default class NotebookManager {
|
|||||||
this.junoClient.subscribeToPinnedRepos((pinnedRepos) => {
|
this.junoClient.subscribeToPinnedRepos((pinnedRepos) => {
|
||||||
this.params.resourceTree.initializeGitHubRepos(pinnedRepos);
|
this.params.resourceTree.initializeGitHubRepos(pinnedRepos);
|
||||||
this.params.resourceTree.triggerRender();
|
this.params.resourceTree.triggerRender();
|
||||||
|
useNotebook.getState().initializeGitHubRepos(pinnedRepos);
|
||||||
});
|
});
|
||||||
this.refreshPinnedRepos();
|
this.refreshPinnedRepos();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ import { getErrorMessage } from "../../Common/ErrorHandlingUtils";
|
|||||||
import * as Logger from "../../Common/Logger";
|
import * as Logger from "../../Common/Logger";
|
||||||
import { configContext } from "../../ConfigContext";
|
import { configContext } from "../../ConfigContext";
|
||||||
import * as DataModels from "../../Contracts/DataModels";
|
import * as DataModels from "../../Contracts/DataModels";
|
||||||
|
import { IPinnedRepo } from "../../Juno/JunoClient";
|
||||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||||
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { getAuthorizationHeader } from "../../Utils/AuthorizationUtils";
|
import { getAuthorizationHeader } from "../../Utils/AuthorizationUtils";
|
||||||
|
import * as GitHubUtils from "../../Utils/GitHubUtils";
|
||||||
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
|
||||||
import NotebookManager from "./NotebookManager";
|
import NotebookManager from "./NotebookManager";
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@ interface NotebookState {
|
|||||||
updateNotebookItem: (item: NotebookContentItem) => void;
|
updateNotebookItem: (item: NotebookContentItem) => void;
|
||||||
deleteNotebookItem: (item: NotebookContentItem) => void;
|
deleteNotebookItem: (item: NotebookContentItem) => void;
|
||||||
initializeNotebooksTree: (notebookManager: NotebookManager) => Promise<void>;
|
initializeNotebooksTree: (notebookManager: NotebookManager) => Promise<void>;
|
||||||
|
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
||||||
@@ -202,4 +205,31 @@ export const useNotebook: UseStore<NotebookState> = create((set, get) => ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
initializeGitHubRepos: (pinnedRepos: IPinnedRepo[]): void => {
|
||||||
|
const gitHubNotebooksContentRoot = cloneDeep(get().gitHubNotebooksContentRoot);
|
||||||
|
if (gitHubNotebooksContentRoot) {
|
||||||
|
gitHubNotebooksContentRoot.children = [];
|
||||||
|
pinnedRepos?.forEach((pinnedRepo) => {
|
||||||
|
const repoFullName = GitHubUtils.toRepoFullName(pinnedRepo.owner, pinnedRepo.name);
|
||||||
|
const repoTreeItem: NotebookContentItem = {
|
||||||
|
name: repoFullName,
|
||||||
|
path: "PsuedoDir",
|
||||||
|
type: NotebookContentItemType.Directory,
|
||||||
|
children: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
pinnedRepo.branches.forEach((branch) => {
|
||||||
|
repoTreeItem.children.push({
|
||||||
|
name: branch.name,
|
||||||
|
path: GitHubUtils.toContentUri(pinnedRepo.owner, pinnedRepo.name, branch.name, ""),
|
||||||
|
type: NotebookContentItemType.Directory,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
gitHubNotebooksContentRoot.children.push(repoTreeItem);
|
||||||
|
});
|
||||||
|
|
||||||
|
set({ gitHubNotebooksContentRoot });
|
||||||
|
}
|
||||||
|
},
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export interface InputParameterProps {
|
|||||||
onDeleteParamKeyPress?: () => void;
|
onDeleteParamKeyPress?: () => void;
|
||||||
onAddNewParamKeyPress?: () => void;
|
onAddNewParamKeyPress?: () => void;
|
||||||
onParamValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
onParamValueChange: (event: React.FormEvent<HTMLElement>, newInput?: string) => void;
|
||||||
onParamKeyChange: (event: React.FormEvent<HTMLElement>, selectedParam: IDropdownOption) => void;
|
onParamKeyChange: (event: React.FormEvent<HTMLElement>, selectedParam?: IDropdownOption) => void;
|
||||||
paramValue: string;
|
paramValue: string;
|
||||||
selectedKey: string | number;
|
selectedKey: string | number;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import _ from "underscore";
|
|||||||
import create, { UseStore } from "zustand";
|
import create, { UseStore } from "zustand";
|
||||||
import * as Constants from "../Common/Constants";
|
import * as Constants from "../Common/Constants";
|
||||||
import * as ViewModels from "../Contracts/ViewModels";
|
import * as ViewModels from "../Contracts/ViewModels";
|
||||||
|
import { userContext } from "../UserContext";
|
||||||
import { useSelectedNode } from "./useSelectedNode";
|
import { useSelectedNode } from "./useSelectedNode";
|
||||||
|
|
||||||
interface DatabasesState {
|
interface DatabasesState {
|
||||||
@@ -136,6 +137,11 @@ export const useDatabases: UseStore<DatabasesState> = create((set, get) => ({
|
|||||||
},
|
},
|
||||||
validateCollectionId: async (databaseId: string, collectionId: string): Promise<boolean> => {
|
validateCollectionId: async (databaseId: string, collectionId: string): Promise<boolean> => {
|
||||||
const database = get().databases.find((db) => db.id() === databaseId);
|
const database = get().databases.find((db) => db.id() === databaseId);
|
||||||
|
// For a new tables account, database is undefined when creating the first table
|
||||||
|
if (!database && userContext.apiType === "Tables") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
await database.loadCollections();
|
await database.loadCollections();
|
||||||
return !database.collections().some((collection) => collection.id() === collectionId);
|
return !database.collections().some((collection) => collection.id() === collectionId);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
"noUnusedParameters": true
|
"noUnusedParameters": true
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
|
"./src/Explorer/Panes/ExecuteSprocParamsPane/InputParameter.tsx",
|
||||||
"./src/AuthType.ts",
|
"./src/AuthType.ts",
|
||||||
"./src/Bindings/ReactBindingHandler.ts",
|
"./src/Bindings/ReactBindingHandler.ts",
|
||||||
"./src/Common/ArrayHashMap.ts",
|
"./src/Common/ArrayHashMap.ts",
|
||||||
@@ -60,6 +61,7 @@
|
|||||||
"./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/StatusBar.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellCreator.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx",
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/CellLabeler.tsx",
|
||||||
|
"./src/Explorer/Notebook/NotebookRenderer/decorators/HoverableCell.tsx",
|
||||||
"./src/Explorer/Notebook/NotebookUtil.ts",
|
"./src/Explorer/Notebook/NotebookUtil.ts",
|
||||||
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerSplashScreen.tsx",
|
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerSplashScreen.tsx",
|
||||||
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerUtils.ts",
|
"./src/Explorer/Notebook/SchemaAnalyzer/SchemaAnalyzerUtils.ts",
|
||||||
|
|||||||
Reference in New Issue
Block a user