Skip to content

Commit 30307b9

Browse files
authored
Merge pull request #50 from Linkurious/develop
Release 1.0.11 [ci:run]
2 parents 6c367a0 + 0444f30 commit 30307b9

File tree

9 files changed

+35
-13
lines changed

9 files changed

+35
-13
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.10
2+
current_version = 1.0.11
33
commit = False
44
tag = False
55
serialize =

.version

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

Jenkinsfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
nodeJob {
44
// General
55
projectName = "linkurious/lke-plugin-data-table"
6+
podTemplateNames = ['jnlp-agent-node']
67
runUnitTests = false
78
runE2eTests = false
89

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ This plugin supports the following URL parameters in the query string:
3838

3939
| Param | Type | Description | Example |
4040
| :-- | :-- | :-- | :-- |
41-
| `queryId` | integer (**required**, forbidden if `queryName` is used) | ID of the query to run. | `queryId=87` |
41+
| `queryId` | integer, short UUID or UUID (**required**, forbidden if `queryName` is used) | ID of the query to run. | `queryId=61b338b0` |
4242
| `queryName` | string (**required**, forbidden if `queryId` is used) | Name of the query to run. | `queryName=getTransactions` |
4343
| `sourceKey` | string (**required**) | Key of the data-source to run the query on. | `sourceKey=b16e9ed5` |
4444
| `limit` | integer (**optional**) | Maximum number of results to display. | `limit=500` |
@@ -52,10 +52,10 @@ This plugin supports the following URL parameters in the query string:
5252
In order to display the result of a standard query in a table:
5353

5454
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=87`.
55+
2. Note down the newly-created query ID, it will by the value of `queryId`. For example: `queryId=61b338b0`.
5656
3. Compose a valid data-table plugin URL and open it in a new tab. For example:
5757
```
58-
{{baseUrl}}plugins/table?queryId=87&sourceKey={{sourceKey}}
58+
{{baseUrl}}plugins/table?queryId=61b338b0&sourceKey={{sourceKey}}
5959
```
6060
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.
6161

@@ -64,11 +64,11 @@ You can save this URL as a [Custom Action](https://doc.linkurio.us/user-manual/l
6464
In order to display the result of a query template in a table:
6565

6666
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=19`.
67+
2. Note down the newly-created query ID, it will by the value of `queryId`. For example: `queryId=bf450812`.
6868
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`.
6969
3. Compose a valid data-table plugin URL and open it in a new tab. For example:
7070
```
71-
{{baseUrl}}plugins/table?queryId=19&sourceKey={{sourceKey}}&param_string_City%20Name=Paris
71+
{{baseUrl}}plugins/table?queryId=bf450812&sourceKey={{sourceKey}}&param_string_City%20Name=Paris
7272
```
7373
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.
7474

backend/routeHandler.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module.exports = function configureRoutes(options) {
6565

6666
options.router.post('/getQuery', async (req, res) => {
6767
const getQueryParams = {
68-
id: +req.body.id,
68+
id: req.body.id,
6969
sourceKey: req.body.sourceKey
7070
};
7171
const query = await options.getRestClient(req).graphQuery.getQuery(getQueryParams);

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.10",
3+
"version": "1.0.11",
44
"pluginApiVersion": "1.0.0",
55
"publicRoute": "public",
66
"singlePageAppIndex": "index.html",

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@linkurious/lke-plugin-data-table",
3-
"version": "1.0.10",
3+
"version": "1.0.11",
44
"description": "Data-table plugin for Linkurious Enterprise",
55
"main": "index.js",
66
"homepage": "https://github.com/Linkurious/lke-plugin-data-table#readme",

public/js/main.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,35 @@ function validateGlobalQueryParams(params) {
199199
return handleError({body: {message: 'Missing URL parameter: a “queryId” (number) or a “queryName” (string) is mandatory'}});
200200
} else if (params.queryId !== undefined && params.queryName !== undefined) {
201201
return handleError({body: {message: 'Only one query parameter is allowed: impossible to use “queryId” and “queryName” at the same moment'}});
202-
} else if (params.queryId !== undefined && !Number.isInteger(+params.queryId)) {
203-
return handleError({body: {message: 'URL parameter “queryId” must be a number'}});
202+
} else if (params.queryId !== undefined && !Number.isInteger(+params.queryId) && !isUuid(params.queryId) && !isShortUuid(params.queryId)) {
203+
return handleError({body: {message: 'URL parameter “queryId” must be an integer, a UUID or a short UUID'}});
204204
} else if (params.sourceKey === undefined) {
205205
return handleError({body: {message: 'Missing URL parameter “sourceKey” (must be a string)'}});
206206
}
207207
return true;
208208
}
209209

210+
/**
211+
* Return true if the supplied value is a valid RFC4122 UUID.
212+
*/
213+
function isUuid(value) {
214+
if (typeof value !== 'string') {
215+
return false;
216+
}
217+
return value === '00000000-0000-0000-0000-000000000000' || /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
218+
}
219+
220+
/**
221+
* Return true if the supplied value is a short UUID, which corresponds to the leftmost eight
222+
* hexadecimal characters of a regular UUID.
223+
*/
224+
function isShortUuid(value) {
225+
if (typeof value !== 'string') {
226+
return false;
227+
}
228+
return /^[0-9a-f]{8}$/i.test(value);
229+
}
230+
210231
/**
211232
* set the schema
212233
* @param result

0 commit comments

Comments
 (0)