@atlaskit/link-datasource 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/analytics/constants.js +1 -1
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/buildJQL.js +23 -3
- package/dist/es2019/analytics/constants.js +1 -1
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/buildJQL.js +17 -4
- package/dist/esm/analytics/constants.js +1 -1
- package/dist/esm/ui/jira-issues-modal/jira-search-container/buildJQL.js +23 -4
- package/dist/types/ui/jira-issues-modal/jira-search-container/buildJQL.d.ts +4 -0
- package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/buildJQL.d.ts +4 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 1.11.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#42377](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/42377) [`c1c8a308bd5`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c1c8a308bd5) - Add support for basic filter in JQL generation
|
|
8
|
+
|
|
3
9
|
## 1.11.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.buildJQL = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
7
9
|
var _jqlAst = require("@atlaskit/jql-ast");
|
|
8
10
|
var fuzzySearchRegExp = /^"(.+)"$/;
|
|
9
11
|
var jiraIssueKeyRegExp = /[A-Z]+-\d+/;
|
|
@@ -21,7 +23,8 @@ var buildJQL = exports.buildJQL = function buildJQL(input) {
|
|
|
21
23
|
_input$orderDirection = input.orderDirection,
|
|
22
24
|
orderDirection = _input$orderDirection === void 0 ? _jqlAst.ORDER_BY_DIRECTION_DESC : _input$orderDirection,
|
|
23
25
|
_input$orderKey = input.orderKey,
|
|
24
|
-
orderKey = _input$orderKey === void 0 ? 'created' : _input$orderKey
|
|
26
|
+
orderKey = _input$orderKey === void 0 ? 'created' : _input$orderKey,
|
|
27
|
+
filterValues = input.filterValues;
|
|
25
28
|
var trimmedRawSearch = rawSearch.trim();
|
|
26
29
|
if (!query) {
|
|
27
30
|
return '';
|
|
@@ -38,12 +41,29 @@ var buildJQL = exports.buildJQL = function buildJQL(input) {
|
|
|
38
41
|
}
|
|
39
42
|
var orClause = _jqlAst.creators.compoundClause(_jqlAst.creators.compoundOperator(_jqlAst.COMPOUND_OPERATOR_OR), orClauseFields);
|
|
40
43
|
query.appendClause(orClause, _jqlAst.COMPOUND_OPERATOR_AND);
|
|
41
|
-
}
|
|
44
|
+
}
|
|
45
|
+
if (filterValues) {
|
|
46
|
+
Object.entries(filterValues).forEach(function (_ref) {
|
|
47
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
48
|
+
key = _ref2[0],
|
|
49
|
+
filterFieldValues = _ref2[1];
|
|
50
|
+
if (!key || filterFieldValues.length === 0) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
var filterInClause = _jqlAst.creators.terminalClause(_jqlAst.creators.field(key), _jqlAst.creators.operator(_jqlAst.OPERATOR_IN), _jqlAst.creators.listOperand(filterFieldValues.map(function (filterFieldValue) {
|
|
54
|
+
return _jqlAst.creators.valueOperand(filterFieldValue.value);
|
|
55
|
+
})));
|
|
56
|
+
query.appendClause(filterInClause, _jqlAst.COMPOUND_OPERATOR_AND);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (!trimmedRawSearch) {
|
|
42
60
|
var created = constructTerminalClause('created', _jqlAst.OPERATOR_GT_EQUALS, '-30d');
|
|
43
61
|
query.appendClause(created, _jqlAst.COMPOUND_OPERATOR_AND);
|
|
44
62
|
}
|
|
45
63
|
var orderField = _jqlAst.creators.orderByField(_jqlAst.creators.field(orderKey));
|
|
46
64
|
query.prependOrderField(orderField);
|
|
47
65
|
query.setOrderDirection(_jqlAst.creators.orderByDirection(orderDirection.toLowerCase() === 'asc' ? _jqlAst.ORDER_BY_DIRECTION_ASC : _jqlAst.ORDER_BY_DIRECTION_DESC));
|
|
48
|
-
return (0, _jqlAst.print)(jast
|
|
66
|
+
return (0, _jqlAst.print)(jast, {
|
|
67
|
+
printWidth: null // this ensures jql string is not broken to new line
|
|
68
|
+
});
|
|
49
69
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COMPOUND_OPERATOR_AND, COMPOUND_OPERATOR_OR, creators, JastBuilder, OPERATOR_EQUALS, OPERATOR_GT_EQUALS, OPERATOR_LIKE, ORDER_BY_DIRECTION_ASC, ORDER_BY_DIRECTION_DESC, print } from '@atlaskit/jql-ast';
|
|
1
|
+
import { COMPOUND_OPERATOR_AND, COMPOUND_OPERATOR_OR, creators, JastBuilder, OPERATOR_EQUALS, OPERATOR_GT_EQUALS, OPERATOR_IN, OPERATOR_LIKE, ORDER_BY_DIRECTION_ASC, ORDER_BY_DIRECTION_DESC, print } from '@atlaskit/jql-ast';
|
|
2
2
|
const fuzzySearchRegExp = /^"(.+)"$/;
|
|
3
3
|
const jiraIssueKeyRegExp = /[A-Z]+-\d+/;
|
|
4
4
|
const constructTerminalClause = (field, operator, value) => creators.terminalClause(creators.field(field), creators.operator(operator), creators.valueOperand(value));
|
|
@@ -14,7 +14,8 @@ export const buildJQL = input => {
|
|
|
14
14
|
const {
|
|
15
15
|
rawSearch,
|
|
16
16
|
orderDirection = ORDER_BY_DIRECTION_DESC,
|
|
17
|
-
orderKey = 'created'
|
|
17
|
+
orderKey = 'created',
|
|
18
|
+
filterValues
|
|
18
19
|
} = input;
|
|
19
20
|
const trimmedRawSearch = rawSearch.trim();
|
|
20
21
|
if (!query) {
|
|
@@ -32,12 +33,24 @@ export const buildJQL = input => {
|
|
|
32
33
|
}
|
|
33
34
|
const orClause = creators.compoundClause(creators.compoundOperator(COMPOUND_OPERATOR_OR), orClauseFields);
|
|
34
35
|
query.appendClause(orClause, COMPOUND_OPERATOR_AND);
|
|
35
|
-
}
|
|
36
|
+
}
|
|
37
|
+
if (filterValues) {
|
|
38
|
+
Object.entries(filterValues).forEach(([key, filterFieldValues]) => {
|
|
39
|
+
if (!key || filterFieldValues.length === 0) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const filterInClause = creators.terminalClause(creators.field(key), creators.operator(OPERATOR_IN), creators.listOperand(filterFieldValues.map(filterFieldValue => creators.valueOperand(filterFieldValue.value))));
|
|
43
|
+
query.appendClause(filterInClause, COMPOUND_OPERATOR_AND);
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (!trimmedRawSearch) {
|
|
36
47
|
const created = constructTerminalClause('created', OPERATOR_GT_EQUALS, '-30d');
|
|
37
48
|
query.appendClause(created, COMPOUND_OPERATOR_AND);
|
|
38
49
|
}
|
|
39
50
|
const orderField = creators.orderByField(creators.field(orderKey));
|
|
40
51
|
query.prependOrderField(orderField);
|
|
41
52
|
query.setOrderDirection(creators.orderByDirection(orderDirection.toLowerCase() === 'asc' ? ORDER_BY_DIRECTION_ASC : ORDER_BY_DIRECTION_DESC));
|
|
42
|
-
return print(jast
|
|
53
|
+
return print(jast, {
|
|
54
|
+
printWidth: null // this ensures jql string is not broken to new line
|
|
55
|
+
});
|
|
43
56
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import { COMPOUND_OPERATOR_AND, COMPOUND_OPERATOR_OR, creators, JastBuilder, OPERATOR_EQUALS, OPERATOR_GT_EQUALS, OPERATOR_IN, OPERATOR_LIKE, ORDER_BY_DIRECTION_ASC, ORDER_BY_DIRECTION_DESC, print } from '@atlaskit/jql-ast';
|
|
2
3
|
var fuzzySearchRegExp = /^"(.+)"$/;
|
|
3
4
|
var jiraIssueKeyRegExp = /[A-Z]+-\d+/;
|
|
4
5
|
var constructTerminalClause = function constructTerminalClause(field, operator, value) {
|
|
@@ -15,7 +16,8 @@ export var buildJQL = function buildJQL(input) {
|
|
|
15
16
|
_input$orderDirection = input.orderDirection,
|
|
16
17
|
orderDirection = _input$orderDirection === void 0 ? ORDER_BY_DIRECTION_DESC : _input$orderDirection,
|
|
17
18
|
_input$orderKey = input.orderKey,
|
|
18
|
-
orderKey = _input$orderKey === void 0 ? 'created' : _input$orderKey
|
|
19
|
+
orderKey = _input$orderKey === void 0 ? 'created' : _input$orderKey,
|
|
20
|
+
filterValues = input.filterValues;
|
|
19
21
|
var trimmedRawSearch = rawSearch.trim();
|
|
20
22
|
if (!query) {
|
|
21
23
|
return '';
|
|
@@ -32,12 +34,29 @@ export var buildJQL = function buildJQL(input) {
|
|
|
32
34
|
}
|
|
33
35
|
var orClause = creators.compoundClause(creators.compoundOperator(COMPOUND_OPERATOR_OR), orClauseFields);
|
|
34
36
|
query.appendClause(orClause, COMPOUND_OPERATOR_AND);
|
|
35
|
-
}
|
|
37
|
+
}
|
|
38
|
+
if (filterValues) {
|
|
39
|
+
Object.entries(filterValues).forEach(function (_ref) {
|
|
40
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
41
|
+
key = _ref2[0],
|
|
42
|
+
filterFieldValues = _ref2[1];
|
|
43
|
+
if (!key || filterFieldValues.length === 0) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
var filterInClause = creators.terminalClause(creators.field(key), creators.operator(OPERATOR_IN), creators.listOperand(filterFieldValues.map(function (filterFieldValue) {
|
|
47
|
+
return creators.valueOperand(filterFieldValue.value);
|
|
48
|
+
})));
|
|
49
|
+
query.appendClause(filterInClause, COMPOUND_OPERATOR_AND);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
if (!trimmedRawSearch) {
|
|
36
53
|
var created = constructTerminalClause('created', OPERATOR_GT_EQUALS, '-30d');
|
|
37
54
|
query.appendClause(created, COMPOUND_OPERATOR_AND);
|
|
38
55
|
}
|
|
39
56
|
var orderField = creators.orderByField(creators.field(orderKey));
|
|
40
57
|
query.prependOrderField(orderField);
|
|
41
58
|
query.setOrderDirection(creators.orderByDirection(orderDirection.toLowerCase() === 'asc' ? ORDER_BY_DIRECTION_ASC : ORDER_BY_DIRECTION_DESC));
|
|
42
|
-
return print(jast
|
|
59
|
+
return print(jast, {
|
|
60
|
+
printWidth: null // this ensures jql string is not broken to new line
|
|
61
|
+
});
|
|
43
62
|
};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { BasicFilterFieldType, SelectOption } from '../basic-filters/ui/async-popup-select/types';
|
|
1
2
|
type BuildJQLInput = {
|
|
2
3
|
rawSearch: string;
|
|
3
4
|
orderDirection?: string;
|
|
4
5
|
orderKey?: string;
|
|
6
|
+
filterValues?: {
|
|
7
|
+
[key in BasicFilterFieldType]?: SelectOption[];
|
|
8
|
+
};
|
|
5
9
|
};
|
|
6
10
|
export declare const buildJQL: (input: BuildJQLInput) => string;
|
|
7
11
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { BasicFilterFieldType, SelectOption } from '../basic-filters/ui/async-popup-select/types';
|
|
1
2
|
type BuildJQLInput = {
|
|
2
3
|
rawSearch: string;
|
|
3
4
|
orderDirection?: string;
|
|
4
5
|
orderKey?: string;
|
|
6
|
+
filterValues?: {
|
|
7
|
+
[key in BasicFilterFieldType]?: SelectOption[];
|
|
8
|
+
};
|
|
5
9
|
};
|
|
6
10
|
export declare const buildJQL: (input: BuildJQLInput) => string;
|
|
7
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "1.11.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^0.11.0",
|
|
55
55
|
"@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll": "^0.6.0",
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop-react-indicator": "^0.16.0",
|
|
57
|
-
"@atlaskit/primitives": "^1.
|
|
57
|
+
"@atlaskit/primitives": "^1.9.0",
|
|
58
58
|
"@atlaskit/select": "^16.7.0",
|
|
59
59
|
"@atlaskit/smart-card": "^26.41.0",
|
|
60
60
|
"@atlaskit/spinner": "^15.6.0",
|