Skip to content

The first and the most powerful web-based terminal for InterSystems Caché®, Ensemble®, HealthShare®, TrakCare® and other products built on top of InterSystems Caché.

License

Notifications You must be signed in to change notification settings

dyubaylo97/webterminal

 
 

Repository files navigation

Caché Web Terminal

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.

Preview

Syntax highlighting & intelligent autocomplete!

2016-09-18_212035

Embedded SQL mode!

2016-09-18_212244

Even more features!

2016-09-18_212325

Key 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!

Installation

Download the latest version from project page and import XML file into any namespace.

Usage

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.

Integration and WebTerminal's API

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_PROMPTRegular input (COS command)
MODE_SQLInput in SQL mode (SQL command)
MODE_READPrompt issued by COS read c command
MODE_READ_CHARPrompt issued by COS read *c command
MODE_SPECIALSpecial 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
});

WebTerminal Project Development

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.

About

The first and the most powerful web-based terminal for InterSystems Caché®, Ensemble®, HealthShare®, TrakCare® and other products built on top of InterSystems Caché.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 74.4%
  • Apex 14.6%
  • OpenEdge ABL 3.6%
  • TeX 3.6%
  • CSS 3.0%
  • Batchfile 0.5%
  • HTML 0.3%