Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/Linkurious/lke-plugin-data-table

Data-table plugins for Linkurious Enterprise
https://github.com/Linkurious/lke-plugin-data-table

framework-lke lang-javascript linkurious-enterprise plugin

Last synced: about 1 month ago
JSON representation

Data-table plugins for Linkurious Enterprise

Awesome Lists containing this project

README

        

# Data-table plugin for Linkurious Enterprise

This Linkurious Enterprise plugin allow displaying the result of a
query (or query template) as a table.

![data-table plugin screenshot](./data-table-screenshot.png)

## Configuration

You can configure a plugin via the [Linkurious Configuration](https://doc.linkurio.us/admin-manual/latest/configure/).

Configuration keys supported by all the plugins:
| Key | Type | Description | Example |
| :-- | :-- | :-- | :-- |
| `basePath` | string (**optional**) | A base path on which the plugin will be mounted. Defaults to [the manifest name](https://github.com/Linkurious/lke-plugin-data-table/blob/master/manifest.json#L2). | `"table"` |
| `debugPort` | number (**optional**) | A debug port on which to attach a debugger for the plugin NodeJS process. If not specfified, the plugin won't be started in debug mode. | `9230` |

Configuration keys supported only by the data-table plugin:

| Key | Type | Description | Example |
| :-- | :-- | :-- | :-- |
| `entityType` | "edge" \| "node" (**required**) | Whether to display nodes or edges in the table. | `"node"` |
| `itemType` | string (**required**) | Name of the node category or edge type to display in the table. | `"Company"` |
| `delimiter` | string (**optional**) | The delimiter used for csv files downloads. Only one character is allowed. By default "," is used | `";"` |
| `properties` | string\[] (**optional**) | Property names to include in the table. Defaults to all the properties of `itemType`. | `["name", "address", "vat_number"]` |

Configuration example for 1 data-table instance accesible via `/plugins/table`:
Screenshot 2021-03-09 at 18 59 07

Configuration example for 2 data-table instances accesible via `/plugins/table` and `/plugins/edgeTable`:
Screenshot 2021-03-10 at 15 16 40

*You can run multiple data-table instances by passing an array with unique `basePath` per config.*

## URL parameters

This plugin supports the following URL parameters in the query string:

| Param | Type | Description | Example |
| :-- | :-- | :-- | :-- |
| `queryId` | integer, short UUID or UUID (**required**, forbidden if `queryName` is used) | ID of the query to run. | `queryId=61b338b0` |
| `queryName` | string (**required**, forbidden if `queryId` is used) | Name of the query to run. | `queryName=getTransactions` |
| `sourceKey` | string (**required**) | Key of the data-source to run the query on. | `sourceKey=b16e9ed5` |
| `limit` | integer (**optional**) | Maximum number of results to display. | `limit=500` |
| `param_number_{{Encoded field name}}` | number (**optional**) | *For query templates*, any numerical parameter of the template. | `param_number_age=30` |
| `param_string_{{Encoded field name}}` | string (**optional**) | *For query templates*, any string parameter of the template. | `param_string_city=Paris` |
| `param_ids_{{Encoded field name}}` | comma-separated list (**optional**) | *For query templates*, any edgeset/nodeset parameter of the template. | `param_ids_target_ids=1,50,12` |
| `showLongValues` | boolean (**optional**) | Avoids truncation of long texts. | `showLongValues=false` |

### Usage with standard queries

In order to display the result of a standard query in a table:

1. Create a standard READ query. For example: `MATCH (n) return n LIMIT 1000`.
2. Note down the newly-created query ID, it will by the value of `queryId`. For example: `queryId=61b338b0`.
3. Compose a valid data-table plugin URL and open it in a new tab. For example:
```
{{baseUrl}}plugins/table?queryId=61b338b0&sourceKey={{sourceKey}}
```
You can save this URL as a [Custom Action](https://doc.linkurio.us/user-manual/latest/custom-actions/), and when triggered, the `{{baseUrl}}` and `{{sourceKey}}` will be replaced with your LKE base URL and your current data-source key, respectively, and the final URL will be opened in a new tab. You can always do it manually, if you want.

### Usage with query templates

In order to display the result of a query template in a table:

1. Create a READ query template. For example: `MATCH (n) where n.city={{"City Name":string}} return n LIMIT 1000`.
2. Note down the newly-created query ID, it will by the value of `queryId`. For example: `queryId=bf450812`.
2. Note down each field title, [URL encode it](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent), prepend it with a valid URL parameter and give it a value. For example: `param_string_City%20Name=Paris`.
3. Compose a valid data-table plugin URL and open it in a new tab. For example:
```
{{baseUrl}}plugins/table?queryId=bf450812&sourceKey={{sourceKey}}&param_string_City%20Name=Paris
```
You can save this URL as a [Custom Action](https://doc.linkurio.us/user-manual/latest/custom-actions/), and when triggered, the `{{baseUrl}}` and `{{sourceKey}}` will be replaced with your LKE base URL and your current data-source key, respectively, and the final URL will be opened in a new tab. You can always do it manually if you want.

*Note that when prepending `param_string_` to the template field name `City Name`, we had to [encode](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURIComponent) it into `City%20Name` in order to be URL compliant.*