@atlaskit/link-datasource 7.3.0 → 7.3.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 +19 -0
- package/dist/cjs/hooks/useAssetsClient.js +56 -44
- package/dist/cjs/hooks/useDatasourceTableState.js +1 -4
- package/dist/cjs/services/fetchIsUnitsEnabledForAssets.js +71 -0
- package/dist/cjs/types/assets/types.js +2 -0
- package/dist/cjs/ui/assets-modal/modal/render-assets-content/index.js +1 -2
- package/dist/cjs/ui/common/modal/display-view-dropdown/display-view-drop-down.compiled.css +1 -2
- package/dist/cjs/ui/common/modal/display-view-dropdown/display-view-drop-down.js +2 -4
- package/dist/cjs/ui/confluence-search-modal/modal/PlainConfluenceSearchConfigModal.js +1 -2
- package/dist/cjs/ui/datasource-table-view/datasourceTableView.js +1 -1
- package/dist/cjs/ui/issue-like-table/issue-like-data-table-view.js +1 -1
- package/dist/cjs/ui/jira-issues-modal/modal/index.js +1 -1
- package/dist/es2019/hooks/useAssetsClient.js +5 -3
- package/dist/es2019/hooks/useDatasourceTableState.js +1 -3
- package/dist/es2019/services/fetchIsUnitsEnabledForAssets.js +46 -0
- package/dist/es2019/types/assets/types.js +2 -0
- package/dist/es2019/ui/assets-modal/modal/render-assets-content/index.js +1 -2
- package/dist/es2019/ui/common/modal/display-view-dropdown/display-view-drop-down.compiled.css +1 -2
- package/dist/es2019/ui/common/modal/display-view-dropdown/display-view-drop-down.js +2 -4
- package/dist/es2019/ui/confluence-search-modal/modal/PlainConfluenceSearchConfigModal.js +1 -2
- package/dist/es2019/ui/datasource-table-view/datasourceTableView.js +1 -1
- package/dist/es2019/ui/issue-like-table/issue-like-data-table-view.js +1 -1
- package/dist/es2019/ui/jira-issues-modal/modal/index.js +1 -1
- package/dist/esm/hooks/useAssetsClient.js +56 -44
- package/dist/esm/hooks/useDatasourceTableState.js +1 -4
- package/dist/esm/services/fetchIsUnitsEnabledForAssets.js +64 -0
- package/dist/esm/types/assets/types.js +2 -0
- package/dist/esm/ui/assets-modal/modal/render-assets-content/index.js +1 -2
- package/dist/esm/ui/common/modal/display-view-dropdown/display-view-drop-down.compiled.css +1 -2
- package/dist/esm/ui/common/modal/display-view-dropdown/display-view-drop-down.js +2 -4
- package/dist/esm/ui/confluence-search-modal/modal/PlainConfluenceSearchConfigModal.js +1 -2
- package/dist/esm/ui/datasource-table-view/datasourceTableView.js +1 -1
- package/dist/esm/ui/issue-like-table/issue-like-data-table-view.js +1 -1
- package/dist/esm/ui/jira-issues-modal/modal/index.js +1 -1
- package/dist/types/services/fetchIsUnitsEnabledForAssets.d.ts +1 -0
- package/dist/types/types/assets/types.d.ts +5 -0
- package/package.json +3 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/link-datasource
|
|
2
2
|
|
|
3
|
+
## 7.3.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`44b6d3bdeba9d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/44b6d3bdeba9d) -
|
|
8
|
+
Assets modal now resolves the primary Unit workspace only when `/assets/is-multi-site` reports
|
|
9
|
+
Units enabled for Assets, otherwise it uses the legacy current-site workspace lookup (behind
|
|
10
|
+
`astral_units_workspace_host_resolver`).
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 7.3.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [`de0d7314fd206`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/de0d7314fd206) -
|
|
18
|
+
Clean up feature gate `platform_lp_sllv_ux_improvements`. Smart Link list views retain table
|
|
19
|
+
headers and show empty results within the table, and view-mode dropdowns size to their content. No
|
|
20
|
+
public API changes.
|
|
21
|
+
|
|
3
22
|
## 7.3.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
|
@@ -11,6 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
11
11
|
var _react = require("react");
|
|
12
12
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
13
|
var _analytics = require("../analytics");
|
|
14
|
+
var _fetchIsUnitsEnabledForAssets = require("../services/fetchIsUnitsEnabledForAssets");
|
|
14
15
|
var _fetchObjectSchema = require("../services/fetchObjectSchema");
|
|
15
16
|
var _fetchObjectSchemas = require("../services/fetchObjectSchemas");
|
|
16
17
|
var _getMeta2 = require("../services/getMeta");
|
|
@@ -70,89 +71,100 @@ var useAssetsClient = exports.useAssetsClient = function useAssetsClient(initial
|
|
|
70
71
|
*/
|
|
71
72
|
(0, _react.useEffect)(function () {
|
|
72
73
|
(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
73
|
-
var _workspaceId, _yield$resolvePrimary, fetchedObjectSchema, fetchedObjectSchemasResponse, _t, _t2, _t3, _t4;
|
|
74
|
+
var _workspaceId, isUnitsEnabledForAssets, _yield$resolvePrimary, fetchedObjectSchema, fetchedObjectSchemasResponse, _t, _t2, _t3, _t4, _t5;
|
|
74
75
|
return _regenerator.default.wrap(function (_context) {
|
|
75
76
|
while (1) switch (_context.prev = _context.next) {
|
|
76
77
|
case 0:
|
|
77
78
|
setLoading(true);
|
|
78
79
|
setWorkspaceError(undefined);
|
|
79
80
|
_context.prev = 1;
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
_t = (0, _fg.fg)('astral_units_workspace_host_resolver') && !!cloudId;
|
|
82
|
+
if (!_t) {
|
|
83
|
+
_context.next = 3;
|
|
82
84
|
break;
|
|
83
85
|
}
|
|
84
|
-
_context.
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
_context.next = 2;
|
|
87
|
+
return (0, _fetchIsUnitsEnabledForAssets.fetchIsUnitsEnabledForAssets)(cloudId);
|
|
88
|
+
case 2:
|
|
89
|
+
_t = _context.sent;
|
|
87
90
|
case 3:
|
|
91
|
+
isUnitsEnabledForAssets = _t;
|
|
92
|
+
if (!isUnitsEnabledForAssets) {
|
|
93
|
+
_context.next = 9;
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
_context.prev = 4;
|
|
97
|
+
_context.next = 5;
|
|
98
|
+
return (0, _resolvePrimaryWorkspace.resolvePrimaryWorkspace)(cloudId);
|
|
99
|
+
case 5:
|
|
88
100
|
_yield$resolvePrimary = _context.sent;
|
|
89
101
|
_workspaceId = _yield$resolvePrimary.workspaceId;
|
|
90
|
-
_context.next =
|
|
102
|
+
_context.next = 8;
|
|
91
103
|
break;
|
|
92
|
-
case
|
|
93
|
-
_context.prev =
|
|
94
|
-
|
|
95
|
-
_context.next =
|
|
104
|
+
case 6:
|
|
105
|
+
_context.prev = 6;
|
|
106
|
+
_t2 = _context["catch"](4);
|
|
107
|
+
_context.next = 7;
|
|
96
108
|
return (0, _getWorkspaceId.getWorkspaceId)(fireEvent);
|
|
97
|
-
case
|
|
109
|
+
case 7:
|
|
98
110
|
_workspaceId = _context.sent;
|
|
99
|
-
case
|
|
100
|
-
_context.next =
|
|
111
|
+
case 8:
|
|
112
|
+
_context.next = 11;
|
|
101
113
|
break;
|
|
102
|
-
case
|
|
103
|
-
_context.next =
|
|
114
|
+
case 9:
|
|
115
|
+
_context.next = 10;
|
|
104
116
|
return (0, _getWorkspaceId.getWorkspaceId)(fireEvent);
|
|
105
|
-
case
|
|
117
|
+
case 10:
|
|
106
118
|
_workspaceId = _context.sent;
|
|
107
|
-
case
|
|
119
|
+
case 11:
|
|
108
120
|
setWorkspaceId(_workspaceId);
|
|
109
121
|
// Check schema from initial parameters still exists and fetch name/permissions for schema select
|
|
110
122
|
if (!(initialParameters !== null && initialParameters !== void 0 && initialParameters.schemaId)) {
|
|
111
|
-
_context.next =
|
|
123
|
+
_context.next = 15;
|
|
112
124
|
break;
|
|
113
125
|
}
|
|
114
|
-
_context.prev =
|
|
115
|
-
_context.next =
|
|
126
|
+
_context.prev = 12;
|
|
127
|
+
_context.next = 13;
|
|
116
128
|
return (0, _fetchObjectSchema.fetchObjectSchema)(_workspaceId, initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.schemaId, fireEvent);
|
|
117
|
-
case
|
|
129
|
+
case 13:
|
|
118
130
|
fetchedObjectSchema = _context.sent;
|
|
119
131
|
setExistingObjectSchema(fetchedObjectSchema);
|
|
120
|
-
_context.next =
|
|
132
|
+
_context.next = 15;
|
|
121
133
|
break;
|
|
122
|
-
case 12:
|
|
123
|
-
_context.prev = 12;
|
|
124
|
-
_t2 = _context["catch"](10);
|
|
125
|
-
handleAssetsClientErrors(setExistingObjectSchemaError, _t2);
|
|
126
|
-
case 13:
|
|
127
|
-
_context.prev = 13;
|
|
128
|
-
_context.next = 14;
|
|
129
|
-
return (0, _fetchObjectSchemas.fetchObjectSchemas)(_workspaceId, undefined, fireEvent);
|
|
130
134
|
case 14:
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
_context.next = 16;
|
|
135
|
-
break;
|
|
135
|
+
_context.prev = 14;
|
|
136
|
+
_t3 = _context["catch"](12);
|
|
137
|
+
handleAssetsClientErrors(setExistingObjectSchemaError, _t3);
|
|
136
138
|
case 15:
|
|
137
139
|
_context.prev = 15;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
_context.next = 16;
|
|
141
|
+
return (0, _fetchObjectSchemas.fetchObjectSchemas)(_workspaceId, undefined, fireEvent);
|
|
140
142
|
case 16:
|
|
143
|
+
fetchedObjectSchemasResponse = _context.sent;
|
|
144
|
+
setObjectSchemas(fetchedObjectSchemasResponse.values);
|
|
145
|
+
setTotalObjectSchemas(fetchedObjectSchemasResponse.total);
|
|
141
146
|
_context.next = 18;
|
|
142
147
|
break;
|
|
143
148
|
case 17:
|
|
144
149
|
_context.prev = 17;
|
|
145
|
-
_t4 = _context["catch"](
|
|
146
|
-
handleAssetsClientErrors(
|
|
150
|
+
_t4 = _context["catch"](15);
|
|
151
|
+
handleAssetsClientErrors(setObjectSchemasError, _t4);
|
|
147
152
|
case 18:
|
|
148
|
-
_context.
|
|
149
|
-
|
|
150
|
-
return _context.finish(18);
|
|
153
|
+
_context.next = 20;
|
|
154
|
+
break;
|
|
151
155
|
case 19:
|
|
156
|
+
_context.prev = 19;
|
|
157
|
+
_t5 = _context["catch"](1);
|
|
158
|
+
handleAssetsClientErrors(setWorkspaceError, _t5);
|
|
159
|
+
case 20:
|
|
160
|
+
_context.prev = 20;
|
|
161
|
+
setLoading(false);
|
|
162
|
+
return _context.finish(20);
|
|
163
|
+
case 21:
|
|
152
164
|
case "end":
|
|
153
165
|
return _context.stop();
|
|
154
166
|
}
|
|
155
|
-
}, _callee, null, [[1,
|
|
167
|
+
}, _callee, null, [[1, 19, 20, 21], [4, 6], [12, 14], [15, 17]]);
|
|
156
168
|
}))();
|
|
157
169
|
}, [initialParameters, fireEvent, cloudId]);
|
|
158
170
|
return {
|
|
@@ -13,7 +13,6 @@ var _react = require("react");
|
|
|
13
13
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
14
14
|
var _isFedramp = require("@atlaskit/atlassian-context/is-fedramp");
|
|
15
15
|
var _useDataSourceClientExtension = require("@atlaskit/link-client-extension/use-data-source-client-extension");
|
|
16
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
16
|
var _analytics = require("../analytics");
|
|
18
17
|
var _state = require("../state");
|
|
19
18
|
var _useDiscoverActions2 = require("../state/actions/useDiscoverActions");
|
|
@@ -239,7 +238,6 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
239
238
|
entityType,
|
|
240
239
|
newIds,
|
|
241
240
|
aris,
|
|
242
|
-
shouldApplySchemaWithoutItems,
|
|
243
241
|
isUserLoadingNextPage,
|
|
244
242
|
currentLoadedItemCount,
|
|
245
243
|
newlyLoadedItemCount,
|
|
@@ -353,8 +351,7 @@ var useDatasourceTableState = exports.useDatasourceTableState = function useData
|
|
|
353
351
|
|
|
354
352
|
// A response with no items still describes its columns, so the schema is worth applying
|
|
355
353
|
// to let the table keep its headers while showing the empty state.
|
|
356
|
-
|
|
357
|
-
if ((isSchemaFromData && schema || fullSchema.properties.length > 0) && (items.length > 0 || shouldApplySchemaWithoutItems)) {
|
|
354
|
+
if (isSchemaFromData && schema || fullSchema.properties.length > 0) {
|
|
358
355
|
applySchemaProperties(schema || fullSchema, fieldKeys);
|
|
359
356
|
}
|
|
360
357
|
isUserLoadingNextPage = responseItems.length !== 0 && !shouldRequestFirstPage;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.fetchIsUnitsEnabledForAssets = void 0;
|
|
8
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _api = require("@atlaskit/linking-common/api");
|
|
11
|
+
var UNITS_ENABLED_TTL_MS = 15 * 60 * 1000;
|
|
12
|
+
var UNITS_ENABLED_ERROR_TTL_MS = 60 * 1000;
|
|
13
|
+
var cache = new Map();
|
|
14
|
+
var performFetch = /*#__PURE__*/function () {
|
|
15
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(cloudId) {
|
|
16
|
+
var res, _t;
|
|
17
|
+
return _regenerator.default.wrap(function (_context) {
|
|
18
|
+
while (1) switch (_context.prev = _context.next) {
|
|
19
|
+
case 0:
|
|
20
|
+
_context.prev = 0;
|
|
21
|
+
_context.next = 1;
|
|
22
|
+
return (0, _api.request)('get', '/assets/is-multi-site', undefined, {
|
|
23
|
+
'x-atlassian-cloud-id': cloudId
|
|
24
|
+
}, [200]);
|
|
25
|
+
case 1:
|
|
26
|
+
res = _context.sent;
|
|
27
|
+
return _context.abrupt("return", {
|
|
28
|
+
enabled: (res === null || res === void 0 ? void 0 : res.isUnitsEnabledForAssets) === true,
|
|
29
|
+
ttlMs: UNITS_ENABLED_TTL_MS
|
|
30
|
+
});
|
|
31
|
+
case 2:
|
|
32
|
+
_context.prev = 2;
|
|
33
|
+
_t = _context["catch"](0);
|
|
34
|
+
return _context.abrupt("return", {
|
|
35
|
+
enabled: false,
|
|
36
|
+
ttlMs: UNITS_ENABLED_ERROR_TTL_MS
|
|
37
|
+
});
|
|
38
|
+
case 3:
|
|
39
|
+
case "end":
|
|
40
|
+
return _context.stop();
|
|
41
|
+
}
|
|
42
|
+
}, _callee, null, [[0, 2]]);
|
|
43
|
+
}));
|
|
44
|
+
return function performFetch(_x) {
|
|
45
|
+
return _ref.apply(this, arguments);
|
|
46
|
+
};
|
|
47
|
+
}();
|
|
48
|
+
|
|
49
|
+
// Whether Units is enabled for Assets on this tenant. Single-flight and cached per
|
|
50
|
+
// cloudId (short TTL after a failure). Resolves false on any failure so callers fall
|
|
51
|
+
// back to the legacy current-site lookup.
|
|
52
|
+
var fetchIsUnitsEnabledForAssets = exports.fetchIsUnitsEnabledForAssets = function fetchIsUnitsEnabledForAssets(cloudId) {
|
|
53
|
+
var cached = cache.get(cloudId);
|
|
54
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
55
|
+
return cached.promise;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Pending entries never expire, so concurrent callers share one request.
|
|
59
|
+
var entry = {
|
|
60
|
+
expiresAt: Infinity,
|
|
61
|
+
promise: Promise.resolve(false)
|
|
62
|
+
};
|
|
63
|
+
entry.promise = performFetch(cloudId).then(function (_ref2) {
|
|
64
|
+
var enabled = _ref2.enabled,
|
|
65
|
+
ttlMs = _ref2.ttlMs;
|
|
66
|
+
entry.expiresAt = Date.now() + ttlMs;
|
|
67
|
+
return enabled;
|
|
68
|
+
});
|
|
69
|
+
cache.set(cloudId, entry);
|
|
70
|
+
return entry.promise;
|
|
71
|
+
};
|
|
@@ -9,6 +9,8 @@ exports.objectSchemaKey = exports.aqlKey = void 0;
|
|
|
9
9
|
* `linkedAssetsWorkspaceId` is the workspace of the Unit's primary Assets site.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
+
/** Wire shape of the `/assets/is-multi-site` response. */
|
|
13
|
+
|
|
12
14
|
// These are to enforce the field "name" property and keep everything typed
|
|
13
15
|
var objectSchemaKey = exports.objectSchemaKey = 'objectSchema';
|
|
14
16
|
var aqlKey = exports.aqlKey = 'aql';
|
|
@@ -11,7 +11,6 @@ require("./index.compiled.css");
|
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var React = _react;
|
|
13
13
|
var _runtime = require("@compiled/react/runtime");
|
|
14
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
15
14
|
var _accessRequired = require("../../../common/error-state/access-required");
|
|
16
15
|
var _modalLoadingError = require("../../../common/error-state/modal-loading-error");
|
|
17
16
|
var _noResults = require("../../../common/error-state/no-results");
|
|
@@ -67,7 +66,7 @@ var RenderAssetsContent = exports.RenderAssetsContent = function RenderAssetsCon
|
|
|
67
66
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
68
67
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
69
68
|
// the rows, instead of replacing the whole table with it.
|
|
70
|
-
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
69
|
+
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
71
70
|
var issueLikeDataTableView = (0, _react.useMemo)(function () {
|
|
72
71
|
return /*#__PURE__*/React.createElement("div", {
|
|
73
72
|
className: (0, _runtime.ax)(["_1reo1wug _18m91wug _4t3i1pna _1e0c11p5", "_19itia51 _n7zl1mpn _13li1mok _qrwq1mok _1itkz1kv _12vemgnk _1lrw1sd4 _qmxj1c00"])
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
._2rko12b0{border-radius:var(--ds-radius-small,4px)}._1bsb1pna{width:420px}
|
|
2
|
-
._4t3i7iqz{height:87pt}
|
|
1
|
+
._2rko12b0{border-radius:var(--ds-radius-small,4px)}._1bsb1pna{width:420px}
|
|
@@ -17,13 +17,11 @@ var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu/drop
|
|
|
17
17
|
var _dropdownMenuItem = _interopRequireDefault(require("@atlaskit/dropdown-menu/dropdown-menu-item"));
|
|
18
18
|
var _dropdownMenuItemGroup = _interopRequireDefault(require("@atlaskit/dropdown-menu/dropdown-menu-item-group"));
|
|
19
19
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/core/chevron-down"));
|
|
20
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
21
20
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
22
21
|
var _messages = require("./messages");
|
|
23
22
|
var _excluded = ["triggerRef"];
|
|
24
23
|
var styles = {
|
|
25
|
-
dropDownItemGroupStyles: "_2rko12b0 _1bsb1pna
|
|
26
|
-
dropDownItemGroupStylesWithoutFixedHeight: "_2rko12b0 _1bsb1pna"
|
|
24
|
+
dropDownItemGroupStyles: "_2rko12b0 _1bsb1pna"
|
|
27
25
|
};
|
|
28
26
|
var InlineIcon = /*#__PURE__*/_react.default.createElement("svg", {
|
|
29
27
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -73,7 +71,7 @@ var DisplayViewDropDown = exports.DisplayViewDropDown = function DisplayViewDrop
|
|
|
73
71
|
},
|
|
74
72
|
testId: "datasource-modal--view-drop-down"
|
|
75
73
|
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
76
|
-
xcss:
|
|
74
|
+
xcss: styles.dropDownItemGroupStyles
|
|
77
75
|
}, /*#__PURE__*/_react.default.createElement(_dropdownMenuItemGroup.default, null, /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
78
76
|
testId: "dropdown-item-table",
|
|
79
77
|
onClick: function onClick() {
|
|
@@ -21,7 +21,6 @@ var _modalBody = _interopRequireDefault(require("@atlaskit/modal-dialog/modal-bo
|
|
|
21
21
|
var _modalFooter = _interopRequireDefault(require("@atlaskit/modal-dialog/modal-footer"));
|
|
22
22
|
var _modalHeader = _interopRequireDefault(require("@atlaskit/modal-dialog/modal-header"));
|
|
23
23
|
var _modalTitle = _interopRequireDefault(require("@atlaskit/modal-dialog/modal-title"));
|
|
24
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
25
24
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
26
25
|
var _analytics = require("../../../analytics");
|
|
27
26
|
var _types = require("../../../analytics/types");
|
|
@@ -161,7 +160,7 @@ var PlainConfluenceSearchConfigModal = exports.PlainConfluenceSearchConfigModal
|
|
|
161
160
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
162
161
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
163
162
|
// the rows, instead of replacing the whole table with it.
|
|
164
|
-
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
163
|
+
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
165
164
|
var hasConfluenceSearchParams = selectedConfluenceSite && (parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
|
|
166
165
|
var selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
|
|
167
166
|
var confluenceSearchUrl = (0, _react.useMemo)(function () {
|
|
@@ -193,7 +193,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
193
193
|
var isResolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
194
194
|
// With columns available the table can keep its headers and footer and show the empty state
|
|
195
195
|
// in place of the rows, instead of replacing the whole view with it.
|
|
196
|
-
var shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns
|
|
196
|
+
var shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns;
|
|
197
197
|
if (isResolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
|
|
198
198
|
return /*#__PURE__*/React.createElement(_noResults.NoResults, null);
|
|
199
199
|
}
|
|
@@ -395,7 +395,7 @@ var IssueLikeDataTableView = exports.IssueLikeDataTableView = function IssueLike
|
|
|
395
395
|
|
|
396
396
|
// A resolved response with no items still carries column metadata, so the table can keep its
|
|
397
397
|
// headers and render the empty state where the rows would normally be.
|
|
398
|
-
var hasNoResults = status === 'resolved' && !hasData
|
|
398
|
+
var hasNoResults = status === 'resolved' && !hasData;
|
|
399
399
|
var _useState7 = (0, _react.useState)(),
|
|
400
400
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
401
401
|
noResultsWidth = _useState8[0],
|
|
@@ -149,7 +149,7 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
149
149
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
150
150
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
151
151
|
// the rows, instead of replacing the whole table with it.
|
|
152
|
-
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
152
|
+
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
153
153
|
var jqlUrlUnwrapped = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(jql));
|
|
154
154
|
var jqlUrl = jqlUrlUnwrapped && (0, _fg.fg)('electric_issue_like_table_xpc_url_wrapping') ? wrapCrossProductUrl(jqlUrlUnwrapped) : jqlUrlUnwrapped;
|
|
155
155
|
var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
3
|
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
4
|
+
import { fetchIsUnitsEnabledForAssets } from '../services/fetchIsUnitsEnabledForAssets';
|
|
4
5
|
import { fetchObjectSchema } from '../services/fetchObjectSchema';
|
|
5
6
|
import { fetchObjectSchemas } from '../services/fetchObjectSchemas';
|
|
6
7
|
import { getMeta } from '../services/getMeta';
|
|
@@ -40,10 +41,11 @@ export const useAssetsClient = initialParameters => {
|
|
|
40
41
|
setLoading(true);
|
|
41
42
|
setWorkspaceError(undefined);
|
|
42
43
|
try {
|
|
43
|
-
// When the gate is on
|
|
44
|
-
// workspace; on any failure fall back to the legacy current-site lookup.
|
|
44
|
+
// When the gate is on, a cloudId is present and Units is enabled for Assets, resolve
|
|
45
|
+
// the primary Unit workspace; on any failure fall back to the legacy current-site lookup.
|
|
45
46
|
let workspaceId;
|
|
46
|
-
|
|
47
|
+
const isUnitsEnabledForAssets = fg('astral_units_workspace_host_resolver') && !!cloudId && (await fetchIsUnitsEnabledForAssets(cloudId));
|
|
48
|
+
if (isUnitsEnabledForAssets) {
|
|
47
49
|
try {
|
|
48
50
|
({
|
|
49
51
|
workspaceId
|
|
@@ -2,7 +2,6 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
2
2
|
import isEqual from 'lodash/isEqual';
|
|
3
3
|
import { isFedRamp } from '@atlaskit/atlassian-context/is-fedramp';
|
|
4
4
|
import { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from '@atlaskit/link-client-extension/use-data-source-client-extension';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
5
|
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
7
6
|
import { useDatasourceActions } from '../state';
|
|
8
7
|
import { useDiscoverActions } from '../state/actions/useDiscoverActions';
|
|
@@ -234,8 +233,7 @@ export const useDatasourceTableState = ({
|
|
|
234
233
|
|
|
235
234
|
// A response with no items still describes its columns, so the schema is worth applying
|
|
236
235
|
// to let the table keep its headers while showing the empty state.
|
|
237
|
-
|
|
238
|
-
if ((isSchemaFromData && schema || fullSchema.properties.length > 0) && (items.length > 0 || shouldApplySchemaWithoutItems)) {
|
|
236
|
+
if (isSchemaFromData && schema || fullSchema.properties.length > 0) {
|
|
239
237
|
applySchemaProperties(schema || fullSchema, fieldKeys);
|
|
240
238
|
}
|
|
241
239
|
const isUserLoadingNextPage = responseItems.length !== 0 && !shouldRequestFirstPage;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { request } from '@atlaskit/linking-common/api';
|
|
2
|
+
const UNITS_ENABLED_TTL_MS = 15 * 60 * 1000;
|
|
3
|
+
const UNITS_ENABLED_ERROR_TTL_MS = 60 * 1000;
|
|
4
|
+
const cache = new Map();
|
|
5
|
+
const performFetch = async cloudId => {
|
|
6
|
+
try {
|
|
7
|
+
const res = await request('get', '/assets/is-multi-site', undefined, {
|
|
8
|
+
'x-atlassian-cloud-id': cloudId
|
|
9
|
+
}, [200]);
|
|
10
|
+
return {
|
|
11
|
+
enabled: (res === null || res === void 0 ? void 0 : res.isUnitsEnabledForAssets) === true,
|
|
12
|
+
ttlMs: UNITS_ENABLED_TTL_MS
|
|
13
|
+
};
|
|
14
|
+
} catch {
|
|
15
|
+
// Fail closed.
|
|
16
|
+
return {
|
|
17
|
+
enabled: false,
|
|
18
|
+
ttlMs: UNITS_ENABLED_ERROR_TTL_MS
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
// Whether Units is enabled for Assets on this tenant. Single-flight and cached per
|
|
24
|
+
// cloudId (short TTL after a failure). Resolves false on any failure so callers fall
|
|
25
|
+
// back to the legacy current-site lookup.
|
|
26
|
+
export const fetchIsUnitsEnabledForAssets = cloudId => {
|
|
27
|
+
const cached = cache.get(cloudId);
|
|
28
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
29
|
+
return cached.promise;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Pending entries never expire, so concurrent callers share one request.
|
|
33
|
+
const entry = {
|
|
34
|
+
expiresAt: Infinity,
|
|
35
|
+
promise: Promise.resolve(false)
|
|
36
|
+
};
|
|
37
|
+
entry.promise = performFetch(cloudId).then(({
|
|
38
|
+
enabled,
|
|
39
|
+
ttlMs
|
|
40
|
+
}) => {
|
|
41
|
+
entry.expiresAt = Date.now() + ttlMs;
|
|
42
|
+
return enabled;
|
|
43
|
+
});
|
|
44
|
+
cache.set(cloudId, entry);
|
|
45
|
+
return entry.promise;
|
|
46
|
+
};
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* `linkedAssetsWorkspaceId` is the workspace of the Unit's primary Assets site.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/** Wire shape of the `/assets/is-multi-site` response. */
|
|
7
|
+
|
|
6
8
|
// These are to enforce the field "name" property and keep everything typed
|
|
7
9
|
export const objectSchemaKey = 'objectSchema';
|
|
8
10
|
export const aqlKey = 'aql';
|
|
@@ -3,7 +3,6 @@ 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 { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
6
|
import { AccessRequired } from '../../../common/error-state/access-required';
|
|
8
7
|
import { ModalLoadingError } from '../../../common/error-state/modal-loading-error';
|
|
9
8
|
import { NoResults } from '../../../common/error-state/no-results';
|
|
@@ -50,7 +49,7 @@ export const RenderAssetsContent = props => {
|
|
|
50
49
|
const resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
51
50
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
52
51
|
// the rows, instead of replacing the whole table with it.
|
|
53
|
-
const shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
52
|
+
const shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
54
53
|
const issueLikeDataTableView = useMemo(() => /*#__PURE__*/React.createElement("div", {
|
|
55
54
|
className: ax(["_1reo1wug _18m91wug _4t3i1pna _1e0c11p5", "_19itia51 _n7zl1mpn _13li1mok _qrwq1mok _1itkz1kv _12vemgnk _1lrw1sd4 _qmxj1c00"])
|
|
56
55
|
}, /*#__PURE__*/React.createElement(IssueLikeDataTableView, {
|
package/dist/es2019/ui/common/modal/display-view-dropdown/display-view-drop-down.compiled.css
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
._2rko12b0{border-radius:var(--ds-radius-small,4px)}._1bsb1pna{width:420px}
|
|
2
|
-
._4t3i7iqz{height:87pt}
|
|
1
|
+
._2rko12b0{border-radius:var(--ds-radius-small,4px)}._1bsb1pna{width:420px}
|
|
@@ -9,12 +9,10 @@ import DropdownMenu from '@atlaskit/dropdown-menu/dropdown-menu';
|
|
|
9
9
|
import DropdownItem from '@atlaskit/dropdown-menu/dropdown-menu-item';
|
|
10
10
|
import DropdownItemGroup from '@atlaskit/dropdown-menu/dropdown-menu-item-group';
|
|
11
11
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
12
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
13
12
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
14
13
|
import { displayViewDropDownMessages } from './messages';
|
|
15
14
|
const styles = {
|
|
16
|
-
dropDownItemGroupStyles: "_2rko12b0 _1bsb1pna
|
|
17
|
-
dropDownItemGroupStylesWithoutFixedHeight: "_2rko12b0 _1bsb1pna"
|
|
15
|
+
dropDownItemGroupStyles: "_2rko12b0 _1bsb1pna"
|
|
18
16
|
};
|
|
19
17
|
const InlineIcon = /*#__PURE__*/React.createElement("svg", {
|
|
20
18
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -63,7 +61,7 @@ export const DisplayViewDropDown = ({
|
|
|
63
61
|
}), triggerText),
|
|
64
62
|
testId: "datasource-modal--view-drop-down"
|
|
65
63
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
66
|
-
xcss:
|
|
64
|
+
xcss: styles.dropDownItemGroupStyles
|
|
67
65
|
}, /*#__PURE__*/React.createElement(DropdownItemGroup, null, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
68
66
|
testId: "dropdown-item-table",
|
|
69
67
|
onClick: () => onViewModeChange('table'),
|
|
@@ -12,7 +12,6 @@ import ModalBody from '@atlaskit/modal-dialog/modal-body';
|
|
|
12
12
|
import ModalFooter from '@atlaskit/modal-dialog/modal-footer';
|
|
13
13
|
import ModalHeader from '@atlaskit/modal-dialog/modal-header';
|
|
14
14
|
import ModalTitle from '@atlaskit/modal-dialog/modal-title';
|
|
15
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
16
15
|
import { Box, Flex } from '@atlaskit/primitives/compiled';
|
|
17
16
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
18
17
|
import { DatasourceAction, DatasourceSearchMethod } from '../../../analytics/types';
|
|
@@ -157,7 +156,7 @@ export const PlainConfluenceSearchConfigModal = props => {
|
|
|
157
156
|
const resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
158
157
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
159
158
|
// the rows, instead of replacing the whole table with it.
|
|
160
|
-
const shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
159
|
+
const shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
161
160
|
const hasConfluenceSearchParams = selectedConfluenceSite && (parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
|
|
162
161
|
const selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
|
|
163
162
|
const confluenceSearchUrl = useMemo(() => {
|
|
@@ -178,7 +178,7 @@ const DatasourceTableViewWithoutAnalytics = ({
|
|
|
178
178
|
const isResolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
179
179
|
// With columns available the table can keep its headers and footer and show the empty state
|
|
180
180
|
// in place of the rows, instead of replacing the whole view with it.
|
|
181
|
-
const shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns
|
|
181
|
+
const shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns;
|
|
182
182
|
if (isResolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
|
|
183
183
|
return /*#__PURE__*/React.createElement(NoResults, null);
|
|
184
184
|
}
|
|
@@ -344,7 +344,7 @@ export const IssueLikeDataTableView = ({
|
|
|
344
344
|
|
|
345
345
|
// A resolved response with no items still carries column metadata, so the table can keep its
|
|
346
346
|
// headers and render the empty state where the rows would normally be.
|
|
347
|
-
const hasNoResults = status === 'resolved' && !hasData
|
|
347
|
+
const hasNoResults = status === 'resolved' && !hasData;
|
|
348
348
|
const [noResultsWidth, setNoResultsWidth] = useState();
|
|
349
349
|
useEffect(() => {
|
|
350
350
|
const container = containerRef.current;
|
|
@@ -133,7 +133,7 @@ const PlainJiraIssuesConfigModal = props => {
|
|
|
133
133
|
const resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
134
134
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
135
135
|
// the rows, instead of replacing the whole table with it.
|
|
136
|
-
const shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
136
|
+
const shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
137
137
|
const jqlUrlUnwrapped = selectedJiraSite && jql && `${selectedJiraSite.url}/issues/?jql=${encodeURI(jql)}`;
|
|
138
138
|
const jqlUrl = jqlUrlUnwrapped && fg('electric_issue_like_table_xpc_url_wrapping') ? wrapCrossProductUrl(jqlUrlUnwrapped) : jqlUrlUnwrapped;
|
|
139
139
|
const shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
@@ -4,6 +4,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
4
4
|
import { useEffect, useState } from 'react';
|
|
5
5
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
6
6
|
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
7
|
+
import { fetchIsUnitsEnabledForAssets } from '../services/fetchIsUnitsEnabledForAssets';
|
|
7
8
|
import { fetchObjectSchema } from '../services/fetchObjectSchema';
|
|
8
9
|
import { fetchObjectSchemas } from '../services/fetchObjectSchemas';
|
|
9
10
|
import { getMeta } from '../services/getMeta';
|
|
@@ -63,89 +64,100 @@ export var useAssetsClient = function useAssetsClient(initialParameters) {
|
|
|
63
64
|
*/
|
|
64
65
|
useEffect(function () {
|
|
65
66
|
_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
66
|
-
var _workspaceId, _yield$resolvePrimary, fetchedObjectSchema, fetchedObjectSchemasResponse, _t, _t2, _t3, _t4;
|
|
67
|
+
var _workspaceId, isUnitsEnabledForAssets, _yield$resolvePrimary, fetchedObjectSchema, fetchedObjectSchemasResponse, _t, _t2, _t3, _t4, _t5;
|
|
67
68
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
68
69
|
while (1) switch (_context.prev = _context.next) {
|
|
69
70
|
case 0:
|
|
70
71
|
setLoading(true);
|
|
71
72
|
setWorkspaceError(undefined);
|
|
72
73
|
_context.prev = 1;
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
_t = fg('astral_units_workspace_host_resolver') && !!cloudId;
|
|
75
|
+
if (!_t) {
|
|
76
|
+
_context.next = 3;
|
|
75
77
|
break;
|
|
76
78
|
}
|
|
77
|
-
_context.
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
_context.next = 2;
|
|
80
|
+
return fetchIsUnitsEnabledForAssets(cloudId);
|
|
81
|
+
case 2:
|
|
82
|
+
_t = _context.sent;
|
|
80
83
|
case 3:
|
|
84
|
+
isUnitsEnabledForAssets = _t;
|
|
85
|
+
if (!isUnitsEnabledForAssets) {
|
|
86
|
+
_context.next = 9;
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
_context.prev = 4;
|
|
90
|
+
_context.next = 5;
|
|
91
|
+
return resolvePrimaryWorkspace(cloudId);
|
|
92
|
+
case 5:
|
|
81
93
|
_yield$resolvePrimary = _context.sent;
|
|
82
94
|
_workspaceId = _yield$resolvePrimary.workspaceId;
|
|
83
|
-
_context.next =
|
|
95
|
+
_context.next = 8;
|
|
84
96
|
break;
|
|
85
|
-
case
|
|
86
|
-
_context.prev =
|
|
87
|
-
|
|
88
|
-
_context.next =
|
|
97
|
+
case 6:
|
|
98
|
+
_context.prev = 6;
|
|
99
|
+
_t2 = _context["catch"](4);
|
|
100
|
+
_context.next = 7;
|
|
89
101
|
return getWorkspaceId(fireEvent);
|
|
90
|
-
case
|
|
102
|
+
case 7:
|
|
91
103
|
_workspaceId = _context.sent;
|
|
92
|
-
case
|
|
93
|
-
_context.next =
|
|
104
|
+
case 8:
|
|
105
|
+
_context.next = 11;
|
|
94
106
|
break;
|
|
95
|
-
case
|
|
96
|
-
_context.next =
|
|
107
|
+
case 9:
|
|
108
|
+
_context.next = 10;
|
|
97
109
|
return getWorkspaceId(fireEvent);
|
|
98
|
-
case
|
|
110
|
+
case 10:
|
|
99
111
|
_workspaceId = _context.sent;
|
|
100
|
-
case
|
|
112
|
+
case 11:
|
|
101
113
|
setWorkspaceId(_workspaceId);
|
|
102
114
|
// Check schema from initial parameters still exists and fetch name/permissions for schema select
|
|
103
115
|
if (!(initialParameters !== null && initialParameters !== void 0 && initialParameters.schemaId)) {
|
|
104
|
-
_context.next =
|
|
116
|
+
_context.next = 15;
|
|
105
117
|
break;
|
|
106
118
|
}
|
|
107
|
-
_context.prev =
|
|
108
|
-
_context.next =
|
|
119
|
+
_context.prev = 12;
|
|
120
|
+
_context.next = 13;
|
|
109
121
|
return fetchObjectSchema(_workspaceId, initialParameters === null || initialParameters === void 0 ? void 0 : initialParameters.schemaId, fireEvent);
|
|
110
|
-
case
|
|
122
|
+
case 13:
|
|
111
123
|
fetchedObjectSchema = _context.sent;
|
|
112
124
|
setExistingObjectSchema(fetchedObjectSchema);
|
|
113
|
-
_context.next =
|
|
125
|
+
_context.next = 15;
|
|
114
126
|
break;
|
|
115
|
-
case 12:
|
|
116
|
-
_context.prev = 12;
|
|
117
|
-
_t2 = _context["catch"](10);
|
|
118
|
-
handleAssetsClientErrors(setExistingObjectSchemaError, _t2);
|
|
119
|
-
case 13:
|
|
120
|
-
_context.prev = 13;
|
|
121
|
-
_context.next = 14;
|
|
122
|
-
return fetchObjectSchemas(_workspaceId, undefined, fireEvent);
|
|
123
127
|
case 14:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
_context.next = 16;
|
|
128
|
-
break;
|
|
128
|
+
_context.prev = 14;
|
|
129
|
+
_t3 = _context["catch"](12);
|
|
130
|
+
handleAssetsClientErrors(setExistingObjectSchemaError, _t3);
|
|
129
131
|
case 15:
|
|
130
132
|
_context.prev = 15;
|
|
131
|
-
|
|
132
|
-
|
|
133
|
+
_context.next = 16;
|
|
134
|
+
return fetchObjectSchemas(_workspaceId, undefined, fireEvent);
|
|
133
135
|
case 16:
|
|
136
|
+
fetchedObjectSchemasResponse = _context.sent;
|
|
137
|
+
setObjectSchemas(fetchedObjectSchemasResponse.values);
|
|
138
|
+
setTotalObjectSchemas(fetchedObjectSchemasResponse.total);
|
|
134
139
|
_context.next = 18;
|
|
135
140
|
break;
|
|
136
141
|
case 17:
|
|
137
142
|
_context.prev = 17;
|
|
138
|
-
_t4 = _context["catch"](
|
|
139
|
-
handleAssetsClientErrors(
|
|
143
|
+
_t4 = _context["catch"](15);
|
|
144
|
+
handleAssetsClientErrors(setObjectSchemasError, _t4);
|
|
140
145
|
case 18:
|
|
141
|
-
_context.
|
|
142
|
-
|
|
143
|
-
return _context.finish(18);
|
|
146
|
+
_context.next = 20;
|
|
147
|
+
break;
|
|
144
148
|
case 19:
|
|
149
|
+
_context.prev = 19;
|
|
150
|
+
_t5 = _context["catch"](1);
|
|
151
|
+
handleAssetsClientErrors(setWorkspaceError, _t5);
|
|
152
|
+
case 20:
|
|
153
|
+
_context.prev = 20;
|
|
154
|
+
setLoading(false);
|
|
155
|
+
return _context.finish(20);
|
|
156
|
+
case 21:
|
|
145
157
|
case "end":
|
|
146
158
|
return _context.stop();
|
|
147
159
|
}
|
|
148
|
-
}, _callee, null, [[1,
|
|
160
|
+
}, _callee, null, [[1, 19, 20, 21], [4, 6], [12, 14], [15, 17]]);
|
|
149
161
|
}))();
|
|
150
162
|
}, [initialParameters, fireEvent, cloudId]);
|
|
151
163
|
return {
|
|
@@ -6,7 +6,6 @@ import { useCallback, useEffect, useRef, useState } from 'react';
|
|
|
6
6
|
import isEqual from 'lodash/isEqual';
|
|
7
7
|
import { isFedRamp } from '@atlaskit/atlassian-context/is-fedramp';
|
|
8
8
|
import { DEFAULT_GET_DATASOURCE_DATA_PAGE_SIZE, useDatasourceClientExtension } from '@atlaskit/link-client-extension/use-data-source-client-extension';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
9
|
import { useDatasourceAnalyticsEvents } from '../analytics';
|
|
11
10
|
import { useDatasourceActions } from '../state';
|
|
12
11
|
import { useDiscoverActions } from '../state/actions/useDiscoverActions';
|
|
@@ -232,7 +231,6 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
232
231
|
entityType,
|
|
233
232
|
newIds,
|
|
234
233
|
aris,
|
|
235
|
-
shouldApplySchemaWithoutItems,
|
|
236
234
|
isUserLoadingNextPage,
|
|
237
235
|
currentLoadedItemCount,
|
|
238
236
|
newlyLoadedItemCount,
|
|
@@ -346,8 +344,7 @@ export var useDatasourceTableState = function useDatasourceTableState(_ref) {
|
|
|
346
344
|
|
|
347
345
|
// A response with no items still describes its columns, so the schema is worth applying
|
|
348
346
|
// to let the table keep its headers while showing the empty state.
|
|
349
|
-
|
|
350
|
-
if ((isSchemaFromData && schema || fullSchema.properties.length > 0) && (items.length > 0 || shouldApplySchemaWithoutItems)) {
|
|
347
|
+
if (isSchemaFromData && schema || fullSchema.properties.length > 0) {
|
|
351
348
|
applySchemaProperties(schema || fullSchema, fieldKeys);
|
|
352
349
|
}
|
|
353
350
|
isUserLoadingNextPage = responseItems.length !== 0 && !shouldRequestFirstPage;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
|
+
import { request } from '@atlaskit/linking-common/api';
|
|
4
|
+
var UNITS_ENABLED_TTL_MS = 15 * 60 * 1000;
|
|
5
|
+
var UNITS_ENABLED_ERROR_TTL_MS = 60 * 1000;
|
|
6
|
+
var cache = new Map();
|
|
7
|
+
var performFetch = /*#__PURE__*/function () {
|
|
8
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(cloudId) {
|
|
9
|
+
var res, _t;
|
|
10
|
+
return _regeneratorRuntime.wrap(function (_context) {
|
|
11
|
+
while (1) switch (_context.prev = _context.next) {
|
|
12
|
+
case 0:
|
|
13
|
+
_context.prev = 0;
|
|
14
|
+
_context.next = 1;
|
|
15
|
+
return request('get', '/assets/is-multi-site', undefined, {
|
|
16
|
+
'x-atlassian-cloud-id': cloudId
|
|
17
|
+
}, [200]);
|
|
18
|
+
case 1:
|
|
19
|
+
res = _context.sent;
|
|
20
|
+
return _context.abrupt("return", {
|
|
21
|
+
enabled: (res === null || res === void 0 ? void 0 : res.isUnitsEnabledForAssets) === true,
|
|
22
|
+
ttlMs: UNITS_ENABLED_TTL_MS
|
|
23
|
+
});
|
|
24
|
+
case 2:
|
|
25
|
+
_context.prev = 2;
|
|
26
|
+
_t = _context["catch"](0);
|
|
27
|
+
return _context.abrupt("return", {
|
|
28
|
+
enabled: false,
|
|
29
|
+
ttlMs: UNITS_ENABLED_ERROR_TTL_MS
|
|
30
|
+
});
|
|
31
|
+
case 3:
|
|
32
|
+
case "end":
|
|
33
|
+
return _context.stop();
|
|
34
|
+
}
|
|
35
|
+
}, _callee, null, [[0, 2]]);
|
|
36
|
+
}));
|
|
37
|
+
return function performFetch(_x) {
|
|
38
|
+
return _ref.apply(this, arguments);
|
|
39
|
+
};
|
|
40
|
+
}();
|
|
41
|
+
|
|
42
|
+
// Whether Units is enabled for Assets on this tenant. Single-flight and cached per
|
|
43
|
+
// cloudId (short TTL after a failure). Resolves false on any failure so callers fall
|
|
44
|
+
// back to the legacy current-site lookup.
|
|
45
|
+
export var fetchIsUnitsEnabledForAssets = function fetchIsUnitsEnabledForAssets(cloudId) {
|
|
46
|
+
var cached = cache.get(cloudId);
|
|
47
|
+
if (cached && Date.now() < cached.expiresAt) {
|
|
48
|
+
return cached.promise;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Pending entries never expire, so concurrent callers share one request.
|
|
52
|
+
var entry = {
|
|
53
|
+
expiresAt: Infinity,
|
|
54
|
+
promise: Promise.resolve(false)
|
|
55
|
+
};
|
|
56
|
+
entry.promise = performFetch(cloudId).then(function (_ref2) {
|
|
57
|
+
var enabled = _ref2.enabled,
|
|
58
|
+
ttlMs = _ref2.ttlMs;
|
|
59
|
+
entry.expiresAt = Date.now() + ttlMs;
|
|
60
|
+
return enabled;
|
|
61
|
+
});
|
|
62
|
+
cache.set(cloudId, entry);
|
|
63
|
+
return entry.promise;
|
|
64
|
+
};
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* `linkedAssetsWorkspaceId` is the workspace of the Unit's primary Assets site.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
/** Wire shape of the `/assets/is-multi-site` response. */
|
|
7
|
+
|
|
6
8
|
// These are to enforce the field "name" property and keep everything typed
|
|
7
9
|
export var objectSchemaKey = 'objectSchema';
|
|
8
10
|
export var aqlKey = 'aql';
|
|
@@ -3,7 +3,6 @@ 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 { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
7
6
|
import { AccessRequired } from '../../../common/error-state/access-required';
|
|
8
7
|
import { ModalLoadingError } from '../../../common/error-state/modal-loading-error';
|
|
9
8
|
import { NoResults } from '../../../common/error-state/no-results';
|
|
@@ -58,7 +57,7 @@ export var RenderAssetsContent = function RenderAssetsContent(props) {
|
|
|
58
57
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
59
58
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
60
59
|
// the rows, instead of replacing the whole table with it.
|
|
61
|
-
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
60
|
+
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
62
61
|
var issueLikeDataTableView = useMemo(function () {
|
|
63
62
|
return /*#__PURE__*/React.createElement("div", {
|
|
64
63
|
className: ax(["_1reo1wug _18m91wug _4t3i1pna _1e0c11p5", "_19itia51 _n7zl1mpn _13li1mok _qrwq1mok _1itkz1kv _12vemgnk _1lrw1sd4 _qmxj1c00"])
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
._2rko12b0{border-radius:var(--ds-radius-small,4px)}._1bsb1pna{width:420px}
|
|
2
|
-
._4t3i7iqz{height:87pt}
|
|
1
|
+
._2rko12b0{border-radius:var(--ds-radius-small,4px)}._1bsb1pna{width:420px}
|
|
@@ -11,12 +11,10 @@ import DropdownMenu from '@atlaskit/dropdown-menu/dropdown-menu';
|
|
|
11
11
|
import DropdownItem from '@atlaskit/dropdown-menu/dropdown-menu-item';
|
|
12
12
|
import DropdownItemGroup from '@atlaskit/dropdown-menu/dropdown-menu-item-group';
|
|
13
13
|
import ChevronDownIcon from '@atlaskit/icon/core/chevron-down';
|
|
14
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
15
14
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
16
15
|
import { displayViewDropDownMessages } from './messages';
|
|
17
16
|
var styles = {
|
|
18
|
-
dropDownItemGroupStyles: "_2rko12b0 _1bsb1pna
|
|
19
|
-
dropDownItemGroupStylesWithoutFixedHeight: "_2rko12b0 _1bsb1pna"
|
|
17
|
+
dropDownItemGroupStyles: "_2rko12b0 _1bsb1pna"
|
|
20
18
|
};
|
|
21
19
|
var InlineIcon = /*#__PURE__*/React.createElement("svg", {
|
|
22
20
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -66,7 +64,7 @@ export var DisplayViewDropDown = function DisplayViewDropDown(_ref) {
|
|
|
66
64
|
},
|
|
67
65
|
testId: "datasource-modal--view-drop-down"
|
|
68
66
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
69
|
-
xcss:
|
|
67
|
+
xcss: styles.dropDownItemGroupStyles
|
|
70
68
|
}, /*#__PURE__*/React.createElement(DropdownItemGroup, null, /*#__PURE__*/React.createElement(DropdownItem, {
|
|
71
69
|
testId: "dropdown-item-table",
|
|
72
70
|
onClick: function onClick() {
|
|
@@ -15,7 +15,6 @@ import ModalBody from '@atlaskit/modal-dialog/modal-body';
|
|
|
15
15
|
import ModalFooter from '@atlaskit/modal-dialog/modal-footer';
|
|
16
16
|
import ModalHeader from '@atlaskit/modal-dialog/modal-header';
|
|
17
17
|
import ModalTitle from '@atlaskit/modal-dialog/modal-title';
|
|
18
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
19
18
|
import { Box, Flex } from '@atlaskit/primitives/compiled';
|
|
20
19
|
import { useDatasourceAnalyticsEvents } from '../../../analytics';
|
|
21
20
|
import { DatasourceAction, DatasourceSearchMethod } from '../../../analytics/types';
|
|
@@ -152,7 +151,7 @@ export var PlainConfluenceSearchConfigModal = function PlainConfluenceSearchConf
|
|
|
152
151
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
153
152
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
154
153
|
// the rows, instead of replacing the whole table with it.
|
|
155
|
-
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
154
|
+
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
156
155
|
var hasConfluenceSearchParams = selectedConfluenceSite && (parameters === null || parameters === void 0 ? void 0 : parameters.searchString);
|
|
157
156
|
var selectedConfluenceSiteUrl = selectedConfluenceSite === null || selectedConfluenceSite === void 0 ? void 0 : selectedConfluenceSite.url;
|
|
158
157
|
var confluenceSearchUrl = useMemo(function () {
|
|
@@ -184,7 +184,7 @@ var DatasourceTableViewWithoutAnalytics = function DatasourceTableViewWithoutAna
|
|
|
184
184
|
var isResolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
185
185
|
// With columns available the table can keep its headers and footer and show the empty state
|
|
186
186
|
// in place of the rows, instead of replacing the whole view with it.
|
|
187
|
-
var shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns
|
|
187
|
+
var shouldRenderTableWithNoResults = isResolvedWithNoResults && hasColumns;
|
|
188
188
|
if (isResolvedWithNoResults && !shouldRenderTableWithNoResults || status === 'forbidden') {
|
|
189
189
|
return /*#__PURE__*/React.createElement(NoResults, null);
|
|
190
190
|
}
|
|
@@ -388,7 +388,7 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref7) {
|
|
|
388
388
|
|
|
389
389
|
// A resolved response with no items still carries column metadata, so the table can keep its
|
|
390
390
|
// headers and render the empty state where the rows would normally be.
|
|
391
|
-
var hasNoResults = status === 'resolved' && !hasData
|
|
391
|
+
var hasNoResults = status === 'resolved' && !hasData;
|
|
392
392
|
var _useState7 = useState(),
|
|
393
393
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
394
394
|
noResultsWidth = _useState8[0],
|
|
@@ -142,7 +142,7 @@ var PlainJiraIssuesConfigModal = function PlainJiraIssuesConfigModal(props) {
|
|
|
142
142
|
var resolvedWithNoResults = status === 'resolved' && !responseItems.length;
|
|
143
143
|
// With columns available the table can keep its headers and show the empty state in place of
|
|
144
144
|
// the rows, instead of replacing the whole table with it.
|
|
145
|
-
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length
|
|
145
|
+
var shouldRenderTableWithNoResults = resolvedWithNoResults && !!columns.length;
|
|
146
146
|
var jqlUrlUnwrapped = selectedJiraSite && jql && "".concat(selectedJiraSite.url, "/issues/?jql=").concat(encodeURI(jql));
|
|
147
147
|
var jqlUrl = jqlUrlUnwrapped && fg('electric_issue_like_table_xpc_url_wrapping') ? wrapCrossProductUrl(jqlUrlUnwrapped) : jqlUrlUnwrapped;
|
|
148
148
|
var shouldShowIssueCount = !!totalCount && totalCount !== 1 && currentViewMode === 'table';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchIsUnitsEnabledForAssets: (cloudId: string) => Promise<boolean>;
|
|
@@ -14,6 +14,11 @@ export type ResolvePrimaryWorkspaceResponse = {
|
|
|
14
14
|
linkedAssetsWorkspaceId?: string;
|
|
15
15
|
siteWithJiraUrl?: string;
|
|
16
16
|
};
|
|
17
|
+
/** Wire shape of the `/assets/is-multi-site` response. */
|
|
18
|
+
export type AssetsMultiSiteResponse = {
|
|
19
|
+
isUnitsEnabledForAssets?: boolean;
|
|
20
|
+
multiSite?: boolean;
|
|
21
|
+
};
|
|
17
22
|
export type ObjectSchema = {
|
|
18
23
|
id: string;
|
|
19
24
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/link-datasource",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.2",
|
|
4
4
|
"description": "UI Components to support linking platform dataset feature",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"ak-postbuild": "ls -d dist/* | xargs -n 1 copyfiles -u 1 -V 'src/**/*.{svg,png}'"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@atlaskit/adf-schema": "^57.
|
|
41
|
+
"@atlaskit/adf-schema": "^57.7.0",
|
|
42
42
|
"@atlaskit/afm-i18n-platform-linking-platform-link-datasource": "2.271.0",
|
|
43
43
|
"@atlaskit/analytics-cross-product": "^2.2.0",
|
|
44
44
|
"@atlaskit/analytics-next": "^12.5.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/badge": "^22.0.0",
|
|
49
49
|
"@atlaskit/button": "^25.4.0",
|
|
50
50
|
"@atlaskit/css": "^1.1.0",
|
|
51
|
-
"@atlaskit/datetime-picker": "^19.
|
|
51
|
+
"@atlaskit/datetime-picker": "^19.1.0",
|
|
52
52
|
"@atlaskit/dropdown-menu": "^21.0.0",
|
|
53
53
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
54
54
|
"@atlaskit/empty-state": "^12.2.0",
|
|
@@ -168,9 +168,6 @@
|
|
|
168
168
|
"linking_platform_link_datasource_unit_compliant": {
|
|
169
169
|
"type": "boolean"
|
|
170
170
|
},
|
|
171
|
-
"platform_lp_sllv_ux_improvements": {
|
|
172
|
-
"type": "boolean"
|
|
173
|
-
},
|
|
174
171
|
"platform_lp_sllv_preserve_assets_columns": {
|
|
175
172
|
"type": "boolean"
|
|
176
173
|
},
|