project-flogo / flogo-web

Project Flogo Web UI
http://flogo.io
BSD 3-Clause "New" or "Revised" License
65 stars 36 forks source link

Connections support #1330

Open fcastill opened 4 years ago

fcastill commented 4 years ago

Is your feature request related to a problem? Please describe.

Flogo Project introduced the concept of "connection", the Flogo Web UI should support working with connections.

From Flogo Core Docs

A connection is typically used to connect to a networked resource

There are three areas where connections surface:

  1. Type of resource: A connection is implemented as a new type of resource, with type flogo:connection. An example of a connection descriptor can be found in the Pulsar Connection contribution
  2. Data type: connection is also a new data type (see Flogo data types) and a such it can be used to describe activities and triggers settings. See pulsar trigger descriptor and pulsar activity descriptor
  3. In app.json: If a contribution declares a setting of data type connection in its descriptor.json then the value for that setting can be either an in-line connection or a shared connection. Usages of connections will be described below.

Question: can connection data type be used anywhere a data type can be used? Trigger settings, handler settings, trigger output, trigger reply, activity settings, activity input, functions.

Usage of connections in an app (flogo.json)

From Flogo Core Docs

These connections can be shared or defined in-line. When a connection is defined in-line, it is only used by that contribution. Shared connection is defined once in the flogo.json and can shared between multiple resources.

Note that for both inline and shared usages the fields under connections.settings depend on the connection.ref. Those settings should be declared in the corresponding descriptor.json for the connection contribution. That is similar to the way Web UI currently uses the descriptor.json of activities and triggers to extract their "schema".

Also, if a connection is used in a Flogo app then the corresponding ref for that connection should be part of the imports of the app.

In-line

"activity" : {
  "ref": "#sql",
  "settings": {
    "connection": {
      "ref" : "github.com/project-flogo/contrib/connection/sql",
      "settings" : {
        "dbType": "mysql",
        "driver": "mysql",
        "dataSource": "username:password@tcp(host:port)/dbName",
      }
    }
  }
}

Shared

"connections": {
  "myConn": {
    "ref" : "github.com/project-flogo/contrib/connection/sql",
    "settings" : {
      "dbType": "mysql",
      "driver": "mysql",
      "dataSource": "username:password@tcp(host:port)/dbName",
    }
  }
}
"activity" : {
  "id": "a1",
  "ref": "#sql",
  "settings": {
    "connection": "conn://myConn"
  }
},
"activity" : {
  "id": "a2",
  "ref": "#sql",
  "settings": {
    "connection": "conn://myConn"
  }
}

Describe the solution you'd like

The Web UI should be able to handle importing, using and exporting connections for all areas (resource type, data type, app usage) and all usage types (in-line and shared).

Plan

We will introduce the connections to the Web UI in iterations as the shared connections in particular will require designing new UI components and interactions.

We will divide it in at least 2 iterations (subject to change). This Github issue will act as the placeholder for supporting all connections features and we will describe the iterations in subsequent Github issues.

To Do

Questions