mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-23 01:53:46 +01:00
Properly handle activetab
This commit is contained in:
parent
b8cbd77069
commit
48b3e05dee
@ -64,10 +64,6 @@ export class DocumentsTabV2 extends TabsBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
if (!this.isActive) {
|
|
||||||
return <></>;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DocumentsTabComponent
|
<DocumentsTabComponent
|
||||||
isPreferredApiMongoDB={userContext.apiType === "Mongo"}
|
isPreferredApiMongoDB={userContext.apiType === "Mongo"}
|
||||||
@ -79,6 +75,7 @@ export class DocumentsTabV2 extends TabsBase {
|
|||||||
resourceTokenPartitionKey={this.resourceTokenPartitionKey}
|
resourceTokenPartitionKey={this.resourceTokenPartitionKey}
|
||||||
onExecutionErrorChange={(isExecutionError: boolean) => this.isExecutionError(isExecutionError)}
|
onExecutionErrorChange={(isExecutionError: boolean) => this.isExecutionError(isExecutionError)}
|
||||||
onIsExecutingChange={(isExecuting: boolean) => this.isExecuting(isExecuting)}
|
onIsExecutingChange={(isExecuting: boolean) => this.isExecuting(isExecuting)}
|
||||||
|
isTabActive={this.isActive()}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -370,10 +367,10 @@ const getTabsButtons = ({
|
|||||||
return buttons;
|
return buttons;
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateNavbarWithTabsButtons = (dependencies: ButtonsDependencies): void => {
|
const updateNavbarWithTabsButtons = (isTabActive: boolean, dependencies: ButtonsDependencies): void => {
|
||||||
// if (this.isActive()) {
|
if (isTabActive) {
|
||||||
useCommandBar.getState().setContextButtons(getTabsButtons(dependencies));
|
useCommandBar.getState().setContextButtons(getTabsButtons(dependencies));
|
||||||
// }
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNewDocumentButtonState = (editorState: ViewModels.DocumentExplorerState) => ({
|
const getNewDocumentButtonState = (editorState: ViewModels.DocumentExplorerState) => ({
|
||||||
@ -436,6 +433,7 @@ const DocumentsTabComponent: React.FunctionComponent<{
|
|||||||
resourceTokenPartitionKey?: string;
|
resourceTokenPartitionKey?: string;
|
||||||
onExecutionErrorChange: (isExecutionError: boolean) => void;
|
onExecutionErrorChange: (isExecutionError: boolean) => void;
|
||||||
onIsExecutingChange: (isExecuting: boolean) => void;
|
onIsExecutingChange: (isExecuting: boolean) => void;
|
||||||
|
isTabActive: boolean;
|
||||||
}> = ({
|
}> = ({
|
||||||
isPreferredApiMongoDB,
|
isPreferredApiMongoDB,
|
||||||
documentIds: _documentIds,
|
documentIds: _documentIds,
|
||||||
@ -446,6 +444,7 @@ const DocumentsTabComponent: React.FunctionComponent<{
|
|||||||
resourceTokenPartitionKey,
|
resourceTokenPartitionKey,
|
||||||
onExecutionErrorChange,
|
onExecutionErrorChange,
|
||||||
onIsExecutingChange,
|
onIsExecutingChange,
|
||||||
|
isTabActive,
|
||||||
}) => {
|
}) => {
|
||||||
const [isFilterCreated, setIsFilterCreated] = useState<boolean>(true);
|
const [isFilterCreated, setIsFilterCreated] = useState<boolean>(true);
|
||||||
const [isFilterExpanded, setIsFilterExpanded] = useState<boolean>(false);
|
const [isFilterExpanded, setIsFilterExpanded] = useState<boolean>(false);
|
||||||
@ -569,7 +568,7 @@ const DocumentsTabComponent: React.FunctionComponent<{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
updateNavbarWithTabsButtons({
|
updateNavbarWithTabsButtons(isTabActive, {
|
||||||
_collection,
|
_collection,
|
||||||
selectedRows,
|
selectedRows,
|
||||||
editorState,
|
editorState,
|
||||||
@ -897,7 +896,7 @@ const DocumentsTabComponent: React.FunctionComponent<{
|
|||||||
// TODO Put whatever the buttons callback use in the dependency array: find a better way to maintain
|
// TODO Put whatever the buttons callback use in the dependency array: find a better way to maintain
|
||||||
useEffect(
|
useEffect(
|
||||||
() =>
|
() =>
|
||||||
updateNavbarWithTabsButtons({
|
updateNavbarWithTabsButtons(isTabActive, {
|
||||||
_collection,
|
_collection,
|
||||||
selectedRows,
|
selectedRows,
|
||||||
editorState,
|
editorState,
|
||||||
@ -920,6 +919,7 @@ const DocumentsTabComponent: React.FunctionComponent<{
|
|||||||
onSaveExistingDocumentClick,
|
onSaveExistingDocumentClick,
|
||||||
onRevertExistingDocumentClick,
|
onRevertExistingDocumentClick,
|
||||||
onDeleteExistingDocumentsClick,
|
onDeleteExistingDocumentsClick,
|
||||||
|
isTabActive,
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user