@backstage/plugin-user-settings 0.8.14-next.1 → 0.8.14-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @backstage/plugin-user-settings
|
|
2
2
|
|
|
3
|
+
## 0.8.14-next.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 0040632: `useUserProfile` will now use the user's picture stored in the catalog as a fallback if the identity provider doesn't return a picture.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @backstage/plugin-catalog-react@1.14.0-next.2
|
|
10
|
+
- @backstage/theme@0.6.0-next.1
|
|
11
|
+
- @backstage/catalog-model@1.7.0
|
|
12
|
+
- @backstage/core-app-api@1.15.1-next.1
|
|
13
|
+
- @backstage/core-compat-api@0.3.1-next.2
|
|
14
|
+
- @backstage/core-components@0.15.1-next.2
|
|
15
|
+
- @backstage/core-plugin-api@1.10.0-next.1
|
|
16
|
+
- @backstage/errors@1.2.4
|
|
17
|
+
- @backstage/frontend-plugin-api@0.9.0-next.2
|
|
18
|
+
- @backstage/types@1.1.1
|
|
19
|
+
- @backstage/plugin-signals-react@0.0.6-next.1
|
|
20
|
+
- @backstage/plugin-user-settings-common@0.0.1
|
|
21
|
+
|
|
3
22
|
## 0.8.14-next.1
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/alpha/package.json
CHANGED
|
@@ -20,12 +20,12 @@ import '@material-ui/core/MenuItem';
|
|
|
20
20
|
import '@material-ui/icons/MeetingRoom';
|
|
21
21
|
import '@material-ui/icons/MoreVert';
|
|
22
22
|
import 'react-use/esm/useAsync';
|
|
23
|
+
import '@backstage/plugin-catalog-react';
|
|
23
24
|
import '@backstage/core-components';
|
|
24
25
|
import '@material-ui/core/List';
|
|
25
26
|
import '@material-ui/core/Switch';
|
|
26
27
|
import '../General/UserSettingsThemeToggle.esm.js';
|
|
27
28
|
import '../General/UserSettingsLanguageToggle.esm.js';
|
|
28
|
-
import '@backstage/plugin-catalog-react';
|
|
29
29
|
import { SettingsLayout } from '../SettingsLayout/SettingsLayout.esm.js';
|
|
30
30
|
|
|
31
31
|
const DefaultSettingsPage = (props) => {
|
|
@@ -1,14 +1,27 @@
|
|
|
1
1
|
import { useApi, identityApiRef, alertApiRef } from '@backstage/core-plugin-api';
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import useAsync from 'react-use/esm/useAsync';
|
|
4
|
+
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
|
4
5
|
|
|
5
6
|
const useUserProfile = () => {
|
|
6
7
|
const identityApi = useApi(identityApiRef);
|
|
7
8
|
const alertApi = useApi(alertApiRef);
|
|
9
|
+
const catalogApi = useApi(catalogApiRef);
|
|
8
10
|
const { value, loading, error } = useAsync(async () => {
|
|
11
|
+
let identityProfile = await identityApi.getProfileInfo();
|
|
12
|
+
const backStageIdentity = await identityApi.getBackstageIdentity();
|
|
13
|
+
const catalogProfile = await catalogApi.getEntityByRef(
|
|
14
|
+
backStageIdentity.userEntityRef
|
|
15
|
+
);
|
|
16
|
+
if (identityProfile.picture === void 0 && catalogProfile?.spec?.profile?.picture) {
|
|
17
|
+
identityProfile = {
|
|
18
|
+
...identityProfile,
|
|
19
|
+
picture: catalogProfile.spec.profile.picture
|
|
20
|
+
};
|
|
21
|
+
}
|
|
9
22
|
return {
|
|
10
|
-
profile:
|
|
11
|
-
identity:
|
|
23
|
+
profile: identityProfile,
|
|
24
|
+
identity: backStageIdentity
|
|
12
25
|
};
|
|
13
26
|
}, []);
|
|
14
27
|
useEffect(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUserProfileInfo.esm.js","sources":["../../src/components/useUserProfileInfo.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n alertApiRef,\n identityApiRef,\n ProfileInfo,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useEffect } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\n\n/** @public */\nexport const useUserProfile = () => {\n const identityApi = useApi(identityApiRef);\n const alertApi = useApi(alertApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n
|
|
1
|
+
{"version":3,"file":"useUserProfileInfo.esm.js","sources":["../../src/components/useUserProfileInfo.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n alertApiRef,\n identityApiRef,\n ProfileInfo,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { useEffect } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { catalogApiRef } from '@backstage/plugin-catalog-react';\nimport { UserEntity } from '@backstage/catalog-model';\n\n/** @public */\nexport const useUserProfile = () => {\n const identityApi = useApi(identityApiRef);\n const alertApi = useApi(alertApiRef);\n const catalogApi = useApi(catalogApiRef);\n\n const { value, loading, error } = useAsync(async () => {\n let identityProfile = await identityApi.getProfileInfo();\n const backStageIdentity = await identityApi.getBackstageIdentity();\n const catalogProfile = (await catalogApi.getEntityByRef(\n backStageIdentity.userEntityRef,\n )) as unknown as UserEntity;\n if (\n identityProfile.picture === undefined &&\n catalogProfile?.spec?.profile?.picture\n ) {\n identityProfile = {\n ...identityProfile,\n picture: catalogProfile.spec.profile.picture,\n };\n }\n return {\n profile: identityProfile,\n identity: backStageIdentity,\n };\n }, []);\n\n useEffect(() => {\n if (error) {\n alertApi.post({\n message: `Failed to load user identity: ${error}`,\n severity: 'error',\n });\n }\n }, [error, alertApi]);\n\n if (loading || error) {\n return {\n profile: {} as ProfileInfo,\n displayName: '',\n loading,\n };\n }\n\n return {\n profile: value!.profile,\n backstageIdentity: value!.identity,\n displayName: value!.profile.displayName ?? value!.identity.userEntityRef,\n loading,\n };\n};\n"],"names":[],"mappings":";;;;;AA4BO,MAAM,iBAAiB,MAAM;AAClC,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AACzC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA,CAAA;AACnC,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA,CAAA;AAEvC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAI,IAAA,eAAA,GAAkB,MAAM,WAAA,CAAY,cAAe,EAAA,CAAA;AACvD,IAAM,MAAA,iBAAA,GAAoB,MAAM,WAAA,CAAY,oBAAqB,EAAA,CAAA;AACjE,IAAM,MAAA,cAAA,GAAkB,MAAM,UAAW,CAAA,cAAA;AAAA,MACvC,iBAAkB,CAAA,aAAA;AAAA,KACpB,CAAA;AACA,IAAA,IACE,gBAAgB,OAAY,KAAA,KAAA,CAAA,IAC5B,cAAgB,EAAA,IAAA,EAAM,SAAS,OAC/B,EAAA;AACA,MAAkB,eAAA,GAAA;AAAA,QAChB,GAAG,eAAA;AAAA,QACH,OAAA,EAAS,cAAe,CAAA,IAAA,CAAK,OAAQ,CAAA,OAAA;AAAA,OACvC,CAAA;AAAA,KACF;AACA,IAAO,OAAA;AAAA,MACL,OAAS,EAAA,eAAA;AAAA,MACT,QAAU,EAAA,iBAAA;AAAA,KACZ,CAAA;AAAA,GACF,EAAG,EAAE,CAAA,CAAA;AAEL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,KAAO,EAAA;AACT,MAAA,QAAA,CAAS,IAAK,CAAA;AAAA,QACZ,OAAA,EAAS,iCAAiC,KAAK,CAAA,CAAA;AAAA,QAC/C,QAAU,EAAA,OAAA;AAAA,OACX,CAAA,CAAA;AAAA,KACH;AAAA,GACC,EAAA,CAAC,KAAO,EAAA,QAAQ,CAAC,CAAA,CAAA;AAEpB,EAAA,IAAI,WAAW,KAAO,EAAA;AACpB,IAAO,OAAA;AAAA,MACL,SAAS,EAAC;AAAA,MACV,WAAa,EAAA,EAAA;AAAA,MACb,OAAA;AAAA,KACF,CAAA;AAAA,GACF;AAEA,EAAO,OAAA;AAAA,IACL,SAAS,KAAO,CAAA,OAAA;AAAA,IAChB,mBAAmB,KAAO,CAAA,QAAA;AAAA,IAC1B,WAAa,EAAA,KAAA,CAAO,OAAQ,CAAA,WAAA,IAAe,MAAO,QAAS,CAAA,aAAA;AAAA,IAC3D,OAAA;AAAA,GACF,CAAA;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-user-settings",
|
|
3
|
-
"version": "0.8.14-next.
|
|
3
|
+
"version": "0.8.14-next.2",
|
|
4
4
|
"description": "A Backstage plugin that provides a settings page",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -55,16 +55,17 @@
|
|
|
55
55
|
"test": "backstage-cli package test"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
+
"@backstage/catalog-model": "1.7.0",
|
|
58
59
|
"@backstage/core-app-api": "1.15.1-next.1",
|
|
59
|
-
"@backstage/core-compat-api": "0.3.1-next.
|
|
60
|
-
"@backstage/core-components": "0.15.1-next.
|
|
60
|
+
"@backstage/core-compat-api": "0.3.1-next.2",
|
|
61
|
+
"@backstage/core-components": "0.15.1-next.2",
|
|
61
62
|
"@backstage/core-plugin-api": "1.10.0-next.1",
|
|
62
63
|
"@backstage/errors": "1.2.4",
|
|
63
|
-
"@backstage/frontend-plugin-api": "0.9.0-next.
|
|
64
|
-
"@backstage/plugin-catalog-react": "1.14.0-next.
|
|
64
|
+
"@backstage/frontend-plugin-api": "0.9.0-next.2",
|
|
65
|
+
"@backstage/plugin-catalog-react": "1.14.0-next.2",
|
|
65
66
|
"@backstage/plugin-signals-react": "0.0.6-next.1",
|
|
66
67
|
"@backstage/plugin-user-settings-common": "0.0.1",
|
|
67
|
-
"@backstage/theme": "0.
|
|
68
|
+
"@backstage/theme": "0.6.0-next.1",
|
|
68
69
|
"@backstage/types": "1.1.1",
|
|
69
70
|
"@material-ui/core": "^4.12.2",
|
|
70
71
|
"@material-ui/icons": "^4.9.1",
|
|
@@ -73,10 +74,10 @@
|
|
|
73
74
|
"zen-observable": "^0.10.0"
|
|
74
75
|
},
|
|
75
76
|
"devDependencies": {
|
|
76
|
-
"@backstage/cli": "0.28.0-next.
|
|
77
|
-
"@backstage/dev-utils": "1.1.2-next.
|
|
78
|
-
"@backstage/plugin-catalog": "1.24.0-next.
|
|
79
|
-
"@backstage/test-utils": "1.6.1-next.
|
|
77
|
+
"@backstage/cli": "0.28.0-next.2",
|
|
78
|
+
"@backstage/dev-utils": "1.1.2-next.2",
|
|
79
|
+
"@backstage/plugin-catalog": "1.24.0-next.2",
|
|
80
|
+
"@backstage/test-utils": "1.6.1-next.2",
|
|
80
81
|
"@testing-library/dom": "^10.0.0",
|
|
81
82
|
"@testing-library/jest-dom": "^6.0.0",
|
|
82
83
|
"@testing-library/react": "^16.0.0",
|