mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
* Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 * Fixes and cleanup * Distro * Fix hygiene yarn * delete no yarn lock changes file * Fix hygiene * Fix layer check * Fix CI * Skip lib checks * Remove tests deleted in vs code * Fix tests * Distro * Fix tests and add removed extension point * Skip failing notebook tests for now * Disable broken tests and cleanup build folder * Update yarn.lock and fix smoke tests * Bump sqlite * fix contributed actions and file spacing * Fix user data path * Update yarn.locks Co-authored-by: ADS Merger <karlb@microsoft.com>
171 lines
5.8 KiB
TypeScript
171 lines
5.8 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { Action } from 'vs/base/common/actions';
|
|
import * as nls from 'vs/nls';
|
|
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
|
|
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
|
import { IScriptingService, ScriptOperation } from 'sql/platform/scripting/common/scriptingService';
|
|
import { BaseActionContext } from 'sql/workbench/browser/actions';
|
|
import { scriptSelect, script, scriptEditSelect } from 'sql/workbench/browser/scriptingUtils';
|
|
import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMessageService';
|
|
|
|
export class ScriptSelectAction extends Action {
|
|
public static ID = 'selectTop';
|
|
public static LABEL = nls.localize('scriptSelect', "Select Top 1000");
|
|
public static KUSTOLABEL = nls.localize('scriptKustoSelect', "Take 10");
|
|
|
|
constructor(
|
|
id: string, label: string,
|
|
@IQueryEditorService protected _queryEditorService: IQueryEditorService,
|
|
@IConnectionManagementService protected _connectionManagementService: IConnectionManagementService,
|
|
@IScriptingService protected _scriptingService: IScriptingService
|
|
) {
|
|
super(id, label);
|
|
}
|
|
|
|
public override async run(actionContext: BaseActionContext): Promise<void> {
|
|
await scriptSelect(
|
|
actionContext.profile!,
|
|
actionContext.object!,
|
|
this._connectionManagementService,
|
|
this._queryEditorService,
|
|
this._scriptingService
|
|
);
|
|
}
|
|
}
|
|
|
|
export class ScriptExecuteAction extends Action {
|
|
public static ID = 'scriptExecute';
|
|
public static LABEL = nls.localize('scriptExecute', "Script as Execute");
|
|
|
|
constructor(
|
|
id: string, label: string,
|
|
@IQueryEditorService protected _queryEditorService: IQueryEditorService,
|
|
@IConnectionManagementService protected _connectionManagementService: IConnectionManagementService,
|
|
@IScriptingService protected _scriptingService: IScriptingService,
|
|
@IErrorMessageService protected _errorMessageService: IErrorMessageService
|
|
) {
|
|
super(id, label);
|
|
}
|
|
|
|
public override async run(actionContext: BaseActionContext): Promise<void> {
|
|
await script(
|
|
actionContext.profile!,
|
|
actionContext.object!,
|
|
this._connectionManagementService,
|
|
this._queryEditorService,
|
|
this._scriptingService,
|
|
ScriptOperation.Execute,
|
|
this._errorMessageService
|
|
);
|
|
}
|
|
}
|
|
|
|
export class ScriptAlterAction extends Action {
|
|
public static ID = 'scriptAlter';
|
|
public static LABEL = nls.localize('scriptAlter', "Script as Alter");
|
|
|
|
constructor(
|
|
id: string, label: string,
|
|
@IQueryEditorService protected _queryEditorService: IQueryEditorService,
|
|
@IConnectionManagementService protected _connectionManagementService: IConnectionManagementService,
|
|
@IScriptingService protected _scriptingService: IScriptingService,
|
|
@IErrorMessageService protected _errorMessageService: IErrorMessageService
|
|
) {
|
|
super(id, label);
|
|
}
|
|
|
|
public override async run(actionContext: BaseActionContext): Promise<void> {
|
|
await script(
|
|
actionContext.profile!,
|
|
actionContext.object!,
|
|
this._connectionManagementService,
|
|
this._queryEditorService,
|
|
this._scriptingService,
|
|
ScriptOperation.Alter,
|
|
this._errorMessageService
|
|
);
|
|
}
|
|
}
|
|
|
|
export class EditDataAction extends Action {
|
|
public static ID = 'editData';
|
|
public static LABEL = nls.localize('editData', "Edit Data");
|
|
|
|
constructor(
|
|
id: string, label: string,
|
|
@IQueryEditorService protected _queryEditorService: IQueryEditorService,
|
|
@IConnectionManagementService protected _connectionManagementService: IConnectionManagementService,
|
|
@IScriptingService protected _scriptingService: IScriptingService
|
|
) {
|
|
super(id, label);
|
|
}
|
|
|
|
public override async run(actionContext: BaseActionContext): Promise<void> {
|
|
await scriptEditSelect(
|
|
actionContext.profile!,
|
|
actionContext.object!,
|
|
this._connectionManagementService,
|
|
this._queryEditorService,
|
|
this._scriptingService
|
|
);
|
|
}
|
|
}
|
|
|
|
export class ScriptCreateAction extends Action {
|
|
public static ID = 'scriptCreate';
|
|
public static LABEL = nls.localize('scriptCreate', "Script as Create");
|
|
|
|
constructor(
|
|
id: string, label: string,
|
|
@IQueryEditorService protected _queryEditorService: IQueryEditorService,
|
|
@IConnectionManagementService protected _connectionManagementService: IConnectionManagementService,
|
|
@IScriptingService protected _scriptingService: IScriptingService,
|
|
@IErrorMessageService protected _errorMessageService: IErrorMessageService
|
|
) {
|
|
super(id, label);
|
|
}
|
|
|
|
public override async run(actionContext: BaseActionContext): Promise<void> {
|
|
await script(
|
|
actionContext.profile!,
|
|
actionContext.object!,
|
|
this._connectionManagementService,
|
|
this._queryEditorService,
|
|
this._scriptingService,
|
|
ScriptOperation.Create,
|
|
this._errorMessageService
|
|
);
|
|
}
|
|
}
|
|
|
|
export class ScriptDeleteAction extends Action {
|
|
public static ID = 'scriptDelete';
|
|
public static LABEL = nls.localize('scriptDelete', "Script as Drop");
|
|
|
|
constructor(
|
|
id: string, label: string,
|
|
@IQueryEditorService protected _queryEditorService: IQueryEditorService,
|
|
@IConnectionManagementService protected _connectionManagementService: IConnectionManagementService,
|
|
@IScriptingService protected _scriptingService: IScriptingService,
|
|
@IErrorMessageService protected _errorMessageService: IErrorMessageService
|
|
) {
|
|
super(id, label);
|
|
}
|
|
|
|
public override async run(actionContext: BaseActionContext): Promise<void> {
|
|
await script(
|
|
actionContext.profile!,
|
|
actionContext.object!,
|
|
this._connectionManagementService,
|
|
this._queryEditorService,
|
|
this._scriptingService,
|
|
ScriptOperation.Delete,
|
|
this._errorMessageService
|
|
);
|
|
}
|
|
}
|