mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
user management fixes (#22282)
* fix a few user management bugs * revert user dialog change
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||||
"version": "4.6.0.4",
|
"version": "4.6.0.5",
|
||||||
"downloadFileNames": {
|
"downloadFileNames": {
|
||||||
"Windows_86": "win-x86-net7.0.zip",
|
"Windows_86": "win-x86-net7.0.zip",
|
||||||
"Windows_64": "win-x64-net7.0.zip",
|
"Windows_64": "win-x64-net7.0.zip",
|
||||||
|
|||||||
@@ -43,8 +43,12 @@ function getObjectManagementService(appContext: AppContext, useTestService: bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleNewLoginDialogCommand(context: azdata.ObjectExplorerContext, service: IObjectManagementService): Promise<void> {
|
async function handleNewLoginDialogCommand(context: azdata.ObjectExplorerContext, service: IObjectManagementService): Promise<void> {
|
||||||
|
const connectionUri = await getConnectionUri(context);
|
||||||
|
if (!connectionUri) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const connectionUri = await azdata.connection.getUriForConnection(context.connectionProfile.id);
|
|
||||||
const dialog = new LoginDialog(service, connectionUri, true, undefined, context);
|
const dialog = new LoginDialog(service, connectionUri, true, undefined, context);
|
||||||
await dialog.open();
|
await dialog.open();
|
||||||
}
|
}
|
||||||
@@ -57,8 +61,11 @@ async function handleNewLoginDialogCommand(context: azdata.ObjectExplorerContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleNewUserDialogCommand(context: azdata.ObjectExplorerContext, service: IObjectManagementService): Promise<void> {
|
async function handleNewUserDialogCommand(context: azdata.ObjectExplorerContext, service: IObjectManagementService): Promise<void> {
|
||||||
|
const connectionUri = await getConnectionUri(context);
|
||||||
|
if (!connectionUri) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const connectionUri = await azdata.connection.getUriForConnection(context.connectionProfile.id);
|
|
||||||
const dialog = new UserDialog(service, connectionUri, context.connectionProfile.databaseName, true, undefined, context);
|
const dialog = new UserDialog(service, connectionUri, context.connectionProfile.databaseName, true, undefined, context);
|
||||||
await dialog.open();
|
await dialog.open();
|
||||||
}
|
}
|
||||||
@@ -71,9 +78,12 @@ async function handleNewUserDialogCommand(context: azdata.ObjectExplorerContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleObjectPropertiesDialogCommand(context: azdata.ObjectExplorerContext, service: IObjectManagementService): Promise<void> {
|
async function handleObjectPropertiesDialogCommand(context: azdata.ObjectExplorerContext, service: IObjectManagementService): Promise<void> {
|
||||||
|
const connectionUri = await getConnectionUri(context);
|
||||||
|
if (!connectionUri) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const nodeTypeDisplayName = getNodeTypeDisplayName(context.nodeInfo.nodeType);
|
const nodeTypeDisplayName = getNodeTypeDisplayName(context.nodeInfo.nodeType);
|
||||||
try {
|
try {
|
||||||
const connectionUri = await azdata.connection.getUriForConnection(context.connectionProfile.id);
|
|
||||||
let dialog;
|
let dialog;
|
||||||
switch (context.nodeInfo.nodeType) {
|
switch (context.nodeInfo.nodeType) {
|
||||||
case NodeType.Login:
|
case NodeType.Login:
|
||||||
@@ -98,6 +108,10 @@ async function handleObjectPropertiesDialogCommand(context: azdata.ObjectExplore
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleDeleteObjectCommand(context: azdata.ObjectExplorerContext, service: IObjectManagementService): Promise<void> {
|
async function handleDeleteObjectCommand(context: azdata.ObjectExplorerContext, service: IObjectManagementService): Promise<void> {
|
||||||
|
const connectionUri = await getConnectionUri(context);
|
||||||
|
if (!connectionUri) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let additionalConfirmationMessage: string;
|
let additionalConfirmationMessage: string;
|
||||||
switch (context.nodeInfo.nodeType) {
|
switch (context.nodeInfo.nodeType) {
|
||||||
case NodeType.Login:
|
case NodeType.Login:
|
||||||
@@ -122,7 +136,6 @@ async function handleDeleteObjectCommand(context: azdata.ObjectExplorerContext,
|
|||||||
operation: async (operation) => {
|
operation: async (operation) => {
|
||||||
try {
|
try {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
const connectionUri = await azdata.connection.getUriForConnection(context.connectionProfile.id);
|
|
||||||
switch (context.nodeInfo.nodeType) {
|
switch (context.nodeInfo.nodeType) {
|
||||||
case NodeType.Login:
|
case NodeType.Login:
|
||||||
await service.deleteLogin(connectionUri, context.nodeInfo.label);
|
await service.deleteLogin(connectionUri, context.nodeInfo.label);
|
||||||
@@ -151,3 +164,11 @@ async function handleDeleteObjectCommand(context: azdata.ObjectExplorerContext,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getConnectionUri(context: azdata.ObjectExplorerContext): Promise<string> {
|
||||||
|
const connectionUri = await azdata.connection.getUriForConnection(context.connectionProfile.id);
|
||||||
|
if (!connectionUri) {
|
||||||
|
await vscode.window.showErrorMessage(localizedConstants.FailedToRetrieveConnectionInfoErrorMessage, { modal: true });
|
||||||
|
}
|
||||||
|
return connectionUri;
|
||||||
|
}
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ export const UserTypeDisplayNameInTitle: string = localize('objectManagement.Use
|
|||||||
export const HelpText: string = localize('objectManagement.helpText', "Help");
|
export const HelpText: string = localize('objectManagement.helpText', "Help");
|
||||||
export const YesText: string = localize('objectManagement.yesText', "Yes");
|
export const YesText: string = localize('objectManagement.yesText', "Yes");
|
||||||
export const OkText: string = localize('objectManagement.OkText', "OK");
|
export const OkText: string = localize('objectManagement.OkText', "OK");
|
||||||
export const LoadingDialogText: string = localize('objectManagement.loadingDialog', "Loading dialog...")
|
export const LoadingDialogText: string = localize('objectManagement.loadingDialog', "Loading dialog...");
|
||||||
|
export const FailedToRetrieveConnectionInfoErrorMessage: string = localize('objectManagement.noConnectionUriError', "Failed to retrieve the connection information, please reconnect and try again.")
|
||||||
|
|
||||||
export function RefreshObjectExplorerError(error: string): string {
|
export function RefreshObjectExplorerError(error: string): string {
|
||||||
return localize({
|
return localize({
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
return this.client.sendRequest(contracts.UpdateUserRequest.type, params).then(
|
return this.client.sendRequest(contracts.UpdateUserRequest.type, params).then(
|
||||||
r => { },
|
r => { },
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.UpdateLoginRequest.type, e);
|
this.client.logFailedRequest(contracts.UpdateUserRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(new Error(e.message));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -184,6 +184,7 @@ export abstract class ObjectManagementDialogBase<ObjectInfoType extends ObjectMa
|
|||||||
objectType: this.objectType
|
objectType: this.objectType
|
||||||
}).send();
|
}).send();
|
||||||
void vscode.window.showErrorMessage(getErrorMessage(err));
|
void vscode.window.showErrorMessage(getErrorMessage(err));
|
||||||
|
azdata.window.closeDialog(this.dialogObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user