Remove other options other than New Query for query copilot collection in the resource tree AB#2501532

This commit is contained in:
Darko Radivojevic 2023-06-30 23:24:58 +02:00
parent ceed162491
commit deb33daae3

View File

@ -1,3 +1,4 @@
import { QueryCopilotSampleContainerId, QueryCopilotSampleDatabaseId } from "Common/Constants";
import React from "react";
import AddCollectionIcon from "../../images/AddCollection.svg";
import AddSqlQueryIcon from "../../images/AddSqlQuery_16x16.svg";
@ -61,6 +62,13 @@ export const createDatabaseContextMenu = (container: Explorer, databaseId: strin
return items;
};
const isQueryCopilotMoreMenu = (selectedCollection: ViewModels.Collection): boolean => {
return (
selectedCollection.databaseId === QueryCopilotSampleDatabaseId &&
selectedCollection.id() === QueryCopilotSampleContainerId
);
};
export const createCollectionContextMenuButton = (
container: Explorer,
selectedCollection: ViewModels.Collection
@ -95,6 +103,7 @@ export const createCollectionContextMenuButton = (
});
}
if (!isQueryCopilotMoreMenu(selectedCollection)) {
if (userContext.apiType === "SQL" || userContext.apiType === "Gremlin") {
items.push({
iconSrc: AddStoredProcedureIcon,
@ -136,7 +145,7 @@ export const createCollectionContextMenuButton = (
label: `Delete ${getCollectionName()}`,
styleClass: "deleteCollectionMenuItem",
});
}
return items;
};