mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-31 17:23:31 -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 @@ export let SelectAllMessages = 'SelectAllMessages';
|
||||
export let SaveAsCsv = 'SaveAsCSV';
|
||||
export let SaveAsJSON = 'SaveAsJSON';
|
||||
export let SaveAsExcel = 'SaveAsExcel';
|
||||
export let SaveAsXML = 'SaveAsXML';
|
||||
export let ViewAsChart = 'ViewAsChart';
|
||||
export let GoToNextQueryOutputTab = 'GoToNextQueryOutputTab';
|
||||
export let GoToNextGrid = 'GoToNextGrid';
|
||||
|
||||
9
src/sql/parts/grid/media/saveXml.svg
Normal file
9
src/sql/parts/grid/media/saveXml.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="saveXml" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon id="canvas" fill="#F6F6F6" fill-rule="nonzero" opacity="0" points="16 16 0 16 0 0 16 0"></polygon>
|
||||
<polygon id="<->" fill="#424242" points="14.3701172 10.7222222 9.41870773 15 9.41870773 12.3454861 12.9578306 9.5 9.41870773 6.6640625 9.41870773 4 14.3701172 8.296875"></polygon>
|
||||
<polygon id="colorAction" fill="#00539C" fill-rule="nonzero" points="8 4 5 7 3 7 5 5 1 5 1 3 5 3 3 1 5 1"></polygon>
|
||||
<path d="M2.32152009,8 L5.28619938,8 L3.4164898,9.5 L6.95140946,12.3454861 L6.95140946,15 L2,10.7222222 L2,8.27777778 L2.32152009,8 Z" id="Combined-Shape" fill="#424242"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 877 B |
9
src/sql/parts/grid/media/saveXml_inverse.svg
Normal file
9
src/sql/parts/grid/media/saveXml_inverse.svg
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg viewBox="0 0 16 16" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="saveXmlInverse" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<polygon id="canvas" fill="#F6F6F6" fill-rule="nonzero" opacity="0" points="16 16 0 16 0 0 16 0"></polygon>
|
||||
<polygon id="<->" fill="#C5C5C5" points="14.3701172 10.7222222 9.41870773 15 9.41870773 12.3454861 12.9578306 9.5 9.41870773 6.6640625 9.41870773 4 14.3701172 8.296875"></polygon>
|
||||
<polygon id="colorAction" fill="#75BEFF" fill-rule="nonzero" points="8 4 5 7 3 7 5 5 1 5 1 3 5 3 3 1 5 1"></polygon>
|
||||
<path d="M2.32152009,8 L5.28619938,8 L3.4164898,9.5 L6.95140946,12.3454861 L6.95140946,15 L2,10.7222222 L2,8.27777778 L2.32152009,8 Z" id="Combined-Shape" fill="#C5C5C5"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 884 B |
@@ -112,6 +112,11 @@
|
||||
background-image: url("saveExcel.svg");
|
||||
}
|
||||
|
||||
.vs .icon.saveXml {
|
||||
/* ResultToXML_16x_vscode */
|
||||
background-image: url("saveXml.svg");
|
||||
}
|
||||
|
||||
.vs .icon.viewChart {
|
||||
/* ResultToXlsx_16x_vscode */
|
||||
background-image: url("viewChart.svg");
|
||||
@@ -243,6 +248,12 @@
|
||||
background-image: url("saveExcel_inverse.svg");
|
||||
}
|
||||
|
||||
.vs-dark .icon.saveXml,
|
||||
.hc-black .icon.saveXml {
|
||||
/* ResultToXml_16x_vscode_inverse.svg */
|
||||
background-image: url("saveXml_inverse.svg");
|
||||
}
|
||||
|
||||
.vs-dark .icon.viewChart,
|
||||
.hc-black .icon.viewChart {
|
||||
/* ResultToXlsx_16x_vscode */
|
||||
|
||||
@@ -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