@atlaskit/link-datasource 0.31.3 → 0.32.0
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 +8 -0
- package/dist/cjs/analytics/generated/analytics.types.js +5 -0
- package/dist/cjs/analytics/generated/create-event-payload.js +46 -0
- package/dist/cjs/analytics/generated/use-analytics-events.js +32 -0
- package/dist/cjs/analytics/index.js +18 -0
- package/dist/cjs/ui/common/error-state/access-required.js +12 -3
- package/dist/cjs/ui/common/error-state/loading-error.js +20 -11
- package/dist/cjs/ui/common/error-state/modal-loading-error.js +21 -12
- package/dist/cjs/ui/common/error-state/no-results.js +48 -41
- package/dist/cjs/ui/jira-issues-modal/jira-search-container/index.js +8 -0
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +31 -6
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/constants.js +1 -0
- package/dist/es2019/analytics/generated/analytics.types.js +1 -0
- package/dist/es2019/analytics/generated/create-event-payload.js +28 -0
- package/dist/es2019/analytics/generated/use-analytics-events.js +24 -0
- package/dist/es2019/analytics/index.js +3 -0
- package/dist/es2019/ui/common/error-state/access-required.js +10 -0
- package/dist/es2019/ui/common/error-state/loading-error.js +10 -0
- package/dist/es2019/ui/common/error-state/modal-loading-error.js +10 -0
- package/dist/es2019/ui/common/error-state/no-results.js +8 -0
- package/dist/es2019/ui/jira-issues-modal/jira-search-container/index.js +9 -0
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +30 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/constants.js +1 -0
- package/dist/esm/analytics/generated/analytics.types.js +1 -0
- package/dist/esm/analytics/generated/create-event-payload.js +38 -0
- package/dist/esm/analytics/generated/use-analytics-events.js +23 -0
- package/dist/esm/analytics/index.js +5 -0
- package/dist/esm/ui/common/error-state/access-required.js +9 -0
- package/dist/esm/ui/common/error-state/loading-error.js +9 -0
- package/dist/esm/ui/common/error-state/modal-loading-error.js +9 -0
- package/dist/esm/ui/common/error-state/no-results.js +7 -0
- package/dist/esm/ui/jira-issues-modal/jira-search-container/index.js +8 -0
- package/dist/esm/ui/jira-issues-modal/modal/index.js +30 -4
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/constants.d.ts +1 -0
- package/dist/types/analytics/generated/analytics.types.d.ts +49 -0
- package/dist/types/analytics/generated/create-event-payload.d.ts +27 -0
- package/dist/types/analytics/generated/use-analytics-events.d.ts +3 -0
- package/dist/types/analytics/index.d.ts +4 -0
- package/dist/types/ui/common/error-state/access-required.d.ts +0 -1
- package/dist/types/ui/common/error-state/loading-error.d.ts +0 -1
- package/dist/types/ui/common/error-state/modal-loading-error.d.ts +0 -1
- package/dist/types/ui/common/error-state/no-results.d.ts +0 -1
- package/dist/types/ui/jira-issues-modal/modal/index.d.ts +3 -1
- package/dist/types-ts4.5/analytics/constants.d.ts +1 -0
- package/dist/types-ts4.5/analytics/generated/analytics.types.d.ts +49 -0
- package/dist/types-ts4.5/analytics/generated/create-event-payload.d.ts +31 -0
- package/dist/types-ts4.5/analytics/generated/use-analytics-events.d.ts +7 -0
- package/dist/types-ts4.5/analytics/index.d.ts +8 -0
- package/dist/types-ts4.5/ui/common/error-state/access-required.d.ts +0 -1
- package/dist/types-ts4.5/ui/common/error-state/loading-error.d.ts +0 -1
- package/dist/types-ts4.5/ui/common/error-state/modal-loading-error.d.ts +0 -1
- package/dist/types-ts4.5/ui/common/error-state/no-results.d.ts +0 -1
- package/dist/types-ts4.5/ui/jira-issues-modal/modal/index.d.ts +3 -1
- package/package.json +6 -1
|
@@ -5,19 +5,23 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.JiraIssuesConfigModal = void 0;
|
|
8
|
+
exports.PlainJiraIssuesConfigModal = exports.JiraIssuesConfigModal = void 0;
|
|
9
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
14
|
var _react = require("react");
|
|
14
15
|
var _react2 = require("@emotion/react");
|
|
15
16
|
var _reactIntlNext = require("react-intl-next");
|
|
17
|
+
var _analyticsNext = require("@atlaskit/analytics-next");
|
|
16
18
|
var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
|
|
17
19
|
var _modalDialog = _interopRequireWildcard(require("@atlaskit/modal-dialog"));
|
|
18
20
|
var _colors = require("@atlaskit/theme/colors");
|
|
21
|
+
var _analytics = require("../../../analytics");
|
|
19
22
|
var _useDatasourceTableState = require("../../../hooks/useDatasourceTableState");
|
|
20
23
|
var _getAvailableJiraSites = require("../../../services/getAvailableJiraSites");
|
|
24
|
+
var _version = require("../../../version.json");
|
|
21
25
|
var _accessRequired = require("../../common/error-state/access-required");
|
|
22
26
|
var _modalLoadingError = require("../../common/error-state/modal-loading-error");
|
|
23
27
|
var _noResults = require("../../common/error-state/no-results");
|
|
@@ -29,8 +33,8 @@ var _siteSelector = require("../site-selector");
|
|
|
29
33
|
var _messages = require("./messages");
|
|
30
34
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
31
35
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
37
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /** @jsx jsx */
|
|
34
38
|
var dropdownContainerStyles = (0, _react2.css)({
|
|
35
39
|
display: 'flex',
|
|
36
40
|
gap: "var(--ds-space-100, 0.5rem)"
|
|
@@ -56,7 +60,7 @@ var issueCountStyles = (0, _react2.css)({
|
|
|
56
60
|
var smartLinkContainerStyles = (0, _react2.css)({
|
|
57
61
|
paddingLeft: '1px'
|
|
58
62
|
});
|
|
59
|
-
var
|
|
63
|
+
var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
60
64
|
var datasourceId = props.datasourceId,
|
|
61
65
|
initialParameters = props.parameters,
|
|
62
66
|
initialVisibleColumnKeys = props.visibleColumnKeys,
|
|
@@ -105,6 +109,8 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
|
|
|
105
109
|
totalCount = _useDatasourceTableSt.totalCount;
|
|
106
110
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
107
111
|
formatMessage = _useIntl.formatMessage;
|
|
112
|
+
var _useDatasourceAnalyti = (0, _analytics.useDatasourceAnalyticsEvents)(),
|
|
113
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
108
114
|
var selectedJiraSite = (0, _react.useMemo)(function () {
|
|
109
115
|
return availableSites.find(function (jiraSite) {
|
|
110
116
|
return jiraSite.cloudId === cloudId;
|
|
@@ -114,6 +120,9 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
|
|
|
114
120
|
var jqlUrl = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(jql));
|
|
115
121
|
var isInsertDisabled = !isParametersSet || status === 'rejected' || status === 'unauthorized' || status === 'loading' || resolvedWithNoResults;
|
|
116
122
|
var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'issue';
|
|
123
|
+
(0, _react.useEffect)(function () {
|
|
124
|
+
fireEvent('screen.datasourceModalDialog.viewed', {});
|
|
125
|
+
}, [fireEvent]);
|
|
117
126
|
(0, _react.useEffect)(function () {
|
|
118
127
|
var newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
|
|
119
128
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
@@ -130,7 +139,10 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
|
|
|
130
139
|
case 2:
|
|
131
140
|
jiraSites = _context.sent;
|
|
132
141
|
setAvailableSites(jiraSites);
|
|
133
|
-
|
|
142
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
143
|
+
instancesCount: jiraSites.length
|
|
144
|
+
});
|
|
145
|
+
case 5:
|
|
134
146
|
case "end":
|
|
135
147
|
return _context.stop();
|
|
136
148
|
}
|
|
@@ -141,7 +153,7 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
|
|
|
141
153
|
};
|
|
142
154
|
}();
|
|
143
155
|
void fetchSiteDisplayNames();
|
|
144
|
-
}, []);
|
|
156
|
+
}, [fireEvent]);
|
|
145
157
|
(0, _react.useEffect)(function () {
|
|
146
158
|
if (!cloudId && selectedJiraSite) {
|
|
147
159
|
setCloudId(selectedJiraSite.cloudId);
|
|
@@ -327,4 +339,17 @@ var JiraIssuesConfigModal = function JiraIssuesConfigModal(props) {
|
|
|
327
339
|
testId: 'jira-jql-datasource-modal--insert-button'
|
|
328
340
|
}, (0, _react2.jsx)(_reactIntlNext.FormattedMessage, _messages.modalMessages.insertIssuesButtonText)))));
|
|
329
341
|
};
|
|
342
|
+
exports.PlainJiraIssuesConfigModal = PlainJiraIssuesConfigModal;
|
|
343
|
+
var analyticsContextAttributes = {
|
|
344
|
+
dataProvider: 'jira-issues'
|
|
345
|
+
};
|
|
346
|
+
var analyticsContextData = {
|
|
347
|
+
packageName: _version.name,
|
|
348
|
+
packageVersion: _version.version,
|
|
349
|
+
source: 'datasourceConfigModal'
|
|
350
|
+
};
|
|
351
|
+
var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
|
|
352
|
+
attributes: _objectSpread({}, analyticsContextAttributes)
|
|
353
|
+
});
|
|
354
|
+
var JiraIssuesConfigModal = (0, _analyticsNext.withAnalyticsContext)(contextData)(PlainJiraIssuesConfigModal);
|
|
330
355
|
exports.JiraIssuesConfigModal = JiraIssuesConfigModal;
|
package/dist/cjs/version.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const EVENT_CHANNEL = 'media';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
+
*
|
|
4
|
+
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
|
+
*
|
|
6
|
+
* @codegen <<SignedSource::819168596ba17484cadda969f8ecf82d>>
|
|
7
|
+
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const createEventPayload = (eventKey, ...[attributes]) => {
|
|
11
|
+
const [eventType, actionSubject, action, actionSubjectId] = eventKey.split('.');
|
|
12
|
+
if (eventType === 'screen') {
|
|
13
|
+
return {
|
|
14
|
+
eventType,
|
|
15
|
+
name: actionSubject,
|
|
16
|
+
action: 'viewed',
|
|
17
|
+
attributes: attributes
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
eventType,
|
|
22
|
+
actionSubject,
|
|
23
|
+
action,
|
|
24
|
+
actionSubjectId,
|
|
25
|
+
attributes: attributes
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export default createEventPayload;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
+
*
|
|
4
|
+
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
|
+
*
|
|
6
|
+
* @codegen <<SignedSource::415836762b378b7d79f3aff4ba051c14>>
|
|
7
|
+
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
8
|
+
*/
|
|
9
|
+
import { useCallback } from 'react';
|
|
10
|
+
import { useAnalyticsEvents as useAnalyticsNextEvents } from '@atlaskit/analytics-next';
|
|
11
|
+
import { EVENT_CHANNEL } from '../constants';
|
|
12
|
+
import createEventPayload from './create-event-payload';
|
|
13
|
+
export const useAnalyticsEvents = () => {
|
|
14
|
+
const {
|
|
15
|
+
createAnalyticsEvent
|
|
16
|
+
} = useAnalyticsNextEvents();
|
|
17
|
+
const fireEvent = useCallback((...params) => {
|
|
18
|
+
const event = createAnalyticsEvent(createEventPayload(...params));
|
|
19
|
+
event.fire(EVENT_CHANNEL);
|
|
20
|
+
}, [createAnalyticsEvent]);
|
|
21
|
+
return {
|
|
22
|
+
fireEvent
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { useIntl } from 'react-intl-next';
|
|
4
5
|
import EmptyState from '@atlaskit/empty-state';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
7
|
import { AccessRequiredSVG } from './access-required-svg';
|
|
6
8
|
import { loadingErrorMessages } from './messages';
|
|
7
9
|
export const AccessRequired = ({
|
|
@@ -10,6 +12,14 @@ export const AccessRequired = ({
|
|
|
10
12
|
const {
|
|
11
13
|
formatMessage
|
|
12
14
|
} = useIntl();
|
|
15
|
+
const {
|
|
16
|
+
fireEvent
|
|
17
|
+
} = useDatasourceAnalyticsEvents();
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
fireEvent('ui.error.shown', {
|
|
20
|
+
reason: 'access'
|
|
21
|
+
});
|
|
22
|
+
}, [fireEvent]);
|
|
13
23
|
return jsx(EmptyState, {
|
|
14
24
|
header: siteName ? formatMessage(loadingErrorMessages.accessRequiredWithSite, {
|
|
15
25
|
siteName
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
5
|
import Button from '@atlaskit/button/standard-button';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
7
|
import { LoadingErrorSVG } from './loading-error-svg';
|
|
6
8
|
import { loadingErrorMessages } from './messages';
|
|
7
9
|
const errorContainerStyles = css({
|
|
@@ -25,6 +27,14 @@ const errorDescriptionStyles = css({
|
|
|
25
27
|
export const LoadingError = ({
|
|
26
28
|
onRefresh
|
|
27
29
|
}) => {
|
|
30
|
+
const {
|
|
31
|
+
fireEvent
|
|
32
|
+
} = useDatasourceAnalyticsEvents();
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
fireEvent('ui.error.shown', {
|
|
35
|
+
reason: 'network'
|
|
36
|
+
});
|
|
37
|
+
}, [fireEvent]);
|
|
28
38
|
return jsx("div", {
|
|
29
39
|
css: errorContainerStyles,
|
|
30
40
|
"data-testid": "jira-jql-datasource--loading-error"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { css, jsx } from '@emotion/react';
|
|
4
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
7
|
import { LoadingErrorSVG } from './loading-error-svg';
|
|
6
8
|
import { loadingErrorMessages } from './messages';
|
|
7
9
|
const errorContainerStyles = css({
|
|
@@ -25,6 +27,14 @@ const errorDescriptionStyles = css({
|
|
|
25
27
|
export const ModalLoadingError = ({
|
|
26
28
|
url
|
|
27
29
|
}) => {
|
|
30
|
+
const {
|
|
31
|
+
fireEvent
|
|
32
|
+
} = useDatasourceAnalyticsEvents();
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
fireEvent('ui.error.shown', {
|
|
35
|
+
reason: 'network'
|
|
36
|
+
});
|
|
37
|
+
}, [fireEvent]);
|
|
28
38
|
return jsx("div", {
|
|
29
39
|
css: errorContainerStyles,
|
|
30
40
|
"data-testid": "jira-jql-datasource-modal--loading-error"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
5
|
import Button from '@atlaskit/button/standard-button';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
7
|
import { loadingErrorMessages } from './messages';
|
|
6
8
|
const noResultsContainerStyles = css({
|
|
7
9
|
display: 'grid',
|
|
@@ -21,6 +23,12 @@ const noResultsMessageStyles = css({
|
|
|
21
23
|
export const NoResults = ({
|
|
22
24
|
onRefresh
|
|
23
25
|
}) => {
|
|
26
|
+
const {
|
|
27
|
+
fireEvent
|
|
28
|
+
} = useDatasourceAnalyticsEvents();
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
fireEvent('ui.emptyResult.shown.datasource', {});
|
|
31
|
+
}, [fireEvent]);
|
|
24
32
|
return jsx("div", {
|
|
25
33
|
css: noResultsContainerStyles,
|
|
26
34
|
"data-testid": "jira-jql-datasource-modal--no-results"
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { css, jsx } from '@emotion/react';
|
|
4
4
|
import { useIntl } from 'react-intl-next';
|
|
5
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
6
|
import { BasicSearchInput } from '../basic-search-input';
|
|
6
7
|
import { JiraJQLEditor } from '../jql-editor';
|
|
7
8
|
import { ModeSwitcher } from '../mode-switcher';
|
|
@@ -34,6 +35,9 @@ export const JiraSearchContainer = props => {
|
|
|
34
35
|
const [jql, setJql] = useState(initialJql || DEFAULT_JQL_QUERY);
|
|
35
36
|
const [orderKey, setOrderKey] = useState();
|
|
36
37
|
const [orderDirection, setOrderDirection] = useState();
|
|
38
|
+
const {
|
|
39
|
+
fireEvent
|
|
40
|
+
} = useDatasourceAnalyticsEvents();
|
|
37
41
|
const onSearchModeChange = searchMode => {
|
|
38
42
|
setCurrentSearchMode(searchMode);
|
|
39
43
|
};
|
|
@@ -65,6 +69,11 @@ export const JiraSearchContainer = props => {
|
|
|
65
69
|
onSearch({
|
|
66
70
|
jql
|
|
67
71
|
});
|
|
72
|
+
if (currentSearchMode === basicModeValue) {
|
|
73
|
+
fireEvent('ui.form.submitted.basicSearch', {});
|
|
74
|
+
} else if (currentSearchMode === jqlModeValue) {
|
|
75
|
+
fireEvent('ui.jqlEditor.searched', {});
|
|
76
|
+
}
|
|
68
77
|
};
|
|
69
78
|
return jsx("div", {
|
|
70
79
|
css: inputContainerStyles
|
|
@@ -3,11 +3,14 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
3
3
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { FormattedMessage, FormattedNumber, useIntl } from 'react-intl-next';
|
|
6
|
+
import { withAnalyticsContext } from '@atlaskit/analytics-next';
|
|
6
7
|
import Button from '@atlaskit/button/standard-button';
|
|
7
8
|
import Modal, { ModalBody, ModalFooter, ModalHeader, ModalTitle, ModalTransition } from '@atlaskit/modal-dialog';
|
|
8
9
|
import { B400, N0, N40, N800 } from '@atlaskit/theme/colors';
|
|
10
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
9
11
|
import { useDatasourceTableState } from '../../../hooks/useDatasourceTableState';
|
|
10
12
|
import { getAvailableJiraSites } from '../../../services/getAvailableJiraSites';
|
|
13
|
+
import { name as packageName, version as packageVersion } from '../../../version.json';
|
|
11
14
|
import { AccessRequired } from '../../common/error-state/access-required';
|
|
12
15
|
import { ModalLoadingError } from '../../common/error-state/modal-loading-error';
|
|
13
16
|
import { NoResults } from '../../common/error-state/no-results';
|
|
@@ -42,7 +45,7 @@ const issueCountStyles = css({
|
|
|
42
45
|
const smartLinkContainerStyles = css({
|
|
43
46
|
paddingLeft: '1px'
|
|
44
47
|
});
|
|
45
|
-
export const
|
|
48
|
+
export const PlainJiraIssuesConfigModal = props => {
|
|
46
49
|
const {
|
|
47
50
|
datasourceId,
|
|
48
51
|
parameters: initialParameters,
|
|
@@ -78,11 +81,17 @@ export const JiraIssuesConfigModal = props => {
|
|
|
78
81
|
const {
|
|
79
82
|
formatMessage
|
|
80
83
|
} = useIntl();
|
|
84
|
+
const {
|
|
85
|
+
fireEvent
|
|
86
|
+
} = useDatasourceAnalyticsEvents();
|
|
81
87
|
const selectedJiraSite = useMemo(() => availableSites.find(jiraSite => jiraSite.cloudId === cloudId) || availableSites[0], [availableSites, cloudId]);
|
|
82
88
|
const resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
83
89
|
const jqlUrl = selectedJiraSite && jql && `${selectedJiraSite.url}/issues/?jql=${encodeURI(jql)}`;
|
|
84
90
|
const isInsertDisabled = !isParametersSet || status === 'rejected' || status === 'unauthorized' || status === 'loading' || resolvedWithNoResults;
|
|
85
91
|
const shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'issue';
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
fireEvent('screen.datasourceModalDialog.viewed', {});
|
|
94
|
+
}, [fireEvent]);
|
|
86
95
|
useEffect(() => {
|
|
87
96
|
const newVisibleColumnKeys = !initialVisibleColumnKeys || (initialVisibleColumnKeys || []).length === 0 ? defaultVisibleColumnKeys : initialVisibleColumnKeys;
|
|
88
97
|
setVisibleColumnKeys(newVisibleColumnKeys);
|
|
@@ -91,9 +100,12 @@ export const JiraIssuesConfigModal = props => {
|
|
|
91
100
|
const fetchSiteDisplayNames = async () => {
|
|
92
101
|
const jiraSites = await getAvailableJiraSites();
|
|
93
102
|
setAvailableSites(jiraSites);
|
|
103
|
+
fireEvent('ui.modal.ready.datasource', {
|
|
104
|
+
instancesCount: jiraSites.length
|
|
105
|
+
});
|
|
94
106
|
};
|
|
95
107
|
void fetchSiteDisplayNames();
|
|
96
|
-
}, []);
|
|
108
|
+
}, [fireEvent]);
|
|
97
109
|
useEffect(() => {
|
|
98
110
|
if (!cloudId && selectedJiraSite) {
|
|
99
111
|
setCloudId(selectedJiraSite.cloudId);
|
|
@@ -273,4 +285,19 @@ export const JiraIssuesConfigModal = props => {
|
|
|
273
285
|
isDisabled: isInsertDisabled,
|
|
274
286
|
testId: 'jira-jql-datasource-modal--insert-button'
|
|
275
287
|
}, jsx(FormattedMessage, modalMessages.insertIssuesButtonText)))));
|
|
276
|
-
};
|
|
288
|
+
};
|
|
289
|
+
const analyticsContextAttributes = {
|
|
290
|
+
dataProvider: 'jira-issues'
|
|
291
|
+
};
|
|
292
|
+
const analyticsContextData = {
|
|
293
|
+
packageName,
|
|
294
|
+
packageVersion,
|
|
295
|
+
source: 'datasourceConfigModal'
|
|
296
|
+
};
|
|
297
|
+
const contextData = {
|
|
298
|
+
...analyticsContextData,
|
|
299
|
+
attributes: {
|
|
300
|
+
...analyticsContextAttributes
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
export const JiraIssuesConfigModal = withAnalyticsContext(contextData)(PlainJiraIssuesConfigModal);
|
package/dist/es2019/version.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export var EVENT_CHANNEL = 'media';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
/**
|
|
3
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
4
|
+
*
|
|
5
|
+
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
6
|
+
*
|
|
7
|
+
* @codegen <<SignedSource::819168596ba17484cadda969f8ecf82d>>
|
|
8
|
+
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var createEventPayload = function createEventPayload(eventKey) {
|
|
12
|
+
for (var _len = arguments.length, _ref = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
13
|
+
_ref[_key - 1] = arguments[_key];
|
|
14
|
+
}
|
|
15
|
+
var attributes = _ref[0];
|
|
16
|
+
var _eventKey$split = eventKey.split('.'),
|
|
17
|
+
_eventKey$split2 = _slicedToArray(_eventKey$split, 4),
|
|
18
|
+
eventType = _eventKey$split2[0],
|
|
19
|
+
actionSubject = _eventKey$split2[1],
|
|
20
|
+
action = _eventKey$split2[2],
|
|
21
|
+
actionSubjectId = _eventKey$split2[3];
|
|
22
|
+
if (eventType === 'screen') {
|
|
23
|
+
return {
|
|
24
|
+
eventType: eventType,
|
|
25
|
+
name: actionSubject,
|
|
26
|
+
action: 'viewed',
|
|
27
|
+
attributes: attributes
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
eventType: eventType,
|
|
32
|
+
actionSubject: actionSubject,
|
|
33
|
+
action: action,
|
|
34
|
+
actionSubjectId: actionSubjectId,
|
|
35
|
+
attributes: attributes
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export default createEventPayload;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THIS FILE WAS CREATED VIA CODEGEN DO NOT MODIFY {@see http://go/af-codegen}
|
|
3
|
+
*
|
|
4
|
+
* Generates Typescript types for analytics events from analytics.spec.yaml
|
|
5
|
+
*
|
|
6
|
+
* @codegen <<SignedSource::415836762b378b7d79f3aff4ba051c14>>
|
|
7
|
+
* @codegenCommand yarn workspace @atlassian/analytics-tooling run analytics:codegen link-datasource
|
|
8
|
+
*/
|
|
9
|
+
import { useCallback } from 'react';
|
|
10
|
+
import { useAnalyticsEvents as useAnalyticsNextEvents } from '@atlaskit/analytics-next';
|
|
11
|
+
import { EVENT_CHANNEL } from '../constants';
|
|
12
|
+
import createEventPayload from './create-event-payload';
|
|
13
|
+
export var useAnalyticsEvents = function useAnalyticsEvents() {
|
|
14
|
+
var _useAnalyticsNextEven = useAnalyticsNextEvents(),
|
|
15
|
+
createAnalyticsEvent = _useAnalyticsNextEven.createAnalyticsEvent;
|
|
16
|
+
var fireEvent = useCallback(function () {
|
|
17
|
+
var event = createAnalyticsEvent(createEventPayload.apply(void 0, arguments));
|
|
18
|
+
event.fire(EVENT_CHANNEL);
|
|
19
|
+
}, [createAnalyticsEvent]);
|
|
20
|
+
return {
|
|
21
|
+
fireEvent: fireEvent
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { jsx } from '@emotion/react';
|
|
3
4
|
import { useIntl } from 'react-intl-next';
|
|
4
5
|
import EmptyState from '@atlaskit/empty-state';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
7
|
import { AccessRequiredSVG } from './access-required-svg';
|
|
6
8
|
import { loadingErrorMessages } from './messages';
|
|
7
9
|
export var AccessRequired = function AccessRequired(_ref) {
|
|
8
10
|
var siteName = _ref.siteName;
|
|
9
11
|
var _useIntl = useIntl(),
|
|
10
12
|
formatMessage = _useIntl.formatMessage;
|
|
13
|
+
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
14
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
15
|
+
useEffect(function () {
|
|
16
|
+
fireEvent('ui.error.shown', {
|
|
17
|
+
reason: 'access'
|
|
18
|
+
});
|
|
19
|
+
}, [fireEvent]);
|
|
11
20
|
return jsx(EmptyState, {
|
|
12
21
|
header: siteName ? formatMessage(loadingErrorMessages.accessRequiredWithSite, {
|
|
13
22
|
siteName: siteName
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
5
|
import Button from '@atlaskit/button/standard-button';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
7
|
import { LoadingErrorSVG } from './loading-error-svg';
|
|
6
8
|
import { loadingErrorMessages } from './messages';
|
|
7
9
|
var errorContainerStyles = css({
|
|
@@ -24,6 +26,13 @@ var errorDescriptionStyles = css({
|
|
|
24
26
|
});
|
|
25
27
|
export var LoadingError = function LoadingError(_ref) {
|
|
26
28
|
var onRefresh = _ref.onRefresh;
|
|
29
|
+
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
30
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
fireEvent('ui.error.shown', {
|
|
33
|
+
reason: 'network'
|
|
34
|
+
});
|
|
35
|
+
}, [fireEvent]);
|
|
27
36
|
return jsx("div", {
|
|
28
37
|
css: errorContainerStyles,
|
|
29
38
|
"data-testid": "jira-jql-datasource--loading-error"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
+
import { useEffect } from 'react';
|
|
3
4
|
import { css, jsx } from '@emotion/react';
|
|
4
5
|
import { FormattedMessage } from 'react-intl-next';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
7
|
import { LoadingErrorSVG } from './loading-error-svg';
|
|
6
8
|
import { loadingErrorMessages } from './messages';
|
|
7
9
|
var errorContainerStyles = css({
|
|
@@ -24,6 +26,13 @@ var errorDescriptionStyles = css({
|
|
|
24
26
|
});
|
|
25
27
|
export var ModalLoadingError = function ModalLoadingError(_ref) {
|
|
26
28
|
var url = _ref.url;
|
|
29
|
+
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
30
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
31
|
+
useEffect(function () {
|
|
32
|
+
fireEvent('ui.error.shown', {
|
|
33
|
+
reason: 'network'
|
|
34
|
+
});
|
|
35
|
+
}, [fireEvent]);
|
|
27
36
|
return jsx("div", {
|
|
28
37
|
css: errorContainerStyles,
|
|
29
38
|
"data-testid": "jira-jql-datasource-modal--loading-error"
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/** @jsx jsx */
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { css, jsx } from '@emotion/react';
|
|
3
4
|
import { FormattedMessage } from 'react-intl-next';
|
|
4
5
|
import Button from '@atlaskit/button/standard-button';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
5
7
|
import { loadingErrorMessages } from './messages';
|
|
6
8
|
var noResultsContainerStyles = css({
|
|
7
9
|
display: 'grid',
|
|
@@ -20,6 +22,11 @@ var noResultsMessageStyles = css({
|
|
|
20
22
|
});
|
|
21
23
|
export var NoResults = function NoResults(_ref) {
|
|
22
24
|
var onRefresh = _ref.onRefresh;
|
|
25
|
+
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
26
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
fireEvent('ui.emptyResult.shown.datasource', {});
|
|
29
|
+
}, [fireEvent]);
|
|
23
30
|
return jsx("div", {
|
|
24
31
|
css: noResultsContainerStyles,
|
|
25
32
|
"data-testid": "jira-jql-datasource-modal--no-results"
|
|
@@ -3,6 +3,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
3
3
|
import React, { useState } from 'react';
|
|
4
4
|
import { css, jsx } from '@emotion/react';
|
|
5
5
|
import { useIntl } from 'react-intl-next';
|
|
6
|
+
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
6
7
|
import { BasicSearchInput } from '../basic-search-input';
|
|
7
8
|
import { JiraJQLEditor } from '../jql-editor';
|
|
8
9
|
import { ModeSwitcher } from '../mode-switcher';
|
|
@@ -46,6 +47,8 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
46
47
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
47
48
|
orderDirection = _useState10[0],
|
|
48
49
|
setOrderDirection = _useState10[1];
|
|
50
|
+
var _useDatasourceAnalyti = useDatasourceAnalyticsEvents(),
|
|
51
|
+
fireEvent = _useDatasourceAnalyti.fireEvent;
|
|
49
52
|
var onSearchModeChange = function onSearchModeChange(searchMode) {
|
|
50
53
|
setCurrentSearchMode(searchMode);
|
|
51
54
|
};
|
|
@@ -79,6 +82,11 @@ export var JiraSearchContainer = function JiraSearchContainer(props) {
|
|
|
79
82
|
onSearch({
|
|
80
83
|
jql: jql
|
|
81
84
|
});
|
|
85
|
+
if (currentSearchMode === basicModeValue) {
|
|
86
|
+
fireEvent('ui.form.submitted.basicSearch', {});
|
|
87
|
+
} else if (currentSearchMode === jqlModeValue) {
|
|
88
|
+
fireEvent('ui.jqlEditor.searched', {});
|
|
89
|
+
}
|
|
82
90
|
};
|
|
83
91
|
return jsx("div", {
|
|
84
92
|
css: inputContainerStyles
|