mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-05-17 10:47:35 +01:00
feat: Add "Duplicate Tab" support for Items, Query, and Settings tabs
This commit is contained in:
committed by
BChoudhury-ms
parent
f3ceca4ba5
commit
97134a5e6e
@@ -49,6 +49,8 @@ import { userContext } from "UserContext";
|
||||
import { logConsoleError, logConsoleInfo } from "Utils/NotificationConsoleUtils";
|
||||
import { Allotment } from "allotment";
|
||||
import { useClientWriteEnabled } from "hooks/useClientWriteEnabled";
|
||||
import { useTabs } from "hooks/useTabs";
|
||||
import ko from "knockout";
|
||||
import React, { KeyboardEventHandler, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { format } from "react-string-format";
|
||||
import DeleteDocumentIcon from "../../../../images/DeleteDocument.svg";
|
||||
@@ -176,6 +178,25 @@ export class DocumentsTabV2 extends TabsBase {
|
||||
};
|
||||
}
|
||||
|
||||
public canDuplicate(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
public duplicateTab(): void {
|
||||
const newTab = new DocumentsTabV2({
|
||||
partitionKey: this.partitionKey,
|
||||
documentIds: ko.observableArray<DocumentId>([]),
|
||||
tabKind: ViewModels.CollectionTabKind.Documents,
|
||||
title: "Items",
|
||||
collection: this.collection,
|
||||
node: this.collection,
|
||||
tabPath: `${this.collection.databaseId}>${this.collection.id()}>Documents`,
|
||||
isPreferredApiMongoDB: userContext.apiType === "Mongo",
|
||||
resourceTokenPartitionKey: this.resourceTokenPartitionKey,
|
||||
});
|
||||
useTabs.getState().activateNewTab(newTab);
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<DocumentsTabComponent
|
||||
|
||||
Reference in New Issue
Block a user