mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 11:01:37 -05:00
new drop object request (#22387)
* simplify drop object requests * update sts * pr comments
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.13",
|
"version": "4.6.0.14",
|
||||||
"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",
|
||||||
|
|||||||
@@ -1539,15 +1539,6 @@ export namespace UpdateLoginRequest {
|
|||||||
export const type = new RequestType<UpdateLoginRequestParams, void, void, void>('objectManagement/updateLogin');
|
export const type = new RequestType<UpdateLoginRequestParams, void, void, void>('objectManagement/updateLogin');
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteLoginRequestParams {
|
|
||||||
connectionUri: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace DeleteLoginRequest {
|
|
||||||
export const type = new RequestType<DeleteLoginRequestParams, void, void, void>('objectManagement/deleteLogin');
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DisposeLoginViewRequestParams {
|
export interface DisposeLoginViewRequestParams {
|
||||||
contextId: string;
|
contextId: string;
|
||||||
}
|
}
|
||||||
@@ -1586,16 +1577,6 @@ export namespace UpdateUserRequest {
|
|||||||
export const type = new RequestType<UpdateUserRequestParams, void, void, void>('objectManagement/updateUser');
|
export const type = new RequestType<UpdateUserRequestParams, void, void, void>('objectManagement/updateUser');
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface DeleteUserRequestParams {
|
|
||||||
connectionUri: string;
|
|
||||||
database: string;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export namespace DeleteUserRequest {
|
|
||||||
export const type = new RequestType<DeleteUserRequestParams, void, void, void>('objectManagement/deleteUser');
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DisposeUserViewRequestParams {
|
export interface DisposeUserViewRequestParams {
|
||||||
contextId: string;
|
contextId: string;
|
||||||
}
|
}
|
||||||
@@ -1614,4 +1595,12 @@ export namespace RenameObjectRequest {
|
|||||||
export const type = new RequestType<RenameObjectRequestParams, void, void, void>('objectManagement/rename');
|
export const type = new RequestType<RenameObjectRequestParams, void, void, void>('objectManagement/rename');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface DropObjectRequestParams {
|
||||||
|
connectionUri: string;
|
||||||
|
objectUrn: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace DropObjectRequest {
|
||||||
|
export const type = new RequestType<DropObjectRequestParams, void, void, void>('objectManagement/drop');
|
||||||
|
}
|
||||||
// ------------------------------- < Object Management > ------------------------------------
|
// ------------------------------- < Object Management > ------------------------------------
|
||||||
|
|||||||
23
extensions/mssql/src/mssql.d.ts
vendored
23
extensions/mssql/src/mssql.d.ts
vendored
@@ -1191,12 +1191,6 @@ declare module 'mssql' {
|
|||||||
* @param login The login information.
|
* @param login The login information.
|
||||||
*/
|
*/
|
||||||
updateLogin(contextId: string, login: ObjectManagement.Login): Thenable<void>;
|
updateLogin(contextId: string, login: ObjectManagement.Login): Thenable<void>;
|
||||||
/**
|
|
||||||
* Delete a login.
|
|
||||||
* @param connectionUri The URI of the server connection.
|
|
||||||
* @param name Name of the login.
|
|
||||||
*/
|
|
||||||
deleteLogin(connectionUri: string, name: string): Thenable<void>;
|
|
||||||
/**
|
/**
|
||||||
* Dispose the login view.
|
* Dispose the login view.
|
||||||
* @param contextId The id of the view.
|
* @param contextId The id of the view.
|
||||||
@@ -1218,18 +1212,11 @@ declare module 'mssql' {
|
|||||||
*/
|
*/
|
||||||
createUser(contextId: string, user: ObjectManagement.User): Thenable<void>;
|
createUser(contextId: string, user: ObjectManagement.User): Thenable<void>;
|
||||||
/**
|
/**
|
||||||
* Create a login.
|
* Update a user.
|
||||||
* @param contextId Id of the view.
|
* @param contextId Id of the view.
|
||||||
* @param user The user information.
|
* @param user The user information.
|
||||||
*/
|
*/
|
||||||
updateUser(contextId: string, user: ObjectManagement.User): Thenable<void>;
|
updateUser(contextId: string, user: ObjectManagement.User): Thenable<void>;
|
||||||
/**
|
|
||||||
* Create a login.
|
|
||||||
* @param connectionUri The URI of the server connection.
|
|
||||||
* @param database Name of the database.
|
|
||||||
* @param name Name of the user.
|
|
||||||
*/
|
|
||||||
deleteUser(connectionUri: string, database: string, name: string): Thenable<void>;
|
|
||||||
/**
|
/**
|
||||||
* Dispose the user view.
|
* Dispose the user view.
|
||||||
* @param contextId The id of the view.
|
* @param contextId The id of the view.
|
||||||
@@ -1238,10 +1225,16 @@ declare module 'mssql' {
|
|||||||
/**
|
/**
|
||||||
* Rename an object.
|
* Rename an object.
|
||||||
* @param connectionUri The URI of the server connection.
|
* @param connectionUri The URI of the server connection.
|
||||||
* @param objectUrn Urn of the object to be renamed. More information: https://learn.microsoft.com/en-us/sql/relational-databases/server-management-objects-smo/overview-smo.
|
* @param objectUrn SMO Urn of the object to be renamed. More information: https://learn.microsoft.com/sql/relational-databases/server-management-objects-smo/overview-smo
|
||||||
* @param newName The new name of the object.
|
* @param newName The new name of the object.
|
||||||
*/
|
*/
|
||||||
rename(connectionUri: string, objectUrn: string, newName: string): Thenable<void>;
|
rename(connectionUri: string, objectUrn: string, newName: string): Thenable<void>;
|
||||||
|
/**
|
||||||
|
* Drop an object.
|
||||||
|
* @param connectionUri The URI of the server connection.
|
||||||
|
* @param objectUrn SMO Urn of the object to be dropped. More information: https://learn.microsoft.com/sql/relational-databases/server-management-objects-smo/overview-smo
|
||||||
|
*/
|
||||||
|
drop(connectionUri: string, objectUrn: string): Thenable<void>;
|
||||||
}
|
}
|
||||||
// Object Management - End.
|
// Object Management - End.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,16 +139,7 @@ async function handleDeleteObjectCommand(context: azdata.ObjectExplorerContext,
|
|||||||
operation: async (operation) => {
|
operation: async (operation) => {
|
||||||
try {
|
try {
|
||||||
const startTime = Date.now();
|
const startTime = Date.now();
|
||||||
switch (context.nodeInfo.nodeType) {
|
await service.drop(connectionUri, context.nodeInfo.metadata.urn);
|
||||||
case NodeType.Login:
|
|
||||||
await service.deleteLogin(connectionUri, context.nodeInfo.label);
|
|
||||||
break;
|
|
||||||
case NodeType.User:
|
|
||||||
await service.deleteUser(connectionUri, context.connectionProfile.databaseName, context.nodeInfo.label);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
TelemetryReporter.sendTelemetryEvent(TelemetryActions.DeleteObject, {
|
TelemetryReporter.sendTelemetryEvent(TelemetryActions.DeleteObject, {
|
||||||
objectType: context.nodeInfo.nodeType
|
objectType: context.nodeInfo.nodeType
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.InitializeLoginViewRequest.type, e);
|
this.client.logFailedRequest(contracts.InitializeLoginViewRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
r => { },
|
r => { },
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.CreateLoginRequest.type, e);
|
this.client.logFailedRequest(contracts.CreateLoginRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -59,17 +59,7 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
r => { },
|
r => { },
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.UpdateLoginRequest.type, e);
|
this.client.logFailedRequest(contracts.UpdateLoginRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
deleteLogin(connectionUri: string, name: string): Thenable<void> {
|
|
||||||
const params: contracts.DeleteLoginRequestParams = { connectionUri, name };
|
|
||||||
return this.client.sendRequest(contracts.DeleteLoginRequest.type, params).then(
|
|
||||||
r => { },
|
|
||||||
e => {
|
|
||||||
this.client.logFailedRequest(contracts.DeleteLoginRequest.type, e);
|
|
||||||
return Promise.reject(new Error(e.message));
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -79,11 +69,10 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
r => { },
|
r => { },
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.DisposeLoginViewRequest.type, e);
|
this.client.logFailedRequest(contracts.DisposeLoginViewRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeUserView(connectionUri: string, database: string, contextId: string, isNewObject: boolean, name: string | undefined): Thenable<ObjectManagement.UserViewInfo> {
|
initializeUserView(connectionUri: string, database: string, contextId: string, isNewObject: boolean, name: string | undefined): Thenable<ObjectManagement.UserViewInfo> {
|
||||||
const params: contracts.InitializeUserViewRequestParams = { connectionUri, database, contextId, isNewObject, name };
|
const params: contracts.InitializeUserViewRequestParams = { connectionUri, database, contextId, isNewObject, name };
|
||||||
return this.client.sendRequest(contracts.InitializeUserViewRequest.type, params).then(
|
return this.client.sendRequest(contracts.InitializeUserViewRequest.type, params).then(
|
||||||
@@ -92,7 +81,7 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.InitializeUserViewRequest.type, e);
|
this.client.logFailedRequest(contracts.InitializeUserViewRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -102,7 +91,7 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
r => { },
|
r => { },
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.CreateUserRequest.type, e);
|
this.client.logFailedRequest(contracts.CreateUserRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -112,17 +101,7 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
r => { },
|
r => { },
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.UpdateUserRequest.type, e);
|
this.client.logFailedRequest(contracts.UpdateUserRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
deleteUser(connectionUri: string, database: string, name: string): Thenable<void> {
|
|
||||||
const params: contracts.DeleteUserRequestParams = { connectionUri, database, name };
|
|
||||||
return this.client.sendRequest(contracts.DeleteUserRequest.type, params).then(
|
|
||||||
r => { },
|
|
||||||
e => {
|
|
||||||
this.client.logFailedRequest(contracts.DeleteUserRequest.type, e);
|
|
||||||
return Promise.reject(new Error(e.message));
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -132,7 +111,7 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
r => { },
|
r => { },
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.DisposeUserViewRequest.type, e);
|
this.client.logFailedRequest(contracts.DisposeUserViewRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -142,7 +121,17 @@ export class ObjectManagementService implements IObjectManagementService {
|
|||||||
r => { },
|
r => { },
|
||||||
e => {
|
e => {
|
||||||
this.client.logFailedRequest(contracts.RenameObjectRequest.type, e);
|
this.client.logFailedRequest(contracts.RenameObjectRequest.type, e);
|
||||||
return Promise.reject(new Error(e.message));
|
return Promise.reject(e);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
drop(connectionUri: string, objectUrn: string): Thenable<void> {
|
||||||
|
const params: contracts.DropObjectRequestParams = { connectionUri, objectUrn };
|
||||||
|
return this.client.sendRequest(contracts.DropObjectRequest.type, params).then(
|
||||||
|
r => { },
|
||||||
|
e => {
|
||||||
|
this.client.logFailedRequest(contracts.DropObjectRequest.type, e);
|
||||||
|
return Promise.reject(e);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -226,13 +215,6 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
}, 3000);
|
}, 3000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async deleteLogin(connectionUri: string, name: string): Promise<void> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
setTimeout(() => {
|
|
||||||
resolve();
|
|
||||||
}, 3000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
async disposeLoginView(contextId: string): Promise<void> {
|
async disposeLoginView(contextId: string): Promise<void> {
|
||||||
}
|
}
|
||||||
async initializeUserView(connectionUri: string, database: string, contextId: string, isNewObject: boolean, name: string): Promise<ObjectManagement.UserViewInfo> {
|
async initializeUserView(connectionUri: string, database: string, contextId: string, isNewObject: boolean, name: string): Promise<ObjectManagement.UserViewInfo> {
|
||||||
@@ -297,15 +279,14 @@ export class TestObjectManagementService implements IObjectManagementService {
|
|||||||
async updateUser(contextId: string, login: ObjectManagement.User): Promise<void> {
|
async updateUser(contextId: string, login: ObjectManagement.User): Promise<void> {
|
||||||
return this.delayAndResolve();
|
return this.delayAndResolve();
|
||||||
}
|
}
|
||||||
async deleteUser(connectionUri: string, database: string, name: string): Promise<void> {
|
|
||||||
return this.delayAndResolve();
|
|
||||||
}
|
|
||||||
async disposeUserView(contextId: string): Promise<void> {
|
async disposeUserView(contextId: string): Promise<void> {
|
||||||
}
|
}
|
||||||
async rename(connectionUri: string, objectUrn: string, newName: string): Promise<void> {
|
async rename(connectionUri: string, objectUrn: string, newName: string): Promise<void> {
|
||||||
return this.delayAndResolve();
|
return this.delayAndResolve();
|
||||||
}
|
}
|
||||||
|
async drop(connectionUri: string, objectUrn: string): Promise<void> {
|
||||||
|
return this.delayAndResolve();
|
||||||
|
}
|
||||||
private delayAndResolve(): Promise<void> {
|
private delayAndResolve(): Promise<void> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user