Fix error when trying to update server or database properties (#23695)

This commit is contained in:
Barbara Valdez
2023-07-11 11:07:09 -07:00
committed by GitHub
parent ba483815b2
commit bfb8536aa6
2 changed files with 3 additions and 3 deletions

View File

@@ -124,7 +124,7 @@ async function handleObjectPropertiesDialogCommand(context: azdata.ObjectExplore
return;
}
try {
const parentUrn = context.nodeInfo ? await getParentUrn(context) : undefined;
const parentUrn = context.isConnectionNode ? undefined : await getParentUrn(context);
const objectType = context.nodeInfo ? context.nodeInfo.nodeType as ObjectManagement.NodeType : (context.connectionProfile.databaseName === '' ? ObjectManagement.NodeType.Server : ObjectManagement.NodeType.Database);
const objectName = context.nodeInfo ? context.nodeInfo.label : (!context.connectionProfile.databaseName ? context.connectionProfile.serverName : context.connectionProfile.databaseName);
const objectUrn = context.nodeInfo ? context.nodeInfo!.metadata!.urn : (context.connectionProfile.databaseName === '' ? 'Server' : `Server/Database[@Name='${escapeSingleQuotes(context.connectionProfile.databaseName)}']`);

View File

@@ -11,7 +11,7 @@ import * as localizedConstants from './localizedConstants';
export async function refreshParentNode(context: azdata.ObjectExplorerContext): Promise<void> {
if (context) {
try {
const node = await azdata.objectexplorer.getNode(context.connectionProfile!.id, context.nodeInfo!.nodePath);
const node = await azdata.objectexplorer.getNode(context.connectionProfile!.id, context.nodeInfo?.nodePath);
const parentNode = await node?.getParent();
await parentNode?.refresh();
}
@@ -24,7 +24,7 @@ export async function refreshParentNode(context: azdata.ObjectExplorerContext):
export async function refreshNode(context: azdata.ObjectExplorerContext): Promise<void> {
if (context) {
try {
const node = await azdata.objectexplorer.getNode(context.connectionProfile!.id, context.nodeInfo!.nodePath);
const node = await azdata.objectexplorer.getNode(context.connectionProfile!.id, context.nodeInfo?.nodePath);
await node?.refresh();
}
catch (err) {