@atlaskit/teams-public 0.19.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/controllers/hooks/use-team-containers/index.js +105 -46
- package/dist/cjs/services/agg-client/index.js +40 -7
- package/dist/cjs/services/agg-client/mocks/index.js +10 -1
- package/dist/cjs/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +12 -0
- package/dist/cjs/services/main.js +37 -12
- package/dist/cjs/ui/team-containers/main.js +1 -0
- package/dist/es2019/controllers/hooks/use-team-containers/index.js +50 -5
- package/dist/es2019/services/agg-client/index.js +15 -2
- package/dist/es2019/services/agg-client/mocks/index.js +9 -0
- package/dist/es2019/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +14 -0
- package/dist/es2019/services/main.js +9 -0
- package/dist/es2019/ui/team-containers/main.js +1 -0
- package/dist/esm/controllers/hooks/use-team-containers/index.js +105 -46
- package/dist/esm/services/agg-client/index.js +40 -7
- package/dist/esm/services/agg-client/mocks/index.js +9 -0
- package/dist/esm/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js +5 -0
- package/dist/esm/services/main.js +37 -12
- package/dist/esm/ui/team-containers/main.js +1 -0
- package/dist/types/controllers/hooks/use-team-containers/index.d.ts +4 -0
- package/dist/types/services/agg-client/index.d.ts +1 -0
- package/dist/types/services/agg-client/mocks/index.d.ts +9 -0
- package/dist/types/services/agg-client/utils/queries/number-of-team-connected-to-container-query.d.ts +11 -0
- package/dist/types/services/main.d.ts +6 -0
- package/dist/types-ts4.5/controllers/hooks/use-team-containers/index.d.ts +4 -0
- package/dist/types-ts4.5/services/agg-client/index.d.ts +1 -0
- package/dist/types-ts4.5/services/agg-client/mocks/index.d.ts +9 -0
- package/dist/types-ts4.5/services/agg-client/utils/queries/number-of-team-connected-to-container-query.d.ts +11 -0
- package/dist/types-ts4.5/services/main.d.ts +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/teams-public
|
|
2
2
|
|
|
3
|
+
## 0.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#132354](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132354)
|
|
8
|
+
[`6a5be2324873a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6a5be2324873a) -
|
|
9
|
+
[ux] add a new query to only fetch number of connected teams
|
|
10
|
+
|
|
11
|
+
## 0.20.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#132367](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/132367)
|
|
16
|
+
[`4e35f939f5756`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/4e35f939f5756) -
|
|
17
|
+
Pass container id to analytics on continer click
|
|
18
|
+
|
|
3
19
|
## 0.19.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useTeamContainersHook = exports.useTeamContainers = exports.useConnectedTeams = void 0;
|
|
8
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
13
|
var _react = require("react");
|
|
14
14
|
var _reactSweetState = require("react-sweet-state");
|
|
@@ -20,7 +20,8 @@ var initialConnectedTeamsState = {
|
|
|
20
20
|
isLoading: false,
|
|
21
21
|
hasLoaded: false,
|
|
22
22
|
teams: undefined,
|
|
23
|
-
error: null
|
|
23
|
+
error: null,
|
|
24
|
+
numberOfTeams: undefined
|
|
24
25
|
};
|
|
25
26
|
var initialState = {
|
|
26
27
|
teamContainers: [],
|
|
@@ -83,10 +84,10 @@ var actions = {
|
|
|
83
84
|
};
|
|
84
85
|
}();
|
|
85
86
|
},
|
|
86
|
-
|
|
87
|
+
fetchNumberOfConnectedTeams: function fetchNumberOfConnectedTeams(containerId) {
|
|
87
88
|
return /*#__PURE__*/function () {
|
|
88
89
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(_ref3) {
|
|
89
|
-
var setState, getState, _getState2, currentContainerId,
|
|
90
|
+
var setState, getState, _getState2, currentContainerId, numberOfTeams;
|
|
90
91
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
91
92
|
while (1) switch (_context2.prev = _context2.next) {
|
|
92
93
|
case 0:
|
|
@@ -97,6 +98,60 @@ var actions = {
|
|
|
97
98
|
break;
|
|
98
99
|
}
|
|
99
100
|
return _context2.abrupt("return");
|
|
101
|
+
case 4:
|
|
102
|
+
setState({
|
|
103
|
+
connectedTeams: _objectSpread(_objectSpread({}, initialConnectedTeamsState), {}, {
|
|
104
|
+
containerId: containerId,
|
|
105
|
+
numberOfTeams: undefined
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
_context2.prev = 5;
|
|
109
|
+
_context2.next = 8;
|
|
110
|
+
return _services.teamsClient.getNumberOfConnectedTeams(containerId);
|
|
111
|
+
case 8:
|
|
112
|
+
numberOfTeams = _context2.sent;
|
|
113
|
+
setState({
|
|
114
|
+
connectedTeams: _objectSpread(_objectSpread({}, initialConnectedTeamsState), {}, {
|
|
115
|
+
containerId: containerId,
|
|
116
|
+
numberOfTeams: numberOfTeams
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
_context2.next = 15;
|
|
120
|
+
break;
|
|
121
|
+
case 12:
|
|
122
|
+
_context2.prev = 12;
|
|
123
|
+
_context2.t0 = _context2["catch"](5);
|
|
124
|
+
setState({
|
|
125
|
+
connectedTeams: _objectSpread(_objectSpread({}, initialConnectedTeamsState), {}, {
|
|
126
|
+
containerId: containerId,
|
|
127
|
+
error: _context2.t0
|
|
128
|
+
})
|
|
129
|
+
});
|
|
130
|
+
case 15:
|
|
131
|
+
case "end":
|
|
132
|
+
return _context2.stop();
|
|
133
|
+
}
|
|
134
|
+
}, _callee2, null, [[5, 12]]);
|
|
135
|
+
}));
|
|
136
|
+
return function (_x2) {
|
|
137
|
+
return _ref4.apply(this, arguments);
|
|
138
|
+
};
|
|
139
|
+
}();
|
|
140
|
+
},
|
|
141
|
+
fetchConnectedTeams: function fetchConnectedTeams(containerId) {
|
|
142
|
+
return /*#__PURE__*/function () {
|
|
143
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(_ref5) {
|
|
144
|
+
var setState, getState, _getState3, _getState3$connectedT, currentContainerId, numberOfTeams, hasLoaded, teams;
|
|
145
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
146
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
147
|
+
case 0:
|
|
148
|
+
setState = _ref5.setState, getState = _ref5.getState;
|
|
149
|
+
_getState3 = getState(), _getState3$connectedT = _getState3.connectedTeams, currentContainerId = _getState3$connectedT.containerId, numberOfTeams = _getState3$connectedT.numberOfTeams, hasLoaded = _getState3$connectedT.hasLoaded;
|
|
150
|
+
if (!(currentContainerId === containerId && hasLoaded)) {
|
|
151
|
+
_context3.next = 4;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
return _context3.abrupt("return");
|
|
100
155
|
case 4:
|
|
101
156
|
setState({
|
|
102
157
|
connectedTeams: {
|
|
@@ -104,71 +159,74 @@ var actions = {
|
|
|
104
159
|
isLoading: true,
|
|
105
160
|
hasLoaded: false,
|
|
106
161
|
teams: undefined,
|
|
107
|
-
error: null
|
|
162
|
+
error: null,
|
|
163
|
+
numberOfTeams: numberOfTeams
|
|
108
164
|
}
|
|
109
165
|
});
|
|
110
|
-
|
|
111
|
-
|
|
166
|
+
_context3.prev = 5;
|
|
167
|
+
_context3.next = 8;
|
|
112
168
|
return _services.teamsClient.getConnectedTeams(containerId);
|
|
113
169
|
case 8:
|
|
114
|
-
teams =
|
|
170
|
+
teams = _context3.sent;
|
|
115
171
|
setState({
|
|
116
172
|
connectedTeams: {
|
|
117
173
|
containerId: containerId,
|
|
118
174
|
isLoading: false,
|
|
119
175
|
hasLoaded: true,
|
|
120
176
|
teams: teams,
|
|
121
|
-
error: null
|
|
177
|
+
error: null,
|
|
178
|
+
numberOfTeams: numberOfTeams
|
|
122
179
|
}
|
|
123
180
|
});
|
|
124
|
-
|
|
181
|
+
_context3.next = 15;
|
|
125
182
|
break;
|
|
126
183
|
case 12:
|
|
127
|
-
|
|
128
|
-
|
|
184
|
+
_context3.prev = 12;
|
|
185
|
+
_context3.t0 = _context3["catch"](5);
|
|
129
186
|
setState({
|
|
130
187
|
connectedTeams: {
|
|
131
188
|
containerId: containerId,
|
|
132
189
|
isLoading: false,
|
|
133
190
|
hasLoaded: false,
|
|
134
191
|
teams: [],
|
|
135
|
-
error:
|
|
192
|
+
error: _context3.t0,
|
|
193
|
+
numberOfTeams: numberOfTeams
|
|
136
194
|
}
|
|
137
195
|
});
|
|
138
196
|
case 15:
|
|
139
197
|
case "end":
|
|
140
|
-
return
|
|
198
|
+
return _context3.stop();
|
|
141
199
|
}
|
|
142
|
-
},
|
|
200
|
+
}, _callee3, null, [[5, 12]]);
|
|
143
201
|
}));
|
|
144
|
-
return function (
|
|
145
|
-
return
|
|
202
|
+
return function (_x3) {
|
|
203
|
+
return _ref6.apply(this, arguments);
|
|
146
204
|
};
|
|
147
205
|
}();
|
|
148
206
|
},
|
|
149
207
|
unlinkTeamContainers: function unlinkTeamContainers(teamId, containerId) {
|
|
150
208
|
return /*#__PURE__*/function () {
|
|
151
|
-
var
|
|
152
|
-
var setState, getState, mutationResult,
|
|
153
|
-
return _regenerator.default.wrap(function
|
|
154
|
-
while (1) switch (
|
|
209
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(_ref7) {
|
|
210
|
+
var setState, getState, mutationResult, _getState4, teamContainers, connectedTeams, newContainers;
|
|
211
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
212
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
155
213
|
case 0:
|
|
156
|
-
setState =
|
|
214
|
+
setState = _ref7.setState, getState = _ref7.getState;
|
|
157
215
|
setState({
|
|
158
216
|
unlinkError: null
|
|
159
217
|
});
|
|
160
|
-
|
|
161
|
-
|
|
218
|
+
_context4.prev = 2;
|
|
219
|
+
_context4.next = 5;
|
|
162
220
|
return _services.teamsClient.unlinkTeamContainer(teamId, containerId);
|
|
163
221
|
case 5:
|
|
164
|
-
mutationResult =
|
|
222
|
+
mutationResult = _context4.sent;
|
|
165
223
|
if (mutationResult.deleteTeamConnectedToContainer.errors.length) {
|
|
166
224
|
// Just handle 1 error at a time should be suffcient as we disconenct only 1 container at a time
|
|
167
225
|
setState({
|
|
168
226
|
unlinkError: mutationResult.deleteTeamConnectedToContainer.errors[0]
|
|
169
227
|
});
|
|
170
228
|
} else {
|
|
171
|
-
|
|
229
|
+
_getState4 = getState(), teamContainers = _getState4.teamContainers, connectedTeams = _getState4.connectedTeams;
|
|
172
230
|
newContainers = teamContainers.filter(function (container) {
|
|
173
231
|
return container.id !== containerId;
|
|
174
232
|
});
|
|
@@ -183,42 +241,42 @@ var actions = {
|
|
|
183
241
|
});
|
|
184
242
|
}
|
|
185
243
|
}
|
|
186
|
-
|
|
244
|
+
_context4.next = 12;
|
|
187
245
|
break;
|
|
188
246
|
case 9:
|
|
189
|
-
|
|
190
|
-
|
|
247
|
+
_context4.prev = 9;
|
|
248
|
+
_context4.t0 = _context4["catch"](2);
|
|
191
249
|
setState({
|
|
192
|
-
unlinkError:
|
|
250
|
+
unlinkError: _context4.t0
|
|
193
251
|
});
|
|
194
252
|
case 12:
|
|
195
253
|
case "end":
|
|
196
|
-
return
|
|
254
|
+
return _context4.stop();
|
|
197
255
|
}
|
|
198
|
-
},
|
|
256
|
+
}, _callee4, null, [[2, 9]]);
|
|
199
257
|
}));
|
|
200
|
-
return function (
|
|
201
|
-
return
|
|
258
|
+
return function (_x4) {
|
|
259
|
+
return _ref8.apply(this, arguments);
|
|
202
260
|
};
|
|
203
261
|
}();
|
|
204
262
|
},
|
|
205
263
|
addTeamContainer: function addTeamContainer(teamContainer) {
|
|
206
264
|
return /*#__PURE__*/function () {
|
|
207
|
-
var
|
|
208
|
-
var setState, getState,
|
|
209
|
-
return _regenerator.default.wrap(function
|
|
210
|
-
while (1) switch (
|
|
265
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(_ref9) {
|
|
266
|
+
var setState, getState, _getState5, teamContainers, connectedTeams, containerExists;
|
|
267
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
268
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
211
269
|
case 0:
|
|
212
|
-
setState =
|
|
213
|
-
|
|
270
|
+
setState = _ref9.setState, getState = _ref9.getState;
|
|
271
|
+
_getState5 = getState(), teamContainers = _getState5.teamContainers, connectedTeams = _getState5.connectedTeams;
|
|
214
272
|
containerExists = teamContainers.some(function (container) {
|
|
215
273
|
return container.id === teamContainer.id;
|
|
216
274
|
});
|
|
217
275
|
if (!containerExists) {
|
|
218
|
-
|
|
276
|
+
_context5.next = 5;
|
|
219
277
|
break;
|
|
220
278
|
}
|
|
221
|
-
return
|
|
279
|
+
return _context5.abrupt("return");
|
|
222
280
|
case 5:
|
|
223
281
|
if (connectedTeams.containerId === teamContainer.id) {
|
|
224
282
|
setState({
|
|
@@ -232,12 +290,12 @@ var actions = {
|
|
|
232
290
|
}
|
|
233
291
|
case 6:
|
|
234
292
|
case "end":
|
|
235
|
-
return
|
|
293
|
+
return _context5.stop();
|
|
236
294
|
}
|
|
237
|
-
},
|
|
295
|
+
}, _callee5);
|
|
238
296
|
}));
|
|
239
|
-
return function (
|
|
240
|
-
return
|
|
297
|
+
return function (_x5) {
|
|
298
|
+
return _ref10.apply(this, arguments);
|
|
241
299
|
};
|
|
242
300
|
}();
|
|
243
301
|
}
|
|
@@ -269,6 +327,7 @@ var useConnectedTeams = exports.useConnectedTeams = function useConnectedTeams()
|
|
|
269
327
|
state = _useTeamContainersHoo4[0],
|
|
270
328
|
actions = _useTeamContainersHoo4[1];
|
|
271
329
|
return _objectSpread(_objectSpread({}, state.connectedTeams), {}, {
|
|
330
|
+
fetchNumberOfConnectedTeams: actions.fetchNumberOfConnectedTeams,
|
|
272
331
|
fetchConnectedTeams: actions.fetchConnectedTeams
|
|
273
332
|
});
|
|
274
333
|
};
|
|
@@ -17,6 +17,7 @@ var _userAri = require("../../common/utils/user-ari");
|
|
|
17
17
|
var _constants = require("../constants");
|
|
18
18
|
var _graphqlClient = require("../graphql-client");
|
|
19
19
|
var _unlinkContainerMutation = require("./utils/mutations/unlink-container-mutation");
|
|
20
|
+
var _numberOfTeamConnectedToContainerQuery = require("./utils/queries/number-of-team-connected-to-container-query");
|
|
20
21
|
var _teamConnectedToContainerQuery = require("./utils/queries/team-connected-to-container-query");
|
|
21
22
|
var _teamContainersQuery = require("./utils/queries/team-containers-query");
|
|
22
23
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
@@ -109,15 +110,47 @@ var AGGClient = exports.AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
|
|
|
109
110
|
return unlinkTeamContainer;
|
|
110
111
|
}()
|
|
111
112
|
}, {
|
|
112
|
-
key: "
|
|
113
|
+
key: "queryNumberOfTeamConnectedToContainer",
|
|
113
114
|
value: function () {
|
|
114
|
-
var
|
|
115
|
+
var _queryNumberOfTeamConnectedToContainer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(containerId) {
|
|
115
116
|
var _response$graphStore;
|
|
116
117
|
var response;
|
|
117
118
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
118
119
|
while (1) switch (_context3.prev = _context3.next) {
|
|
119
120
|
case 0:
|
|
120
121
|
_context3.next = 2;
|
|
122
|
+
return this.makeGraphQLRequest({
|
|
123
|
+
query: _numberOfTeamConnectedToContainerQuery.NumberOfTeamConnectedToContainerQuery,
|
|
124
|
+
variables: {
|
|
125
|
+
containerId: containerId
|
|
126
|
+
}
|
|
127
|
+
}, {
|
|
128
|
+
operationName: 'NumberOfTeamConnectedToContainerQuery'
|
|
129
|
+
});
|
|
130
|
+
case 2:
|
|
131
|
+
response = _context3.sent;
|
|
132
|
+
return _context3.abrupt("return", response === null || response === void 0 || (_response$graphStore = response.graphStore) === null || _response$graphStore === void 0 || (_response$graphStore = _response$graphStore.teamConnectedToContainerInverse) === null || _response$graphStore === void 0 || (_response$graphStore = _response$graphStore.edges) === null || _response$graphStore === void 0 ? void 0 : _response$graphStore.length);
|
|
133
|
+
case 4:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context3.stop();
|
|
136
|
+
}
|
|
137
|
+
}, _callee3, this);
|
|
138
|
+
}));
|
|
139
|
+
function queryNumberOfTeamConnectedToContainer(_x4) {
|
|
140
|
+
return _queryNumberOfTeamConnectedToContainer.apply(this, arguments);
|
|
141
|
+
}
|
|
142
|
+
return queryNumberOfTeamConnectedToContainer;
|
|
143
|
+
}()
|
|
144
|
+
}, {
|
|
145
|
+
key: "queryTeamsConnectedToContainer",
|
|
146
|
+
value: function () {
|
|
147
|
+
var _queryTeamsConnectedToContainer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(containerId) {
|
|
148
|
+
var _response$graphStore2;
|
|
149
|
+
var response;
|
|
150
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
151
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
152
|
+
case 0:
|
|
153
|
+
_context4.next = 2;
|
|
121
154
|
return this.makeGraphQLRequest({
|
|
122
155
|
query: _teamConnectedToContainerQuery.TeamConnectedToContainerQuery,
|
|
123
156
|
variables: {
|
|
@@ -127,8 +160,8 @@ var AGGClient = exports.AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
|
|
|
127
160
|
operationName: 'TeamConnectedToContainerQuery'
|
|
128
161
|
});
|
|
129
162
|
case 2:
|
|
130
|
-
response =
|
|
131
|
-
return
|
|
163
|
+
response = _context4.sent;
|
|
164
|
+
return _context4.abrupt("return", response === null || response === void 0 || (_response$graphStore2 = response.graphStore) === null || _response$graphStore2 === void 0 || (_response$graphStore2 = _response$graphStore2.teamConnectedToContainerInverse) === null || _response$graphStore2 === void 0 || (_response$graphStore2 = _response$graphStore2.edges) === null || _response$graphStore2 === void 0 ? void 0 : _response$graphStore2.map(function (_ref) {
|
|
132
165
|
var _node$members$nodes$m, _node$members, _node$members$nodes$l, _node$members2;
|
|
133
166
|
var node = _ref.node;
|
|
134
167
|
return {
|
|
@@ -162,11 +195,11 @@ var AGGClient = exports.AGGClient = /*#__PURE__*/function (_BaseGraphQlClient) {
|
|
|
162
195
|
}));
|
|
163
196
|
case 4:
|
|
164
197
|
case "end":
|
|
165
|
-
return
|
|
198
|
+
return _context4.stop();
|
|
166
199
|
}
|
|
167
|
-
},
|
|
200
|
+
}, _callee4, this);
|
|
168
201
|
}));
|
|
169
|
-
function queryTeamsConnectedToContainer(
|
|
202
|
+
function queryTeamsConnectedToContainer(_x5) {
|
|
170
203
|
return _queryTeamsConnectedToContainer.apply(this, arguments);
|
|
171
204
|
}
|
|
172
205
|
return queryTeamsConnectedToContainer;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.MOCK_TEAM_CONTAINERS = exports.MOCK_CONNECTED_TEAMS_RESULT = exports.MOCK_CONNECTED_TEAMS = void 0;
|
|
6
|
+
exports.MOCK_TEAM_CONTAINERS = exports.MOCK_NUMBER_OF_CONNECTED_TEAMS = exports.MOCK_CONNECTED_TEAMS_RESULT = exports.MOCK_CONNECTED_TEAMS = void 0;
|
|
7
7
|
var MOCK_TEAM_CONTAINERS = exports.MOCK_TEAM_CONTAINERS = {
|
|
8
8
|
graphStore: {
|
|
9
9
|
cypherQuery: {
|
|
@@ -50,6 +50,15 @@ var MOCK_TEAM_CONTAINERS = exports.MOCK_TEAM_CONTAINERS = {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
var MOCK_NUMBER_OF_CONNECTED_TEAMS = exports.MOCK_NUMBER_OF_CONNECTED_TEAMS = {
|
|
54
|
+
graphStore: {
|
|
55
|
+
teamConnectedToContainerInverse: {
|
|
56
|
+
edges: [{
|
|
57
|
+
id: 'ari:cloud:identity::team/8ee37950-7de7-41ec-aee2-2c02c95949f4'
|
|
58
|
+
}]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
53
62
|
var MOCK_CONNECTED_TEAMS = exports.MOCK_CONNECTED_TEAMS = {
|
|
54
63
|
graphStore: {
|
|
55
64
|
teamConnectedToContainerInverse: {
|
package/dist/cjs/services/agg-client/utils/queries/number-of-team-connected-to-container-query.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.NumberOfTeamConnectedToContainerQuery = void 0;
|
|
8
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _graphql = require("graphql");
|
|
10
|
+
var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
|
|
11
|
+
var _templateObject;
|
|
12
|
+
var NumberOfTeamConnectedToContainerQuery = exports.NumberOfTeamConnectedToContainerQuery = (0, _graphql.print)((0, _graphqlTag.default)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\tquery getNumberOfTeamsForContainer($containerId: ID!) {\n\t\tgraphStore @optIn(to: \"GraphStore\") {\n\t\t\tteamConnectedToContainerInverse(id: $containerId, consistentRead: true)\n\t\t\t\t@optIn(to: \"GraphStoreTeamConnectedToContainer\") {\n\t\t\t\tedges {\n\t\t\t\t\tid\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n"]))));
|
|
@@ -68,26 +68,51 @@ var TeamsClient = exports.TeamsClient = /*#__PURE__*/function () {
|
|
|
68
68
|
return getTeamContainers;
|
|
69
69
|
}()
|
|
70
70
|
/**
|
|
71
|
-
* Get teams connected to a container (Confluence space or Jira project)
|
|
71
|
+
* Get the number of teams connected to a container (Confluence space or Jira project)
|
|
72
72
|
* @param {string} containerId
|
|
73
73
|
* @returns {Promise}
|
|
74
74
|
*/
|
|
75
75
|
)
|
|
76
76
|
}, {
|
|
77
|
-
key: "
|
|
77
|
+
key: "getNumberOfConnectedTeams",
|
|
78
78
|
value: (function () {
|
|
79
|
-
var
|
|
79
|
+
var _getNumberOfConnectedTeams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(containerId) {
|
|
80
80
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
81
81
|
while (1) switch (_context2.prev = _context2.next) {
|
|
82
82
|
case 0:
|
|
83
|
-
return _context2.abrupt("return", this._aggClient.
|
|
83
|
+
return _context2.abrupt("return", this._aggClient.queryNumberOfTeamConnectedToContainer(containerId));
|
|
84
84
|
case 1:
|
|
85
85
|
case "end":
|
|
86
86
|
return _context2.stop();
|
|
87
87
|
}
|
|
88
88
|
}, _callee2, this);
|
|
89
89
|
}));
|
|
90
|
-
function
|
|
90
|
+
function getNumberOfConnectedTeams(_x2) {
|
|
91
|
+
return _getNumberOfConnectedTeams.apply(this, arguments);
|
|
92
|
+
}
|
|
93
|
+
return getNumberOfConnectedTeams;
|
|
94
|
+
}()
|
|
95
|
+
/**
|
|
96
|
+
* Get teams connected to a container (Confluence space or Jira project)
|
|
97
|
+
* @param {string} containerId
|
|
98
|
+
* @returns {Promise}
|
|
99
|
+
*/
|
|
100
|
+
)
|
|
101
|
+
}, {
|
|
102
|
+
key: "getConnectedTeams",
|
|
103
|
+
value: (function () {
|
|
104
|
+
var _getConnectedTeams = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(containerId) {
|
|
105
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
106
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
return _context3.abrupt("return", this._aggClient.queryTeamsConnectedToContainer(containerId));
|
|
109
|
+
case 1:
|
|
110
|
+
case "end":
|
|
111
|
+
return _context3.stop();
|
|
112
|
+
}
|
|
113
|
+
}, _callee3, this);
|
|
114
|
+
}));
|
|
115
|
+
function getConnectedTeams(_x3) {
|
|
91
116
|
return _getConnectedTeams.apply(this, arguments);
|
|
92
117
|
}
|
|
93
118
|
return getConnectedTeams;
|
|
@@ -102,18 +127,18 @@ var TeamsClient = exports.TeamsClient = /*#__PURE__*/function () {
|
|
|
102
127
|
}, {
|
|
103
128
|
key: "unlinkTeamContainer",
|
|
104
129
|
value: (function () {
|
|
105
|
-
var _unlinkTeamContainer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
106
|
-
return _regenerator.default.wrap(function
|
|
107
|
-
while (1) switch (
|
|
130
|
+
var _unlinkTeamContainer = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(teamId, containerId) {
|
|
131
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
132
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
108
133
|
case 0:
|
|
109
|
-
return
|
|
134
|
+
return _context4.abrupt("return", this._aggClient.unlinkTeamContainer(teamId, containerId));
|
|
110
135
|
case 1:
|
|
111
136
|
case "end":
|
|
112
|
-
return
|
|
137
|
+
return _context4.stop();
|
|
113
138
|
}
|
|
114
|
-
},
|
|
139
|
+
}, _callee4, this);
|
|
115
140
|
}));
|
|
116
|
-
function unlinkTeamContainer(
|
|
141
|
+
function unlinkTeamContainer(_x4, _x5) {
|
|
117
142
|
return _unlinkTeamContainer.apply(this, arguments);
|
|
118
143
|
}
|
|
119
144
|
return unlinkTeamContainer;
|
|
@@ -181,6 +181,7 @@ var TeamContainers = exports.TeamContainers = function TeamContainers(_ref) {
|
|
|
181
181
|
title: container.name,
|
|
182
182
|
containerIcon: container.icon || undefined,
|
|
183
183
|
link: container.link || undefined,
|
|
184
|
+
containerId: container.id,
|
|
184
185
|
onDisconnectButtonClick: function onDisconnectButtonClick() {
|
|
185
186
|
return handleOpenDisconnectDialog({
|
|
186
187
|
containerId: container.id,
|
|
@@ -6,7 +6,8 @@ const initialConnectedTeamsState = {
|
|
|
6
6
|
isLoading: false,
|
|
7
7
|
hasLoaded: false,
|
|
8
8
|
teams: undefined,
|
|
9
|
-
error: null
|
|
9
|
+
error: null,
|
|
10
|
+
numberOfTeams: undefined
|
|
10
11
|
};
|
|
11
12
|
const initialState = {
|
|
12
13
|
teamContainers: [],
|
|
@@ -48,7 +49,7 @@ const actions = {
|
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
|
-
|
|
52
|
+
fetchNumberOfConnectedTeams: containerId => async ({
|
|
52
53
|
setState,
|
|
53
54
|
getState
|
|
54
55
|
}) => {
|
|
@@ -60,13 +61,54 @@ const actions = {
|
|
|
60
61
|
if (currentContainerId === containerId) {
|
|
61
62
|
return;
|
|
62
63
|
}
|
|
64
|
+
setState({
|
|
65
|
+
connectedTeams: {
|
|
66
|
+
...initialConnectedTeamsState,
|
|
67
|
+
containerId,
|
|
68
|
+
numberOfTeams: undefined
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
try {
|
|
72
|
+
const numberOfTeams = await teamsClient.getNumberOfConnectedTeams(containerId);
|
|
73
|
+
setState({
|
|
74
|
+
connectedTeams: {
|
|
75
|
+
...initialConnectedTeamsState,
|
|
76
|
+
containerId,
|
|
77
|
+
numberOfTeams
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
} catch (e) {
|
|
81
|
+
setState({
|
|
82
|
+
connectedTeams: {
|
|
83
|
+
...initialConnectedTeamsState,
|
|
84
|
+
containerId,
|
|
85
|
+
error: e
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
fetchConnectedTeams: containerId => async ({
|
|
91
|
+
setState,
|
|
92
|
+
getState
|
|
93
|
+
}) => {
|
|
94
|
+
const {
|
|
95
|
+
connectedTeams: {
|
|
96
|
+
containerId: currentContainerId,
|
|
97
|
+
numberOfTeams,
|
|
98
|
+
hasLoaded
|
|
99
|
+
}
|
|
100
|
+
} = getState();
|
|
101
|
+
if (currentContainerId === containerId && hasLoaded) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
63
104
|
setState({
|
|
64
105
|
connectedTeams: {
|
|
65
106
|
containerId,
|
|
66
107
|
isLoading: true,
|
|
67
108
|
hasLoaded: false,
|
|
68
109
|
teams: undefined,
|
|
69
|
-
error: null
|
|
110
|
+
error: null,
|
|
111
|
+
numberOfTeams
|
|
70
112
|
}
|
|
71
113
|
});
|
|
72
114
|
try {
|
|
@@ -77,7 +119,8 @@ const actions = {
|
|
|
77
119
|
isLoading: false,
|
|
78
120
|
hasLoaded: true,
|
|
79
121
|
teams,
|
|
80
|
-
error: null
|
|
122
|
+
error: null,
|
|
123
|
+
numberOfTeams
|
|
81
124
|
}
|
|
82
125
|
});
|
|
83
126
|
} catch (e) {
|
|
@@ -87,7 +130,8 @@ const actions = {
|
|
|
87
130
|
isLoading: false,
|
|
88
131
|
hasLoaded: false,
|
|
89
132
|
teams: [],
|
|
90
|
-
error: e
|
|
133
|
+
error: e,
|
|
134
|
+
numberOfTeams
|
|
91
135
|
}
|
|
92
136
|
});
|
|
93
137
|
}
|
|
@@ -175,6 +219,7 @@ export const useConnectedTeams = () => {
|
|
|
175
219
|
const [state, actions] = useTeamContainersHook();
|
|
176
220
|
return {
|
|
177
221
|
...state.connectedTeams,
|
|
222
|
+
fetchNumberOfConnectedTeams: actions.fetchNumberOfConnectedTeams,
|
|
178
223
|
fetchConnectedTeams: actions.fetchConnectedTeams
|
|
179
224
|
};
|
|
180
225
|
};
|
|
@@ -3,6 +3,7 @@ import { toUserId } from '../../common/utils/user-ari';
|
|
|
3
3
|
import { DEFAULT_CONFIG } from '../constants';
|
|
4
4
|
import { BaseGraphQlClient } from '../graphql-client';
|
|
5
5
|
import { UnlinkContainerMutation } from './utils/mutations/unlink-container-mutation';
|
|
6
|
+
import { NumberOfTeamConnectedToContainerQuery } from './utils/queries/number-of-team-connected-to-container-query';
|
|
6
7
|
import { TeamConnectedToContainerQuery } from './utils/queries/team-connected-to-container-query';
|
|
7
8
|
import { TeamContainersQuery } from './utils/queries/team-containers-query';
|
|
8
9
|
export class AGGClient extends BaseGraphQlClient {
|
|
@@ -46,8 +47,20 @@ export class AGGClient extends BaseGraphQlClient {
|
|
|
46
47
|
});
|
|
47
48
|
return response.graphStore;
|
|
48
49
|
}
|
|
49
|
-
async
|
|
50
|
+
async queryNumberOfTeamConnectedToContainer(containerId) {
|
|
50
51
|
var _response$graphStore, _response$graphStore$, _response$graphStore$2;
|
|
52
|
+
const response = await this.makeGraphQLRequest({
|
|
53
|
+
query: NumberOfTeamConnectedToContainerQuery,
|
|
54
|
+
variables: {
|
|
55
|
+
containerId
|
|
56
|
+
}
|
|
57
|
+
}, {
|
|
58
|
+
operationName: 'NumberOfTeamConnectedToContainerQuery'
|
|
59
|
+
});
|
|
60
|
+
return response === null || response === void 0 ? void 0 : (_response$graphStore = response.graphStore) === null || _response$graphStore === void 0 ? void 0 : (_response$graphStore$ = _response$graphStore.teamConnectedToContainerInverse) === null || _response$graphStore$ === void 0 ? void 0 : (_response$graphStore$2 = _response$graphStore$.edges) === null || _response$graphStore$2 === void 0 ? void 0 : _response$graphStore$2.length;
|
|
61
|
+
}
|
|
62
|
+
async queryTeamsConnectedToContainer(containerId) {
|
|
63
|
+
var _response$graphStore2, _response$graphStore3, _response$graphStore4;
|
|
51
64
|
const response = await this.makeGraphQLRequest({
|
|
52
65
|
query: TeamConnectedToContainerQuery,
|
|
53
66
|
variables: {
|
|
@@ -56,7 +69,7 @@ export class AGGClient extends BaseGraphQlClient {
|
|
|
56
69
|
}, {
|
|
57
70
|
operationName: 'TeamConnectedToContainerQuery'
|
|
58
71
|
});
|
|
59
|
-
return response === null || response === void 0 ? void 0 : (_response$
|
|
72
|
+
return response === null || response === void 0 ? void 0 : (_response$graphStore2 = response.graphStore) === null || _response$graphStore2 === void 0 ? void 0 : (_response$graphStore3 = _response$graphStore2.teamConnectedToContainerInverse) === null || _response$graphStore3 === void 0 ? void 0 : (_response$graphStore4 = _response$graphStore3.edges) === null || _response$graphStore4 === void 0 ? void 0 : _response$graphStore4.map(({
|
|
60
73
|
node
|
|
61
74
|
}) => {
|
|
62
75
|
var _node$members$nodes$m, _node$members, _node$members$nodes$l, _node$members2;
|