Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support importing/exporting XML files #1171

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/Studio.md
Expand Up @@ -48,6 +48,10 @@ The [InterSystems ObjectScript extension](https://marketplace.visualstudio.com/i

The [InterSystems ObjectScript extension](https://marketplace.visualstudio.com/items?itemName=intersystems-community.vscode-objectscript) provides commands for creating new Interoperability classes. Commands are provided for Business Operation, Business Process, Business Rule, Business Service and Data Transformation classes. These commands are modeled after the wizards in Studio's [`File` → `New...` → `Production` menu](https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=GSTD_Commands#GSTD_Commands_File). The commands are shown in the `New File...` menu, which can be opened from the `File` menu (`File` → `New File...`) or the `Get Started` welcome page.

## XML Import/Export Commands

The [InterSystems ObjectScript extension](https://marketplace.visualstudio.com/items?itemName=intersystems-community.vscode-objectscript) provides commands for importing and exporing XML files. The commands can be invoked from [the command palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette) under the titles `Import XML Files...` and `Export Documents to XML File...`. These commands require an active server connection (the one from the currently opened document will be used if one is open), and the server's version must be 2023.2 or greater.
isc-bsaviano marked this conversation as resolved.
Show resolved Hide resolved

## Keyboard Shortcuts

In general, VS Code keyboard shortcuts are infinitely customizable <a href="https://code.visualstudio.com/docs/getstarted/keybindings">as described in the docs</a>. However, the IDE comes configured with a number of shortcuts that match Studio. <a href="https://code.visualstudio.com/docs/getstarted/keybindings#_keyboard-shortcuts-reference">Download a cheat sheet here</a>.
Expand Down
20 changes: 20 additions & 0 deletions package.json
Expand Up @@ -91,6 +91,8 @@
"onCommand:vscode-objectscript.openErrorLocation",
"onCommand:vscode-objectscript.launchWebSocketTerminal",
"onCommand:vscode-objectscript.intersystems-servermanager.webterminal",
"onCommand:vscode-objectscript.importXMLFiles",
"onCommand:vscode-objectscript.exportToXMLFile",
"onTerminalProfile:vscode-objectscript.webSocketTerminal",
"onLanguage:objectscript",
"onLanguage:objectscript-int",
Expand Down Expand Up @@ -355,6 +357,14 @@
{
"command": "vscode-objectscript.intersystems-servermanager.webterminal",
"when": "false"
},
{
"command": "vscode-objectscript.importXMLFiles",
"when": "vscode-objectscript.connectActive && workspaceFolderCount != 0"
},
{
"command": "vscode-objectscript.exportToXMLFile",
"when": "vscode-objectscript.connectActive && workspaceFolderCount != 0"
}
],
"view/title": [
Expand Down Expand Up @@ -1146,6 +1156,16 @@
"command": "vscode-objectscript.intersystems-servermanager.webterminal",
"title": "Launch WebSocket Terminal",
"icon": "$(terminal)"
},
{
"category": "ObjectScript",
"command": "vscode-objectscript.importXMLFiles",
"title": "Import XML Files..."
},
{
"category": "ObjectScript",
"command": "vscode-objectscript.exportToXMLFile",
"title": "Export Documents to XML File..."
}
],
"keybindings": [
Expand Down
27 changes: 27 additions & 0 deletions src/api/index.ts
Expand Up @@ -240,6 +240,12 @@ export class AtelierAPI {
);
}

/** Return the server's name in `intersystems.servers` if it exists, else its `host:port/pathPrefix` */
public get serverId(): string {
const { serverName, host, port, pathPrefix } = this.config;
return serverName && serverName !== "" ? serverName : `${host}:${port}${pathPrefix}`;
}

public async request(
minVersion: number,
method: string,
Expand Down Expand Up @@ -723,4 +729,25 @@ export class AtelierAPI {
public async getCSPDebugId(): Promise<Atelier.Response<Atelier.Content<number>>> {
return this.request(2, "GET", "%SYS/cspdebugid");
}

// v7+
public async actionXMLExport(body: string[]): Promise<Atelier.Response<Atelier.Content<string[]>>> {
return this.request(7, "POST", `${this.ns}/action/xml/export`, body);
}

// v7+
public async actionXMLLoad(
body: { file: string; content: string[]; selected?: string[] }[]
): Promise<Atelier.Response<Atelier.Content<{ file: string; imported: string[]; status: string }[]>>> {
return this.request(7, "POST", `${this.ns}/action/xml/load`, body);
}

// v7+
public async actionXMLList(
body: { file: string; content: string[] }[]
): Promise<
Atelier.Response<Atelier.Content<{ file: string; documents: { name: string; ts: string }[]; status: string }[]>>
> {
return this.request(7, "POST", `${this.ns}/action/xml/list`, body);
}
}