@atlaskit/link-datasource 7.8.0 → 7.8.2
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 +14 -0
- package/compass.yml +3 -0
- package/dist/cjs/ui/assets-modal/modal/index.js +9 -7
- package/dist/cjs/ui/assets-modal/modal/messages.js +15 -0
- package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +12 -0
- package/dist/cjs/ui/assets-modal/modal-config-popup/index.compiled.css +6 -0
- package/dist/cjs/ui/assets-modal/modal-config-popup/index.js +155 -0
- package/dist/cjs/ui/assets-modal/modal-config-popup/messages.js +29 -0
- package/dist/cjs/ui/assets-modal/search-container/index.compiled.css +0 -1
- package/dist/cjs/ui/assets-modal/search-container/index.js +37 -8
- package/dist/es2019/ui/assets-modal/modal/index.js +7 -7
- package/dist/es2019/ui/assets-modal/modal/messages.js +15 -0
- package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +12 -0
- package/dist/es2019/ui/assets-modal/modal-config-popup/index.compiled.css +6 -0
- package/dist/es2019/ui/assets-modal/modal-config-popup/index.js +126 -0
- package/dist/es2019/ui/assets-modal/modal-config-popup/messages.js +23 -0
- package/dist/es2019/ui/assets-modal/search-container/index.compiled.css +0 -1
- package/dist/es2019/ui/assets-modal/search-container/index.js +37 -8
- package/dist/esm/ui/assets-modal/modal/index.js +9 -7
- package/dist/esm/ui/assets-modal/modal/messages.js +15 -0
- package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +12 -0
- package/dist/esm/ui/assets-modal/modal-config-popup/index.compiled.css +6 -0
- package/dist/esm/ui/assets-modal/modal-config-popup/index.js +147 -0
- package/dist/esm/ui/assets-modal/modal-config-popup/messages.js +23 -0
- package/dist/esm/ui/assets-modal/search-container/index.compiled.css +0 -1
- package/dist/esm/ui/assets-modal/search-container/index.js +37 -8
- package/dist/types/ui/assets-modal/modal/messages.d.ts +19 -4
- package/dist/types/ui/assets-modal/modal-config-popup/index.d.ts +30 -0
- package/dist/types/ui/assets-modal/modal-config-popup/messages.d.ts +22 -0
- package/package.json +12 -12
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import "./index.compiled.css";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
6
|
+
import { useId, useState } from 'react';
|
|
7
|
+
import { useIntl, FormattedMessage } from 'react-intl';
|
|
8
|
+
import IconButton from '@atlaskit/button/icon/button';
|
|
9
|
+
import Checkbox from '@atlaskit/checkbox/checkbox';
|
|
10
|
+
import { Label } from '@atlaskit/form/label/default';
|
|
11
|
+
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
12
|
+
import { Popup } from '@atlaskit/popup/popup';
|
|
13
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
14
|
+
import { Stack } from '@atlaskit/primitives/compiled/stack';
|
|
15
|
+
import Select from '@atlaskit/select/default';
|
|
16
|
+
import { aboveModal } from '../../../common/zindex';
|
|
17
|
+
import { modalConfigPopupMessages } from './messages';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Rendering a `<Select>` in a `<Modal>` results in the select options getting cut off by the bottom of the modal and
|
|
21
|
+
* scrolling. This is a work-around for that, see https://atlassian.slack.com/archives/CFJ9DU39U/p1623179496484100
|
|
22
|
+
*/
|
|
23
|
+
export const selectInAModalStyleFixProps = {
|
|
24
|
+
styles: {
|
|
25
|
+
menuPortal: base => ({
|
|
26
|
+
...base,
|
|
27
|
+
zIndex: aboveModal
|
|
28
|
+
})
|
|
29
|
+
},
|
|
30
|
+
menuPortalTarget: document.body
|
|
31
|
+
};
|
|
32
|
+
export const PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
|
|
33
|
+
export const DEFAULT_PAGE_SIZE = 20;
|
|
34
|
+
const styles = {
|
|
35
|
+
trigger: "_19bvxy5q _u5f3pxbi",
|
|
36
|
+
content: "_1bsb1kdj _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi"
|
|
37
|
+
};
|
|
38
|
+
export const AssetsModalConfigPopup = ({
|
|
39
|
+
initialConfig,
|
|
40
|
+
onChange,
|
|
41
|
+
testId = 'assets-datasource-modal--config-popup'
|
|
42
|
+
}) => {
|
|
43
|
+
var _initialConfig$pageSi, _initialConfig$isNest;
|
|
44
|
+
const {
|
|
45
|
+
formatMessage
|
|
46
|
+
} = useIntl();
|
|
47
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
48
|
+
const [config, setConfig] = useState({
|
|
49
|
+
pageSize: (_initialConfig$pageSi = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.pageSize) !== null && _initialConfig$pageSi !== void 0 ? _initialConfig$pageSi : DEFAULT_PAGE_SIZE,
|
|
50
|
+
isNestedReferenceAttributeSelectionEnabled: (_initialConfig$isNest = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.isNestedReferenceAttributeSelectionEnabled) !== null && _initialConfig$isNest !== void 0 ? _initialConfig$isNest : false
|
|
51
|
+
});
|
|
52
|
+
const pageSizeSelectId = useId();
|
|
53
|
+
const pageSizeOptions = PAGE_SIZE_OPTIONS.map(count => ({
|
|
54
|
+
label: formatMessage(modalConfigPopupMessages.objectsPerPage, {
|
|
55
|
+
count
|
|
56
|
+
}),
|
|
57
|
+
value: count
|
|
58
|
+
}));
|
|
59
|
+
const updateConfig = partialConfig => {
|
|
60
|
+
const nextConfig = {
|
|
61
|
+
...config,
|
|
62
|
+
...partialConfig
|
|
63
|
+
};
|
|
64
|
+
setConfig(nextConfig);
|
|
65
|
+
onChange(nextConfig);
|
|
66
|
+
};
|
|
67
|
+
const handlePageSizeChange = option => {
|
|
68
|
+
if (option) {
|
|
69
|
+
updateConfig({
|
|
70
|
+
pageSize: option.value
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
const handleNestedReferenceAttributeSelectionChange = event => {
|
|
75
|
+
updateConfig({
|
|
76
|
+
isNestedReferenceAttributeSelectionEnabled: event.target.checked
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const selectedPageSizeOption = pageSizeOptions.find(option => option.value === config.pageSize);
|
|
80
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
81
|
+
isOpen: isOpen,
|
|
82
|
+
onClose: () => setIsOpen(false),
|
|
83
|
+
placement: "bottom-end",
|
|
84
|
+
testId: testId,
|
|
85
|
+
role: "dialog",
|
|
86
|
+
label: formatMessage(modalConfigPopupMessages.configureTable),
|
|
87
|
+
zIndex: aboveModal,
|
|
88
|
+
trigger: triggerProps => /*#__PURE__*/React.createElement(Box, {
|
|
89
|
+
xcss: styles.trigger
|
|
90
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
91
|
+
ref: triggerProps.ref,
|
|
92
|
+
"aria-controls": triggerProps['aria-controls'],
|
|
93
|
+
"aria-expanded": triggerProps['aria-expanded'],
|
|
94
|
+
"aria-haspopup": triggerProps['aria-haspopup'],
|
|
95
|
+
icon: CustomizeIcon,
|
|
96
|
+
isSelected: isOpen,
|
|
97
|
+
isTooltipDisabled: false,
|
|
98
|
+
label: formatMessage(modalConfigPopupMessages.configureTable),
|
|
99
|
+
onClick: () => setIsOpen(currentIsOpen => !currentIsOpen),
|
|
100
|
+
testId: `${testId}--trigger`
|
|
101
|
+
})),
|
|
102
|
+
content: () => /*#__PURE__*/React.createElement(Box, {
|
|
103
|
+
xcss: styles.content
|
|
104
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
105
|
+
space: "space.200"
|
|
106
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
107
|
+
space: "space.050",
|
|
108
|
+
alignInline: "start"
|
|
109
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
110
|
+
htmlFor: pageSizeSelectId
|
|
111
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, modalConfigPopupMessages.tablePagination)), /*#__PURE__*/React.createElement(Select, _extends({}, selectInAModalStyleFixProps, {
|
|
112
|
+
inputId: pageSizeSelectId,
|
|
113
|
+
options: pageSizeOptions,
|
|
114
|
+
value: selectedPageSizeOption,
|
|
115
|
+
onChange: handlePageSizeChange,
|
|
116
|
+
isSearchable: false,
|
|
117
|
+
menuPlacement: "bottom",
|
|
118
|
+
testId: `${testId}--page-size-select`
|
|
119
|
+
}))), /*#__PURE__*/React.createElement(Checkbox, {
|
|
120
|
+
isChecked: config.isNestedReferenceAttributeSelectionEnabled,
|
|
121
|
+
onChange: handleNestedReferenceAttributeSelectionChange,
|
|
122
|
+
label: formatMessage(modalConfigPopupMessages.nestedReferenceAttributeSelection),
|
|
123
|
+
testId: `${testId}--nested-reference-attribute-selection`
|
|
124
|
+
})))
|
|
125
|
+
});
|
|
126
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
export const modalConfigPopupMessages = defineMessages({
|
|
3
|
+
configureTable: {
|
|
4
|
+
id: 'linkDataSource.assets.configModal.configPopup.configureTable',
|
|
5
|
+
description: 'Tooltip and accessibility label for the icon button that opens the Assets table configuration popup',
|
|
6
|
+
defaultMessage: 'Configure table'
|
|
7
|
+
},
|
|
8
|
+
nestedReferenceAttributeSelection: {
|
|
9
|
+
id: 'linkDataSource.assets.configModal.configPopup.nestedReferenceAttributeSelection',
|
|
10
|
+
description: 'Label for the checkbox that allows users to select attributes of referenced objects (nested attributes) as table columns',
|
|
11
|
+
defaultMessage: 'Enable nested reference attribute selection'
|
|
12
|
+
},
|
|
13
|
+
objectsPerPage: {
|
|
14
|
+
id: 'linkDataSource.assets.configModal.configPopup.objectsPerPage',
|
|
15
|
+
description: 'Option label in the pagination select showing how many Assets objects are displayed per table page. {count} is the number of objects.',
|
|
16
|
+
defaultMessage: '{count, plural, one {# object per page} other {# objects per page}}'
|
|
17
|
+
},
|
|
18
|
+
tablePagination: {
|
|
19
|
+
id: 'linkDataSource.assets.configModal.configPopup.tablePagination',
|
|
20
|
+
description: 'Label for the select input where users choose how many Assets objects are displayed per table page',
|
|
21
|
+
defaultMessage: 'Table pagination:'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -4,18 +4,23 @@ import "./index.compiled.css";
|
|
|
4
4
|
import { forwardRef } from 'react';
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
+
import { FormattedMessage } from 'react-intl';
|
|
7
8
|
import Form from '@atlaskit/form/form';
|
|
9
|
+
import Heading from '@atlaskit/heading/heading';
|
|
8
10
|
import { CloseButton } from '@atlaskit/modal-dialog/close-button';
|
|
9
11
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
12
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
13
|
+
import { Text } from '@atlaskit/primitives/compiled/text';
|
|
11
14
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
12
15
|
import { aqlKey } from '../../../types/assets/types';
|
|
16
|
+
import { AssetsModalConfigPopup } from '../modal-config-popup';
|
|
17
|
+
import { modalMessages } from '../modal/messages';
|
|
13
18
|
import { AqlSearchInput } from './aql-search-input';
|
|
14
19
|
import { AssetsObjectSchemaSelect } from './object-schema-select';
|
|
15
20
|
import { FormRowContainer } from './styled';
|
|
16
21
|
const styles = {
|
|
17
22
|
modalTitleContainer: "_zulppxbi _4cvr1h6o",
|
|
18
|
-
flexStyles: "
|
|
23
|
+
flexStyles: "_1bsb1osq"
|
|
19
24
|
};
|
|
20
25
|
const DEFAULT_AQL_QUERY = '';
|
|
21
26
|
const SEARCH_FORM_ID = 'linkDataSource.assets.configModal.searchContainer-form';
|
|
@@ -64,7 +69,7 @@ export const AssetsSearchContainer = props => {
|
|
|
64
69
|
formProps,
|
|
65
70
|
setFieldValue
|
|
66
71
|
}) => {
|
|
67
|
-
var _initialSearchData$ob, _initialSearchData$ob2, _initialSearchData$aq;
|
|
72
|
+
var _initialSearchData$ob, _initialSearchData$ob2, _initialSearchData$ob3, _initialSearchData$ob4, _initialSearchData$aq;
|
|
68
73
|
const onSchemaChange = schema => {
|
|
69
74
|
if (fg('platform_lp_sllv_assets_default_schema_aql')) {
|
|
70
75
|
const defaultAql = `objectSchema = "${schema.label}"`;
|
|
@@ -76,24 +81,48 @@ export const AssetsSearchContainer = props => {
|
|
|
76
81
|
id: SEARCH_FORM_ID
|
|
77
82
|
}), /*#__PURE__*/React.createElement(FormRowContainer, {
|
|
78
83
|
isNarrowGap: true
|
|
79
|
-
}, /*#__PURE__*/React.createElement(Flex, {
|
|
84
|
+
}, fg('astral_assets_macro_table_ui_uplift') ? /*#__PURE__*/React.createElement(Flex, {
|
|
80
85
|
gap: "space.200",
|
|
81
86
|
justifyContent: "space-between",
|
|
82
87
|
xcss: styles.flexStyles
|
|
83
88
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
89
|
+
justifyContent: "start",
|
|
90
|
+
xcss: styles.modalTitleContainer
|
|
91
|
+
}, modalTitle), /*#__PURE__*/React.createElement(Flex, {
|
|
84
92
|
justifyContent: "end"
|
|
85
|
-
}, /*#__PURE__*/React.createElement(
|
|
93
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
94
|
+
alignItems: "center",
|
|
95
|
+
gap: "space.100"
|
|
96
|
+
}, /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement(FormattedMessage, modalMessages.insertObjectsTitle), ":"), /*#__PURE__*/React.createElement(AssetsObjectSchemaSelect, {
|
|
97
|
+
value: (_initialSearchData$ob = initialSearchData.objectSchema) !== null && _initialSearchData$ob !== void 0 ? _initialSearchData$ob : undefined,
|
|
98
|
+
workspaceId: workspaceId,
|
|
99
|
+
initialObjectSchemas: (_initialSearchData$ob2 = initialSearchData.objectSchemas) !== null && _initialSearchData$ob2 !== void 0 ? _initialSearchData$ob2 : undefined,
|
|
100
|
+
classNamePrefix: "assets-datasource-modal--object-schema-select",
|
|
101
|
+
onSchemaChange: onSchemaChange
|
|
102
|
+
})), /*#__PURE__*/React.createElement(AssetsModalConfigPopup, {
|
|
103
|
+
onChange: () => {}
|
|
104
|
+
}), /*#__PURE__*/React.createElement(CloseButton, {
|
|
86
105
|
onClick: onCancel
|
|
87
|
-
}))
|
|
106
|
+
}))) : /*#__PURE__*/React.createElement(Flex, {
|
|
107
|
+
gap: "space.200",
|
|
108
|
+
justifyContent: "space-between",
|
|
109
|
+
xcss: styles.flexStyles
|
|
110
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
88
111
|
justifyContent: "start",
|
|
89
112
|
xcss: styles.modalTitleContainer
|
|
90
113
|
}, modalTitle, /*#__PURE__*/React.createElement(AssetsObjectSchemaSelect, {
|
|
91
|
-
value: (_initialSearchData$
|
|
114
|
+
value: (_initialSearchData$ob3 = initialSearchData.objectSchema) !== null && _initialSearchData$ob3 !== void 0 ? _initialSearchData$ob3 : undefined,
|
|
92
115
|
workspaceId: workspaceId,
|
|
93
|
-
initialObjectSchemas: (_initialSearchData$
|
|
116
|
+
initialObjectSchemas: (_initialSearchData$ob4 = initialSearchData.objectSchemas) !== null && _initialSearchData$ob4 !== void 0 ? _initialSearchData$ob4 : undefined,
|
|
94
117
|
classNamePrefix: "assets-datasource-modal--object-schema-select",
|
|
95
118
|
onSchemaChange: onSchemaChange
|
|
96
|
-
}))
|
|
119
|
+
})), /*#__PURE__*/React.createElement(Flex, {
|
|
120
|
+
justifyContent: "end"
|
|
121
|
+
}, /*#__PURE__*/React.createElement(CloseButton, {
|
|
122
|
+
onClick: onCancel
|
|
123
|
+
})))), fg('astral_assets_macro_table_ui_uplift') ? /*#__PURE__*/React.createElement(Heading, {
|
|
124
|
+
size: "xsmall"
|
|
125
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, modalMessages.filterObjectsText)) : null, /*#__PURE__*/React.createElement(FormRowContainer, null, /*#__PURE__*/React.createElement(AqlSearchInput, {
|
|
97
126
|
value: (_initialSearchData$aq = initialSearchData.aql) !== null && _initialSearchData$aq !== void 0 ? _initialSearchData$aq : DEFAULT_AQL_QUERY,
|
|
98
127
|
workspaceId: workspaceId,
|
|
99
128
|
isSearching: isSearching
|
|
@@ -46,7 +46,9 @@ import { modalMessages } from './messages';
|
|
|
46
46
|
import { RenderAssetsContent } from './render-assets-content';
|
|
47
47
|
var VERSION_TWO = '2';
|
|
48
48
|
var modalBodyErrorWrapperStyles = null;
|
|
49
|
-
var AssetsModalTitle =
|
|
49
|
+
var AssetsModalTitle = function AssetsModalTitle() {
|
|
50
|
+
return /*#__PURE__*/React.createElement(ModalTitle, null, /*#__PURE__*/React.createElement(FormattedMessage, fg('astral_assets_macro_table_ui_uplift') ? modalMessages.assetsConfigModalTitle : modalMessages.insertObjectsTitle));
|
|
51
|
+
};
|
|
50
52
|
var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
51
53
|
var datasourceId = props.datasourceId,
|
|
52
54
|
initialParameters = props.parameters,
|
|
@@ -155,7 +157,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
155
157
|
// newly selected ones - refetching for them, and throwing away the results just received. The
|
|
156
158
|
// re-render this schedules is discarded before commit, so the hook only ever sees the reconciled
|
|
157
159
|
// selection.
|
|
158
|
-
if (
|
|
160
|
+
if (hasPreservedColumns && status === 'resolved' && columns.length > 0) {
|
|
159
161
|
var availableKeys = new Set(columns.map(function (_ref) {
|
|
160
162
|
var key = _ref.key;
|
|
161
163
|
return key;
|
|
@@ -231,7 +233,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
231
233
|
}, []);
|
|
232
234
|
useEffect(function () {
|
|
233
235
|
// A preserved selection owns the columns, so restoring the saved or default ones would undo it
|
|
234
|
-
if (
|
|
236
|
+
if (hasPreservedColumns) {
|
|
235
237
|
return;
|
|
236
238
|
}
|
|
237
239
|
var newVisibleColumnKeys = initialVisibleColumnKeys && initialVisibleColumnKeys.length > 0 && apiVersion === VERSION_TWO ? initialVisibleColumnKeys : defaultVisibleColumnKeys;
|
|
@@ -241,7 +243,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
241
243
|
// The response described none of the requested fields, so there is nothing valid to keep and
|
|
242
244
|
// no reported defaults to fall back to. Give up preserving and re-request the schema's own
|
|
243
245
|
// defaults. This one has to stay an effect because it issues a request.
|
|
244
|
-
if (!
|
|
246
|
+
if (!hasPreservedColumns || status !== 'resolved' || columns.length > 0) {
|
|
245
247
|
return;
|
|
246
248
|
}
|
|
247
249
|
setHasPreservedColumns(false);
|
|
@@ -329,7 +331,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
329
331
|
}
|
|
330
332
|
// An empty selection has nothing worth preserving, and keeping it would stop the
|
|
331
333
|
// response's defaults from being adopted
|
|
332
|
-
var shouldPreserveColumns =
|
|
334
|
+
var shouldPreserveColumns = schemaId === searchSchemaId && (visibleColumnKeys !== null && visibleColumnKeys !== void 0 ? visibleColumnKeys : []).length > 0;
|
|
333
335
|
setHasPreservedColumns(shouldPreserveColumns);
|
|
334
336
|
setAql(searchAql);
|
|
335
337
|
setSchemaId(searchSchemaId);
|
|
@@ -361,7 +363,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
361
363
|
} else {
|
|
362
364
|
if (!workspaceId || assetsClientLoading) {
|
|
363
365
|
return /*#__PURE__*/React.createElement(AssetsSearchContainerLoading, {
|
|
364
|
-
modalTitle: AssetsModalTitle
|
|
366
|
+
modalTitle: /*#__PURE__*/React.createElement(AssetsModalTitle, null)
|
|
365
367
|
});
|
|
366
368
|
}
|
|
367
369
|
return /*#__PURE__*/React.createElement(AssetsSearchContainer, {
|
|
@@ -372,7 +374,7 @@ var PlainAssetsConfigModal = function PlainAssetsConfigModal(props) {
|
|
|
372
374
|
objectSchemas: objectSchemas
|
|
373
375
|
},
|
|
374
376
|
onSearch: handleOnSearch,
|
|
375
|
-
modalTitle: AssetsModalTitle,
|
|
377
|
+
modalTitle: /*#__PURE__*/React.createElement(AssetsModalTitle, null),
|
|
376
378
|
isSearching: status === 'loading',
|
|
377
379
|
onCancel: onCancel
|
|
378
380
|
});
|
|
@@ -14,5 +14,20 @@ export var modalMessages = defineMessages({
|
|
|
14
14
|
id: 'linkDataSource.assets.configmodal.insertObjectsTitle',
|
|
15
15
|
description: 'Title for the Assets Objects Datasource config modal which prefixes a select picker',
|
|
16
16
|
defaultMessage: 'Insert objects from'
|
|
17
|
+
},
|
|
18
|
+
assetsConfigModalTitle: {
|
|
19
|
+
id: 'linkDataSource.assets.configmodal.title',
|
|
20
|
+
description: 'Title for the Assets Objects Datasource config modal',
|
|
21
|
+
defaultMessage: 'Assets table macro configuration'
|
|
22
|
+
},
|
|
23
|
+
filterObjectsText: {
|
|
24
|
+
id: 'linkDataSource.assets.configmodal.filterObjectsText',
|
|
25
|
+
description: 'Text for the filter option using aql search',
|
|
26
|
+
defaultMessage: 'Filter'
|
|
27
|
+
},
|
|
28
|
+
tablePreviewText: {
|
|
29
|
+
id: 'linkDataSource.assets.configmodal.tablePreviewText',
|
|
30
|
+
description: 'Heading above the table preview in the Assets configuration modal',
|
|
31
|
+
defaultMessage: 'Table preview'
|
|
17
32
|
}
|
|
18
33
|
});
|
|
@@ -3,11 +3,16 @@ import "./index.compiled.css";
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { ax, ix } from "@compiled/react/runtime";
|
|
5
5
|
import { useCallback, useMemo } from 'react';
|
|
6
|
+
import { FormattedMessage } from 'react-intl';
|
|
7
|
+
import Heading from '@atlaskit/heading/heading';
|
|
8
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
|
+
import { Stack } from '@atlaskit/primitives/compiled/stack';
|
|
6
10
|
import { AccessRequired } from '../../../common/error-state/access-required';
|
|
7
11
|
import { ModalLoadingError } from '../../../common/error-state/modal-loading-error';
|
|
8
12
|
import { NoResults } from '../../../common/error-state/no-results';
|
|
9
13
|
import EmptyState from '../../../issue-like-table/empty-state';
|
|
10
14
|
import { IssueLikeDataTableView } from '../../../issue-like-table/issue-like-data-table-view';
|
|
15
|
+
import { modalMessages } from '../messages';
|
|
11
16
|
import { InitialStateView } from './initial-state-view';
|
|
12
17
|
export var MODAL_HEIGHT = 420;
|
|
13
18
|
|
|
@@ -91,5 +96,12 @@ export var RenderAssetsContent = function RenderAssetsContent(props) {
|
|
|
91
96
|
}
|
|
92
97
|
return issueLikeDataTableView;
|
|
93
98
|
}, [columns.length, isFetchingInitialData, issueLikeDataTableView, resolvedWithNoResults, shouldRenderTableWithNoResults, status]);
|
|
99
|
+
if (fg('astral_assets_macro_table_ui_uplift')) {
|
|
100
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
101
|
+
space: "space.200"
|
|
102
|
+
}, status !== 'empty' && /*#__PURE__*/React.createElement(Heading, {
|
|
103
|
+
size: "xsmall"
|
|
104
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, modalMessages.tablePreviewText)), renderAssetsContentView());
|
|
105
|
+
}
|
|
94
106
|
return renderAssetsContentView();
|
|
95
107
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
|
|
2
|
+
._19bvxy5q{padding-left:var(--ds-space-400,2pc)}
|
|
3
|
+
._1bsb1kdj{width:25pc}
|
|
4
|
+
._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
|
|
5
|
+
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
6
|
+
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v3.0.2 */
|
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
|
+
import "./index.compiled.css";
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
import { useId, useState } from 'react';
|
|
11
|
+
import { useIntl, FormattedMessage } from 'react-intl';
|
|
12
|
+
import IconButton from '@atlaskit/button/icon/button';
|
|
13
|
+
import Checkbox from '@atlaskit/checkbox/checkbox';
|
|
14
|
+
import { Label } from '@atlaskit/form/label/default';
|
|
15
|
+
import CustomizeIcon from '@atlaskit/icon/core/customize';
|
|
16
|
+
import { Popup } from '@atlaskit/popup/popup';
|
|
17
|
+
import { Box } from '@atlaskit/primitives/compiled/box';
|
|
18
|
+
import { Stack } from '@atlaskit/primitives/compiled/stack';
|
|
19
|
+
import Select from '@atlaskit/select/default';
|
|
20
|
+
import { aboveModal } from '../../../common/zindex';
|
|
21
|
+
import { modalConfigPopupMessages } from './messages';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Rendering a `<Select>` in a `<Modal>` results in the select options getting cut off by the bottom of the modal and
|
|
25
|
+
* scrolling. This is a work-around for that, see https://atlassian.slack.com/archives/CFJ9DU39U/p1623179496484100
|
|
26
|
+
*/
|
|
27
|
+
export var selectInAModalStyleFixProps = {
|
|
28
|
+
styles: {
|
|
29
|
+
menuPortal: function menuPortal(base) {
|
|
30
|
+
return _objectSpread(_objectSpread({}, base), {}, {
|
|
31
|
+
zIndex: aboveModal
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
menuPortalTarget: document.body
|
|
36
|
+
};
|
|
37
|
+
export var PAGE_SIZE_OPTIONS = [10, 20, 50, 100];
|
|
38
|
+
export var DEFAULT_PAGE_SIZE = 20;
|
|
39
|
+
var styles = {
|
|
40
|
+
trigger: "_19bvxy5q _u5f3pxbi",
|
|
41
|
+
content: "_1bsb1kdj _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi"
|
|
42
|
+
};
|
|
43
|
+
export var AssetsModalConfigPopup = function AssetsModalConfigPopup(_ref) {
|
|
44
|
+
var _initialConfig$pageSi, _initialConfig$isNest;
|
|
45
|
+
var initialConfig = _ref.initialConfig,
|
|
46
|
+
onChange = _ref.onChange,
|
|
47
|
+
_ref$testId = _ref.testId,
|
|
48
|
+
testId = _ref$testId === void 0 ? 'assets-datasource-modal--config-popup' : _ref$testId;
|
|
49
|
+
var _useIntl = useIntl(),
|
|
50
|
+
formatMessage = _useIntl.formatMessage;
|
|
51
|
+
var _useState = useState(false),
|
|
52
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
53
|
+
isOpen = _useState2[0],
|
|
54
|
+
setIsOpen = _useState2[1];
|
|
55
|
+
var _useState3 = useState({
|
|
56
|
+
pageSize: (_initialConfig$pageSi = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.pageSize) !== null && _initialConfig$pageSi !== void 0 ? _initialConfig$pageSi : DEFAULT_PAGE_SIZE,
|
|
57
|
+
isNestedReferenceAttributeSelectionEnabled: (_initialConfig$isNest = initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.isNestedReferenceAttributeSelectionEnabled) !== null && _initialConfig$isNest !== void 0 ? _initialConfig$isNest : false
|
|
58
|
+
}),
|
|
59
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
60
|
+
config = _useState4[0],
|
|
61
|
+
setConfig = _useState4[1];
|
|
62
|
+
var pageSizeSelectId = useId();
|
|
63
|
+
var pageSizeOptions = PAGE_SIZE_OPTIONS.map(function (count) {
|
|
64
|
+
return {
|
|
65
|
+
label: formatMessage(modalConfigPopupMessages.objectsPerPage, {
|
|
66
|
+
count: count
|
|
67
|
+
}),
|
|
68
|
+
value: count
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
var updateConfig = function updateConfig(partialConfig) {
|
|
72
|
+
var nextConfig = _objectSpread(_objectSpread({}, config), partialConfig);
|
|
73
|
+
setConfig(nextConfig);
|
|
74
|
+
onChange(nextConfig);
|
|
75
|
+
};
|
|
76
|
+
var handlePageSizeChange = function handlePageSizeChange(option) {
|
|
77
|
+
if (option) {
|
|
78
|
+
updateConfig({
|
|
79
|
+
pageSize: option.value
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var handleNestedReferenceAttributeSelectionChange = function handleNestedReferenceAttributeSelectionChange(event) {
|
|
84
|
+
updateConfig({
|
|
85
|
+
isNestedReferenceAttributeSelectionEnabled: event.target.checked
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
var selectedPageSizeOption = pageSizeOptions.find(function (option) {
|
|
89
|
+
return option.value === config.pageSize;
|
|
90
|
+
});
|
|
91
|
+
return /*#__PURE__*/React.createElement(Popup, {
|
|
92
|
+
isOpen: isOpen,
|
|
93
|
+
onClose: function onClose() {
|
|
94
|
+
return setIsOpen(false);
|
|
95
|
+
},
|
|
96
|
+
placement: "bottom-end",
|
|
97
|
+
testId: testId,
|
|
98
|
+
role: "dialog",
|
|
99
|
+
label: formatMessage(modalConfigPopupMessages.configureTable),
|
|
100
|
+
zIndex: aboveModal,
|
|
101
|
+
trigger: function trigger(triggerProps) {
|
|
102
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
103
|
+
xcss: styles.trigger
|
|
104
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
105
|
+
ref: triggerProps.ref,
|
|
106
|
+
"aria-controls": triggerProps['aria-controls'],
|
|
107
|
+
"aria-expanded": triggerProps['aria-expanded'],
|
|
108
|
+
"aria-haspopup": triggerProps['aria-haspopup'],
|
|
109
|
+
icon: CustomizeIcon,
|
|
110
|
+
isSelected: isOpen,
|
|
111
|
+
isTooltipDisabled: false,
|
|
112
|
+
label: formatMessage(modalConfigPopupMessages.configureTable),
|
|
113
|
+
onClick: function onClick() {
|
|
114
|
+
return setIsOpen(function (currentIsOpen) {
|
|
115
|
+
return !currentIsOpen;
|
|
116
|
+
});
|
|
117
|
+
},
|
|
118
|
+
testId: "".concat(testId, "--trigger")
|
|
119
|
+
}));
|
|
120
|
+
},
|
|
121
|
+
content: function content() {
|
|
122
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
123
|
+
xcss: styles.content
|
|
124
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
125
|
+
space: "space.200"
|
|
126
|
+
}, /*#__PURE__*/React.createElement(Stack, {
|
|
127
|
+
space: "space.050",
|
|
128
|
+
alignInline: "start"
|
|
129
|
+
}, /*#__PURE__*/React.createElement(Label, {
|
|
130
|
+
htmlFor: pageSizeSelectId
|
|
131
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, modalConfigPopupMessages.tablePagination)), /*#__PURE__*/React.createElement(Select, _extends({}, selectInAModalStyleFixProps, {
|
|
132
|
+
inputId: pageSizeSelectId,
|
|
133
|
+
options: pageSizeOptions,
|
|
134
|
+
value: selectedPageSizeOption,
|
|
135
|
+
onChange: handlePageSizeChange,
|
|
136
|
+
isSearchable: false,
|
|
137
|
+
menuPlacement: "bottom",
|
|
138
|
+
testId: "".concat(testId, "--page-size-select")
|
|
139
|
+
}))), /*#__PURE__*/React.createElement(Checkbox, {
|
|
140
|
+
isChecked: config.isNestedReferenceAttributeSelectionEnabled,
|
|
141
|
+
onChange: handleNestedReferenceAttributeSelectionChange,
|
|
142
|
+
label: formatMessage(modalConfigPopupMessages.nestedReferenceAttributeSelection),
|
|
143
|
+
testId: "".concat(testId, "--nested-reference-attribute-selection")
|
|
144
|
+
})));
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { defineMessages } from 'react-intl';
|
|
2
|
+
export var modalConfigPopupMessages = defineMessages({
|
|
3
|
+
configureTable: {
|
|
4
|
+
id: 'linkDataSource.assets.configModal.configPopup.configureTable',
|
|
5
|
+
description: 'Tooltip and accessibility label for the icon button that opens the Assets table configuration popup',
|
|
6
|
+
defaultMessage: 'Configure table'
|
|
7
|
+
},
|
|
8
|
+
nestedReferenceAttributeSelection: {
|
|
9
|
+
id: 'linkDataSource.assets.configModal.configPopup.nestedReferenceAttributeSelection',
|
|
10
|
+
description: 'Label for the checkbox that allows users to select attributes of referenced objects (nested attributes) as table columns',
|
|
11
|
+
defaultMessage: 'Enable nested reference attribute selection'
|
|
12
|
+
},
|
|
13
|
+
objectsPerPage: {
|
|
14
|
+
id: 'linkDataSource.assets.configModal.configPopup.objectsPerPage',
|
|
15
|
+
description: 'Option label in the pagination select showing how many Assets objects are displayed per table page. {count} is the number of objects.',
|
|
16
|
+
defaultMessage: '{count, plural, one {# object per page} other {# objects per page}}'
|
|
17
|
+
},
|
|
18
|
+
tablePagination: {
|
|
19
|
+
id: 'linkDataSource.assets.configModal.configPopup.tablePagination',
|
|
20
|
+
description: 'Label for the select input where users choose how many Assets objects are displayed per table page',
|
|
21
|
+
defaultMessage: 'Table pagination:'
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -6,18 +6,23 @@ import "./index.compiled.css";
|
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
import * as React from 'react';
|
|
8
8
|
import { ax, ix } from "@compiled/react/runtime";
|
|
9
|
+
import { FormattedMessage } from 'react-intl';
|
|
9
10
|
import Form from '@atlaskit/form/form';
|
|
11
|
+
import Heading from '@atlaskit/heading/heading';
|
|
10
12
|
import { CloseButton } from '@atlaskit/modal-dialog/close-button';
|
|
11
13
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
14
|
import { Flex } from '@atlaskit/primitives/compiled/flex';
|
|
15
|
+
import { Text } from '@atlaskit/primitives/compiled/text';
|
|
13
16
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
14
17
|
import { aqlKey } from '../../../types/assets/types';
|
|
18
|
+
import { AssetsModalConfigPopup } from '../modal-config-popup';
|
|
19
|
+
import { modalMessages } from '../modal/messages';
|
|
15
20
|
import { AqlSearchInput } from './aql-search-input';
|
|
16
21
|
import { AssetsObjectSchemaSelect } from './object-schema-select';
|
|
17
22
|
import { FormRowContainer } from './styled';
|
|
18
23
|
var styles = {
|
|
19
24
|
modalTitleContainer: "_zulppxbi _4cvr1h6o",
|
|
20
|
-
flexStyles: "
|
|
25
|
+
flexStyles: "_1bsb1osq"
|
|
21
26
|
};
|
|
22
27
|
var DEFAULT_AQL_QUERY = '';
|
|
23
28
|
var SEARCH_FORM_ID = 'linkDataSource.assets.configModal.searchContainer-form';
|
|
@@ -58,7 +63,7 @@ export var AssetsSearchContainer = function AssetsSearchContainer(props) {
|
|
|
58
63
|
return /*#__PURE__*/React.createElement(Form, {
|
|
59
64
|
onSubmit: onFormSubmit
|
|
60
65
|
}, function (_ref2) {
|
|
61
|
-
var _initialSearchData$ob, _initialSearchData$ob2, _initialSearchData$aq;
|
|
66
|
+
var _initialSearchData$ob, _initialSearchData$ob2, _initialSearchData$ob3, _initialSearchData$ob4, _initialSearchData$aq;
|
|
62
67
|
var formProps = _ref2.formProps,
|
|
63
68
|
setFieldValue = _ref2.setFieldValue;
|
|
64
69
|
var onSchemaChange = function onSchemaChange(schema) {
|
|
@@ -72,24 +77,48 @@ export var AssetsSearchContainer = function AssetsSearchContainer(props) {
|
|
|
72
77
|
id: SEARCH_FORM_ID
|
|
73
78
|
}), /*#__PURE__*/React.createElement(FormRowContainer, {
|
|
74
79
|
isNarrowGap: true
|
|
75
|
-
}, /*#__PURE__*/React.createElement(Flex, {
|
|
80
|
+
}, fg('astral_assets_macro_table_ui_uplift') ? /*#__PURE__*/React.createElement(Flex, {
|
|
76
81
|
gap: "space.200",
|
|
77
82
|
justifyContent: "space-between",
|
|
78
83
|
xcss: styles.flexStyles
|
|
79
84
|
}, /*#__PURE__*/React.createElement(Flex, {
|
|
85
|
+
justifyContent: "start",
|
|
86
|
+
xcss: styles.modalTitleContainer
|
|
87
|
+
}, modalTitle), /*#__PURE__*/React.createElement(Flex, {
|
|
80
88
|
justifyContent: "end"
|
|
81
|
-
}, /*#__PURE__*/React.createElement(
|
|
89
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
gap: "space.100"
|
|
92
|
+
}, /*#__PURE__*/React.createElement(Text, null, /*#__PURE__*/React.createElement(FormattedMessage, modalMessages.insertObjectsTitle), ":"), /*#__PURE__*/React.createElement(AssetsObjectSchemaSelect, {
|
|
93
|
+
value: (_initialSearchData$ob = initialSearchData.objectSchema) !== null && _initialSearchData$ob !== void 0 ? _initialSearchData$ob : undefined,
|
|
94
|
+
workspaceId: workspaceId,
|
|
95
|
+
initialObjectSchemas: (_initialSearchData$ob2 = initialSearchData.objectSchemas) !== null && _initialSearchData$ob2 !== void 0 ? _initialSearchData$ob2 : undefined,
|
|
96
|
+
classNamePrefix: "assets-datasource-modal--object-schema-select",
|
|
97
|
+
onSchemaChange: onSchemaChange
|
|
98
|
+
})), /*#__PURE__*/React.createElement(AssetsModalConfigPopup, {
|
|
99
|
+
onChange: function onChange() {}
|
|
100
|
+
}), /*#__PURE__*/React.createElement(CloseButton, {
|
|
82
101
|
onClick: onCancel
|
|
83
|
-
}))
|
|
102
|
+
}))) : /*#__PURE__*/React.createElement(Flex, {
|
|
103
|
+
gap: "space.200",
|
|
104
|
+
justifyContent: "space-between",
|
|
105
|
+
xcss: styles.flexStyles
|
|
106
|
+
}, /*#__PURE__*/React.createElement(Flex, {
|
|
84
107
|
justifyContent: "start",
|
|
85
108
|
xcss: styles.modalTitleContainer
|
|
86
109
|
}, modalTitle, /*#__PURE__*/React.createElement(AssetsObjectSchemaSelect, {
|
|
87
|
-
value: (_initialSearchData$
|
|
110
|
+
value: (_initialSearchData$ob3 = initialSearchData.objectSchema) !== null && _initialSearchData$ob3 !== void 0 ? _initialSearchData$ob3 : undefined,
|
|
88
111
|
workspaceId: workspaceId,
|
|
89
|
-
initialObjectSchemas: (_initialSearchData$
|
|
112
|
+
initialObjectSchemas: (_initialSearchData$ob4 = initialSearchData.objectSchemas) !== null && _initialSearchData$ob4 !== void 0 ? _initialSearchData$ob4 : undefined,
|
|
90
113
|
classNamePrefix: "assets-datasource-modal--object-schema-select",
|
|
91
114
|
onSchemaChange: onSchemaChange
|
|
92
|
-
}))
|
|
115
|
+
})), /*#__PURE__*/React.createElement(Flex, {
|
|
116
|
+
justifyContent: "end"
|
|
117
|
+
}, /*#__PURE__*/React.createElement(CloseButton, {
|
|
118
|
+
onClick: onCancel
|
|
119
|
+
})))), fg('astral_assets_macro_table_ui_uplift') ? /*#__PURE__*/React.createElement(Heading, {
|
|
120
|
+
size: "xsmall"
|
|
121
|
+
}, /*#__PURE__*/React.createElement(FormattedMessage, modalMessages.filterObjectsText)) : null, /*#__PURE__*/React.createElement(FormRowContainer, null, /*#__PURE__*/React.createElement(AqlSearchInput, {
|
|
93
122
|
value: (_initialSearchData$aq = initialSearchData.aql) !== null && _initialSearchData$aq !== void 0 ? _initialSearchData$aq : DEFAULT_AQL_QUERY,
|
|
94
123
|
workspaceId: workspaceId,
|
|
95
124
|
isSearching: isSearching
|