@atlaskit/link-datasource 7.0.1 → 7.0.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
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 7.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`9f02259ff4f80`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9f02259ff4f80) -
|
|
8
|
+
Cleanup `feature_gate` `platform_datasource_sync_info_boundary_updates`. The datasource table
|
|
9
|
+
footer sync label now always schedules its refresh on the next minute, hour or day boundary and
|
|
10
|
+
stops scheduling once the label becomes a fixed date after eight days, instead of re-rendering
|
|
11
|
+
every second.
|
|
12
|
+
|
|
3
13
|
## 7.0.1
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _reactIntl = require("react-intl");
|
|
13
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
14
13
|
var _messages = require("./messages");
|
|
15
14
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
16
15
|
var SECONDS_IN_MIN = 60;
|
|
@@ -26,10 +25,9 @@ var WithUpdatedLabel = function WithUpdatedLabel(formattedDate) {
|
|
|
26
25
|
};
|
|
27
26
|
var SyncInfo = exports.SyncInfo = function SyncInfo(_ref) {
|
|
28
27
|
var lastSyncTime = _ref.lastSyncTime;
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var _useState = (0, _react.useState)(calculateTimeDiff()),
|
|
28
|
+
var _useState = (0, _react.useState)(function () {
|
|
29
|
+
return Math.floor((Date.now() - lastSyncTime.getTime()) / 1000);
|
|
30
|
+
}),
|
|
33
31
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
34
32
|
secondsSinceUpdate = _useState2[0],
|
|
35
33
|
setSecondsSinceUpdate = _useState2[1];
|
|
@@ -37,31 +35,22 @@ var SyncInfo = exports.SyncInfo = function SyncInfo(_ref) {
|
|
|
37
35
|
var totalHours = Math.floor(secondsSinceUpdate / SECONDS_IN_HR);
|
|
38
36
|
var totalMinutes = Math.floor(secondsSinceUpdate / SECONDS_IN_MIN);
|
|
39
37
|
(0, _react.useEffect)(function () {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
var
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_update();
|
|
53
|
-
return function () {
|
|
54
|
-
return clearTimeout(timeout);
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
setSecondsSinceUpdate(calculateTimeDiff());
|
|
58
|
-
var interval = setInterval(function () {
|
|
59
|
-
return setSecondsSinceUpdate(calculateTimeDiff());
|
|
60
|
-
}, 1000);
|
|
38
|
+
var timeout;
|
|
39
|
+
var _update = function update() {
|
|
40
|
+
var elapsedMs = Date.now() - lastSyncTime.getTime();
|
|
41
|
+
setSecondsSinceUpdate(Math.floor(elapsedMs / 1000));
|
|
42
|
+
// At eight days the label becomes a fixed date, so no further updates are needed.
|
|
43
|
+
if (elapsedMs >= 8 * SECONDS_IN_DAY * 1000) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
var unitMs = (elapsedMs < SECONDS_IN_HR * 1000 ? SECONDS_IN_MIN : elapsedMs < SECONDS_IN_DAY * 1000 ? SECONDS_IN_HR : SECONDS_IN_DAY) * 1000;
|
|
47
|
+
timeout = setTimeout(_update, unitMs - elapsedMs % unitMs);
|
|
48
|
+
};
|
|
49
|
+
_update();
|
|
61
50
|
return function () {
|
|
62
|
-
return
|
|
51
|
+
return clearTimeout(timeout);
|
|
63
52
|
};
|
|
64
|
-
}, [lastSyncTime
|
|
53
|
+
}, [lastSyncTime]);
|
|
65
54
|
if (totalMinutes >= 1 && totalMinutes < 60) {
|
|
66
55
|
return /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedRelativeTime, {
|
|
67
56
|
value: -totalMinutes,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { FormattedDate, FormattedMessage, FormattedRelativeTime } from 'react-intl';
|
|
4
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
5
4
|
import { messages } from './messages';
|
|
6
5
|
const SECONDS_IN_MIN = 60;
|
|
7
6
|
const SECONDS_IN_HR = SECONDS_IN_MIN * 60;
|
|
@@ -17,31 +16,25 @@ const WithUpdatedLabel = formattedDate => {
|
|
|
17
16
|
export const SyncInfo = ({
|
|
18
17
|
lastSyncTime
|
|
19
18
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
const [secondsSinceUpdate, setSecondsSinceUpdate] = useState(calculateTimeDiff());
|
|
19
|
+
const [secondsSinceUpdate, setSecondsSinceUpdate] = useState(() => Math.floor((Date.now() - lastSyncTime.getTime()) / 1000));
|
|
22
20
|
const totalDays = Math.floor(secondsSinceUpdate / SECONDS_IN_DAY);
|
|
23
21
|
const totalHours = Math.floor(secondsSinceUpdate / SECONDS_IN_HR);
|
|
24
22
|
const totalMinutes = Math.floor(secondsSinceUpdate / SECONDS_IN_MIN);
|
|
25
23
|
useEffect(() => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
setSecondsSinceUpdate(calculateTimeDiff());
|
|
42
|
-
const interval = setInterval(() => setSecondsSinceUpdate(calculateTimeDiff()), 1000);
|
|
43
|
-
return () => clearInterval(interval);
|
|
44
|
-
}, [lastSyncTime, calculateTimeDiff]);
|
|
24
|
+
let timeout;
|
|
25
|
+
const update = () => {
|
|
26
|
+
const elapsedMs = Date.now() - lastSyncTime.getTime();
|
|
27
|
+
setSecondsSinceUpdate(Math.floor(elapsedMs / 1000));
|
|
28
|
+
// At eight days the label becomes a fixed date, so no further updates are needed.
|
|
29
|
+
if (elapsedMs >= 8 * SECONDS_IN_DAY * 1000) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const unitMs = (elapsedMs < SECONDS_IN_HR * 1000 ? SECONDS_IN_MIN : elapsedMs < SECONDS_IN_DAY * 1000 ? SECONDS_IN_HR : SECONDS_IN_DAY) * 1000;
|
|
33
|
+
timeout = setTimeout(update, unitMs - elapsedMs % unitMs);
|
|
34
|
+
};
|
|
35
|
+
update();
|
|
36
|
+
return () => clearTimeout(timeout);
|
|
37
|
+
}, [lastSyncTime]);
|
|
45
38
|
if (totalMinutes >= 1 && totalMinutes < 60) {
|
|
46
39
|
return /*#__PURE__*/React.createElement(FormattedRelativeTime, {
|
|
47
40
|
value: -totalMinutes,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
|
3
|
-
import React, {
|
|
3
|
+
import React, { useEffect, useState } from 'react';
|
|
4
4
|
import { FormattedDate, FormattedMessage, FormattedRelativeTime } from 'react-intl';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
5
|
import { messages } from './messages';
|
|
7
6
|
var SECONDS_IN_MIN = 60;
|
|
8
7
|
var SECONDS_IN_HR = SECONDS_IN_MIN * 60;
|
|
@@ -17,10 +16,9 @@ var WithUpdatedLabel = function WithUpdatedLabel(formattedDate) {
|
|
|
17
16
|
};
|
|
18
17
|
export var SyncInfo = function SyncInfo(_ref) {
|
|
19
18
|
var lastSyncTime = _ref.lastSyncTime;
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var _useState = useState(calculateTimeDiff()),
|
|
19
|
+
var _useState = useState(function () {
|
|
20
|
+
return Math.floor((Date.now() - lastSyncTime.getTime()) / 1000);
|
|
21
|
+
}),
|
|
24
22
|
_useState2 = _slicedToArray(_useState, 2),
|
|
25
23
|
secondsSinceUpdate = _useState2[0],
|
|
26
24
|
setSecondsSinceUpdate = _useState2[1];
|
|
@@ -28,31 +26,22 @@ export var SyncInfo = function SyncInfo(_ref) {
|
|
|
28
26
|
var totalHours = Math.floor(secondsSinceUpdate / SECONDS_IN_HR);
|
|
29
27
|
var totalMinutes = Math.floor(secondsSinceUpdate / SECONDS_IN_MIN);
|
|
30
28
|
useEffect(function () {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_update();
|
|
44
|
-
return function () {
|
|
45
|
-
return clearTimeout(timeout);
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
setSecondsSinceUpdate(calculateTimeDiff());
|
|
49
|
-
var interval = setInterval(function () {
|
|
50
|
-
return setSecondsSinceUpdate(calculateTimeDiff());
|
|
51
|
-
}, 1000);
|
|
29
|
+
var timeout;
|
|
30
|
+
var _update = function update() {
|
|
31
|
+
var elapsedMs = Date.now() - lastSyncTime.getTime();
|
|
32
|
+
setSecondsSinceUpdate(Math.floor(elapsedMs / 1000));
|
|
33
|
+
// At eight days the label becomes a fixed date, so no further updates are needed.
|
|
34
|
+
if (elapsedMs >= 8 * SECONDS_IN_DAY * 1000) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
var unitMs = (elapsedMs < SECONDS_IN_HR * 1000 ? SECONDS_IN_MIN : elapsedMs < SECONDS_IN_DAY * 1000 ? SECONDS_IN_HR : SECONDS_IN_DAY) * 1000;
|
|
38
|
+
timeout = setTimeout(_update, unitMs - elapsedMs % unitMs);
|
|
39
|
+
};
|
|
40
|
+
_update();
|
|
52
41
|
return function () {
|
|
53
|
-
return
|
|
42
|
+
return clearTimeout(timeout);
|
|
54
43
|
};
|
|
55
|
-
}, [lastSyncTime
|
|
44
|
+
}, [lastSyncTime]);
|
|
56
45
|
if (totalMinutes >= 1 && totalMinutes < 60) {
|
|
57
46
|
return /*#__PURE__*/React.createElement(FormattedRelativeTime, {
|
|
58
47
|
value: -totalMinutes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.2",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@atlaskit/link-provider": "^6.0.0",
|
|
70
70
|
"@atlaskit/linking-common": "^13.0.0",
|
|
71
71
|
"@atlaskit/linking-types": "^16.0.0",
|
|
72
|
-
"@atlaskit/logo": "^23.
|
|
72
|
+
"@atlaskit/logo": "^23.3.0",
|
|
73
73
|
"@atlaskit/lozenge": "^15.4.0",
|
|
74
74
|
"@atlaskit/modal-dialog": "^17.0.0",
|
|
75
75
|
"@atlaskit/object": "^2.3.0",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^4.2.0",
|
|
85
85
|
"@atlaskit/primitives": "^22.5.0",
|
|
86
86
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
87
|
-
"@atlaskit/react-select": "^4.
|
|
88
|
-
"@atlaskit/select": "^23.
|
|
87
|
+
"@atlaskit/react-select": "^4.11.0",
|
|
88
|
+
"@atlaskit/select": "^23.1.0",
|
|
89
89
|
"@atlaskit/smart-card": "^46.0.0",
|
|
90
90
|
"@atlaskit/smart-user-picker": "^12.0.0",
|
|
91
91
|
"@atlaskit/spinner": "^20.4.0",
|
|
@@ -146,9 +146,6 @@
|
|
|
146
146
|
"wait-for-expect": "^1.2.0"
|
|
147
147
|
},
|
|
148
148
|
"platform-feature-flags": {
|
|
149
|
-
"platform_datasource_sync_info_boundary_updates": {
|
|
150
|
-
"type": "boolean"
|
|
151
|
-
},
|
|
152
149
|
"platform_datasource_missing_columns_error": {
|
|
153
150
|
"type": "boolean"
|
|
154
151
|
},
|