Web-based Caché terminal for InterSystems products. Access your database from everywhere!
Visit project page for more details and download the latest version here. Read more and discuss WebTerminal on InterSystems Developer Community.
Syntax highlighting & intelligent autocomplete!
Embedded SQL mode!
Even more features!
Native browser application | Allows to access Caché terminal both from desktop or mobile devices. |
Autocompletion | Type faster. Autocomplete is available in the most cases. |
Tracing | Monitor any changes in globals or files. |
SQL mode | A convenient way to execute SQL queries. |
Syntax highlighting | Intelligently highlighted input. |
Favorites | Save commands you execute frequently. |
Security | All you need is to protect /terminal/ entry point, and all sessions are guaranteed to be secure. |
Self-updating | Terminal version 4 and higher prompts to update automatically, so you will not miss the important update. |
Explore! | Enjoy using WebTerminal! |
Download the latest version from project page and import XML file into any namespace.
After installation, you will be able to access application at http://[host]:[port]/terminal/
(slash at the end is required).
Type /help
there to get more information.
To embed WebTerminal to any other web application, you can use <iframe>
tag.
Example:
<iframe id="terminal" src="http://127.0.0.1:57772/terminal/?ns=SAMPLES&clean=1"></iframe>
Note that terminal URL may include optional GET parameters, which are the next:
ns=USER
Namespace to open terminal in. If the logged user has no access to this namespace, the error message will appear and no namespace changes will occur.clean
Start the WebTerminal without any additional information printed. It is not recommended to use this option if you are using terminal as a stand-alone tool (for everyday use), as you can miss important updates.
To use WebTerminal's API, you need to get WebTerminal instance first. Use iframe's
onTerminalInit
function to get it.
document.querySelector("#terminal").contentWindow.onTerminalInit(function (terminal) {
// now work with terminal object here!
});
This function is triggered after WebTerminal establish an authorized connection.
The next table demonstrates available API. Left column are terminal
object properties.
Function | Description |
execute(command, options) |
Executes the COS command right as if it is entered
to the terminal. However, options provide an
additional flags setup. options.echo (false by default) - prints the command on the screen. options.prompt (false by default) - prompts the user after execution (prints "NAMESPACE > " as well). |
onUserInput(cb) |
cb(text, mode) is fired right after user presses enter. Argument
text is a String of user input, and
mode is a Number , which can be compared
with one of the terminal mode constants, such as MODE_PROMPT .
|
print(text) | Prints text which can include special characters and escape sequences. This function is input-safe, and you can print event when terminal is requesting for input without disrupting input. In this case the input will reappear right after text printed. |
Constant | Description |
MODE_PROMPT | Regular input (COS command) |
MODE_SQL | Input in SQL mode (SQL command) |
MODE_READ | Prompt issued by COS read c command |
MODE_READ_CHAR | Prompt issued by COS read *c command |
MODE_SPECIAL | Special CWT's input (commands like /help, /config etc) |
The next example demonstrates a way to intercept terminal's input:
let iFrame = document.querySelector("#terminal");
function myInitHandler (terminal) {
terminal.execute("set hiddenVariable = 7", {
echo: false // the default is false, this is just a demo
});
terminal.onUserInput(function (text, mode) {
if (mode !== terminal.MODE_PROMPT)
return;
terminal.print("\r\nYou've just entered the next command: " + text);
});
}
// At first, handle iFrame load event. Note that the load handler won't work
// if this code is executed at the moment when iFrame is already initialized.
iFrame.addEventListener("load", function () {
iFrame.contentWindow.onTerminalInit(myInitHandler); // handle terminal initialization
});
We are glad to see anyone who want to contribute to Caché WEB Terminal development! Check our developer's guide.
In short, the "hot start" is extremely easy. Having latest Git and NodeJS installed (tested on NodeJS v4-6), execute the following:
git clone https://github.com/intersystems-ru/webterminal
cd webterminal # enter repository directory
npm install # install all project's dependencies
npm run build # build the project
# OR edit import.bat script (on Windows) and then use only the following command:
import
Now, in build
folder you will find WebTerminal-v*.xml
file. Every time you
changes is ready to be tested, just run import
.