Skip to content

Commit 4aaec4c

Browse files
Merge pull request #53 from Linkurious/develop
Release 1.0.12 [ci:run]
2 parents 30307b9 + ed0ad66 commit 4aaec4c

File tree

9 files changed

+1122
-451
lines changed

9 files changed

+1122
-451
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 1.0.11
2+
current_version = 1.0.12
33
commit = False
44
tag = False
55
serialize =

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
public/js/vendor/**
12
dist/**

.eslintrc.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ module.exports = {
8686
'max-statements': 'error',
8787
'max-statements-per-line': 'error',
8888
'multiline-comment-style': 'error',
89-
'multiline-ternary': 'error',
9089
'new-cap': 'error',
9190
'new-parens': 'error',
9291
'newline-per-chained-call': 'error',
@@ -153,7 +152,6 @@ module.exports = {
153152
'no-shadow': 'error',
154153
'no-tabs': 'error',
155154
'no-template-curly-in-string': 'error',
156-
'no-ternary': 'error',
157155
'no-throw-literal': 'error',
158156
'no-trailing-spaces': 'error',
159157
'no-undef-init': 'error',

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.11
1+
1.0.12

README.md

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Data-table plugin for Linkurious Enterprise
22

3-
This Linkurious Enterprise plugin allow displaying the result of a
3+
This Linkurious Enterprise plugin allows displaying the result of a
44
query (or query template) as a table.
55

66
![data-table plugin screenshot](./data-table-screenshot.png)
@@ -9,50 +9,51 @@ query (or query template) as a table.
99

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

12-
Configuration keys supported by all the plugins:
13-
| Key | Type | Description | Example |
14-
| :-- | :-- | :-- | :-- |
15-
| `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"` |
16-
| `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` |
12+
Configuration keys that are supported by all the plugins:
1713

18-
Configuration keys supported only by the data-table plugin:
14+
| Key | Type | Description | Example |
15+
|:------------|:------------------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------|
16+
| `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"` |
17+
| `debugPort` | `number` (**optional**) | A debug port on which to attach a debugger for the plugin Node.js process. If not specified, the plugin won't be started in debug mode. | `9230` |
1918

20-
| Key | Type | Description | Example |
21-
| :-- | :-- | :-- | :-- |
22-
| `entityType` | "edge" \| "node" (**required**) | Whether to display nodes or edges in the table. | `"node"` |
23-
| `itemType` | string (**required**) | Name of the node category or edge type to display in the table. | `"Company"` |
24-
| `delimiter` | string (**optional**) | The delimiter used for csv files downloads. Only one character is allowed. By default "," is used | `";"` |
25-
| `properties` | string\[] (**optional**) | Property names to include in the table. Defaults to all the properties of `itemType`. | `["name", "address", "vat_number"]` |
19+
Configuration keys that are supported by the data-table plugin:
2620

27-
Configuration example for 1 data-table instance accesible via `/plugins/table`:
21+
| Key | Type | Description | Example |
22+
|:-------------|:----------------------------------|:--------------------------------------------------------------------------------------------------|:------------------------------------|
23+
| `entityType` | `"edge" \| "node"` (**required**) | Whether to display nodes or edges in the table. | `"node"` |
24+
| `itemType` | `string` (**required**) | Name of the node category or edge type to display in the table. | `"Company"` |
25+
| `delimiter` | `string` (**optional**) | The delimiter used for csv files downloads. Only one character is allowed. By default "," is used | `";"` |
26+
| `properties` | `string[]` (**optional**) | Property names to include in the table. Defaults to all the properties of `itemType`. | `["name", "address", "vat_number"]` |
27+
28+
Configuration example for one data-table instance accessible via `/plugins/table`:
2829
<img width="1036" alt="Screenshot 2021-03-09 at 18 59 07" src="https://user-images.githubusercontent.com/11739632/110516230-9508c200-8109-11eb-9fae-1218010597f6.png">
2930

30-
Configuration example for 2 data-table instances accesible via `/plugins/table` and `/plugins/edgeTable`:
31+
Configuration example for two data-table instances accessible via `/plugins/table` and `/plugins/edgeTable`:
3132
<img width="1031" alt="Screenshot 2021-03-10 at 15 16 40" src="https://user-images.githubusercontent.com/11739632/110642781-a4444a00-81b3-11eb-9864-919916648db9.png">
3233

33-
*You can run multiple data-table instances by passing an array with unique `basePath` per config.*
34+
> ℹ️ You can set up multiple data-table instances by passing an array with unique `basePath` per config.*
3435
3536
## URL parameters
3637

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

39-
| Param | Type | Description | Example |
40-
| :-- | :-- | :-- | :-- |
41-
| `queryId` | integer, short UUID or UUID (**required**, forbidden if `queryName` is used) | ID of the query to run. | `queryId=61b338b0` |
42-
| `queryName` | string (**required**, forbidden if `queryId` is used) | Name of the query to run. | `queryName=getTransactions` |
43-
| `sourceKey` | string (**required**) | Key of the data-source to run the query on. | `sourceKey=b16e9ed5` |
44-
| `limit` | integer (**optional**) | Maximum number of results to display. | `limit=500` |
45-
| `param_number_{{Encoded field name}}` | number (**optional**) | *For query templates*, any numerical parameter of the template. | `param_number_age=30` |
46-
| `param_string_{{Encoded field name}}` | string (**optional**) | *For query templates*, any string parameter of the template. | `param_string_city=Paris` |
47-
| `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` |
48-
| `showLongValues` | boolean (**optional**) | Avoids truncation of long texts. | `showLongValues=false` |
40+
| Param | Type | Description | Example |
41+
|:--------------------------------------|:-------------------------------------------------------------------------------|:----------------------------------------------------------------------|:-------------------------------|
42+
| `queryId` | `integer`, short UUID or UUID (**required**, forbidden if `queryName` is used) | ID of the query to run. | `queryId=61b338b0` |
43+
| `queryName` | `string` (**required**, forbidden if `queryId` is used) | Name of the query to run. | `queryName=getTransactions` |
44+
| `sourceKey` | `string` (**required**) | Key of the data-source to run the query on. | `sourceKey=b16e9ed5` |
45+
| `limit` | `integer` (**optional**) | Maximum number of results to display. | `limit=500` |
46+
| `param_number_{{Encoded field name}}` | `number` (**optional**) | *For query templates*, any numerical parameter of the template. | `param_number_age=30` |
47+
| `param_string_{{Encoded field name}}` | `string` (**optional**) | *For query templates*, any string parameter of the template. | `param_string_city=Paris` |
48+
| `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` |
49+
| `showLongValues` | `boolean` (**optional**) | Avoids truncation of long texts. | `showLongValues=false` |
4950

5051
### Usage with standard queries
5152

52-
In order to display the result of a standard query in a table:
53+
To display the result of a standard query in a table:
5354

5455
1. Create a standard READ query. For example: `MATCH (n) return n LIMIT 1000`.
55-
2. Note down the newly-created query ID, it will by the value of `queryId`. For example: `queryId=61b338b0`.
56+
2. Note down the newly created query ID, it will by the value of `queryId`. For example: `queryId=61b338b0`.
5657
3. Compose a valid data-table plugin URL and open it in a new tab. For example:
5758
```
5859
{{baseUrl}}plugins/table?queryId=61b338b0&sourceKey={{sourceKey}}
@@ -61,12 +62,12 @@ You can save this URL as a [Custom Action](https://doc.linkurio.us/user-manual/l
6162

6263
### Usage with query templates
6364

64-
In order to display the result of a query template in a table:
65+
To display the result of a query template in a table:
6566

6667
1. Create a READ query template. For example: `MATCH (n) where n.city={{"City Name":string}} return n LIMIT 1000`.
67-
2. Note down the newly-created query ID, it will by the value of `queryId`. For example: `queryId=bf450812`.
68-
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`.
69-
3. Compose a valid data-table plugin URL and open it in a new tab. For example:
68+
2. Note down the newly created query ID, it will by the value of `queryId`. For example: `queryId=bf450812`.
69+
3. 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`.
70+
4. Compose a valid data-table plugin URL and open it in a new tab. For example:
7071
```
7172
{{baseUrl}}plugins/table?queryId=bf450812&sourceKey={{sourceKey}}&param_string_City%20Name=Paris
7273
```

backend/routeHandler.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,18 @@ module.exports = function configureRoutes(options) {
124124
sourceKey: req.body.queryParams.global.sourceKey,
125125
limit: +req.body.queryParams.global.limit
126126
};
127-
if (req.body.query.templateFields) {
128-
data.templateData = sanitizeTemplateData(req.body.queryParams.templateFields, req.body.query.templateFields);
129-
}
130127
try {
128+
if (req.body.query.templateFields) {
129+
data.templateData = sanitizeTemplateData(req.body.queryParams.templateFields, req.body.query.templateFields);
130+
}
131131
const queryResult = await options.getRestClient(req).graphQuery.runQueryById(data);
132132
res.status(200);
133133
res.contentType('application/json');
134134
res.send(JSON.stringify(queryResult));
135135
} catch (e) {
136136
res.status(400);
137137
res.contentType('application/json');
138-
const error = e.originalResponse.body ? e.originalResponse.body : e;
138+
const error = e.originalResponse?.body ? e.originalResponse.body : e;
139139
res.send(JSON.stringify({status: 400, body: {error}}));
140140
}
141141

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "data-table",
3-
"version": "1.0.11",
3+
"version": "1.0.12",
44
"pluginApiVersion": "1.0.0",
55
"publicRoute": "public",
66
"singlePageAppIndex": "index.html",

0 commit comments

Comments
 (0)