mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-05 17:23:51 -05:00
Completed: Missing feature request: Save as XML (#3729)
* Save as XML feature added to grid * Unrelated code removed
This commit is contained in:
committed by
Karl Burtram
parent
5c16ceb2fa
commit
4de3cc8a09
@@ -17,6 +17,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
export const GRID_SAVECSV_ID = 'grid.saveAsCsv';
|
||||
export const GRID_SAVEJSON_ID = 'grid.saveAsJson';
|
||||
export const GRID_SAVEEXCEL_ID = 'grid.saveAsExcel';
|
||||
export const GRID_SAVEXML_ID = 'grid.saveAsXml';
|
||||
export const GRID_COPY_ID = 'grid.copySelection';
|
||||
export const GRID_COPYWITHHEADERS_ID = 'grid.copyWithHeaders';
|
||||
export const GRID_SELECTALL_ID = 'grid.selectAll';
|
||||
@@ -46,6 +47,7 @@ export class GridActionProvider {
|
||||
actions.push(new SaveResultAction(SaveResultAction.SAVECSV_ID, SaveResultAction.SAVECSV_LABEL, SaveFormat.CSV, this._dataService));
|
||||
actions.push(new SaveResultAction(SaveResultAction.SAVEJSON_ID, SaveResultAction.SAVEJSON_LABEL, SaveFormat.JSON, this._dataService));
|
||||
actions.push(new SaveResultAction(SaveResultAction.SAVEEXCEL_ID, SaveResultAction.SAVEEXCEL_LABEL, SaveFormat.EXCEL, this._dataService));
|
||||
actions.push(new SaveResultAction(SaveResultAction.SAVEXML_ID, SaveResultAction.SAVEXML_LABEL, SaveFormat.XML, this._dataService));
|
||||
actions.push(new SelectAllGridAction(SelectAllGridAction.ID, SelectAllGridAction.LABEL, this._selectAllCallback));
|
||||
actions.push(new CopyResultAction(CopyResultAction.COPY_ID, CopyResultAction.COPY_LABEL, false, this._dataService));
|
||||
actions.push(new CopyResultAction(CopyResultAction.COPYWITHHEADERS_ID, CopyResultAction.COPYWITHHEADERS_LABEL, true, this._dataService));
|
||||
@@ -74,6 +76,9 @@ export class SaveResultAction extends Action {
|
||||
public static SAVEEXCEL_ID = GRID_SAVEEXCEL_ID;
|
||||
public static SAVEEXCEL_LABEL = localize('saveAsExcel', 'Save As Excel');
|
||||
|
||||
public static SAVEXML_ID = GRID_SAVEXML_ID;
|
||||
public static SAVEXML_LABEL = localize('saveAsXml', 'Save As XML');
|
||||
|
||||
constructor(
|
||||
id: string,
|
||||
label: string,
|
||||
|
||||
@@ -69,6 +69,10 @@ export const saveAsExcel = (accessor: ServicesAccessor) => {
|
||||
runActionOnActiveResultsEditor(accessor, GridContentEvents.SaveAsExcel);
|
||||
};
|
||||
|
||||
export const saveAsXml = (accessor: ServicesAccessor) => {
|
||||
runActionOnActiveResultsEditor(accessor, GridContentEvents.SaveAsXML);
|
||||
};
|
||||
|
||||
export const selectAll = (accessor: ServicesAccessor) => {
|
||||
runActionOnActiveResultsEditor(accessor, GridContentEvents.SelectAll);
|
||||
};
|
||||
|
||||
@@ -154,6 +154,9 @@ export abstract class GridParentComponent {
|
||||
case GridContentEvents.SaveAsExcel:
|
||||
self.sendSaveRequest(SaveFormat.EXCEL);
|
||||
break;
|
||||
case GridContentEvents.SaveAsXML:
|
||||
self.sendSaveRequest(SaveFormat.XML);
|
||||
break;
|
||||
case GridContentEvents.GoToNextQueryOutputTab:
|
||||
self.goToNextQueryOutputTab();
|
||||
break;
|
||||
@@ -320,6 +323,9 @@ export abstract class GridParentComponent {
|
||||
'SaveAsExcel': () => {
|
||||
this.sendSaveRequest(SaveFormat.EXCEL);
|
||||
},
|
||||
'SaveAsXML': () => {
|
||||
this.sendSaveRequest(SaveFormat.XML);
|
||||
},
|
||||
'GoToNextQueryOutputTab': () => {
|
||||
this.goToNextQueryOutputTab();
|
||||
}
|
||||
@@ -345,6 +351,9 @@ export abstract class GridParentComponent {
|
||||
case 'saveexcel':
|
||||
this.dataService.sendSaveRequest({ batchIndex: event.batchId, resultSetNumber: event.resultId, format: SaveFormat.EXCEL, selection: event.selection });
|
||||
break;
|
||||
case 'savexml':
|
||||
this.dataService.sendSaveRequest({ batchIndex: event.batchId, resultSetNumber: event.resultId, format: SaveFormat.XML, selection: event.selection });
|
||||
break;
|
||||
case 'selectall':
|
||||
this.activeGrid = event.index;
|
||||
this.onSelectAllForActiveGrid();
|
||||
|
||||
@@ -127,6 +127,19 @@ export class QueryComponent extends GridParentComponent implements OnInit, OnDes
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
showCondition: () => { return true; },
|
||||
icon: () => { return 'saveXml'; },
|
||||
hoverText: () => { return LocalizedConstants.saveXMLLabel; },
|
||||
functionality: (batchId, resultId, index) => {
|
||||
let selection = this.getSelection(index);
|
||||
if (selection.length <= 1) {
|
||||
this.handleContextClick({ type: 'savexml', batchId: batchId, resultId: resultId, index: index, selection: selection });
|
||||
} else {
|
||||
this.dataService.showWarning(LocalizedConstants.msgCannotSaveMultipleSelections);
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
showCondition: () => {
|
||||
return this.configurationService.getValue('workbench')['enablePreviewFeatures'];
|
||||
|
||||
Reference in New Issue
Block a user