@atlaskit/link-datasource 7.0.1 → 7.0.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 +22 -0
- package/dist/cjs/services/getAvailableSites.js +27 -32
- package/dist/cjs/ui/table-footer/sync-info/index.js +17 -28
- package/dist/es2019/services/getAvailableSites.js +6 -3
- package/dist/es2019/ui/table-footer/sync-info/index.js +16 -23
- package/dist/esm/services/getAvailableSites.js +27 -32
- package/dist/esm/ui/table-footer/sync-info/index.js +18 -29
- package/package.json +7 -13
- package/dist/cjs/services/isLinkDatasourceInUnitsRollout.js +0 -25
- package/dist/es2019/services/isLinkDatasourceInUnitsRollout.js +0 -20
- package/dist/esm/services/isLinkDatasourceInUnitsRollout.js +0 -20
- package/dist/types/services/isLinkDatasourceInUnitsRollout.d.ts +0 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 7.0.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ffe3187520151`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ffe3187520151) -
|
|
8
|
+
Remove the redundant `linking_platform_site_picker_api_unit_compliant_cloud_id` and
|
|
9
|
+
`linking_platform_link_datasource_unit_compliant_cloud_id` feature gates. Both duplicated the
|
|
10
|
+
targeting of the existing `linking_platform_site_picker_api_unit_compliant` and
|
|
11
|
+
`linking_platform_link_datasource_unit_compliant` gates, which now solely drive the units
|
|
12
|
+
isolation rollout for the site picker and link datasource. No behaviour change.
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 7.0.2
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`9f02259ff4f80`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9f02259ff4f80) -
|
|
20
|
+
Cleanup `feature_gate` `platform_datasource_sync_info_boundary_updates`. The datasource table
|
|
21
|
+
footer sync label now always schedules its refresh on the next minute, hour or day boundary and
|
|
22
|
+
stops scheduling once the label becomes a fixed date after eight days, instead of re-rendering
|
|
23
|
+
every second.
|
|
24
|
+
|
|
3
25
|
## 7.0.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -9,10 +9,10 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _mapAccessibleProductsToAvailableSites = require("@atlaskit/linking-common/map-accessible-products-to-available-sites");
|
|
11
11
|
var _unitsRollout = require("@atlaskit/linking-common/units-rollout");
|
|
12
|
-
var
|
|
12
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
13
|
var getAccessibleProducts = exports.getAccessibleProducts = /*#__PURE__*/function () {
|
|
14
14
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(product) {
|
|
15
|
-
var requestConfig, endpoint, response, res, _t, _t2, _t3
|
|
15
|
+
var requestConfig, isUnitCompliant, endpoint, response, res, _t, _t2, _t3;
|
|
16
16
|
return _regenerator.default.wrap(function (_context) {
|
|
17
17
|
while (1) switch (_context.prev = _context.next) {
|
|
18
18
|
case 0:
|
|
@@ -28,49 +28,44 @@ var getAccessibleProducts = exports.getAccessibleProducts = /*#__PURE__*/functio
|
|
|
28
28
|
productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
|
|
29
29
|
})
|
|
30
30
|
}; // Organisations with units isolation in effect must be served the unit compliant endpoint,
|
|
31
|
-
// which filters the products down to the unit the user belongs to.
|
|
31
|
+
// which filters the products down to the unit the user belongs to. The gate is passed as a
|
|
32
|
+
// callback so it is only evaluated - and only records exposure - once the units GA killswitch
|
|
33
|
+
// has already let the check through.
|
|
32
34
|
_context.next = 1;
|
|
33
|
-
return (0, _unitsRollout.shouldUseUnitCompliantApi)(
|
|
35
|
+
return (0, _unitsRollout.shouldUseUnitCompliantApi)(function () {
|
|
36
|
+
return (0, _fg.fg)('linking_platform_link_datasource_unit_compliant');
|
|
37
|
+
});
|
|
34
38
|
case 1:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
_t = '/gateway/api/experimental/v2/accessible-products';
|
|
40
|
-
_context.next = 3;
|
|
41
|
-
break;
|
|
42
|
-
case 2:
|
|
43
|
-
_t = '/gateway/api/v2/accessible-products';
|
|
44
|
-
case 3:
|
|
45
|
-
endpoint = _t;
|
|
46
|
-
_context.next = 4;
|
|
39
|
+
isUnitCompliant = _context.sent;
|
|
40
|
+
endpoint = isUnitCompliant ? '/gateway/api/experimental/v2/accessible-products' : '/gateway/api/v2/accessible-products';
|
|
41
|
+
_context.next = 2;
|
|
47
42
|
return fetch(endpoint, requestConfig);
|
|
48
|
-
case
|
|
43
|
+
case 2:
|
|
49
44
|
response = _context.sent;
|
|
50
45
|
if (!response.ok) {
|
|
51
|
-
_context.next =
|
|
46
|
+
_context.next = 4;
|
|
52
47
|
break;
|
|
53
48
|
}
|
|
54
|
-
_context.next =
|
|
49
|
+
_context.next = 3;
|
|
55
50
|
return response.json();
|
|
56
|
-
case
|
|
51
|
+
case 3:
|
|
57
52
|
res = _context.sent;
|
|
58
53
|
return _context.abrupt("return", (0, _mapAccessibleProductsToAvailableSites.mapAccessibleProductsToAvailableSites)(res.data));
|
|
59
|
-
case
|
|
60
|
-
|
|
61
|
-
_context.next =
|
|
54
|
+
case 4:
|
|
55
|
+
_t = Error;
|
|
56
|
+
_context.next = 5;
|
|
62
57
|
return response.text();
|
|
63
|
-
case
|
|
64
|
-
|
|
65
|
-
if (
|
|
66
|
-
_context.next =
|
|
58
|
+
case 5:
|
|
59
|
+
_t2 = _context.sent;
|
|
60
|
+
if (_t2) {
|
|
61
|
+
_context.next = 6;
|
|
67
62
|
break;
|
|
68
63
|
}
|
|
69
|
-
|
|
70
|
-
case
|
|
71
|
-
|
|
72
|
-
throw new
|
|
73
|
-
case
|
|
64
|
+
_t2 = 'Something went wrong';
|
|
65
|
+
case 6:
|
|
66
|
+
_t3 = _t2;
|
|
67
|
+
throw new _t(_t3);
|
|
68
|
+
case 7:
|
|
74
69
|
case "end":
|
|
75
70
|
return _context.stop();
|
|
76
71
|
}
|
|
@@ -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,6 +1,6 @@
|
|
|
1
1
|
import { mapAccessibleProductsToAvailableSites } from '@atlaskit/linking-common/map-accessible-products-to-available-sites';
|
|
2
2
|
import { shouldUseUnitCompliantApi } from '@atlaskit/linking-common/units-rollout';
|
|
3
|
-
import {
|
|
3
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
4
4
|
export const getAccessibleProducts = async product => {
|
|
5
5
|
const requestConfig = {
|
|
6
6
|
method: 'POST',
|
|
@@ -16,8 +16,11 @@ export const getAccessibleProducts = async product => {
|
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
// Organisations with units isolation in effect must be served the unit compliant endpoint,
|
|
19
|
-
// which filters the products down to the unit the user belongs to.
|
|
20
|
-
|
|
19
|
+
// which filters the products down to the unit the user belongs to. The gate is passed as a
|
|
20
|
+
// callback so it is only evaluated - and only records exposure - once the units GA killswitch
|
|
21
|
+
// has already let the check through.
|
|
22
|
+
const isUnitCompliant = await shouldUseUnitCompliantApi(() => fg('linking_platform_link_datasource_unit_compliant'));
|
|
23
|
+
const endpoint = isUnitCompliant ? '/gateway/api/experimental/v2/accessible-products' : '/gateway/api/v2/accessible-products';
|
|
21
24
|
const response = await fetch(endpoint, requestConfig);
|
|
22
25
|
if (response.ok) {
|
|
23
26
|
const res = await response.json();
|
|
@@ -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,
|
|
@@ -2,10 +2,10 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { mapAccessibleProductsToAvailableSites } from '@atlaskit/linking-common/map-accessible-products-to-available-sites';
|
|
4
4
|
import { shouldUseUnitCompliantApi } from '@atlaskit/linking-common/units-rollout';
|
|
5
|
-
import {
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
6
|
export var getAccessibleProducts = /*#__PURE__*/function () {
|
|
7
7
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(product) {
|
|
8
|
-
var requestConfig, endpoint, response, res, _t, _t2, _t3
|
|
8
|
+
var requestConfig, isUnitCompliant, endpoint, response, res, _t, _t2, _t3;
|
|
9
9
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
10
10
|
while (1) switch (_context.prev = _context.next) {
|
|
11
11
|
case 0:
|
|
@@ -21,49 +21,44 @@ export var getAccessibleProducts = /*#__PURE__*/function () {
|
|
|
21
21
|
productIds: product === 'confluence' ? ['confluence.ondemand'] : ['jira-software.ondemand', 'jira-core.ondemand', 'jira-incident-manager.ondemand', 'jira-product-discovery', 'jira-servicedesk.ondemand']
|
|
22
22
|
})
|
|
23
23
|
}; // Organisations with units isolation in effect must be served the unit compliant endpoint,
|
|
24
|
-
// which filters the products down to the unit the user belongs to.
|
|
24
|
+
// which filters the products down to the unit the user belongs to. The gate is passed as a
|
|
25
|
+
// callback so it is only evaluated - and only records exposure - once the units GA killswitch
|
|
26
|
+
// has already let the check through.
|
|
25
27
|
_context.next = 1;
|
|
26
|
-
return shouldUseUnitCompliantApi(
|
|
28
|
+
return shouldUseUnitCompliantApi(function () {
|
|
29
|
+
return fg('linking_platform_link_datasource_unit_compliant');
|
|
30
|
+
});
|
|
27
31
|
case 1:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
_t = '/gateway/api/experimental/v2/accessible-products';
|
|
33
|
-
_context.next = 3;
|
|
34
|
-
break;
|
|
35
|
-
case 2:
|
|
36
|
-
_t = '/gateway/api/v2/accessible-products';
|
|
37
|
-
case 3:
|
|
38
|
-
endpoint = _t;
|
|
39
|
-
_context.next = 4;
|
|
32
|
+
isUnitCompliant = _context.sent;
|
|
33
|
+
endpoint = isUnitCompliant ? '/gateway/api/experimental/v2/accessible-products' : '/gateway/api/v2/accessible-products';
|
|
34
|
+
_context.next = 2;
|
|
40
35
|
return fetch(endpoint, requestConfig);
|
|
41
|
-
case
|
|
36
|
+
case 2:
|
|
42
37
|
response = _context.sent;
|
|
43
38
|
if (!response.ok) {
|
|
44
|
-
_context.next =
|
|
39
|
+
_context.next = 4;
|
|
45
40
|
break;
|
|
46
41
|
}
|
|
47
|
-
_context.next =
|
|
42
|
+
_context.next = 3;
|
|
48
43
|
return response.json();
|
|
49
|
-
case
|
|
44
|
+
case 3:
|
|
50
45
|
res = _context.sent;
|
|
51
46
|
return _context.abrupt("return", mapAccessibleProductsToAvailableSites(res.data));
|
|
52
|
-
case
|
|
53
|
-
|
|
54
|
-
_context.next =
|
|
47
|
+
case 4:
|
|
48
|
+
_t = Error;
|
|
49
|
+
_context.next = 5;
|
|
55
50
|
return response.text();
|
|
56
|
-
case
|
|
57
|
-
|
|
58
|
-
if (
|
|
59
|
-
_context.next =
|
|
51
|
+
case 5:
|
|
52
|
+
_t2 = _context.sent;
|
|
53
|
+
if (_t2) {
|
|
54
|
+
_context.next = 6;
|
|
60
55
|
break;
|
|
61
56
|
}
|
|
62
|
-
|
|
63
|
-
case
|
|
64
|
-
|
|
65
|
-
throw new
|
|
66
|
-
case
|
|
57
|
+
_t2 = 'Something went wrong';
|
|
58
|
+
case 6:
|
|
59
|
+
_t3 = _t2;
|
|
60
|
+
throw new _t(_t3);
|
|
61
|
+
case 7:
|
|
67
62
|
case "end":
|
|
68
63
|
return _context.stop();
|
|
69
64
|
}
|
|
@@ -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.3",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
"@atlaskit/analytics-cross-product": "^2.2.0",
|
|
44
44
|
"@atlaskit/analytics-next": "^12.5.0",
|
|
45
45
|
"@atlaskit/atlassian-context": "^2.0.0",
|
|
46
|
-
"@atlaskit/avatar": "^29.
|
|
47
|
-
"@atlaskit/avatar-group": "^14.
|
|
46
|
+
"@atlaskit/avatar": "^29.1.0",
|
|
47
|
+
"@atlaskit/avatar-group": "^14.4.0",
|
|
48
48
|
"@atlaskit/badge": "^22.0.0",
|
|
49
49
|
"@atlaskit/button": "^25.4.0",
|
|
50
50
|
"@atlaskit/css": "^1.1.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,9 +84,9 @@
|
|
|
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.
|
|
89
|
-
"@atlaskit/smart-card": "^46.
|
|
87
|
+
"@atlaskit/react-select": "^4.12.0",
|
|
88
|
+
"@atlaskit/select": "^23.1.0",
|
|
89
|
+
"@atlaskit/smart-card": "^46.1.0",
|
|
90
90
|
"@atlaskit/smart-user-picker": "^12.0.0",
|
|
91
91
|
"@atlaskit/spinner": "^20.4.0",
|
|
92
92
|
"@atlaskit/tag": "^16.0.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
|
},
|
|
@@ -174,9 +171,6 @@
|
|
|
174
171
|
"linking_platform_link_datasource_unit_compliant": {
|
|
175
172
|
"type": "boolean"
|
|
176
173
|
},
|
|
177
|
-
"linking_platform_link_datasource_unit_compliant_cloud_id": {
|
|
178
|
-
"type": "boolean"
|
|
179
|
-
},
|
|
180
174
|
"platform_lp_sllv_richtext_margin_reset": {
|
|
181
175
|
"type": "boolean"
|
|
182
176
|
},
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isLinkDatasourceInUnitsRollout = void 0;
|
|
7
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
8
|
-
/**
|
|
9
|
-
* Whether link datasource is in the units isolation rollout.
|
|
10
|
-
*
|
|
11
|
-
* Two gates drive the same rollout so it can be turned on for either an organisation or a single
|
|
12
|
-
* site: `..._unit_compliant` targets org id, `..._unit_compliant_cloud_id` targets cloud id.
|
|
13
|
-
* Either one being on opts link datasource in, and both are always evaluated so that exposure is
|
|
14
|
-
* recorded for the two of them.
|
|
15
|
-
*
|
|
16
|
-
* Being in the rollout is not on its own enough to change behaviour - the organisation also has to
|
|
17
|
-
* have launched units with boundary enforcement on. Pass this to `shouldUseUnitCompliantApi` from
|
|
18
|
-
* `@atlaskit/linking-common/units-rollout`, which owns that decision, rather than calling it
|
|
19
|
-
* directly.
|
|
20
|
-
*/
|
|
21
|
-
var isLinkDatasourceInUnitsRollout = exports.isLinkDatasourceInUnitsRollout = function isLinkDatasourceInUnitsRollout() {
|
|
22
|
-
var isOrgInRollout = (0, _fg.fg)('linking_platform_link_datasource_unit_compliant');
|
|
23
|
-
var isSiteInRollout = (0, _fg.fg)('linking_platform_link_datasource_unit_compliant_cloud_id');
|
|
24
|
-
return isOrgInRollout || isSiteInRollout;
|
|
25
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Whether link datasource is in the units isolation rollout.
|
|
5
|
-
*
|
|
6
|
-
* Two gates drive the same rollout so it can be turned on for either an organisation or a single
|
|
7
|
-
* site: `..._unit_compliant` targets org id, `..._unit_compliant_cloud_id` targets cloud id.
|
|
8
|
-
* Either one being on opts link datasource in, and both are always evaluated so that exposure is
|
|
9
|
-
* recorded for the two of them.
|
|
10
|
-
*
|
|
11
|
-
* Being in the rollout is not on its own enough to change behaviour - the organisation also has to
|
|
12
|
-
* have launched units with boundary enforcement on. Pass this to `shouldUseUnitCompliantApi` from
|
|
13
|
-
* `@atlaskit/linking-common/units-rollout`, which owns that decision, rather than calling it
|
|
14
|
-
* directly.
|
|
15
|
-
*/
|
|
16
|
-
export const isLinkDatasourceInUnitsRollout = () => {
|
|
17
|
-
const isOrgInRollout = fg('linking_platform_link_datasource_unit_compliant');
|
|
18
|
-
const isSiteInRollout = fg('linking_platform_link_datasource_unit_compliant_cloud_id');
|
|
19
|
-
return isOrgInRollout || isSiteInRollout;
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Whether link datasource is in the units isolation rollout.
|
|
5
|
-
*
|
|
6
|
-
* Two gates drive the same rollout so it can be turned on for either an organisation or a single
|
|
7
|
-
* site: `..._unit_compliant` targets org id, `..._unit_compliant_cloud_id` targets cloud id.
|
|
8
|
-
* Either one being on opts link datasource in, and both are always evaluated so that exposure is
|
|
9
|
-
* recorded for the two of them.
|
|
10
|
-
*
|
|
11
|
-
* Being in the rollout is not on its own enough to change behaviour - the organisation also has to
|
|
12
|
-
* have launched units with boundary enforcement on. Pass this to `shouldUseUnitCompliantApi` from
|
|
13
|
-
* `@atlaskit/linking-common/units-rollout`, which owns that decision, rather than calling it
|
|
14
|
-
* directly.
|
|
15
|
-
*/
|
|
16
|
-
export var isLinkDatasourceInUnitsRollout = function isLinkDatasourceInUnitsRollout() {
|
|
17
|
-
var isOrgInRollout = fg('linking_platform_link_datasource_unit_compliant');
|
|
18
|
-
var isSiteInRollout = fg('linking_platform_link_datasource_unit_compliant_cloud_id');
|
|
19
|
-
return isOrgInRollout || isSiteInRollout;
|
|
20
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether link datasource is in the units isolation rollout.
|
|
3
|
-
*
|
|
4
|
-
* Two gates drive the same rollout so it can be turned on for either an organisation or a single
|
|
5
|
-
* site: `..._unit_compliant` targets org id, `..._unit_compliant_cloud_id` targets cloud id.
|
|
6
|
-
* Either one being on opts link datasource in, and both are always evaluated so that exposure is
|
|
7
|
-
* recorded for the two of them.
|
|
8
|
-
*
|
|
9
|
-
* Being in the rollout is not on its own enough to change behaviour - the organisation also has to
|
|
10
|
-
* have launched units with boundary enforcement on. Pass this to `shouldUseUnitCompliantApi` from
|
|
11
|
-
* `@atlaskit/linking-common/units-rollout`, which owns that decision, rather than calling it
|
|
12
|
-
* directly.
|
|
13
|
-
*/
|
|
14
|
-
export declare const isLinkDatasourceInUnitsRollout: () => boolean;
|