Skip to main content
Skip table of contents

WebCLI application example

The WebCLI application example described in this article consists of a simple web interface that makes it possible to create and resolve IBI-aws messages.

Components

The following components are involved in order to create messages via the web interface:

Website

The website is a simple HTML page that communicates with the IBI-aws WebCLI using JavaScript (or Ajax requests). The sample website makes it possible to create and resolve messages.

IBI-aws WebCLI

The IBI-aws WebCLI is the interface between an external application (e.g. a web application) and the IBI-aws. Actions can be stored in the WebCLI which make CLI calls at the request of the external application. Such an action can be, for example, the execution of a PowerShell script.

PowerShell scripts

In this IBI-aws WebCLI application example, certain actions are implemented by executing PowerShell scripts. The following PowerShell scripts are used:

IBI-aws Admin CLI

With the command line interface, some functions of the IBI-aws Admin can be used without using the graphical user interface.

Further details on the IBI-aws command line interface can be found here.

Process flow

Create a message

The process from user input via a web interface to the created IBI-aws message is as follows:

  1. The user makes entries via the web interface and submits the form to create an IBI-aws message.
    From the user's point of view, no further actions are required.

  2. The website now calls the IBI-aws WebCLI via AJAX.
    The action to be triggered in the WebCLI and the user input are transferred in the AJAX request body.

  3. The IBI-aws WebCLI determines the action specified from the incoming request and executes it with the additionally specified arguments of the request.
    In this example, the action consists of a call to a PowerShell script.

  4. The PowerShell script prepares the transferred data for the CLI of the IBI-aws Admin.

  5. The CLI of the IBI-aws Admin receives the data and creates the message.

  6. The IBI-aws WebCLI has completed its task and returns the result of the processing as a response to the caller (in this case the web interface).

  7. The web interface displays the result of the action graphically.

    1. If successful, the new message is added to the listing in the sample website.

    2. In the event of an error, the error is displayed via a dialog.

Resolving a message

The procedure for resolving a message is similar to that for creating a message. The following differences should be emphasized:

  • When the IBI-aws WebCLI is called, a different action and other additional information is specified (such as the ID of the message to be resolved).

  • The IBI-aws WebCLI action for resolving a message uses a different PowerShell script.

User interface

The user interface of the sample website provides the following input options:

  • Switch the language between English and German (top right).
    This only affects the language of the web interface and has no effect on the message to be created.

  • Reason and message.

  • Selection of the affected applications (optional).
    The selection field can be used to select applications to which the message should refer. The CTRL key can be used to make multiple selections or to deselect applications.

  • Checkbox Publish now.
    Indicates whether the message should be published immediately after creation.

  • Button Create message.

  • Selection field Language.
    This selection field can be used to define different translations for the message.

  • Listing Messages.
    If messages have already been created, they will be listed below.

In this simple sample website the list of created messages disappears if the website is reloaded or closed.

  • Button Resolve.
    Allows you to resolve a message that has already been created.

image-20240530-071546.png

Installation

Installation

IBI-aws WebCLI

Provide the IBI-aws WebCLI on a web server. The directory structure could look as follows: ./WebCLI/Server/Application

This directory contains the IBI-aws WebCLI web application and the associated Actions.xml, in which the executable actions are defined.

Details on the installation of the IBI-aws WebCLI can be found here.

Sample website

The web resources (such as HTML, CSS and JavaScript) can be stored under ./WebCLI/SampleWebsites, for example.

Customizing JavaScript variables

In the JavaScript files sample1.js and sample2.js, adjust the variables webCliBaseUrl and apiKey.

  • webCliBaseUrl: Base URL of the IBI-aws WebCLI.

  • apiKey: The API Key stored in the appsettings.json file.

Please note that special security measures have been omitted in this application example for reasons of simplicity. The API key specified in the JavaScript files can be read and used by all visitors to the sample website.

Implement authentication and authorization in a production environment.

PowerShell-Scripts

In this application example, there are two PowerShell scripts that have been stored in the following directory: ./WebCLI/Server/Scripts

create_aws_message.ps1

This script is used to create IBI-aws messages. It processes the transferred data and prepares it for the command line interface of the IBI-aws Admin. Among other things, the script makes it possible to create messages that refer to an application or application group. For this purpose, the IDs of these applications were taken from the IBI-aws Admin and stored in the script.

  • For this application example, make sure that the applications specified in the UI are stored in the IBI-aws Admin and that their IDs are updated in the PowerShell script.

You can obtain the ID of an application or application group via the action panel or via the context menu of the selected entry.

  • Excerpt from the PowerShell script:

    CODE
    ...
    $awsApplications = @{
        "browsers" = @{
            Type     = "group"
            Reference = "2672b6cc-1efd-444e-877e-1b03d3141516"
        }
    ...
  • Also make sure that the path to the IBI.aws.Admin.exe specified in the script is correct. If you accept the project as it was provided (or as described below), no changes should be necessary.

    CODE
    ...
    $exePath = Join-Path $scriptDirectory ".\Admin\IBI.aws.Admin.exe"
    ...

resolve_aws_message.ps1

This script is used to resolve IBI-aws messages. Again, make sure that the path to the IBI.aws.Admin.exe is correct.

general_message.iaatemplate

In the Scripts directory there is another file general_message.iaatemplate. This serves as a template for the creation of IBI-aws messages.

IBI-aws Admin

The IBI-aws Admin application, which provides the IBI-aws command line interface, has been placed in the following directory: ./WebCLI/Server/Scripts/Admin

A preconfigured Data.xml was provided for this example, which is located in the same directory as the IBI.aws.Admin.exe.

Overview of directory structure

To summarize, the directory structure of this application example could look as follows:

  • WebCLI

    • Server

      • Application

        • IBI.aws.WebCLI.exe 

        • Actions.xml

        • ...

      • Scripts

        • create_aws_message.ps1 

        • resolve_aws_message.ps1

        • general_message.iaatemplate

        • Admin

          • IBI.aws.Admin.exe

          • Data.xml

          • ...

    • SampleWebsites

      • index.html

      • sample1.html

      • sample2.html

      • css

      • js

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.