@atlaskit/link-datasource 0.31.1 → 0.31.3
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 +12 -0
- package/dist/cjs/ui/assets-modal/modal/index.js +3 -3
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +7 -19
- package/dist/cjs/ui/issue-like-table/column-picker/index.js +2 -4
- package/dist/cjs/ui/issue-like-table/drag-column-preview.js +37 -0
- package/dist/cjs/ui/issue-like-table/draggable-table-heading.js +60 -25
- package/dist/cjs/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/cjs/ui/issue-like-table/index.js +102 -71
- package/dist/cjs/ui/issue-like-table/styled.js +2 -1
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +12 -9
- package/dist/cjs/ui/table-footer/index.js +10 -7
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/ui/assets-modal/modal/index.js +4 -4
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +8 -20
- package/dist/es2019/ui/issue-like-table/column-picker/index.js +1 -3
- package/dist/es2019/ui/issue-like-table/drag-column-preview.js +46 -0
- package/dist/es2019/ui/issue-like-table/draggable-table-heading.js +53 -18
- package/dist/es2019/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/es2019/ui/issue-like-table/index.js +86 -43
- package/dist/es2019/ui/issue-like-table/styled.js +18 -0
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +13 -10
- package/dist/es2019/ui/table-footer/index.js +11 -11
- package/dist/es2019/version.json +1 -1
- package/dist/esm/ui/assets-modal/modal/index.js +3 -3
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +8 -20
- package/dist/esm/ui/issue-like-table/column-picker/index.js +2 -4
- package/dist/esm/ui/issue-like-table/drag-column-preview.js +29 -0
- package/dist/esm/ui/issue-like-table/draggable-table-heading.js +60 -25
- package/dist/esm/ui/issue-like-table/empty-state/index.js +6 -1
- package/dist/esm/ui/issue-like-table/index.js +102 -71
- package/dist/esm/ui/issue-like-table/styled.js +2 -1
- package/dist/esm/ui/jira-issues-modal/modal/index.js +13 -10
- package/dist/esm/ui/table-footer/index.js +10 -7
- package/dist/esm/version.json +1 -1
- package/dist/types/ui/issue-like-table/column-picker/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/column-picker/types.d.ts +0 -1
- package/dist/types/ui/issue-like-table/drag-column-preview.d.ts +7 -0
- package/dist/types/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
- package/dist/types/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types/ui/issue-like-table/types.d.ts +5 -0
- package/dist/types-ts4.5/ui/issue-like-table/column-picker/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/column-picker/types.d.ts +0 -1
- package/dist/types-ts4.5/ui/issue-like-table/drag-column-preview.d.ts +7 -0
- package/dist/types-ts4.5/ui/issue-like-table/draggable-table-heading.d.ts +2 -3
- package/dist/types-ts4.5/ui/issue-like-table/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/issue-like-table/types.d.ts +5 -0
- package/package.json +3 -3
|
@@ -3,30 +3,42 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import invariant from 'tiny-invariant';
|
|
6
|
+
import Heading from '@atlaskit/heading';
|
|
6
7
|
import { Skeleton } from '@atlaskit/linking-common';
|
|
7
8
|
import { extractClosestEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/addon/closest-edge';
|
|
8
9
|
import { reorderWithEdge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/util/reorder-with-edge';
|
|
9
10
|
import { autoScroller } from '@atlaskit/pragmatic-drag-and-drop-react-beautiful-dnd-autoscroll';
|
|
10
11
|
import { monitorForElements } from '@atlaskit/pragmatic-drag-and-drop/adapter/element';
|
|
11
12
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/util/combine';
|
|
13
|
+
import { N40 } from '@atlaskit/theme/colors';
|
|
12
14
|
import { ColumnPicker } from './column-picker';
|
|
15
|
+
import { DragColumnPreview } from './drag-column-preview';
|
|
13
16
|
import { DraggableTableHeading } from './draggable-table-heading';
|
|
14
17
|
import TableEmptyState from './empty-state';
|
|
15
18
|
import { fallbackRenderType } from './render-type';
|
|
16
19
|
import { Table, TableHeading } from './styled';
|
|
17
20
|
import { useIsOnScreen } from './useIsOnScreen';
|
|
21
|
+
const tableSidePadding = "var(--ds-space-200, 16px)";
|
|
18
22
|
const tableHeadStyles = css({
|
|
19
23
|
background: "var(--ds-surface, #FFF)",
|
|
20
|
-
|
|
24
|
+
position: 'sticky',
|
|
25
|
+
top: 0,
|
|
26
|
+
zIndex: 10
|
|
21
27
|
});
|
|
22
|
-
const ColumnPickerHeader = styled.
|
|
28
|
+
const ColumnPickerHeader = styled.th`
|
|
23
29
|
width: 40px;
|
|
24
|
-
padding-block: ${"var(--ds-space-100, 8px)"};
|
|
25
30
|
position: sticky;
|
|
26
|
-
right:
|
|
31
|
+
right: calc(-1 * ${tableSidePadding});
|
|
27
32
|
background-color: ${"var(--ds-surface, #FFF)"};
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
border-bottom: 2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`}; /* It is required to have solid (not half-transparent) color because of this gradient business bellow */
|
|
34
|
+
background: linear-gradient(
|
|
35
|
+
90deg,
|
|
36
|
+
rgba(255, 255, 255, 0) 0%,
|
|
37
|
+
${"var(--ds-surface, #FFF)"} 10%
|
|
38
|
+
);
|
|
39
|
+
vertical-align: middle; /* Keeps dropdown button in the middle */
|
|
40
|
+
&:last-of-type {
|
|
41
|
+
padding-right: ${tableSidePadding};
|
|
30
42
|
}
|
|
31
43
|
`;
|
|
32
44
|
const truncatedCellStyles = css({
|
|
@@ -34,11 +46,22 @@ const truncatedCellStyles = css({
|
|
|
34
46
|
textOverflow: 'ellipsis',
|
|
35
47
|
whiteSpace: 'nowrap'
|
|
36
48
|
});
|
|
37
|
-
const
|
|
38
|
-
|
|
49
|
+
const scrollableContainerStyles = css({
|
|
50
|
+
overflow: 'auto',
|
|
51
|
+
padding: `0 ${tableSidePadding} 0 ${tableSidePadding}`,
|
|
52
|
+
boxSizing: 'border-box'
|
|
39
53
|
});
|
|
40
|
-
const
|
|
41
|
-
|
|
54
|
+
const tableStyles = css({
|
|
55
|
+
// These styles are needed to prevent thead bottom border from scrolling away.
|
|
56
|
+
// This happens because it is sticky. https://stackoverflow.com/questions/50361698/border-style-do-not-work-with-sticky-position-element
|
|
57
|
+
borderCollapse: 'separate',
|
|
58
|
+
borderSpacing: 0
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// By default tbody and thead have border-bottom: 2px ...
|
|
62
|
+
// This removes it, because for header we handle it via `th` styling and footer supply bottom border
|
|
63
|
+
const noDefaultBorderStyles = css({
|
|
64
|
+
borderBottom: 0
|
|
42
65
|
});
|
|
43
66
|
function extractIndex(data) {
|
|
44
67
|
const {
|
|
@@ -69,7 +92,6 @@ const BASE_WIDTH = 8;
|
|
|
69
92
|
function getColumnWidth(key, type) {
|
|
70
93
|
const keyBasedWidth = {
|
|
71
94
|
assignee: BASE_WIDTH * 22,
|
|
72
|
-
key: BASE_WIDTH * 10,
|
|
73
95
|
labels: BASE_WIDTH * 22,
|
|
74
96
|
priority: BASE_WIDTH * 8,
|
|
75
97
|
status: BASE_WIDTH * 18,
|
|
@@ -98,11 +120,11 @@ export const IssueLikeDataTableView = ({
|
|
|
98
120
|
visibleColumnKeys,
|
|
99
121
|
onVisibleColumnKeysChange,
|
|
100
122
|
status,
|
|
101
|
-
hasNextPage
|
|
123
|
+
hasNextPage,
|
|
124
|
+
scrollableContainerHeight
|
|
102
125
|
}) => {
|
|
103
126
|
const tableId = useMemo(() => Symbol('unique-id'), []);
|
|
104
127
|
const [lastRowElement, setLastRowElement] = useState(null);
|
|
105
|
-
const [isDragPreview, setIsDragPreview] = useState(false);
|
|
106
128
|
const [hasFullSchema, setHasFullSchema] = useState(false);
|
|
107
129
|
const isBottomOfTableVisibleRaw = useIsOnScreen(lastRowElement);
|
|
108
130
|
const containerRef = useRef(null);
|
|
@@ -135,7 +157,7 @@ export const IssueLikeDataTableView = ({
|
|
|
135
157
|
};
|
|
136
158
|
})
|
|
137
159
|
}), [visibleSortedColumns]);
|
|
138
|
-
const headColumns = visibleSortedColumns.map(({
|
|
160
|
+
const headColumns = useMemo(() => visibleSortedColumns.map(({
|
|
139
161
|
key,
|
|
140
162
|
title,
|
|
141
163
|
type
|
|
@@ -144,7 +166,7 @@ export const IssueLikeDataTableView = ({
|
|
|
144
166
|
content: title,
|
|
145
167
|
shouldTruncate: true,
|
|
146
168
|
maxWidth: getColumnWidth(key, type)
|
|
147
|
-
}));
|
|
169
|
+
})), [visibleSortedColumns]);
|
|
148
170
|
useEffect(() => {
|
|
149
171
|
if (isBottomOfTableVisibleRaw && hasNextPage && status === 'resolved') {
|
|
150
172
|
void onNextPage({
|
|
@@ -152,37 +174,41 @@ export const IssueLikeDataTableView = ({
|
|
|
152
174
|
});
|
|
153
175
|
}
|
|
154
176
|
}, [isBottomOfTableVisibleRaw, status, hasNextPage, onNextPage]);
|
|
155
|
-
|
|
156
|
-
if (items.length > 0 && containerRef.current) {
|
|
157
|
-
const containerEl = containerRef.current;
|
|
158
|
-
invariant(containerEl);
|
|
159
|
-
dndPreviewHeight = containerEl.offsetHeight;
|
|
160
|
-
}
|
|
177
|
+
const hasData = items.length > 0;
|
|
161
178
|
|
|
162
179
|
// This variable contains initial Y mouse coordinate, so we can restrict
|
|
163
180
|
// autoScroller in X axis only
|
|
164
181
|
const initialAutoScrollerClientY = useRef();
|
|
165
182
|
useEffect(() => {
|
|
166
|
-
if (!onVisibleColumnKeysChange) {
|
|
183
|
+
if (!onVisibleColumnKeysChange || !hasData) {
|
|
167
184
|
return;
|
|
168
185
|
}
|
|
169
186
|
return combine(monitorForElements({
|
|
170
187
|
onDragStart: ({
|
|
171
188
|
location
|
|
172
189
|
}) => {
|
|
190
|
+
var _containerRef$current;
|
|
173
191
|
initialAutoScrollerClientY.current = location.current.input.clientY;
|
|
174
192
|
autoScroller.start({
|
|
175
|
-
input:
|
|
193
|
+
input: {
|
|
194
|
+
...location.current.input,
|
|
195
|
+
clientY:
|
|
196
|
+
// The goal is to have clientY the same and in the middle of the scrollable area
|
|
197
|
+
// Since clientY is taken from to of the viewport we need to plus that in order to get
|
|
198
|
+
// middle of the scrollable area in reference to the viewport
|
|
199
|
+
(initialAutoScrollerClientY.current || 0) + (((_containerRef$current = containerRef.current) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.offsetHeight) || 0) / 2
|
|
200
|
+
},
|
|
176
201
|
behavior: 'container-only'
|
|
177
202
|
});
|
|
178
203
|
},
|
|
179
204
|
onDrag: ({
|
|
180
205
|
location
|
|
181
206
|
}) => {
|
|
207
|
+
var _containerRef$current2;
|
|
182
208
|
autoScroller.updateInput({
|
|
183
209
|
input: {
|
|
184
210
|
...location.current.input,
|
|
185
|
-
clientY: initialAutoScrollerClientY.current || 0
|
|
211
|
+
clientY: (initialAutoScrollerClientY.current || 0) + (((_containerRef$current2 = containerRef.current) === null || _containerRef$current2 === void 0 ? void 0 : _containerRef$current2.offsetHeight) || 0) / 2
|
|
186
212
|
}
|
|
187
213
|
});
|
|
188
214
|
},
|
|
@@ -190,7 +216,6 @@ export const IssueLikeDataTableView = ({
|
|
|
190
216
|
source,
|
|
191
217
|
location
|
|
192
218
|
}) {
|
|
193
|
-
initialAutoScrollerClientY.current = null;
|
|
194
219
|
autoScroller.stop();
|
|
195
220
|
if (location.current.dropTargets.length === 0) {
|
|
196
221
|
return;
|
|
@@ -220,7 +245,7 @@ export const IssueLikeDataTableView = ({
|
|
|
220
245
|
}
|
|
221
246
|
}
|
|
222
247
|
}));
|
|
223
|
-
}, [visibleColumnKeys, onVisibleColumnKeysChange, tableId]);
|
|
248
|
+
}, [visibleColumnKeys, onVisibleColumnKeysChange, tableId, hasData]);
|
|
224
249
|
const tableRows = useMemo(() => items.map((newRowData, rowIndex) => ({
|
|
225
250
|
key: `${identityColumnKey && newRowData[identityColumnKey] && newRowData[identityColumnKey].data || rowIndex}`,
|
|
226
251
|
cells: visibleSortedColumns.map(({
|
|
@@ -242,9 +267,7 @@ export const IssueLikeDataTableView = ({
|
|
|
242
267
|
}),
|
|
243
268
|
ref: rowIndex === items.length - 1 ? el => setLastRowElement(el) : undefined
|
|
244
269
|
})), [identityColumnKey, renderItem, items, visibleSortedColumns]);
|
|
245
|
-
const rows = [...tableRows, ...(status === 'loading' ? [loadingRow] : [])];
|
|
246
|
-
const setIsDragPreviewOn = useCallback(() => setIsDragPreview(true), [setIsDragPreview]);
|
|
247
|
-
const setIsDragPreviewOff = useCallback(() => setIsDragPreview(false), [setIsDragPreview]);
|
|
270
|
+
const rows = useMemo(() => [...tableRows, ...(status === 'loading' ? [loadingRow] : [])], [loadingRow, status, tableRows]);
|
|
248
271
|
const onSelectedColumnKeysChange = useCallback(newSelectedColumnKeys => {
|
|
249
272
|
onVisibleColumnKeysChange === null || onVisibleColumnKeysChange === void 0 ? void 0 : onVisibleColumnKeysChange(newSelectedColumnKeys);
|
|
250
273
|
}, [onVisibleColumnKeysChange]);
|
|
@@ -261,32 +284,50 @@ export const IssueLikeDataTableView = ({
|
|
|
261
284
|
}, [hasFullSchema, onLoadDatasourceDetails]);
|
|
262
285
|
return jsx("div", {
|
|
263
286
|
ref: containerRef,
|
|
264
|
-
css:
|
|
287
|
+
css: scrollableContainerHeight ? scrollableContainerStyles : null,
|
|
288
|
+
style: scrollableContainerHeight ? {
|
|
289
|
+
maxHeight: `${scrollableContainerHeight}px`
|
|
290
|
+
} : undefined
|
|
265
291
|
}, jsx(Table, {
|
|
266
|
-
css:
|
|
292
|
+
css: tableStyles,
|
|
267
293
|
"data-testid": testId
|
|
268
294
|
}, jsx("thead", {
|
|
269
295
|
"data-testid": testId && `${testId}--head`,
|
|
270
|
-
css: tableHeadStyles
|
|
296
|
+
css: [noDefaultBorderStyles, tableHeadStyles]
|
|
271
297
|
}, jsx("tr", null, headColumns.map(({
|
|
272
298
|
key,
|
|
273
299
|
content,
|
|
274
300
|
maxWidth
|
|
275
301
|
}, cellIndex) => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
302
|
+
if (onVisibleColumnKeysChange && hasData) {
|
|
303
|
+
var _containerRef$current3;
|
|
304
|
+
const previewRows = tableRows.map(({
|
|
305
|
+
cells
|
|
306
|
+
}) => {
|
|
307
|
+
const cell = cells.find(({
|
|
308
|
+
key: cellKey
|
|
309
|
+
}) => cellKey === key);
|
|
310
|
+
if (cell) {
|
|
311
|
+
return cell.content;
|
|
312
|
+
}
|
|
313
|
+
}).slice(0, 5);
|
|
314
|
+
const dragPreview = jsx(DragColumnPreview, {
|
|
315
|
+
title: jsx(Heading, {
|
|
316
|
+
level: "h400"
|
|
317
|
+
}, content),
|
|
318
|
+
rows: previewRows
|
|
319
|
+
});
|
|
280
320
|
return jsx(DraggableTableHeading, {
|
|
281
321
|
tableId: tableId,
|
|
282
322
|
key: key,
|
|
283
323
|
id: key,
|
|
284
324
|
index: cellIndex,
|
|
285
325
|
maxWidth: maxWidth,
|
|
286
|
-
dndPreviewHeight:
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
326
|
+
dndPreviewHeight: ((_containerRef$current3 = containerRef.current) === null || _containerRef$current3 === void 0 ? void 0 : _containerRef$current3.offsetHeight) || 0,
|
|
327
|
+
dragPreview: dragPreview
|
|
328
|
+
}, jsx(Heading, {
|
|
329
|
+
level: "h400"
|
|
330
|
+
}, content));
|
|
290
331
|
} else {
|
|
291
332
|
return jsx(TableHeading, {
|
|
292
333
|
key: key,
|
|
@@ -294,15 +335,17 @@ export const IssueLikeDataTableView = ({
|
|
|
294
335
|
style: {
|
|
295
336
|
maxWidth
|
|
296
337
|
}
|
|
297
|
-
}, jsx(
|
|
338
|
+
}, jsx(Heading, {
|
|
339
|
+
level: "h400"
|
|
340
|
+
}, content));
|
|
298
341
|
}
|
|
299
|
-
}), onVisibleColumnKeysChange && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
|
|
342
|
+
}), onVisibleColumnKeysChange && hasData && jsx(ColumnPickerHeader, null, jsx(ColumnPicker, {
|
|
300
343
|
columns: hasFullSchema ? orderedColumns : [],
|
|
301
344
|
selectedColumnKeys: hasFullSchema ? visibleColumnKeys : [],
|
|
302
|
-
isDatasourceLoading: status === 'loading',
|
|
303
345
|
onSelectedColumnKeysChange: onSelectedColumnKeysChange,
|
|
304
346
|
onOpen: handlePickerOpen
|
|
305
347
|
})))), jsx("tbody", {
|
|
348
|
+
css: noDefaultBorderStyles,
|
|
306
349
|
"data-testid": testId && `${testId}--body`
|
|
307
350
|
}, rows.map(({
|
|
308
351
|
key,
|
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
import styled from '@emotion/styled';
|
|
2
|
+
import { N40 } from '@atlaskit/theme/colors';
|
|
2
3
|
export const Table = styled.table`
|
|
3
4
|
width: 100%;
|
|
4
5
|
`;
|
|
5
6
|
export const TableHeading = styled.th`
|
|
7
|
+
cursor: grab;
|
|
6
8
|
position: relative;
|
|
7
9
|
padding-block: ${"var(--ds-space-100, 8px)"};
|
|
8
10
|
line-height: ${"var(--ds-font-lineHeight-300, 24px)"};
|
|
11
|
+
border-bottom: 2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`};
|
|
12
|
+
.ProseMirror & h5,
|
|
13
|
+
& h5 {
|
|
14
|
+
margin-top: 0;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
text-overflow: ellipsis;
|
|
17
|
+
white-space: nowrap;
|
|
18
|
+
line-height: 24px; /* Is needed to keep overall height consistent with or without drag handle icon present */
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:hover .issue-like-table-drag-handle {
|
|
22
|
+
width: 24px;
|
|
23
|
+
}
|
|
24
|
+
&:hover .issue-like-table-drag-handle-spacer {
|
|
25
|
+
width: 0px;
|
|
26
|
+
}
|
|
9
27
|
`;
|
|
10
28
|
export const EmptyStateTableHeading = styled(TableHeading)`
|
|
11
29
|
&:first-child {
|
|
@@ -5,7 +5,7 @@ import { css, jsx } from '@emotion/react';
|
|
|
5
5
|
import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
|
|
6
6
|
import Button from '@atlaskit/button/standard-button';
|
|
7
7
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
8
|
-
import { B400, N0, N800 } from '@atlaskit/theme/colors';
|
|
8
|
+
import { B400, N0, N40, N800 } from '@atlaskit/theme/colors';
|
|
9
9
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
10
10
|
import { getAvailableJiraSites } from '../../../services/getAvailableJiraSites';
|
|
11
11
|
import { AccessRequired } from '../../common/error-state/access-required';
|
|
@@ -23,8 +23,9 @@ const dropdownContainerStyles = css({
|
|
|
23
23
|
});
|
|
24
24
|
const contentContainerStyles = css({
|
|
25
25
|
display: 'grid',
|
|
26
|
-
|
|
27
|
-
overflow: 'auto'
|
|
26
|
+
maxHeight: '420px',
|
|
27
|
+
overflow: 'auto',
|
|
28
|
+
borderBottom: `2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`}`
|
|
28
29
|
});
|
|
29
30
|
const placeholderSmartLinkStyles = css({
|
|
30
31
|
backgroundColor: `var(--ds-surface-raised, ${N0})`,
|
|
@@ -159,7 +160,9 @@ export const JiraIssuesConfigModal = props => {
|
|
|
159
160
|
const handleViewModeChange = selectedMode => {
|
|
160
161
|
setCurrentViewMode(selectedMode);
|
|
161
162
|
};
|
|
162
|
-
const issueLikeDataTableView = useMemo(() => jsx(
|
|
163
|
+
const issueLikeDataTableView = useMemo(() => jsx("div", {
|
|
164
|
+
css: contentContainerStyles
|
|
165
|
+
}, jsx(IssueLikeDataTableView, {
|
|
163
166
|
testId: "jira-jql-datasource-table",
|
|
164
167
|
status: status,
|
|
165
168
|
columns: columns,
|
|
@@ -169,7 +172,7 @@ export const JiraIssuesConfigModal = props => {
|
|
|
169
172
|
onNextPage: onNextPage,
|
|
170
173
|
onLoadDatasourceDetails: loadDatasourceDetails,
|
|
171
174
|
onVisibleColumnKeysChange: setVisibleColumnKeys
|
|
172
|
-
}), [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, responseItems, status, visibleColumnKeys]);
|
|
175
|
+
})), [columns, defaultVisibleColumnKeys, hasNextPage, loadDatasourceDetails, onNextPage, responseItems, status, visibleColumnKeys]);
|
|
173
176
|
const renderCountModeContent = useCallback(() => {
|
|
174
177
|
const url = selectedJiraSite === null || selectedJiraSite === void 0 ? void 0 : selectedJiraSite.url;
|
|
175
178
|
if (status === 'unauthorized') {
|
|
@@ -205,9 +208,11 @@ export const JiraIssuesConfigModal = props => {
|
|
|
205
208
|
return jsx(NoResults, null);
|
|
206
209
|
} else if (status === 'empty' || !columns.length) {
|
|
207
210
|
// persist the empty state when making the initial /data request which contains the columns
|
|
208
|
-
return jsx(
|
|
211
|
+
return jsx("div", {
|
|
212
|
+
css: contentContainerStyles
|
|
213
|
+
}, jsx(EmptyState, {
|
|
209
214
|
testId: `jira-jql-datasource-modal--empty-state`
|
|
210
|
-
});
|
|
215
|
+
}));
|
|
211
216
|
}
|
|
212
217
|
const firstIssueUrl = retrieveUrlForSmartCardRender();
|
|
213
218
|
if (responseItems.length === 1 && firstIssueUrl) {
|
|
@@ -250,9 +255,7 @@ export const JiraIssuesConfigModal = props => {
|
|
|
250
255
|
isSearching: status === 'loading',
|
|
251
256
|
parameters: parameters,
|
|
252
257
|
onSearch: onSearch
|
|
253
|
-
}), jsx("div", {
|
|
254
|
-
css: contentContainerStyles
|
|
255
|
-
}, currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent())), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
|
|
258
|
+
}), currentViewMode === 'count' ? renderCountModeContent() : renderIssuesModeContent()), jsx(ModalFooter, null, shouldShowIssueCount && jsx("div", {
|
|
256
259
|
"data-testid": "jira-jql-datasource-modal-total-issues-count",
|
|
257
260
|
css: issueCountStyles
|
|
258
261
|
}, jsx(FormattedNumber, {
|
|
@@ -11,20 +11,18 @@ import { N0, N40, N800, N90 } from '@atlaskit/theme/colors';
|
|
|
11
11
|
import { footerMessages } from './messages';
|
|
12
12
|
import { SyncInfo } from './sync-info';
|
|
13
13
|
const FooterWrapper = styled.div`
|
|
14
|
+
padding: 0 ${"var(--ds-space-200, 16px)"};
|
|
15
|
+
box-sizing: border-box;
|
|
16
|
+
background: ${`var(--ds-background-input, ${N0})`};
|
|
17
|
+
`;
|
|
18
|
+
const TopBorderWrapper = styled.div`
|
|
14
19
|
display: flex;
|
|
20
|
+
box-sizing: border-box;
|
|
15
21
|
justify-content: space-between;
|
|
16
|
-
width: 100%;
|
|
17
22
|
padding: ${"var(--ds-space-250, 20px)"} 0;
|
|
18
|
-
|
|
19
|
-
bottom: 0;
|
|
20
|
-
background: ${`var(--ds-background-input, ${N0})`};
|
|
21
|
-
border-top-style: solid;
|
|
22
|
-
border-top-color: ${`var(--ds-background-neutral, ${N40})`};
|
|
23
|
-
margin-top: -2px;
|
|
24
|
-
align-self: center;
|
|
23
|
+
border-top: 2px solid ${`var(--ds-background-accent-gray-subtler, ${N40})`};
|
|
25
24
|
`;
|
|
26
25
|
const IssueCounterWrapper = styled.div`
|
|
27
|
-
margin-left: 10px;
|
|
28
26
|
display: flex;
|
|
29
27
|
align-self: center;
|
|
30
28
|
color: ${`var(--ds-text-accent-gray, ${N800})`};
|
|
@@ -55,7 +53,9 @@ export const TableFooter = ({
|
|
|
55
53
|
// ensure correct positioning since 'justify-content: space-between' is used).
|
|
56
54
|
return onRefresh || showIssueCount ? jsx(FooterWrapper, {
|
|
57
55
|
"data-testid": "table-footer"
|
|
58
|
-
}, jsx(
|
|
56
|
+
}, jsx(TopBorderWrapper, null, jsx(IssueCounterWrapper, {
|
|
57
|
+
"data-testid": 'issue-count-wrapper'
|
|
58
|
+
}, showIssueCount && jsx(Heading, {
|
|
59
59
|
testId: "issue-count",
|
|
60
60
|
level: "h400"
|
|
61
61
|
}, jsx(FormattedNumber, {
|
|
@@ -76,5 +76,5 @@ export const TableFooter = ({
|
|
|
76
76
|
}),
|
|
77
77
|
isDisabled: isLoading,
|
|
78
78
|
testId: "refresh-button"
|
|
79
|
-
})))) : null;
|
|
79
|
+
}))))) : null;
|
|
80
80
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -80,7 +80,7 @@ export var AssetsConfigModal = function AssetsConfigModal(props) {
|
|
|
80
80
|
return data === null || data === void 0 ? void 0 : (_data$key = data.key) === null || _data$key === void 0 ? void 0 : (_data$key$data = _data$key.data) === null || _data$key$data === void 0 ? void 0 : _data$key$data.url;
|
|
81
81
|
}, [responseItems]);
|
|
82
82
|
var onInsertPressed = useCallback(function () {
|
|
83
|
-
if (!aql || !schemaId) {
|
|
83
|
+
if (!aql || !schemaId || !workspaceId) {
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
86
|
var firstAssetUrl = retrieveUrlForSmartCardRender();
|
|
@@ -98,7 +98,7 @@ export var AssetsConfigModal = function AssetsConfigModal(props) {
|
|
|
98
98
|
datasource: {
|
|
99
99
|
id: datasourceId,
|
|
100
100
|
parameters: {
|
|
101
|
-
workspaceId:
|
|
101
|
+
workspaceId: workspaceId,
|
|
102
102
|
aql: aql,
|
|
103
103
|
schemaId: schemaId
|
|
104
104
|
},
|
|
@@ -116,7 +116,7 @@ export var AssetsConfigModal = function AssetsConfigModal(props) {
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
}
|
|
119
|
-
}, [aql, datasourceId, onInsert, responseItems.length, retrieveUrlForSmartCardRender, schemaId, visibleColumnKeys]);
|
|
119
|
+
}, [aql, datasourceId, onInsert, responseItems.length, retrieveUrlForSmartCardRender, schemaId, workspaceId, visibleColumnKeys]);
|
|
120
120
|
var handleOnSearch = useCallback(function (aql, schemaId) {
|
|
121
121
|
reset();
|
|
122
122
|
setAql(aql);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { jsx } from '@emotion/react';
|
|
4
4
|
import { useDatasourceTableState } from '../../hooks/useDatasourceTableState';
|
|
5
5
|
import { AccessRequired } from '../common/error-state/access-required';
|
|
6
6
|
import { LoadingError } from '../common/error-state/loading-error';
|
|
@@ -8,13 +8,6 @@ import { NoResults } from '../common/error-state/no-results';
|
|
|
8
8
|
import { IssueLikeDataTableView } from '../issue-like-table';
|
|
9
9
|
import EmptyState from '../issue-like-table/empty-state';
|
|
10
10
|
import { TableFooter } from '../table-footer';
|
|
11
|
-
var TableViewWrapperStyles = css({
|
|
12
|
-
display: 'grid',
|
|
13
|
-
position: 'relative',
|
|
14
|
-
padding: "var(--ds-space-200, 16px)",
|
|
15
|
-
paddingBottom: 0,
|
|
16
|
-
boxSizing: 'border-box'
|
|
17
|
-
});
|
|
18
11
|
export var DatasourceTableView = function DatasourceTableView(_ref) {
|
|
19
12
|
var datasourceId = _ref.datasourceId,
|
|
20
13
|
parameters = _ref.parameters,
|
|
@@ -57,9 +50,8 @@ export var DatasourceTableView = function DatasourceTableView(_ref) {
|
|
|
57
50
|
onRefresh: reset
|
|
58
51
|
});
|
|
59
52
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}, jsx(IssueLikeDataTableView, {
|
|
53
|
+
var isDataReady = columns.length > 0;
|
|
54
|
+
return jsx("div", null, isDataReady ? jsx(IssueLikeDataTableView, {
|
|
63
55
|
testId: 'datasource-table-view',
|
|
64
56
|
hasNextPage: hasNextPage,
|
|
65
57
|
items: responseItems,
|
|
@@ -68,18 +60,14 @@ export var DatasourceTableView = function DatasourceTableView(_ref) {
|
|
|
68
60
|
status: status,
|
|
69
61
|
columns: columns,
|
|
70
62
|
visibleColumnKeys: visibleColumnKeys || defaultVisibleColumnKeys,
|
|
71
|
-
onVisibleColumnKeysChange: onVisibleColumnKeysChange
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
onRefresh: reset,
|
|
75
|
-
isLoading: status === 'loading'
|
|
76
|
-
})) : jsx("div", {
|
|
77
|
-
css: TableViewWrapperStyles
|
|
78
|
-
}, jsx(EmptyState, {
|
|
63
|
+
onVisibleColumnKeysChange: onVisibleColumnKeysChange,
|
|
64
|
+
scrollableContainerHeight: 590
|
|
65
|
+
}) : jsx(EmptyState, {
|
|
79
66
|
testId: "datasource-table-view-skeleton",
|
|
80
67
|
isCompact: true
|
|
81
68
|
}), jsx(TableFooter, {
|
|
69
|
+
issueCount: isDataReady ? totalCount : undefined,
|
|
82
70
|
onRefresh: reset,
|
|
83
|
-
isLoading:
|
|
71
|
+
isLoading: !isDataReady || status === 'loading'
|
|
84
72
|
}));
|
|
85
73
|
};
|
|
@@ -13,8 +13,7 @@ import ChevronDownIcon from '@atlaskit/icon/glyph/chevron-down';
|
|
|
13
13
|
import { CheckboxOption, PopupSelect } from '@atlaskit/select';
|
|
14
14
|
import { columnPickerMessages } from './messages';
|
|
15
15
|
export var ColumnPicker = function ColumnPicker(_ref) {
|
|
16
|
-
var
|
|
17
|
-
columns = _ref.columns,
|
|
16
|
+
var columns = _ref.columns,
|
|
18
17
|
selectedColumnKeys = _ref.selectedColumnKeys,
|
|
19
18
|
onSelectedColumnKeysChange = _ref.onSelectedColumnKeysChange,
|
|
20
19
|
onOpen = _ref.onOpen;
|
|
@@ -120,8 +119,7 @@ export var ColumnPicker = function ColumnPicker(_ref) {
|
|
|
120
119
|
})),
|
|
121
120
|
spacing: "compact",
|
|
122
121
|
appearance: "subtle",
|
|
123
|
-
testId: "column-picker-trigger-button"
|
|
124
|
-
isDisabled: isDatasourceLoading
|
|
122
|
+
testId: "column-picker-trigger-button"
|
|
125
123
|
}));
|
|
126
124
|
}
|
|
127
125
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2;
|
|
3
|
+
/** @jsx jsx */
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { css, jsx } from '@emotion/react';
|
|
6
|
+
import styled from '@emotion/styled';
|
|
7
|
+
import { TableHeading } from './styled';
|
|
8
|
+
var maxWidth = '200px';
|
|
9
|
+
var firstLastChildOverride = "\n &:first-of-type, &:last-of-type {\n padding-left: ".concat("var(--ds-space-100, 8px)", ";\n padding-right: ", "var(--ds-space-100, 8px)", ";\n }\n");
|
|
10
|
+
var TablePreviewHeading = styled(TableHeading)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n background: ", ";\n color: ", ";\n max-width: ", ";\n ", "\n"])), "var(--ds-background-disabled, #091E4224)", "var(--ds-text-disabled, #091E424F)", maxWidth, firstLastChildOverride);
|
|
11
|
+
var TablePreviewCell = styled.td(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n max-width: ", ";\n padding: ", " ", ";\n ", "\n"])), maxWidth, "var(--ds-space-050, 4px)", "var(--ds-space-100, 8px)", firstLastChildOverride);
|
|
12
|
+
var tableStyles = css({
|
|
13
|
+
background: "var(--ds-surface, #FFF)",
|
|
14
|
+
borderCollapse: 'separate',
|
|
15
|
+
borderSpacing: 0,
|
|
16
|
+
fontSize: "var(--ds-font-size-200, 16px)",
|
|
17
|
+
maxWidth: maxWidth
|
|
18
|
+
});
|
|
19
|
+
export var DragColumnPreview = function DragColumnPreview(_ref) {
|
|
20
|
+
var title = _ref.title,
|
|
21
|
+
rows = _ref.rows;
|
|
22
|
+
return jsx("table", {
|
|
23
|
+
css: tableStyles
|
|
24
|
+
}, jsx("thead", null, jsx("tr", null, jsx(TablePreviewHeading, null, title))), jsx("tbody", null, rows.map(function (data, i) {
|
|
25
|
+
return jsx("tr", {
|
|
26
|
+
key: i
|
|
27
|
+
}, jsx(TablePreviewCell, null, data));
|
|
28
|
+
}), jsx("tr", null, jsx(TablePreviewCell, null, "..."))));
|
|
29
|
+
};
|