@strapi/admin 4.8.1 → 4.9.0-exp.90df253ba90fd6879eb56a720a1f80d04ff745b8
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/admin/src/pages/SettingsPage/components/Tokens/TokenTypeSelect/index.js +7 -5
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/components/FormTransferTokenContainer/index.js +41 -0
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/index.js +6 -4
- package/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +1 -0
- package/admin/src/translations/zh-Hans.json +895 -693
- package/build/5563.451e91ee.chunk.js +30 -0
- package/build/7259.7744297b.chunk.js +1 -0
- package/build/{8580.0aa21940.chunk.js → 8580.b0dcf37c.chunk.js} +3 -3
- package/build/{Admin-authenticatedApp.1f2fd68f.chunk.js → Admin-authenticatedApp.5aa08bf5.chunk.js} +4 -4
- package/build/{Admin_settingsPage.caf3b9ab.chunk.js → Admin_settingsPage.489ec4eb.chunk.js} +1 -1
- package/build/{api-tokens-create-page.4328b852.chunk.js → api-tokens-create-page.2a6e22bd.chunk.js} +1 -1
- package/build/{api-tokens-edit-page.bce5050f.chunk.js → api-tokens-edit-page.fa38cd63.chunk.js} +1 -1
- package/build/{content-manager.84afc839.chunk.js → content-manager.f530e141.chunk.js} +1 -1
- package/build/{content-type-builder.55dac849.chunk.js → content-type-builder.6ecd201d.chunk.js} +9 -9
- package/build/index.html +1 -1
- package/build/{main.5b92c1d6.js → main.43b93ff3.js} +386 -352
- package/build/{runtime~main.a3892432.js → runtime~main.a40b1b57.js} +2 -2
- package/build/users-permissions-translation-zh-Hans-json.6ab714ee.chunk.js +1 -0
- package/build/zh-Hans-json.4cfef87d.chunk.js +1 -0
- package/package.json +11 -11
- package/server/controllers/transfer/runner.js +4 -2
- package/server/routes/transfer.js +13 -4
- package/server/services/constants.js +4 -0
- package/server/services/transfer/permission.js +1 -1
- package/server/services/transfer/token.js +33 -31
- package/server/validation/transfer/token.js +10 -2
- package/build/4649.33220ac3.chunk.js +0 -30
- package/build/7259.3675c199.chunk.js +0 -1
- package/build/users-permissions-translation-zh-Hans-json.0b31c705.chunk.js +0 -1
- package/build/zh-Hans-json.4c9706a6.chunk.js +0 -1
|
@@ -4,21 +4,21 @@ import { useIntl } from 'react-intl';
|
|
|
4
4
|
|
|
5
5
|
import { Select, Option } from '@strapi/design-system';
|
|
6
6
|
|
|
7
|
-
const TokenTypeSelect = ({ errors, values, onChange, canEditInputs, options, label }) => {
|
|
7
|
+
const TokenTypeSelect = ({ name, errors, values, onChange, canEditInputs, options, label }) => {
|
|
8
8
|
const { formatMessage } = useIntl();
|
|
9
9
|
|
|
10
10
|
return (
|
|
11
11
|
<Select
|
|
12
|
-
name=
|
|
12
|
+
name={name}
|
|
13
13
|
label={formatMessage({
|
|
14
14
|
id: label.id,
|
|
15
15
|
defaultMessage: label.defaultMessage,
|
|
16
16
|
})}
|
|
17
|
-
value={values
|
|
17
|
+
value={values && values[name]}
|
|
18
18
|
error={
|
|
19
|
-
errors
|
|
19
|
+
errors[name]
|
|
20
20
|
? formatMessage(
|
|
21
|
-
errors
|
|
21
|
+
errors[name]?.id ? errors[name] : { id: errors[name], defaultMessage: errors[name] }
|
|
22
22
|
)
|
|
23
23
|
: null
|
|
24
24
|
}
|
|
@@ -38,6 +38,7 @@ const TokenTypeSelect = ({ errors, values, onChange, canEditInputs, options, lab
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
TokenTypeSelect.propTypes = {
|
|
41
|
+
name: PropTypes.string,
|
|
41
42
|
options: PropTypes.arrayOf(
|
|
42
43
|
PropTypes.shape({
|
|
43
44
|
label: PropTypes.shape({
|
|
@@ -62,6 +63,7 @@ TokenTypeSelect.propTypes = {
|
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
TokenTypeSelect.defaultProps = {
|
|
66
|
+
name: 'type',
|
|
65
67
|
errors: {},
|
|
66
68
|
options: [],
|
|
67
69
|
};
|
|
@@ -5,6 +5,7 @@ import { Box, Grid, GridItem, Flex, Typography } from '@strapi/design-system';
|
|
|
5
5
|
import LifeSpanInput from '../../../../../components/Tokens/LifeSpanInput';
|
|
6
6
|
import TokenName from '../../../../../components/Tokens/TokenName';
|
|
7
7
|
import TokenDescription from '../../../../../components/Tokens/TokenDescription';
|
|
8
|
+
import TokenTypeSelect from '../../../../../components/Tokens/TokenTypeSelect';
|
|
8
9
|
|
|
9
10
|
const FormTransferTokenContainer = ({
|
|
10
11
|
errors,
|
|
@@ -16,6 +17,30 @@ const FormTransferTokenContainer = ({
|
|
|
16
17
|
}) => {
|
|
17
18
|
const { formatMessage } = useIntl();
|
|
18
19
|
|
|
20
|
+
const typeOptions = [
|
|
21
|
+
{
|
|
22
|
+
value: 'push',
|
|
23
|
+
label: {
|
|
24
|
+
id: 'Settings.transferTokens.types.push',
|
|
25
|
+
defaultMessage: 'Push',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: 'pull',
|
|
30
|
+
label: {
|
|
31
|
+
id: 'Settings.transferTokens.types.pull',
|
|
32
|
+
defaultMessage: 'Pull',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
value: 'push-pull',
|
|
37
|
+
label: {
|
|
38
|
+
id: 'Settings.transferTokens.types.push-pull',
|
|
39
|
+
defaultMessage: 'Full Access',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
|
|
19
44
|
return (
|
|
20
45
|
<Box
|
|
21
46
|
background="neutral0"
|
|
@@ -59,6 +84,22 @@ const FormTransferTokenContainer = ({
|
|
|
59
84
|
token={transferToken}
|
|
60
85
|
/>
|
|
61
86
|
</GridItem>
|
|
87
|
+
<GridItem key="permissions" col={6} xs={12}>
|
|
88
|
+
<TokenTypeSelect
|
|
89
|
+
name="permissions"
|
|
90
|
+
values={values}
|
|
91
|
+
errors={errors}
|
|
92
|
+
label={{
|
|
93
|
+
id: 'Settings.tokens.form.type',
|
|
94
|
+
defaultMessage: 'Token type',
|
|
95
|
+
}}
|
|
96
|
+
onChange={(value) => {
|
|
97
|
+
onChange({ target: { name: 'permissions', value } });
|
|
98
|
+
}}
|
|
99
|
+
options={typeOptions}
|
|
100
|
+
canEditInputs={canEditInputs}
|
|
101
|
+
/>
|
|
102
|
+
</GridItem>
|
|
62
103
|
</Grid>
|
|
63
104
|
</Flex>
|
|
64
105
|
</Box>
|
|
@@ -92,6 +92,8 @@ const TransferTokenCreateView = () => {
|
|
|
92
92
|
? parseInt(body.lifespan, 10)
|
|
93
93
|
: null;
|
|
94
94
|
|
|
95
|
+
const permissions = body.permissions.split('-');
|
|
96
|
+
|
|
95
97
|
try {
|
|
96
98
|
const {
|
|
97
99
|
data: { data: response },
|
|
@@ -99,13 +101,12 @@ const TransferTokenCreateView = () => {
|
|
|
99
101
|
? await post(`/admin/transfer/tokens`, {
|
|
100
102
|
...body,
|
|
101
103
|
lifespan: lifespanVal,
|
|
102
|
-
permissions
|
|
104
|
+
permissions,
|
|
103
105
|
})
|
|
104
106
|
: await put(`/admin/transfer/tokens/${id}`, {
|
|
105
107
|
name: body.name,
|
|
106
108
|
description: body.description,
|
|
107
|
-
|
|
108
|
-
permissions: ['push'],
|
|
109
|
+
permissions,
|
|
109
110
|
});
|
|
110
111
|
|
|
111
112
|
unlockApp();
|
|
@@ -132,7 +133,7 @@ const TransferTokenCreateView = () => {
|
|
|
132
133
|
});
|
|
133
134
|
|
|
134
135
|
trackUsageRef.current(isCreating ? 'didCreateToken' : 'didEditToken', {
|
|
135
|
-
type: transferToken?.
|
|
136
|
+
type: transferToken?.permissions,
|
|
136
137
|
tokenType: TRANSFER_TOKEN_TYPE,
|
|
137
138
|
});
|
|
138
139
|
} catch (err) {
|
|
@@ -173,6 +174,7 @@ const TransferTokenCreateView = () => {
|
|
|
173
174
|
lifespan: transferToken?.lifespan
|
|
174
175
|
? transferToken.lifespan.toString()
|
|
175
176
|
: transferToken?.lifespan,
|
|
177
|
+
permissions: transferToken?.permissions.join('-'),
|
|
176
178
|
}}
|
|
177
179
|
enableReinitialize
|
|
178
180
|
onSubmit={(body, actions) => handleSubmit(body, actions)}
|
|
@@ -5,6 +5,7 @@ const schema = yup.object().shape({
|
|
|
5
5
|
name: yup.string(translatedErrors.string).max(100).required(translatedErrors.required),
|
|
6
6
|
description: yup.string().nullable(),
|
|
7
7
|
lifespan: yup.number().integer().min(0).nullable().defined(translatedErrors.required),
|
|
8
|
+
permissions: yup.string(translatedErrors.string).required(translatedErrors.required),
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
export default schema;
|