mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Rework message panel (#10177)
* wip * fix compile * fix look * fix hygiene errors * add back functionality * fix some issues with accessibility * proper dispose template * handle state properly in message panel
This commit is contained in:
@@ -5,14 +5,10 @@
|
||||
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { Table } from 'sql/base/browser/ui/table/table';
|
||||
import { QueryEditor } from './queryEditor';
|
||||
import { CellSelectionModel } from 'sql/base/browser/ui/table/plugins/cellSelectionModel.plugin';
|
||||
import { isWindows } from 'vs/base/common/platform';
|
||||
import { removeAnsiEscapeCodes } from 'vs/base/common/strings';
|
||||
import { IGridDataProvider } from 'sql/workbench/services/query/common/gridDataProvider';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import QueryRunner from 'sql/workbench/services/query/common/queryRunner';
|
||||
@@ -35,11 +31,6 @@ export interface IGridActionContext {
|
||||
resultId: number;
|
||||
}
|
||||
|
||||
export interface IMessagesActionContext {
|
||||
selection: Selection;
|
||||
tree: ITree;
|
||||
}
|
||||
|
||||
function mapForNumberColumn(ranges: Slick.Range[]): Slick.Range[] {
|
||||
if (ranges) {
|
||||
return ranges.map(e => new Slick.Range(e.fromRow, e.fromCell - 1, e.toRow, e.toCell ? e.toCell - 1 : undefined));
|
||||
@@ -132,49 +123,6 @@ export class SelectAllGridAction extends Action {
|
||||
}
|
||||
}
|
||||
|
||||
export class CopyMessagesAction extends Action {
|
||||
public static ID = 'grid.messages.copy';
|
||||
public static LABEL = localize('copyMessages', "Copy");
|
||||
|
||||
constructor(
|
||||
@IClipboardService private clipboardService: IClipboardService
|
||||
) {
|
||||
super(CopyMessagesAction.ID, CopyMessagesAction.LABEL);
|
||||
}
|
||||
|
||||
public run(context: IMessagesActionContext): Promise<boolean> {
|
||||
this.clipboardService.writeText(context.selection.toString());
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
const lineDelimiter = isWindows ? '\r\n' : '\n';
|
||||
export class CopyAllMessagesAction extends Action {
|
||||
public static ID = 'grid.messages.copyAll';
|
||||
public static LABEL = localize('copyAll', "Copy All");
|
||||
|
||||
constructor(
|
||||
private tree: ITree,
|
||||
@IClipboardService private clipboardService: IClipboardService) {
|
||||
super(CopyAllMessagesAction.ID, CopyAllMessagesAction.LABEL);
|
||||
}
|
||||
|
||||
public run(): Promise<any> {
|
||||
let text = '';
|
||||
const navigator = this.tree.getNavigator();
|
||||
// skip first navigator element - the root node
|
||||
while (navigator.next()) {
|
||||
if (text) {
|
||||
text += lineDelimiter;
|
||||
}
|
||||
text += (navigator.current()).message;
|
||||
}
|
||||
|
||||
this.clipboardService.writeText(removeAnsiEscapeCodes(text));
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
}
|
||||
|
||||
export class MaximizeTableAction extends Action {
|
||||
public static ID = 'grid.maximize';
|
||||
public static LABEL = localize('maximize', "Maximize");
|
||||
|
||||
Reference in New Issue
Block a user