mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Enable original azure resource tree style for Fabric native and turn on Settings tab (#2103)
* Enable original azure resource tree for Fabric native and turn on Settings page * Fix unit tests
This commit is contained in:
@@ -740,12 +740,38 @@ exports[`createDatabaseTreeNodes generates the correct tree structure for the Mo
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`createDatabaseTreeNodes generates the correct tree structure for the SQL API, on Fabric non read-only 1`] = `
|
||||
exports[`createDatabaseTreeNodes generates the correct tree structure for the SQL API, on Fabric non read-only (native) 1`] = `
|
||||
[
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": undefined,
|
||||
"children": [
|
||||
{
|
||||
"contextMenu": [
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "New SQL Query",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "Delete Container",
|
||||
"onClick": [Function],
|
||||
"styleClass": "deleteCollectionMenuItem",
|
||||
},
|
||||
],
|
||||
"id": "",
|
||||
"isSelected": [Function],
|
||||
"label": "Items",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"isSelected": [Function],
|
||||
"label": "Settings",
|
||||
"onClick": [Function],
|
||||
},
|
||||
],
|
||||
"className": "collectionNode",
|
||||
"contextMenu": [
|
||||
{
|
||||
@@ -772,7 +798,38 @@ exports[`createDatabaseTreeNodes generates the correct tree structure for the SQ
|
||||
"onExpanded": [Function],
|
||||
},
|
||||
{
|
||||
"children": undefined,
|
||||
"children": [
|
||||
{
|
||||
"contextMenu": [
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "New SQL Query",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "Delete Container",
|
||||
"onClick": [Function],
|
||||
"styleClass": "deleteCollectionMenuItem",
|
||||
},
|
||||
],
|
||||
"id": "",
|
||||
"isSelected": [Function],
|
||||
"label": "Items",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"isSelected": [Function],
|
||||
"label": "Settings",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"isSelected": [Function],
|
||||
"label": "Conflicts",
|
||||
"onClick": [Function],
|
||||
},
|
||||
],
|
||||
"className": "collectionNode",
|
||||
"contextMenu": [
|
||||
{
|
||||
@@ -806,12 +863,6 @@ exports[`createDatabaseTreeNodes generates the correct tree structure for the SQ
|
||||
"label": "New Container",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "Delete Database",
|
||||
"onClick": [Function],
|
||||
"styleClass": "deleteDatabaseMenuItem",
|
||||
},
|
||||
],
|
||||
"iconSrc": <DatabaseRegular
|
||||
fontSize={16}
|
||||
@@ -826,7 +877,33 @@ exports[`createDatabaseTreeNodes generates the correct tree structure for the SQ
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": undefined,
|
||||
"children": [
|
||||
{
|
||||
"contextMenu": [
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "New SQL Query",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "Delete Container",
|
||||
"onClick": [Function],
|
||||
"styleClass": "deleteCollectionMenuItem",
|
||||
},
|
||||
],
|
||||
"id": "sampleItems",
|
||||
"isSelected": [Function],
|
||||
"label": "Items",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"id": "sampleSettings",
|
||||
"isSelected": [Function],
|
||||
"label": "Settings",
|
||||
"onClick": [Function],
|
||||
},
|
||||
],
|
||||
"className": "collectionNode",
|
||||
"contextMenu": [
|
||||
{
|
||||
@@ -860,12 +937,6 @@ exports[`createDatabaseTreeNodes generates the correct tree structure for the SQ
|
||||
"label": "New Container",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "Delete Database",
|
||||
"onClick": [Function],
|
||||
"styleClass": "deleteDatabaseMenuItem",
|
||||
},
|
||||
],
|
||||
"iconSrc": <DatabaseRegular
|
||||
fontSize={16}
|
||||
@@ -880,7 +951,88 @@ exports[`createDatabaseTreeNodes generates the correct tree structure for the SQ
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": undefined,
|
||||
"children": [
|
||||
{
|
||||
"contextMenu": [
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "New SQL Query",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "Delete Container",
|
||||
"onClick": [Function],
|
||||
"styleClass": "deleteCollectionMenuItem",
|
||||
},
|
||||
],
|
||||
"id": "",
|
||||
"isSelected": [Function],
|
||||
"label": "Items",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"id": "",
|
||||
"isSelected": [Function],
|
||||
"label": "Settings",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"label": "string",
|
||||
},
|
||||
{
|
||||
"label": "HasNulls: false",
|
||||
},
|
||||
],
|
||||
"label": "street",
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"label": "string",
|
||||
},
|
||||
{
|
||||
"label": "HasNulls: true",
|
||||
},
|
||||
],
|
||||
"label": "line2",
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"label": "number",
|
||||
},
|
||||
{
|
||||
"label": "HasNulls: false",
|
||||
},
|
||||
],
|
||||
"label": "zip",
|
||||
},
|
||||
],
|
||||
"label": "address",
|
||||
},
|
||||
{
|
||||
"children": [
|
||||
{
|
||||
"label": "string",
|
||||
},
|
||||
{
|
||||
"label": "HasNulls: false",
|
||||
},
|
||||
],
|
||||
"label": "orderId",
|
||||
},
|
||||
],
|
||||
"label": "Schema",
|
||||
"onClick": [Function],
|
||||
},
|
||||
],
|
||||
"className": "collectionNode",
|
||||
"contextMenu": [
|
||||
{
|
||||
@@ -919,12 +1071,6 @@ exports[`createDatabaseTreeNodes generates the correct tree structure for the SQ
|
||||
"label": "New Container",
|
||||
"onClick": [Function],
|
||||
},
|
||||
{
|
||||
"iconSrc": {},
|
||||
"label": "Delete Database",
|
||||
"onClick": [Function],
|
||||
"styleClass": "deleteDatabaseMenuItem",
|
||||
},
|
||||
],
|
||||
"iconSrc": <DatabaseRegular
|
||||
fontSize={16}
|
||||
@@ -939,7 +1085,7 @@ exports[`createDatabaseTreeNodes generates the correct tree structure for the SQ
|
||||
]
|
||||
`;
|
||||
|
||||
exports[`createDatabaseTreeNodes generates the correct tree structure for the SQL API, on Fabric read-only 1`] = `
|
||||
exports[`createDatabaseTreeNodes generates the correct tree structure for the SQL API, on Fabric read-only (mirrored) 1`] = `
|
||||
[
|
||||
{
|
||||
"children": [
|
||||
|
||||
@@ -373,18 +373,28 @@ describe("createDatabaseTreeNodes", () => {
|
||||
|
||||
it.each<[string, Platform, boolean, Partial<DataModels.DatabaseAccountExtendedProperties>, Partial<UserContext>]>([
|
||||
[
|
||||
"the SQL API, on Fabric read-only",
|
||||
"the SQL API, on Fabric read-only (mirrored)",
|
||||
Platform.Fabric,
|
||||
false,
|
||||
{ capabilities: [], enableMultipleWriteLocations: true },
|
||||
{ fabricContext: { isReadOnly: true } as FabricContext<CosmosDbArtifactType> },
|
||||
{
|
||||
fabricContext: {
|
||||
isReadOnly: true,
|
||||
artifactType: CosmosDbArtifactType.MIRRORED_KEY,
|
||||
} as FabricContext<CosmosDbArtifactType>,
|
||||
},
|
||||
],
|
||||
[
|
||||
"the SQL API, on Fabric non read-only",
|
||||
"the SQL API, on Fabric non read-only (native)",
|
||||
Platform.Fabric,
|
||||
false,
|
||||
{ capabilities: [], enableMultipleWriteLocations: true },
|
||||
{ fabricContext: { isReadOnly: false } as FabricContext<CosmosDbArtifactType> },
|
||||
{
|
||||
fabricContext: {
|
||||
isReadOnly: false,
|
||||
artifactType: CosmosDbArtifactType.NATIVE,
|
||||
} as FabricContext<CosmosDbArtifactType>,
|
||||
},
|
||||
],
|
||||
[
|
||||
"the SQL API, on Portal",
|
||||
|
||||
@@ -6,7 +6,7 @@ import StoredProcedure from "Explorer/Tree/StoredProcedure";
|
||||
import Trigger from "Explorer/Tree/Trigger";
|
||||
import UserDefinedFunction from "Explorer/Tree/UserDefinedFunction";
|
||||
import { useDatabases } from "Explorer/useDatabases";
|
||||
import { isFabricMirrored } from "Platform/Fabric/FabricUtil";
|
||||
import { isFabric, isFabricMirrored, isFabricNative } from "Platform/Fabric/FabricUtil";
|
||||
import { getItemName } from "Utils/APITypeUtils";
|
||||
import { isServerlessAccount } from "Utils/CapabilityUtils";
|
||||
import { useTabs } from "hooks/useTabs";
|
||||
@@ -23,7 +23,7 @@ import { useNotebook } from "../Notebook/useNotebook";
|
||||
import { useSelectedNode } from "../useSelectedNode";
|
||||
|
||||
export const shouldShowScriptNodes = (): boolean => {
|
||||
return !isFabricMirrored() && (userContext.apiType === "SQL" || userContext.apiType === "Gremlin");
|
||||
return !isFabric() && (userContext.apiType === "SQL" || userContext.apiType === "Gremlin");
|
||||
};
|
||||
|
||||
const TreeDatabaseIcon = <DatabaseRegular fontSize={16} />;
|
||||
@@ -220,7 +220,7 @@ export const buildCollectionNode = (
|
||||
): TreeNode => {
|
||||
let children: TreeNode[];
|
||||
// Flat Tree for Fabric
|
||||
if (configContext.platform !== Platform.Fabric) {
|
||||
if (!isFabricMirrored()) {
|
||||
children = buildCollectionNodeChildren(database, collection, isNotebookEnabled, container, refreshActiveTab);
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ const buildCollectionNodeChildren = (
|
||||
|
||||
children.push({
|
||||
id,
|
||||
label: database.isDatabaseShared() || isServerlessAccount() ? "Settings" : "Scale & Settings",
|
||||
label: database.isDatabaseShared() || isServerlessAccount() || isFabricNative() ? "Settings" : "Scale & Settings",
|
||||
onClick: collection.onSettingsClick.bind(collection),
|
||||
isSelected: () =>
|
||||
useSelectedNode
|
||||
|
||||
Reference in New Issue
Block a user