@atlaskit/teams-public 0.2.0 → 0.3.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 +14 -0
- package/dist/cjs/common/utils/error/index.js +120 -0
- package/dist/cjs/common/utils/get-container-properties.js +2 -12
- package/dist/cjs/common/utils/http.js +119 -0
- package/dist/cjs/common/utils/status-code-handlers-provider.js +30 -0
- package/dist/cjs/common/utils/team-id-to-ari.js +10 -0
- package/dist/cjs/controllers/hooks/use-team-containers/index.js +79 -0
- package/dist/cjs/controllers/index.js +12 -0
- package/dist/cjs/services/agg-client/index.js +79 -0
- package/dist/cjs/services/agg-client/mocks/index.js +52 -0
- package/dist/cjs/services/agg-client/utils/queries/team-containers-query.js +12 -0
- package/dist/cjs/services/base-client/index.js +92 -0
- package/dist/cjs/services/constants.js +9 -0
- package/dist/cjs/services/graphql-client/index.js +12 -0
- package/dist/cjs/services/graphql-client/main.js +69 -0
- package/dist/cjs/services/graphql-client/types.js +5 -0
- package/dist/cjs/services/graphql-client/utils/index.js +157 -0
- package/dist/cjs/services/index.js +18 -0
- package/dist/cjs/services/main.js +72 -0
- package/dist/cjs/services/types.js +5 -0
- package/dist/cjs/ui/team-containers/add-container-card/index.compiled.css +0 -2
- package/dist/cjs/ui/team-containers/add-container-card/index.js +30 -12
- package/dist/cjs/ui/team-containers/linked-container-card/index.compiled.css +1 -2
- package/dist/cjs/ui/team-containers/linked-container-card/index.js +45 -15
- package/dist/cjs/ui/team-containers/main.js +94 -16
- package/dist/cjs/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
- package/dist/cjs/ui/team-containers/team-containers-skeleton/index.js +36 -0
- package/dist/cjs/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
- package/dist/cjs/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +38 -0
- package/dist/es2019/common/utils/error/index.js +87 -0
- package/dist/es2019/common/utils/get-container-properties.js +3 -13
- package/dist/es2019/common/utils/http.js +82 -0
- package/dist/es2019/common/utils/status-code-handlers-provider.js +25 -0
- package/dist/es2019/common/utils/team-id-to-ari.js +2 -0
- package/dist/es2019/controllers/hooks/use-team-containers/index.js +45 -0
- package/dist/es2019/controllers/index.js +1 -0
- package/dist/es2019/services/agg-client/index.js +36 -0
- package/dist/es2019/services/agg-client/mocks/index.js +46 -0
- package/dist/es2019/services/agg-client/utils/queries/team-containers-query.js +46 -0
- package/dist/es2019/services/base-client/index.js +64 -0
- package/dist/es2019/services/constants.js +3 -0
- package/dist/es2019/services/graphql-client/index.js +1 -0
- package/dist/es2019/services/graphql-client/main.js +23 -0
- package/dist/es2019/services/graphql-client/types.js +1 -0
- package/dist/es2019/services/graphql-client/utils/index.js +76 -0
- package/dist/es2019/services/index.js +1 -0
- package/dist/es2019/services/main.js +39 -0
- package/dist/es2019/services/types.js +1 -0
- package/dist/es2019/ui/team-containers/add-container-card/index.compiled.css +0 -2
- package/dist/es2019/ui/team-containers/add-container-card/index.js +15 -7
- package/dist/es2019/ui/team-containers/linked-container-card/index.compiled.css +1 -2
- package/dist/es2019/ui/team-containers/linked-container-card/index.js +28 -9
- package/dist/es2019/ui/team-containers/main.js +79 -16
- package/dist/es2019/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
- package/dist/es2019/ui/team-containers/team-containers-skeleton/index.js +27 -0
- package/dist/es2019/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
- package/dist/es2019/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +31 -0
- package/dist/esm/common/utils/error/index.js +117 -0
- package/dist/esm/common/utils/get-container-properties.js +3 -13
- package/dist/esm/common/utils/http.js +109 -0
- package/dist/esm/common/utils/status-code-handlers-provider.js +23 -0
- package/dist/esm/common/utils/team-id-to-ari.js +4 -0
- package/dist/esm/controllers/hooks/use-team-containers/index.js +72 -0
- package/dist/esm/controllers/index.js +1 -0
- package/dist/esm/services/agg-client/index.js +72 -0
- package/dist/esm/services/agg-client/mocks/index.js +46 -0
- package/dist/esm/services/agg-client/utils/queries/team-containers-query.js +5 -0
- package/dist/esm/services/base-client/index.js +85 -0
- package/dist/esm/services/constants.js +3 -0
- package/dist/esm/services/graphql-client/index.js +1 -0
- package/dist/esm/services/graphql-client/main.js +62 -0
- package/dist/esm/services/graphql-client/types.js +1 -0
- package/dist/esm/services/graphql-client/utils/index.js +149 -0
- package/dist/esm/services/index.js +1 -0
- package/dist/esm/services/main.js +65 -0
- package/dist/esm/services/types.js +1 -0
- package/dist/esm/ui/team-containers/add-container-card/index.compiled.css +0 -2
- package/dist/esm/ui/team-containers/add-container-card/index.js +25 -7
- package/dist/esm/ui/team-containers/linked-container-card/index.compiled.css +1 -2
- package/dist/esm/ui/team-containers/linked-container-card/index.js +39 -9
- package/dist/esm/ui/team-containers/main.js +91 -16
- package/dist/esm/ui/team-containers/team-containers-skeleton/index.compiled.css +4 -0
- package/dist/esm/ui/team-containers/team-containers-skeleton/index.js +29 -0
- package/dist/esm/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.compiled.css +14 -0
- package/dist/esm/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.js +31 -0
- package/dist/types/common/types.d.ts +1 -1
- package/dist/types/common/utils/error/index.d.ts +59 -0
- package/dist/types/common/utils/http.d.ts +31 -0
- package/dist/types/common/utils/status-code-handlers-provider.d.ts +17 -0
- package/dist/types/common/utils/team-id-to-ari.d.ts +2 -0
- package/dist/types/controllers/hooks/use-team-containers/index.d.ts +12 -0
- package/dist/types/controllers/index.d.ts +1 -0
- package/dist/types/services/agg-client/index.d.ts +15 -0
- package/dist/types/services/agg-client/mocks/index.d.ts +55 -0
- package/dist/types/services/agg-client/utils/queries/team-containers-query.d.ts +44 -0
- package/dist/types/services/base-client/index.d.ts +37 -0
- package/dist/types/services/constants.d.ts +4 -0
- package/dist/types/services/graphql-client/index.d.ts +1 -0
- package/dist/types/services/graphql-client/main.d.ts +8 -0
- package/dist/types/services/graphql-client/types.d.ts +19 -0
- package/dist/types/services/graphql-client/utils/index.d.ts +3 -0
- package/dist/types/services/index.d.ts +1 -0
- package/dist/types/services/main.d.ts +25 -0
- package/dist/types/services/types.d.ts +19 -0
- package/dist/types/ui/team-containers/add-container-card/index.d.ts +3 -2
- package/dist/types/ui/team-containers/linked-container-card/index.d.ts +3 -6
- package/dist/types/ui/team-containers/main.d.ts +3 -1
- package/dist/types/ui/team-containers/team-containers-skeleton/index.d.ts +6 -0
- package/dist/types/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.d.ts +2 -0
- package/dist/types/ui/team-containers/types.d.ts +5 -0
- package/dist/types-ts4.5/common/types.d.ts +1 -1
- package/dist/types-ts4.5/common/utils/error/index.d.ts +59 -0
- package/dist/types-ts4.5/common/utils/http.d.ts +31 -0
- package/dist/types-ts4.5/common/utils/status-code-handlers-provider.d.ts +17 -0
- package/dist/types-ts4.5/common/utils/team-id-to-ari.d.ts +2 -0
- package/dist/types-ts4.5/controllers/hooks/use-team-containers/index.d.ts +12 -0
- package/dist/types-ts4.5/controllers/index.d.ts +1 -0
- package/dist/types-ts4.5/services/agg-client/index.d.ts +15 -0
- package/dist/types-ts4.5/services/agg-client/mocks/index.d.ts +55 -0
- package/dist/types-ts4.5/services/agg-client/utils/queries/team-containers-query.d.ts +44 -0
- package/dist/types-ts4.5/services/base-client/index.d.ts +37 -0
- package/dist/types-ts4.5/services/constants.d.ts +4 -0
- package/dist/types-ts4.5/services/graphql-client/index.d.ts +1 -0
- package/dist/types-ts4.5/services/graphql-client/main.d.ts +8 -0
- package/dist/types-ts4.5/services/graphql-client/types.d.ts +19 -0
- package/dist/types-ts4.5/services/graphql-client/utils/index.d.ts +3 -0
- package/dist/types-ts4.5/services/index.d.ts +1 -0
- package/dist/types-ts4.5/services/main.d.ts +25 -0
- package/dist/types-ts4.5/services/types.d.ts +19 -0
- package/dist/types-ts4.5/ui/team-containers/add-container-card/index.d.ts +3 -2
- package/dist/types-ts4.5/ui/team-containers/linked-container-card/index.d.ts +3 -6
- package/dist/types-ts4.5/ui/team-containers/main.d.ts +3 -1
- package/dist/types-ts4.5/ui/team-containers/team-containers-skeleton/index.d.ts +6 -0
- package/dist/types-ts4.5/ui/team-containers/team-containers-skeleton/linked-container-card-skeleton/index.d.ts +2 -0
- package/dist/types-ts4.5/ui/team-containers/types.d.ts +5 -0
- package/package.json +9 -5
- package/dist/cjs/ui/team-containers/constants.js +0 -7
- package/dist/es2019/ui/team-containers/constants.js +0 -1
- package/dist/esm/ui/team-containers/constants.js +0 -1
- package/dist/types/ui/team-containers/constants.d.ts +0 -1
- package/dist/types-ts4.5/ui/team-containers/constants.d.ts +0 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
export class BaseClient {
|
|
3
|
+
constructor(config) {
|
|
4
|
+
_defineProperty(this, "cache", {});
|
|
5
|
+
_defineProperty(this, "logException", (ex, name, context) => {
|
|
6
|
+
this.config.logException(ex, name, context);
|
|
7
|
+
});
|
|
8
|
+
this.config = config;
|
|
9
|
+
this.context = {
|
|
10
|
+
cloudId: null
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
setContext(context) {
|
|
14
|
+
this.context = {
|
|
15
|
+
...context,
|
|
16
|
+
cloudId: context.cloudId || null
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
getContext() {
|
|
20
|
+
return this.context;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* @param localValue is used for backwards compatibility
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
getOrgId(localValue) {
|
|
29
|
+
const orgId = localValue || this.getContext().orgId;
|
|
30
|
+
if (!orgId) {
|
|
31
|
+
const err = new Error('No orgId set');
|
|
32
|
+
this.logException(err, 'No orgId set');
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
return orgId;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
* @param localValue is used for backwards compatibility
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
getCloudId(localValue) {
|
|
43
|
+
return localValue || this.getContext().cloudId;
|
|
44
|
+
}
|
|
45
|
+
keyWithContext(key) {
|
|
46
|
+
var _this$getContext$orgI, _this$getContext$user;
|
|
47
|
+
return `${this.getContext().cloudId}-${(_this$getContext$orgI = this.getContext().orgId) !== null && _this$getContext$orgI !== void 0 ? _this$getContext$orgI : 'no-org-id'}-${(_this$getContext$user = this.getContext().userId) !== null && _this$getContext$user !== void 0 ? _this$getContext$user : 'no-user-id'}-${key}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Default expiration is 5 minutes
|
|
51
|
+
cacheValue(key, value, expiryMs = 1000 * 60 * 5) {
|
|
52
|
+
this.cache[this.keyWithContext(key)] = {
|
|
53
|
+
data: value,
|
|
54
|
+
expiration: Date.now() + expiryMs
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
getCachedValue(key) {
|
|
58
|
+
const record = this.cache[this.keyWithContext(key)];
|
|
59
|
+
if (record && record.expiration > Date.now()) {
|
|
60
|
+
return record.data;
|
|
61
|
+
}
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BaseGraphQlClient } from './main';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DefaultError, GraphQLError } from '../../common/utils/error';
|
|
2
|
+
import { BaseClient } from '../base-client';
|
|
3
|
+
import { handleGraphQLRequest } from './utils';
|
|
4
|
+
export class BaseGraphQlClient extends BaseClient {
|
|
5
|
+
constructor(serviceUrl, config) {
|
|
6
|
+
super(config);
|
|
7
|
+
this.serviceUrl = serviceUrl;
|
|
8
|
+
}
|
|
9
|
+
setServiceUrl(serviceUrl) {
|
|
10
|
+
this.serviceUrl = serviceUrl;
|
|
11
|
+
}
|
|
12
|
+
async makeGraphQLRequest(body, options = {}) {
|
|
13
|
+
try {
|
|
14
|
+
return handleGraphQLRequest(this.serviceUrl, body, options);
|
|
15
|
+
} catch (error) {
|
|
16
|
+
if (error instanceof GraphQLError) {
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
this.logException(error, 'UnknownError in GraphQLClient.makeGraphQLRequestWithoutRetries');
|
|
20
|
+
throw new DefaultError({});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { GraphQLError, HttpError } from '../../../common/utils/error';
|
|
2
|
+
import { EXPONENTIAL_BACKOFF_RETRY_POLICY, is5xx, isFetchResponse, withExponentialBackoff } from '../../../common/utils/http';
|
|
3
|
+
import { handleResponse } from '../../../common/utils/status-code-handlers-provider';
|
|
4
|
+
export async function makeGraphQLRequestWithoutRetries(serviceUrl, body, options = {}) {
|
|
5
|
+
const operationNameQuery = options.operationName ? `?q=${options.operationName}` : '';
|
|
6
|
+
const errorPolicy = options.errorPolicy || 'none';
|
|
7
|
+
const url = serviceUrl + operationNameQuery;
|
|
8
|
+
const request = fetch(url, {
|
|
9
|
+
method: 'POST',
|
|
10
|
+
headers: new Headers({
|
|
11
|
+
'Content-Type': 'application/json'
|
|
12
|
+
}),
|
|
13
|
+
credentials: 'include',
|
|
14
|
+
body: JSON.stringify(body)
|
|
15
|
+
}).then(res => {
|
|
16
|
+
if (res.status < 300 || res.status === 400) {
|
|
17
|
+
return res.json();
|
|
18
|
+
} else {
|
|
19
|
+
throw res;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
try {
|
|
23
|
+
const response = await request;
|
|
24
|
+
const errors = response.errors;
|
|
25
|
+
if (errors) {
|
|
26
|
+
if (errorPolicy === 'none') {
|
|
27
|
+
throw GraphQLError.from(errors);
|
|
28
|
+
} else if (errorPolicy === 'all') {
|
|
29
|
+
// Set timeout will postpone error throwing and de-touch it to another event loop,
|
|
30
|
+
// so we can return data along with throwing error
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
setTimeout(() => {
|
|
33
|
+
reject(GraphQLError.from(errors));
|
|
34
|
+
}, 0);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return response.data;
|
|
39
|
+
} catch (error) {
|
|
40
|
+
if (error instanceof Response) {
|
|
41
|
+
return {
|
|
42
|
+
response: error
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
if (Object(error).hasOwnProperty('response')) {
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
return error;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export async function handleGraphQLRequest(serviceUrl, body, options = {}) {
|
|
52
|
+
const makeGraphQLRequestWithRetries = withExponentialBackoff(makeGraphQLRequestWithoutRetries, {
|
|
53
|
+
initial: EXPONENTIAL_BACKOFF_RETRY_POLICY.INITIAL_DELAY,
|
|
54
|
+
jitter: EXPONENTIAL_BACKOFF_RETRY_POLICY.JITTER,
|
|
55
|
+
max: EXPONENTIAL_BACKOFF_RETRY_POLICY.MAX_RETRIES,
|
|
56
|
+
retryIf: data => {
|
|
57
|
+
return isFetchResponse(data) && is5xx(data.response.status);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const result = await makeGraphQLRequestWithRetries(serviceUrl, body, options);
|
|
61
|
+
const response = result === null || result === void 0 ? void 0 : result.response;
|
|
62
|
+
if (response) {
|
|
63
|
+
const status = response.status;
|
|
64
|
+
const statusText = response.statusText;
|
|
65
|
+
const traceId = response.headers.get('atl-traceid');
|
|
66
|
+
handleResponse(response);
|
|
67
|
+
if (status > 400 && status <= 599) {
|
|
68
|
+
throw new HttpError({
|
|
69
|
+
message: statusText,
|
|
70
|
+
status,
|
|
71
|
+
traceId: traceId !== null && traceId !== void 0 ? traceId : undefined
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { teamsClient, TeamsClient } from './main';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { aggClient } from './agg-client';
|
|
3
|
+
export class TeamsClient {
|
|
4
|
+
constructor(
|
|
5
|
+
/**
|
|
6
|
+
* @param {ClientContextProps} context - Context including CloudId & OrgId to be used for all requests
|
|
7
|
+
*/
|
|
8
|
+
context) {
|
|
9
|
+
_defineProperty(this, "_aggClient", aggClient);
|
|
10
|
+
if (context) {
|
|
11
|
+
this.setContext(context);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Sets the base URL to be used in the client requests
|
|
17
|
+
* @param {string} baseUrl - The new base URL
|
|
18
|
+
*/
|
|
19
|
+
setBaseUrl(baseUrl) {
|
|
20
|
+
this._aggClient.setBaseUrl(baseUrl);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Sets context including CloudId & OrgId to be used for all requests
|
|
25
|
+
*/
|
|
26
|
+
setContext(context) {
|
|
27
|
+
this._aggClient.setContext(context);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the containers for a given team
|
|
32
|
+
* @param {string} teamId
|
|
33
|
+
* @returns {Promise<TeamContainers>}
|
|
34
|
+
*/
|
|
35
|
+
async getTeamContainers(teamId) {
|
|
36
|
+
return this._aggClient.getTeamContainers(teamId);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export const teamsClient = new TeamsClient();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
._12y3e4h9{outline-width:var(--ds-border-width,1px)}
|
|
4
4
|
._19bvutpp{padding-left:var(--ds-space-150,9pt)}
|
|
5
5
|
._1qu2gq9o{outline-style:dashed}
|
|
6
|
-
._bfhkqbzx{background-color:var(--ds-surface-sunken,#f7f8f9)}
|
|
7
6
|
._ca0qutpp{padding-top:var(--ds-space-150,9pt)}
|
|
8
7
|
._n3tdutpp{padding-bottom:var(--ds-space-150,9pt)}
|
|
9
8
|
._syaz131l{color:var(--ds-text-subtlest,#626f86)}
|
|
10
9
|
._u5f3utpp{padding-right:var(--ds-space-150,9pt)}
|
|
11
10
|
._4cvxmuej:hover{border-color:var(--ds-border,#091e4224)}
|
|
12
|
-
._irr3108i:hover{background-color:var(--ds-surface-hovered,#f1f2f4)}
|
|
13
11
|
._ksodnqa1:hover{outline-style:solid}
|
|
@@ -1,25 +1,32 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v0.36.
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
2
|
import "./index.compiled.css";
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
5
|
import { IconButton } from '@atlaskit/button/new';
|
|
6
6
|
import AddIcon from '@atlaskit/icon/utility/add';
|
|
7
7
|
import { CustomItem } from '@atlaskit/menu';
|
|
8
|
-
import { Box, Inline } from '@atlaskit/primitives';
|
|
8
|
+
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
9
9
|
import { getContainerProperties } from '../../../common/utils/get-container-properties';
|
|
10
10
|
const styles = {
|
|
11
|
-
container: "_2rkoiti9
|
|
11
|
+
container: "_2rkoiti9 _ca0qutpp _u5f3utpp _n3tdutpp _19bvutpp",
|
|
12
12
|
iconWrapper: "_2rkoiti9 _12y3e4h9 _12jimuej _1qu2gq9o _syaz131l _4cvxmuej _ksodnqa1"
|
|
13
13
|
};
|
|
14
14
|
const CustomItemInner = ({
|
|
15
15
|
children
|
|
16
16
|
}) => {
|
|
17
|
+
const [hovered, setHovered] = useState(false);
|
|
18
|
+
const handleMouseEnter = () => setHovered(true);
|
|
19
|
+
const handleMouseLeave = () => setHovered(false);
|
|
17
20
|
return /*#__PURE__*/React.createElement(Box, {
|
|
18
|
-
|
|
21
|
+
backgroundColor: hovered ? 'elevation.surface.hovered' : 'elevation.surface.sunken',
|
|
22
|
+
xcss: styles.container,
|
|
23
|
+
onMouseEnter: handleMouseEnter,
|
|
24
|
+
onMouseLeave: handleMouseLeave
|
|
19
25
|
}, children);
|
|
20
26
|
};
|
|
21
27
|
export const AddContainerCard = ({
|
|
22
|
-
containerType
|
|
28
|
+
containerType,
|
|
29
|
+
onAddAContainerClick
|
|
23
30
|
}) => {
|
|
24
31
|
const {
|
|
25
32
|
description,
|
|
@@ -34,7 +41,8 @@ export const AddContainerCard = ({
|
|
|
34
41
|
appearance: "subtle",
|
|
35
42
|
icon: AddIcon,
|
|
36
43
|
spacing: "compact",
|
|
37
|
-
testId: "add-icon"
|
|
44
|
+
testId: "add-icon",
|
|
45
|
+
onClick: e => onAddAContainerClick(e)
|
|
38
46
|
})),
|
|
39
47
|
component: CustomItemInner,
|
|
40
48
|
description: /*#__PURE__*/React.createElement(Inline, {
|
|
@@ -9,5 +9,4 @@
|
|
|
9
9
|
._ca0qutpp{padding-top:var(--ds-space-150,9pt)}
|
|
10
10
|
._n3tdutpp{padding-bottom:var(--ds-space-150,9pt)}
|
|
11
11
|
._syaz1fxt{color:var(--ds-text,#172b4d)}
|
|
12
|
-
._u5f3utpp{padding-right:var(--ds-space-150,9pt)}
|
|
13
|
-
._irr31d5g:hover{background-color:var(--ds-background-input-hovered,#f7f8f9)}
|
|
12
|
+
._u5f3utpp{padding-right:var(--ds-space-150,9pt)}
|
|
@@ -1,38 +1,55 @@
|
|
|
1
|
-
/* index.tsx generated by @compiled/babel-plugin v0.36.
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
2
|
import "./index.compiled.css";
|
|
3
|
-
import * as React from 'react';
|
|
4
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
5
|
import { IconButton } from '@atlaskit/button/new';
|
|
6
6
|
import CrossIcon from '@atlaskit/icon/utility/cross';
|
|
7
7
|
import Image from '@atlaskit/image';
|
|
8
8
|
import Link from '@atlaskit/link';
|
|
9
9
|
import { CustomItem } from '@atlaskit/menu';
|
|
10
|
-
import { Box, Inline } from '@atlaskit/primitives';
|
|
10
|
+
import { Box, Inline } from '@atlaskit/primitives/compiled';
|
|
11
11
|
import { getContainerProperties } from '../../../common/utils/get-container-properties';
|
|
12
12
|
const styles = {
|
|
13
|
-
container: "_2rkoiti9 _1h6dz9xs _12y3e4h9 _12jimuej _1qu2nqa1 _ca0qutpp _u5f3utpp _n3tdutpp _19bvutpp _syaz1fxt
|
|
13
|
+
container: "_2rkoiti9 _1h6dz9xs _12y3e4h9 _12jimuej _1qu2nqa1 _ca0qutpp _u5f3utpp _n3tdutpp _19bvutpp _syaz1fxt",
|
|
14
14
|
iconWrapper: "_1bsb1tcg _4t3i1tcg"
|
|
15
15
|
};
|
|
16
16
|
const CustomItemInner = ({
|
|
17
17
|
children,
|
|
18
|
-
href
|
|
18
|
+
href,
|
|
19
|
+
handleMouseEnter,
|
|
20
|
+
handleMouseLeave
|
|
19
21
|
}) => {
|
|
22
|
+
const [hovered, setHovered] = useState(false);
|
|
23
|
+
const onMouseEnter = () => {
|
|
24
|
+
handleMouseEnter();
|
|
25
|
+
setHovered(true);
|
|
26
|
+
};
|
|
27
|
+
const onMouseLeave = () => {
|
|
28
|
+
handleMouseLeave();
|
|
29
|
+
setHovered(false);
|
|
30
|
+
};
|
|
20
31
|
return /*#__PURE__*/React.createElement(Link, {
|
|
21
32
|
href: href,
|
|
22
33
|
appearance: "subtle"
|
|
23
34
|
}, /*#__PURE__*/React.createElement(Box, {
|
|
24
|
-
|
|
35
|
+
backgroundColor: hovered ? 'color.background.input.hovered' : 'color.background.input',
|
|
36
|
+
xcss: styles.container,
|
|
37
|
+
onMouseEnter: onMouseEnter,
|
|
38
|
+
onMouseLeave: onMouseLeave,
|
|
39
|
+
testId: "linked-container-card-inner"
|
|
25
40
|
}, children));
|
|
26
41
|
};
|
|
27
42
|
export const LinkedContainerCard = ({
|
|
28
43
|
containerType,
|
|
29
44
|
title,
|
|
30
|
-
containerIcon
|
|
45
|
+
containerIcon,
|
|
46
|
+
link
|
|
31
47
|
}) => {
|
|
32
48
|
const {
|
|
33
49
|
description,
|
|
34
50
|
icon
|
|
35
51
|
} = getContainerProperties(containerType);
|
|
52
|
+
const [showCloseIcon, setShowCloseIcon] = useState(false);
|
|
36
53
|
return /*#__PURE__*/React.createElement(CustomItem, {
|
|
37
54
|
iconBefore: /*#__PURE__*/React.createElement(Box, {
|
|
38
55
|
xcss: styles.iconWrapper
|
|
@@ -44,7 +61,7 @@ export const LinkedContainerCard = ({
|
|
|
44
61
|
description: /*#__PURE__*/React.createElement(Inline, {
|
|
45
62
|
space: "space.050"
|
|
46
63
|
}, icon, description),
|
|
47
|
-
iconAfter: /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(IconButton, {
|
|
64
|
+
iconAfter: showCloseIcon && /*#__PURE__*/React.createElement(Box, null, /*#__PURE__*/React.createElement(IconButton, {
|
|
48
65
|
label: `disconnect the container ${title}`,
|
|
49
66
|
appearance: "subtle",
|
|
50
67
|
icon: CrossIcon,
|
|
@@ -53,7 +70,9 @@ export const LinkedContainerCard = ({
|
|
|
53
70
|
e.preventDefault();
|
|
54
71
|
}
|
|
55
72
|
})),
|
|
56
|
-
href:
|
|
73
|
+
href: link,
|
|
74
|
+
handleMouseEnter: () => setShowCloseIcon(true),
|
|
75
|
+
handleMouseLeave: () => setShowCloseIcon(false),
|
|
57
76
|
component: CustomItemInner
|
|
58
77
|
}, title);
|
|
59
78
|
};
|
|
@@ -1,24 +1,87 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import { defineMessages, FormattedMessage } from 'react-intl-next';
|
|
3
|
+
import Button from '@atlaskit/button/new';
|
|
4
|
+
import { Grid, Inline, Stack } from '@atlaskit/primitives';
|
|
3
5
|
import { N0, N90 } from '@atlaskit/theme/colors';
|
|
6
|
+
import { useTeamContainers } from '../../controllers/hooks/use-team-containers';
|
|
4
7
|
import { AddContainerCard } from './add-container-card';
|
|
5
8
|
import { LinkedContainerCard } from './linked-container-card';
|
|
9
|
+
import { TeamContainersSkeleton } from './team-containers-skeleton';
|
|
6
10
|
export const ICON_BACKGROUND = `var(--ds-icon-inverse, ${N0})`;
|
|
7
11
|
export const ICON_COLOR = `var(--ds-icon-subtle, ${N90})`;
|
|
8
|
-
export const
|
|
9
|
-
|
|
12
|
+
export const MAX_NUMBER_OF_CONTAINERS_TO_SHOW = 4;
|
|
13
|
+
export const TeamContainers = ({
|
|
14
|
+
teamId,
|
|
15
|
+
onAddAContainerClick
|
|
16
|
+
}) => {
|
|
17
|
+
const {
|
|
18
|
+
teamContainers,
|
|
19
|
+
loading
|
|
20
|
+
} = useTeamContainers(teamId);
|
|
21
|
+
const [showAddJiraContainer, setShowAddJiraContainer] = useState(false);
|
|
22
|
+
const [showAddConfluenceContainer, setShowAddConfluenceContainer] = useState(false);
|
|
23
|
+
const [showMore, setShowMore] = useState(false);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (teamContainers.length > MAX_NUMBER_OF_CONTAINERS_TO_SHOW) {
|
|
26
|
+
setShowAddJiraContainer(false);
|
|
27
|
+
setShowAddConfluenceContainer(false);
|
|
28
|
+
} else {
|
|
29
|
+
const hasJiraProject = teamContainers.some(container => container.type === 'JiraProject');
|
|
30
|
+
const hasConfluenceSpace = teamContainers.some(container => container.type === 'ConfluenceSpace');
|
|
31
|
+
setShowAddJiraContainer(!hasJiraProject);
|
|
32
|
+
setShowAddConfluenceContainer(!hasConfluenceSpace);
|
|
33
|
+
}
|
|
34
|
+
}, [teamContainers]);
|
|
35
|
+
const handleShowMore = () => {
|
|
36
|
+
setShowMore(!showMore);
|
|
37
|
+
};
|
|
38
|
+
if (loading) {
|
|
39
|
+
return /*#__PURE__*/React.createElement(TeamContainersSkeleton, {
|
|
40
|
+
numberOfContainers: MAX_NUMBER_OF_CONTAINERS_TO_SHOW
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
44
|
+
space: "space.200"
|
|
45
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
10
46
|
templateColumns: "1fr 1fr",
|
|
11
47
|
gap: "space.100",
|
|
12
48
|
autoFlow: "row"
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}), /*#__PURE__*/React.createElement(AddContainerCard, {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
49
|
+
}, teamContainers.slice(0, MAX_NUMBER_OF_CONTAINERS_TO_SHOW).map(container => {
|
|
50
|
+
return /*#__PURE__*/React.createElement(LinkedContainerCard, {
|
|
51
|
+
key: container.id,
|
|
52
|
+
containerType: container.type,
|
|
53
|
+
title: container.name,
|
|
54
|
+
containerIcon: container.icon,
|
|
55
|
+
link: container.link
|
|
56
|
+
});
|
|
57
|
+
}), showAddJiraContainer && /*#__PURE__*/React.createElement(AddContainerCard, {
|
|
58
|
+
onAddAContainerClick: onAddAContainerClick,
|
|
59
|
+
containerType: "JiraProject"
|
|
60
|
+
}), showAddConfluenceContainer && /*#__PURE__*/React.createElement(AddContainerCard, {
|
|
61
|
+
onAddAContainerClick: onAddAContainerClick,
|
|
62
|
+
containerType: "ConfluenceSpace"
|
|
63
|
+
}), showMore && teamContainers.slice(MAX_NUMBER_OF_CONTAINERS_TO_SHOW).map(container => {
|
|
64
|
+
return /*#__PURE__*/React.createElement(LinkedContainerCard, {
|
|
65
|
+
key: container.id,
|
|
66
|
+
containerType: container.type,
|
|
67
|
+
title: container.name,
|
|
68
|
+
containerIcon: container.icon,
|
|
69
|
+
link: container.link
|
|
70
|
+
});
|
|
71
|
+
})), teamContainers.length > MAX_NUMBER_OF_CONTAINERS_TO_SHOW && /*#__PURE__*/React.createElement(Inline, null, /*#__PURE__*/React.createElement(Button, {
|
|
72
|
+
appearance: "subtle",
|
|
73
|
+
onClick: handleShowMore
|
|
74
|
+
}, showMore ? /*#__PURE__*/React.createElement(FormattedMessage, messages.showLess) : /*#__PURE__*/React.createElement(FormattedMessage, messages.showMore))));
|
|
75
|
+
};
|
|
76
|
+
const messages = defineMessages({
|
|
77
|
+
showMore: {
|
|
78
|
+
id: 'ptc-directory.team-profile-page.team-containers.show-more.non-final',
|
|
79
|
+
defaultMessage: 'Show more',
|
|
80
|
+
description: 'Button to show more containers'
|
|
81
|
+
},
|
|
82
|
+
showLess: {
|
|
83
|
+
id: 'ptc-directory.team-profile-page.team-containers.show-less.non-final',
|
|
84
|
+
defaultMessage: 'Show less',
|
|
85
|
+
description: 'Button to show less containers'
|
|
86
|
+
}
|
|
87
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Box, Grid, Stack } from '@atlaskit/primitives/compiled';
|
|
6
|
+
import { LinkedContainerCardSkeleton } from './linked-container-card-skeleton';
|
|
7
|
+
const styles = {
|
|
8
|
+
containers: "_yv0ewxkt",
|
|
9
|
+
showMoreButtonSkeleton: "_2rko1q77 _1rjc1b66 _1bsbvbgk"
|
|
10
|
+
};
|
|
11
|
+
export const TeamContainersSkeleton = ({
|
|
12
|
+
numberOfContainers
|
|
13
|
+
}) => {
|
|
14
|
+
return /*#__PURE__*/React.createElement(Stack, {
|
|
15
|
+
space: "space.200",
|
|
16
|
+
testId: "team-containers-skeleton"
|
|
17
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
18
|
+
xcss: styles.containers,
|
|
19
|
+
gap: "space.100",
|
|
20
|
+
autoFlow: "row"
|
|
21
|
+
}, [...Array(numberOfContainers)].map((_, index) => /*#__PURE__*/React.createElement(LinkedContainerCardSkeleton, {
|
|
22
|
+
key: index
|
|
23
|
+
}))), /*#__PURE__*/React.createElement(Box, {
|
|
24
|
+
backgroundColor: "color.background.neutral",
|
|
25
|
+
xcss: styles.showMoreButtonSkeleton
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
._2rko1q77{border-radius:var(--ds-border-radius-400,1pc)}
|
|
3
|
+
._2rkoglpi{border-radius:var(--ds-border-radius,4px)}
|
|
4
|
+
._2rkoiti9{border-radius:var(--ds-border-radius-100,4px)}
|
|
5
|
+
._1h6dz9xs{border-color:var(--ds-border-accent-gray,#758195)}
|
|
6
|
+
._1rjc1b66{padding-block:var(--ds-space-050,4px)}._12jimuej{outline-color:var(--ds-border,#091e4224)}
|
|
7
|
+
._12y3e4h9{outline-width:var(--ds-border-width,1px)}
|
|
8
|
+
._19bvpxbi{padding-left:var(--ds-space-200,1pc)}
|
|
9
|
+
._1bsbqkoa{width:9pc}
|
|
10
|
+
._1qu2nqa1{outline-style:solid}
|
|
11
|
+
._ca0qpxbi{padding-top:var(--ds-space-200,1pc)}
|
|
12
|
+
._n3tdpxbi{padding-bottom:var(--ds-space-200,1pc)}
|
|
13
|
+
._syaz1fxt{color:var(--ds-text,#172b4d)}
|
|
14
|
+
._u5f3pxbi{padding-right:var(--ds-space-200,1pc)}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* index.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
import "./index.compiled.css";
|
|
3
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Box, Inline, Stack } from '@atlaskit/primitives/compiled';
|
|
6
|
+
const styles = {
|
|
7
|
+
container: "_2rkoiti9 _1h6dz9xs _12y3e4h9 _12jimuej _1qu2nqa1 _syaz1fxt _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi",
|
|
8
|
+
avatarSkeleton: "_2rkoglpi _ca0qpxbi _u5f3pxbi _n3tdpxbi _19bvpxbi",
|
|
9
|
+
firstLineSkeleton: "_2rko1q77 _1rjc1b66",
|
|
10
|
+
secondLineSkeleton: "_2rko1q77 _1rjc1b66 _1bsbqkoa"
|
|
11
|
+
};
|
|
12
|
+
export const LinkedContainerCardSkeleton = () => {
|
|
13
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
14
|
+
xcss: styles.container
|
|
15
|
+
}, /*#__PURE__*/React.createElement(Inline, {
|
|
16
|
+
space: "space.100",
|
|
17
|
+
alignBlock: "center"
|
|
18
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
19
|
+
backgroundColor: "color.background.neutral",
|
|
20
|
+
xcss: styles.avatarSkeleton
|
|
21
|
+
}), /*#__PURE__*/React.createElement(Stack, {
|
|
22
|
+
space: "space.100",
|
|
23
|
+
grow: "fill"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
25
|
+
backgroundColor: "color.background.neutral",
|
|
26
|
+
xcss: styles.firstLineSkeleton
|
|
27
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
28
|
+
backgroundColor: "color.background.neutral",
|
|
29
|
+
xcss: styles.secondLineSkeleton
|
|
30
|
+
}))));
|
|
31
|
+
};
|