@atlaskit/link-datasource 1.2.2 → 1.2.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @atlaskit/link-datasource
2
2
 
3
+ ## 1.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [`de4dddb97d4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/de4dddb97d4) - Added 'ui.datasource.renderSuccess' event with display = 'table'
8
+
3
9
  ## 1.2.2
4
10
 
5
11
  ### Patch Changes
@@ -8,6 +8,6 @@ var EVENT_CHANNEL = 'media';
8
8
  exports.EVENT_CHANNEL = EVENT_CHANNEL;
9
9
  var packageMetaData = {
10
10
  packageName: "@atlaskit/link-datasource",
11
- packageVersion: "1.2.2"
11
+ packageVersion: "1.2.3"
12
12
  };
13
13
  exports.packageMetaData = packageMetaData;
@@ -231,7 +231,7 @@ var analyticsContextAttributes = {
231
231
  };
232
232
  var analyticsContextData = {
233
233
  packageName: "@atlaskit/link-datasource",
234
- packageVersion: "1.2.2",
234
+ packageVersion: "1.2.3",
235
235
  source: 'datasourceConfigModal'
236
236
  };
237
237
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
@@ -48,12 +48,15 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
48
48
  fireEvent = _useDatasourceAnalyti.fireEvent;
49
49
  var _useRef = (0, _react.useRef)((0, _uuid.v4)()),
50
50
  tableRenderInstanceId = _useRef.current;
51
+ var visibleColumnCount = (0, _react.useRef)((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
51
52
 
52
53
  /* Need this to make sure that the datasource in the editor gets updated new info if any edits are made in the modal
53
54
  But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
54
55
  mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
55
56
  */
56
57
  var isInitialRender = (0, _react.useRef)(true);
58
+ var isDataReady = columns.length > 0 && responseItems.length > 0 && totalCount && totalCount > 0;
59
+ visibleColumnCount.current = (visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0;
57
60
  (0, _react.useEffect)(function () {
58
61
  if (!isInitialRender.current) {
59
62
  reset();
@@ -65,6 +68,18 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
65
68
  onVisibleColumnKeysChange(defaultVisibleColumnKeys);
66
69
  }
67
70
  }, [visibleColumnKeys, defaultVisibleColumnKeys, onVisibleColumnKeysChange]);
71
+ (0, _react.useEffect)(function () {
72
+ var isTableViewRenderedWithData = status === 'resolved' && isDataReady;
73
+ if (isTableViewRenderedWithData) {
74
+ fireEvent('ui.datasource.renderSuccess', {
75
+ extensionKey: extensionKey,
76
+ destinationObjectTypes: destinationObjectTypes,
77
+ totalItemCount: totalCount,
78
+ displayedColumnCount: visibleColumnCount.current,
79
+ display: 'table'
80
+ });
81
+ }
82
+ }, [totalCount, fireEvent, status, extensionKey, destinationObjectTypes, isDataReady]);
68
83
  (0, _react.useEffect)(function () {
69
84
  var shouldStartUfoExperience = datasourceId && parameters && visibleColumnKeys && status === 'loading';
70
85
  if (shouldStartUfoExperience) {
@@ -101,7 +116,6 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
101
116
  onRefresh: reset
102
117
  });
103
118
  }
104
- var isDataReady = columns.length > 0;
105
119
  return (
106
120
  // datasource-table classname is to exclude all children from being commentable - exclude list is in CFE
107
121
  (0, _react2.jsx)("div", {
@@ -1,5 +1,5 @@
1
1
  export const EVENT_CHANNEL = 'media';
2
2
  export const packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.2.2"
4
+ packageVersion: "1.2.3"
5
5
  };
@@ -205,7 +205,7 @@ const analyticsContextAttributes = {
205
205
  };
206
206
  const analyticsContextData = {
207
207
  packageName: "@atlaskit/link-datasource",
208
- packageVersion: "1.2.2",
208
+ packageVersion: "1.2.3",
209
209
  source: 'datasourceConfigModal'
210
210
  };
211
211
  const contextData = {
@@ -43,12 +43,15 @@ const DatasourceTableViewWithoutAnalytics = ({
43
43
  const {
44
44
  current: tableRenderInstanceId
45
45
  } = useRef(uuidv4());
46
+ const visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
46
47
 
47
48
  /* Need this to make sure that the datasource in the editor gets updated new info if any edits are made in the modal
48
49
  But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
49
50
  mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
50
51
  */
51
52
  const isInitialRender = useRef(true);
53
+ const isDataReady = columns.length > 0 && responseItems.length > 0 && totalCount && totalCount > 0;
54
+ visibleColumnCount.current = (visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0;
52
55
  useEffect(() => {
53
56
  if (!isInitialRender.current) {
54
57
  reset();
@@ -60,6 +63,18 @@ const DatasourceTableViewWithoutAnalytics = ({
60
63
  onVisibleColumnKeysChange(defaultVisibleColumnKeys);
61
64
  }
62
65
  }, [visibleColumnKeys, defaultVisibleColumnKeys, onVisibleColumnKeysChange]);
66
+ useEffect(() => {
67
+ const isTableViewRenderedWithData = status === 'resolved' && isDataReady;
68
+ if (isTableViewRenderedWithData) {
69
+ fireEvent('ui.datasource.renderSuccess', {
70
+ extensionKey,
71
+ destinationObjectTypes,
72
+ totalItemCount: totalCount,
73
+ displayedColumnCount: visibleColumnCount.current,
74
+ display: 'table'
75
+ });
76
+ }
77
+ }, [totalCount, fireEvent, status, extensionKey, destinationObjectTypes, isDataReady]);
63
78
  useEffect(() => {
64
79
  const shouldStartUfoExperience = datasourceId && parameters && visibleColumnKeys && status === 'loading';
65
80
  if (shouldStartUfoExperience) {
@@ -96,7 +111,6 @@ const DatasourceTableViewWithoutAnalytics = ({
96
111
  onRefresh: reset
97
112
  });
98
113
  }
99
- const isDataReady = columns.length > 0;
100
114
  return (
101
115
  // datasource-table classname is to exclude all children from being commentable - exclude list is in CFE
102
116
  jsx("div", {
@@ -1,5 +1,5 @@
1
1
  export var EVENT_CHANNEL = 'media';
2
2
  export var packageMetaData = {
3
3
  packageName: "@atlaskit/link-datasource",
4
- packageVersion: "1.2.2"
4
+ packageVersion: "1.2.3"
5
5
  };
@@ -222,7 +222,7 @@ var analyticsContextAttributes = {
222
222
  };
223
223
  var analyticsContextData = {
224
224
  packageName: "@atlaskit/link-datasource",
225
- packageVersion: "1.2.2",
225
+ packageVersion: "1.2.3",
226
226
  source: 'datasourceConfigModal'
227
227
  };
228
228
  var contextData = _objectSpread(_objectSpread({}, analyticsContextData), {}, {
@@ -40,12 +40,15 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
40
40
  fireEvent = _useDatasourceAnalyti.fireEvent;
41
41
  var _useRef = useRef(uuidv4()),
42
42
  tableRenderInstanceId = _useRef.current;
43
+ var visibleColumnCount = useRef((visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0);
43
44
 
44
45
  /* Need this to make sure that the datasource in the editor gets updated new info if any edits are made in the modal
45
46
  But we don't want to call it on initial load. This screws up useDatasourceTableState's internal
46
47
  mechanism of initial loading. Use of ref here makes it basically work as a `componentDidUpdate` but not `componentDidMount`
47
48
  */
48
49
  var isInitialRender = useRef(true);
50
+ var isDataReady = columns.length > 0 && responseItems.length > 0 && totalCount && totalCount > 0;
51
+ visibleColumnCount.current = (visibleColumnKeys === null || visibleColumnKeys === void 0 ? void 0 : visibleColumnKeys.length) || 0;
49
52
  useEffect(function () {
50
53
  if (!isInitialRender.current) {
51
54
  reset();
@@ -57,6 +60,18 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
57
60
  onVisibleColumnKeysChange(defaultVisibleColumnKeys);
58
61
  }
59
62
  }, [visibleColumnKeys, defaultVisibleColumnKeys, onVisibleColumnKeysChange]);
63
+ useEffect(function () {
64
+ var isTableViewRenderedWithData = status === 'resolved' && isDataReady;
65
+ if (isTableViewRenderedWithData) {
66
+ fireEvent('ui.datasource.renderSuccess', {
67
+ extensionKey: extensionKey,
68
+ destinationObjectTypes: destinationObjectTypes,
69
+ totalItemCount: totalCount,
70
+ displayedColumnCount: visibleColumnCount.current,
71
+ display: 'table'
72
+ });
73
+ }
74
+ }, [totalCount, fireEvent, status, extensionKey, destinationObjectTypes, isDataReady]);
60
75
  useEffect(function () {
61
76
  var shouldStartUfoExperience = datasourceId && parameters && visibleColumnKeys && status === 'loading';
62
77
  if (shouldStartUfoExperience) {
@@ -93,7 +108,6 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
93
108
  onRefresh: reset
94
109
  });
95
110
  }
96
- var isDataReady = columns.length > 0;
97
111
  return (
98
112
  // datasource-table classname is to exclude all children from being commentable - exclude list is in CFE
99
113
  jsx("div", {
@@ -50,13 +50,12 @@ export type LinkClickedSingleItemAttributesType = {
50
50
  extensionKey: string | null;
51
51
  destinationObjectTypes: unknown[];
52
52
  };
53
- export type DatasourceRenderedAttributesType = {
53
+ export type DatasourceRenderSuccessAttributesType = {
54
54
  totalItemCount: number;
55
55
  destinationObjectTypes: unknown[];
56
56
  displayedColumnCount: number | null;
57
57
  extensionKey: string | null;
58
- display: 'datasource_inline' | 'datasource_table' | 'inline';
59
- status: 'resolved' | 'unauthorized' | 'forbidden' | 'not_found' | 'errored';
58
+ display: 'table';
60
59
  };
61
60
  export type NextItemLoadedAttributesType = {
62
61
  destinationObjectTypes: unknown[];
@@ -114,7 +113,7 @@ export type AnalyticsEventAttributes = {
114
113
  'ui.link.clicked.singleItem': LinkClickedSingleItemAttributesType;
115
114
  /**
116
115
  * Fired when an inserted datasource resolves / renders. */
117
- 'ui.datasource.rendered': DatasourceRenderedAttributesType;
116
+ 'ui.datasource.renderSuccess': DatasourceRenderSuccessAttributesType;
118
117
  /**
119
118
  * Fired when user scrolls to the next page/list of the objects */
120
119
  'track.nextItem.loaded': NextItemLoadedAttributesType;
@@ -50,13 +50,12 @@ export type LinkClickedSingleItemAttributesType = {
50
50
  extensionKey: string | null;
51
51
  destinationObjectTypes: unknown[];
52
52
  };
53
- export type DatasourceRenderedAttributesType = {
53
+ export type DatasourceRenderSuccessAttributesType = {
54
54
  totalItemCount: number;
55
55
  destinationObjectTypes: unknown[];
56
56
  displayedColumnCount: number | null;
57
57
  extensionKey: string | null;
58
- display: 'datasource_inline' | 'datasource_table' | 'inline';
59
- status: 'resolved' | 'unauthorized' | 'forbidden' | 'not_found' | 'errored';
58
+ display: 'table';
60
59
  };
61
60
  export type NextItemLoadedAttributesType = {
62
61
  destinationObjectTypes: unknown[];
@@ -114,7 +113,7 @@ export type AnalyticsEventAttributes = {
114
113
  'ui.link.clicked.singleItem': LinkClickedSingleItemAttributesType;
115
114
  /**
116
115
  * Fired when an inserted datasource resolves / renders. */
117
- 'ui.datasource.rendered': DatasourceRenderedAttributesType;
116
+ 'ui.datasource.renderSuccess': DatasourceRenderSuccessAttributesType;
118
117
  /**
119
118
  * Fired when user scrolls to the next page/list of the objects */
120
119
  'track.nextItem.loaded': NextItemLoadedAttributesType;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/link-datasource",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "UI Components to support linking platform dataset feature",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/tag": "^11.6.0",
59
59
  "@atlaskit/textfield": "5.6.7",
60
60
  "@atlaskit/theme": "^12.6.0",
61
- "@atlaskit/tokens": "^1.23.0",
61
+ "@atlaskit/tokens": "^1.24.0",
62
62
  "@atlaskit/tooltip": "^17.8.0",
63
63
  "@atlaskit/ufo": "^0.2.4",
64
64
  "@atlassianlabs/jql-editor": "^2.0.1",