From 33bdeb83033faba5ab3807b66a5a91724a5523ee Mon Sep 17 00:00:00 2001 From: Simone Taeggi Date: Wed, 22 Feb 2023 16:04:30 +0100 Subject: [PATCH 1/5] add limitation on the schema validation of the name API and Transfer token --- .../pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js | 2 +- .../SettingsPage/pages/TransferTokens/EditView/utils/schema.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js index 4d6686c7ec..626080eef1 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/utils/schema.js @@ -2,7 +2,7 @@ import * as yup from 'yup'; import { translatedErrors } from '@strapi/helper-plugin'; const schema = yup.object().shape({ - name: yup.string(translatedErrors.string).required(translatedErrors.required), + name: yup.string(translatedErrors.string).max(100).required(translatedErrors.required), type: yup .string(translatedErrors.string) .oneOf(['read-only', 'full-access', 'custom']) diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js b/packages/core/admin/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js index ccaded4103..ca6efd5060 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/TransferTokens/EditView/utils/schema.js @@ -2,7 +2,7 @@ import * as yup from 'yup'; import { translatedErrors } from '@strapi/helper-plugin'; const schema = yup.object().shape({ - name: yup.string(translatedErrors.string).required(translatedErrors.required), + name: yup.string(translatedErrors.string).max(100).required(translatedErrors.required), description: yup.string().nullable(), lifespan: yup.number().integer().min(0).nullable().defined(translatedErrors.required), }); From 7dac99e011922c3c416e1d8a3482002c20bc4750 Mon Sep 17 00:00:00 2001 From: Simone Taeggi Date: Wed, 22 Feb 2023 16:11:03 +0100 Subject: [PATCH 2/5] update snapshots --- .../tests/__snapshots__/index.test.js.snap | 184 +- .../tests/__snapshots__/index.test.js.snap | 1689 +++++++++-------- .../ListView/tests/index.test.js | 621 +++--- 3 files changed, 1384 insertions(+), 1110 deletions(-) diff --git a/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/tests/__snapshots__/index.test.js.snap b/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/tests/__snapshots__/index.test.js.snap index 71244fe533..2e3934ca66 100644 --- a/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/tests/__snapshots__/index.test.js.snap +++ b/packages/core/admin/admin/src/pages/SettingsPage/pages/ApiTokens/EditView/tests/__snapshots__/index.test.js.snap @@ -15,7 +15,7 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot color: #32324d; } -.c25 { +.c24 { font-weight: 500; font-size: 1rem; line-height: 1.25; @@ -61,6 +61,11 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot padding-right: 8px; } +.c19 { + padding-right: 56px; + padding-left: 56px; +} + .c22 { background: #ffffff; padding-top: 24px; @@ -179,7 +184,7 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot flex-direction: row; } -.c23 { +.c20 { -webkit-align-items: stretch; -webkit-box-align: stretch; -ms-flex-align: stretch; @@ -311,12 +316,21 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot border: 2px solid #4945ff; } -.c24 > * { +.c21 > * { margin-top: 0; margin-bottom: 0; } -.c24 > * + * { +.c21 > * + * { + margin-top: 24px; +} + +.c23 > * { + margin-top: 0; + margin-bottom: 0; +} + +.c23 > * + * { margin-top: 16px; } @@ -519,7 +533,7 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot fill: #ffffff; } -.c26 { +.c25 { display: grid; grid-template-columns: repeat(12,1fr); gap: 20px; @@ -530,7 +544,7 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot grid-template-columns: repeat(12,1fr); } -.c27 { +.c26 { grid-column: span 6; max-width: 100%; } @@ -553,11 +567,6 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot padding-right: 8px; } -.c19 { - padding-right: 56px; - padding-left: 56px; -} - .c42 { padding-right: 16px; padding-left: 16px; @@ -602,7 +611,7 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot color: #666687; } -.c20 { +.c27 { -webkit-align-items: stretch; -webkit-box-align: stretch; -ms-flex-align: stretch; @@ -708,15 +717,6 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot display: flex; } -.c21 > * { - margin-top: 0; - margin-bottom: 0; -} - -.c21 > * + * { - margin-top: 24px; -} - .c28 > * { margin-top: 0; margin-bottom: 0; @@ -958,13 +958,13 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot } @media (max-width:68.75rem) { - .c27 { + .c26 { grid-column: span; } } @media (max-width:34.375rem) { - .c27 { + .c26 { grid-column: span 12; } } @@ -1091,27 +1091,27 @@ exports[`ADMIN | Pages | API TOKENS | EditView renders and matches the snapshot

Details