@atlaskit/link-datasource 1.19.16 → 1.19.18

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.
Files changed (31) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/analytics/constants.js +1 -1
  3. package/dist/cjs/hooks/useDatasourceTableState.js +46 -18
  4. package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +1 -1
  5. package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +1 -1
  6. package/dist/cjs/ui/issue-like-table/empty-state/index.js +4 -0
  7. package/dist/cjs/ui/issue-like-table/index.js +81 -67
  8. package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +34 -36
  9. package/dist/cjs/ui/jira-issues-modal/modal/index.js +29 -17
  10. package/dist/es2019/analytics/constants.js +1 -1
  11. package/dist/es2019/hooks/useDatasourceTableState.js +20 -4
  12. package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +1 -1
  13. package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +1 -1
  14. package/dist/es2019/ui/issue-like-table/empty-state/index.js +4 -0
  15. package/dist/es2019/ui/issue-like-table/index.js +33 -20
  16. package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +19 -19
  17. package/dist/es2019/ui/jira-issues-modal/modal/index.js +15 -6
  18. package/dist/esm/analytics/constants.js +1 -1
  19. package/dist/esm/hooks/useDatasourceTableState.js +46 -18
  20. package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +1 -1
  21. package/dist/esm/ui/datasource-table-view/datasourceTableView.js +1 -1
  22. package/dist/esm/ui/issue-like-table/empty-state/index.js +4 -0
  23. package/dist/esm/ui/issue-like-table/index.js +81 -67
  24. package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +34 -36
  25. package/dist/esm/ui/jira-issues-modal/modal/index.js +29 -17
  26. package/dist/types/ui/issue-like-table/index.d.ts +2 -1
  27. package/dist/types/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -0
  28. package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +2 -1
  29. package/dist/types-ts4.5/ui/jira-issues-modal/jira-search-container/index.d.ts +2 -0
  30. package/examples-helpers/hoverableContainer.tsx +26 -0
  31. package/package.json +1 -1
@@ -56,7 +56,8 @@ var contentContainerStyles = css({
56
56
  maxHeight: '420px',
57
57
  overflow: 'auto',
58
58
  borderBottom: "2px solid ".concat("var(--ds-background-accent-gray-subtler, ".concat(N40, ")")),
59
- background: scrollableContainerShadowsCssComponents.background,
59
+ backgroundImage: scrollableContainerShadowsCssComponents.backgroundImage,
60
+ backgroundPosition: scrollableContainerShadowsCssComponents.backgroundPosition,
60
61
  backgroundRepeat: scrollableContainerShadowsCssComponents.backgroundRepeat,
61
62
  backgroundSize: scrollableContainerShadowsCssComponents.backgroundSize,
62
63
  backgroundAttachment: scrollableContainerShadowsCssComponents.backgroundAttachment
@@ -123,19 +124,23 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
123
124
  _useState8 = _slicedToArray(_useState7, 2),
124
125
  jql = _useState8[0],
125
126
  setJql = _useState8[1];
126
- var _useState9 = useState(initialVisibleColumnKeys),
127
+ var _useState9 = useState(initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql),
127
128
  _useState10 = _slicedToArray(_useState9, 2),
128
- visibleColumnKeys = _useState10[0],
129
- setVisibleColumnKeys = _useState10[1];
129
+ searchBarJql = _useState10[0],
130
+ setSearchBarJql = _useState10[1];
131
+ var _useState11 = useState(initialVisibleColumnKeys),
132
+ _useState12 = _slicedToArray(_useState11, 2),
133
+ visibleColumnKeys = _useState12[0],
134
+ setVisibleColumnKeys = _useState12[1];
130
135
 
131
136
  // analytics related parameters
132
137
  var searchCount = useRef(0);
133
138
  var userInteractionActions = useRef(new Set());
134
139
  var initialSearchMethod = getBooleanFF('platform.linking-platform.datasource.show-jlol-basic-filters') && !isQueryTooComplex((initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.jql) || '') ? 'basic' : 'jql';
135
- var _useState11 = useState(initialSearchMethod),
136
- _useState12 = _slicedToArray(_useState11, 2),
137
- currentSearchMethod = _useState12[0],
138
- setCurrentSearchMethod = _useState12[1];
140
+ var _useState13 = useState(initialSearchMethod),
141
+ _useState14 = _slicedToArray(_useState13, 2),
142
+ currentSearchMethod = _useState14[0],
143
+ setCurrentSearchMethod = _useState14[1];
139
144
  var searchMethodSearchedWith = useRef(null);
140
145
  var visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
141
146
  var basicFilterSelectionsSearchedWith = useRef({});
@@ -147,10 +152,10 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
147
152
  } : undefined;
148
153
  }, [cloudId, jql]);
149
154
  var isParametersSet = !!(jql && cloudId);
150
- var _useState13 = useState(initialColumnCustomSizes),
151
- _useState14 = _slicedToArray(_useState13, 2),
152
- columnCustomSizes = _useState14[0],
153
- setColumnCustomSizes = _useState14[1];
155
+ var _useState15 = useState(initialColumnCustomSizes),
156
+ _useState16 = _slicedToArray(_useState15, 2),
157
+ columnCustomSizes = _useState16[0],
158
+ setColumnCustomSizes = _useState16[1];
154
159
  var onColumnResize = useCallback(function (key, width) {
155
160
  setColumnCustomSizes(_objectSpread(_objectSpread({}, columnCustomSizes), {}, _defineProperty({}, key, width)));
156
161
  }, [columnCustomSizes]);
@@ -351,6 +356,11 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
351
356
  if (!isParametersSet || !jql || !selectedJiraSite) {
352
357
  return;
353
358
  }
359
+
360
+ // During insertion, we want the JQL of the datasource to be whatever is in the search bar,
361
+ // even if the user didn't previously click search
362
+ var upToDateJql = searchBarJql !== null && searchBarJql !== void 0 ? searchBarJql : jql;
363
+ var upToDateJqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(upToDateJql));
354
364
  var filterSelectionCount = availableBasicFilterTypes.reduce(function (current, filter) {
355
365
  var _basicFilterSelection;
356
366
  return _objectSpread(_objectSpread({}, current), {}, _defineProperty({}, "".concat(filter, "BasicFilterSelectionCount"), ((_basicFilterSelection = basicFilterSelectionsSearchedWith.current[filter]) === null || _basicFilterSelection === void 0 ? void 0 : _basicFilterSelection.length) || 0));
@@ -393,7 +403,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
393
403
  onInsert({
394
404
  type: 'inlineCard',
395
405
  attrs: {
396
- url: jqlUrl
406
+ url: upToDateJqlUrl
397
407
  }
398
408
  }, consumerEvent);
399
409
  } else if (responseItems.length === 1 && firstIssueUrl) {
@@ -408,12 +418,12 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
408
418
  onInsert({
409
419
  type: 'blockCard',
410
420
  attrs: {
411
- url: jqlUrl,
421
+ url: upToDateJqlUrl,
412
422
  datasource: {
413
423
  id: datasourceId,
414
424
  parameters: {
415
425
  cloudId: cloudId,
416
- jql: jql // TODO support non JQL type
426
+ jql: upToDateJql // TODO support non JQL type
417
427
  },
418
428
 
419
429
  views: [{
@@ -431,7 +441,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
431
441
  }
432
442
  }, consumerEvent);
433
443
  }
434
- }, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, responseItems.length, onInsert, jqlUrl, datasourceId, cloudId, columnCustomSizes]);
444
+ }, [isParametersSet, jql, selectedJiraSite, analyticsPayload, totalCount, visibleColumnKeys, currentViewMode, retrieveUrlForSmartCardRender, responseItems.length, onInsert, datasourceId, cloudId, columnCustomSizes, searchBarJql]);
435
445
  var handleViewModeChange = function handleViewModeChange(selectedMode) {
436
446
  userInteractionActions.current.add(DatasourceAction.DISPLAY_VIEW_CHANGED);
437
447
  setCurrentViewMode(selectedMode);
@@ -499,7 +509,7 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
499
509
  return jsx(AccessRequired, {
500
510
  url: selectedJiraSiteUrl || urlBeingEdited
501
511
  });
502
- } else if (resolvedWithNoResults) {
512
+ } else if (resolvedWithNoResults || status === 'forbidden') {
503
513
  return jsx(NoResults, null);
504
514
  } else if (status === 'empty' || !columns.length) {
505
515
  // persist the empty state when making the initial /data request which contains the columns
@@ -545,6 +555,8 @@ export var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(prop
545
555
  onOptionValueChange: handleViewModeChange,
546
556
  selectedOptionValue: currentViewMode
547
557
  })), jsx(ModalBody, null, !hasNoJiraSites ? jsx(Fragment, null, jsx(JiraSearchContainer, {
558
+ setSearchBarJql: setSearchBarJql,
559
+ searchBarJql: searchBarJql,
548
560
  isSearching: status === 'loading',
549
561
  parameters: parameters,
550
562
  onSearch: onSearch,
@@ -4,7 +4,8 @@ import { jsx } from '@emotion/react';
4
4
  import { DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/datasource';
5
5
  import { IssueLikeDataTableViewProps } from './types';
6
6
  export declare const scrollableContainerShadowsCssComponents: {
7
- background: string;
7
+ backgroundImage: string;
8
+ backgroundPosition: string;
8
9
  backgroundRepeat: string;
9
10
  backgroundSize: string;
10
11
  backgroundAttachment: string;
@@ -15,5 +15,7 @@ export interface SearchContainerProps {
15
15
  initialSearchMethod: JiraSearchMethod;
16
16
  onSearchMethodChange: (searchMethod: JiraSearchMethod) => void;
17
17
  parameters?: JiraIssueDatasourceParameters;
18
+ searchBarJql?: string;
19
+ setSearchBarJql: (jql: string) => void;
18
20
  }
19
21
  export declare const JiraSearchContainer: (props: SearchContainerProps) => jsx.JSX.Element;
@@ -4,7 +4,8 @@ import { jsx } from '@emotion/react';
4
4
  import { DatasourceResponseSchemaProperty } from '@atlaskit/linking-types/datasource';
5
5
  import { IssueLikeDataTableViewProps } from './types';
6
6
  export declare const scrollableContainerShadowsCssComponents: {
7
- background: string;
7
+ backgroundImage: string;
8
+ backgroundPosition: string;
8
9
  backgroundRepeat: string;
9
10
  backgroundSize: string;
10
11
  backgroundAttachment: string;
@@ -15,5 +15,7 @@ export interface SearchContainerProps {
15
15
  initialSearchMethod: JiraSearchMethod;
16
16
  onSearchMethodChange: (searchMethod: JiraSearchMethod) => void;
17
17
  parameters?: JiraIssueDatasourceParameters;
18
+ searchBarJql?: string;
19
+ setSearchBarJql: (jql: string) => void;
18
20
  }
19
21
  export declare const JiraSearchContainer: (props: SearchContainerProps) => jsx.JSX.Element;
@@ -0,0 +1,26 @@
1
+ /** @jsx jsx */
2
+ import React from 'react';
3
+
4
+ import { jsx } from '@emotion/react';
5
+
6
+ import { Box, xcss } from '@atlaskit/primitives';
7
+
8
+ const containerStyles = xcss({
9
+ height: '100%',
10
+ backgroundColor: 'elevation.surface.overlay',
11
+ padding: 'space.400',
12
+ ':hover': {
13
+ backgroundColor: 'elevation.surface.overlay.hovered',
14
+ },
15
+ });
16
+
17
+ // To simulate Jira description's hover background wrapper
18
+ export const HoverableContainer = ({
19
+ children,
20
+ }: React.PropsWithChildren<{}>) => {
21
+ return (
22
+ <Box testId="examples-hoverable-container" xcss={containerStyles}>
23
+ {children}
24
+ </Box>
25
+ );
26
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.19.16",
3
+ "version": "1.19.18",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"