/openwhisk-react-ui

Simple UI for Apache OpenWhisk written in React&Redux.

Primary LanguageJavaScript

UI for Apache OpenWhisk

This repo is an experiment with the main purpose of learning React & Redux. Because I played around with Apache OpenWhisk earlier, I decided to create a UI for this FaaS platform.

With this UI, you will be able to create actions, triggers and rules. This UI can be useful when working with custom cloud deployments of OpenWhisk.

Technologies

  • React
  • Redux
  • Webpack

Other libraries:

  • axios
  • lodash
  • react-ace
  • react-pagination
  • redux-logger
  • redux-promise
  • redux-thunk

For testing:

  • jest
  • enzyme
  • sinon
  • deep-freeze

Prerequisites

You have 2 options here:

  • Deploy a custom OpenWhisk in your cloud infrastructure
  • Use a hosted version of OpenWhisk on Bluemix:

Remember about disabling the CORS add-on after you're finished playing around.

Run app

  1. After Bluemix CLI is installed, run

    bx wsk property get
  2. Encode whisk auth token, consisting of username and password (username:password):

    echo -n username:password | base64 
  3. Copy whisk API host, whisk API version, returned token from command above and paste into config.js file:

    export const config = {
        baseUrl: 'https://<whisk API host>/api/<whisk API version>/namespaces/<your email>_dev',
        namespace: '<your email>_dev',
        token: 'Basic <token>'
    };
  4. Install all dependencies

    yarn install
  5. Run

    npm start

The application should appear under localhost (port 8080 is set by default).

And VoilĂ ! Have fun!

Simple user journey

  1. Create an action with this code and name it as you want:
function main(params) {
   return {
       result: 'Hello ' + params.name
   };
}
  1. Create a trigger with these parameters:
[
  {
    "key": "name",
    "value": "WRITE_HERE_YOUR_NAME"
  }
]
  1. Create a rule to connect your action and trigger.
  2. Go to Trigger list and Run your trigger.
  3. Go to Activations list and display details. You should see something like this:
{
  "response": {
    "result": {
      "result": "Hello WRITE_HERE_YOUR_NAME"
    },
    "success": true,
    "status": "success"
  },
  "logs": []
}

In case if you don't see new activation, just wait. When you run a trigger, OpenWhisk has to take its parameters, inject them into the action and then create an activation. It can take a while.

Roadmap

There are a couple of things, which will be improved:

  • RWD (the application was tested only on Chrome browser and 15-inch laptop)
  • modals (confirmation before deleting and information in case of any failures)
  • listening for the new activations
  • caching
  • add possibility to run the code using a custom image (blackbox option)
  • create sequence actions (with drag and drop)

Resources