@strapi/admin 4.10.2-alpha.0 → 4.10.4

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.
Files changed (121) hide show
  1. package/admin/src/content-manager/components/Wysiwyg/WysiwygNav.js +156 -155
  2. package/admin/src/content-manager/pages/ListSettingsView/{utils/excludedSortOptions.js → constants.js} +1 -1
  3. package/admin/src/content-manager/pages/ListSettingsView/index.js +33 -36
  4. package/admin/src/pages/Admin/index.js +3 -0
  5. package/admin/src/pages/AuthPage/components/Register/index.js +1 -1
  6. package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FilterSelect.js +1 -1
  7. package/admin/src/pages/MarketplacePage/components/NpmPackagesFilters/FiltersPopover.js +52 -41
  8. package/admin/src/pages/MarketplacePage/components/SortSelect/index.js +16 -0
  9. package/admin/src/pages/SettingsPage/pages/Users/components/SelectRoles/index.js +2 -2
  10. package/admin/src/translations/en.json +1 -0
  11. package/admin/src/translations/ru.json +7 -0
  12. package/build/{1387.84b454d3.chunk.js → 1387.437eb420.chunk.js} +1 -1
  13. package/build/{1657.45231968.chunk.js → 1657.85034334.chunk.js} +52 -52
  14. package/build/3081.c2cdfac8.chunk.js +108 -0
  15. package/build/3816.2b58bc1a.chunk.js +214 -0
  16. package/build/462.a073ff1f.chunk.js +71 -0
  17. package/build/{4628.20631dd1.chunk.js → 4628.9cbb6df5.chunk.js} +1 -1
  18. package/build/5542.5328b662.chunk.js +71 -0
  19. package/build/{5563.986609ed.chunk.js → 5563.44e0ef15.chunk.js} +22 -22
  20. package/build/617.ce23dea8.chunk.js +155 -0
  21. package/build/6858.85d76858.chunk.js +50 -0
  22. package/build/6970.e8422af3.chunk.js +1 -0
  23. package/build/{7259.7a48aa2f.chunk.js → 7259.3ed2b60e.chunk.js} +1 -1
  24. package/build/{Admin-authenticatedApp.2fab70e4.chunk.js → Admin-authenticatedApp.dbb99d34.chunk.js} +2 -2
  25. package/build/Admin_homePage.e15dcf28.chunk.js +73 -0
  26. package/build/Admin_marketplace.87f51b29.chunk.js +55 -0
  27. package/build/Admin_pluginsPage.7df6b5a9.chunk.js +6 -0
  28. package/build/{Admin_profilePage.1b337b73.chunk.js → Admin_profilePage.1687246a.chunk.js} +1 -1
  29. package/build/Admin_settingsPage.20884a40.chunk.js +79 -0
  30. package/build/Upload_ConfigureTheView.aa64ed9a.chunk.js +1 -0
  31. package/build/{admin-app.9bfe4ec7.chunk.js → admin-app.d4fd9379.chunk.js} +4 -4
  32. package/build/{admin-edit-roles-page.d0c9497b.chunk.js → admin-edit-roles-page.6fe9de49.chunk.js} +43 -41
  33. package/build/{admin-edit-users.ba27c532.chunk.js → admin-edit-users.49363035.chunk.js} +4 -4
  34. package/build/admin-roles-list.a323aa9f.chunk.js +31 -0
  35. package/build/admin-users.16bb6e77.chunk.js +34 -0
  36. package/build/audit-logs-settings-page.48b921f9.chunk.js +129 -0
  37. package/build/content-manager.a837bfcd.chunk.js +1123 -0
  38. package/build/content-type-builder-list-view.1e821eb9.chunk.js +215 -0
  39. package/build/{content-type-builder-translation-en-json.446b611d.chunk.js → content-type-builder-translation-en-json.5e5f8607.chunk.js} +1 -1
  40. package/build/{content-type-builder.4737a30c.chunk.js → content-type-builder.51c64fe5.chunk.js} +4 -4
  41. package/build/email-settings-page.5bc22e5a.chunk.js +11 -0
  42. package/build/en-json.1f6af924.chunk.js +1 -0
  43. package/build/i18n-settings-page.1581894e.chunk.js +114 -0
  44. package/build/i18n-translation-ru-json.401bc498.chunk.js +1 -0
  45. package/build/index.html +1 -1
  46. package/build/main.31bdf27e.js +2679 -0
  47. package/build/review-workflows-settings.26409ce4.chunk.js +61 -0
  48. package/build/ru-json.678cd48b.chunk.js +1 -0
  49. package/build/{runtime~main.c9593d59.js → runtime~main.a096f3d0.js} +2 -2
  50. package/build/{sso-settings-page.f44d95d8.chunk.js → sso-settings-page.c9d7c8df.chunk.js} +1 -1
  51. package/build/upload-settings.4d962053.chunk.js +14 -0
  52. package/build/upload.4dcd513f.chunk.js +34 -0
  53. package/build/users-advanced-settings-page.dd2a4954.chunk.js +9 -0
  54. package/build/users-email-settings-page.510648ab.chunk.js +24 -0
  55. package/build/users-permissions-translation-ru-json.8e883c67.chunk.js +1 -0
  56. package/build/users-providers-settings-page.0ee7d54f.chunk.js +29 -0
  57. package/build/webhook-edit-page.36c9f20d.chunk.js +128 -0
  58. package/build/webhook-list-page.0983d83f.chunk.js +71 -0
  59. package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/ReviewWorkflowsStageEE.js +22 -5
  60. package/ee/admin/content-manager/components/DynamicTable/CellContent/ReviewWorkflowsStage/getTableColumn.js +7 -3
  61. package/ee/admin/content-manager/pages/EditView/InformationBox/InformationBoxEE.js +20 -3
  62. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/ReviewWorkflows.js +34 -25
  63. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/actions/index.js +11 -0
  64. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/StageDragPreview/StageDragPreview.js +45 -0
  65. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/StageDragPreview/index.js +1 -0
  66. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/Stage.js +290 -63
  67. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/OptionColor/OptionColor.js +37 -0
  68. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/OptionColor/index.js +1 -0
  69. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/SingleValueColor/SingleValueColor.js +44 -0
  70. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stage/components/SingleValueColor/index.js +1 -0
  71. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/components/Stages/Stages.js +2 -1
  72. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/constants.js +26 -0
  73. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/reducer/index.js +36 -2
  74. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/colors.js +39 -0
  75. package/ee/admin/pages/SettingsPage/pages/ReviewWorkflows/utils/getWorkflowValidationSchema.js +9 -0
  76. package/ee/server/constants/workflows.js +1 -0
  77. package/ee/server/content-types/workflow-stage/index.js +7 -0
  78. package/ee/server/controllers/authentication/middlewares.js +1 -1
  79. package/ee/server/migrations/review-workflows-stages-color.js +20 -0
  80. package/ee/server/register.js +2 -0
  81. package/ee/server/routes/audit-logs.js +43 -0
  82. package/ee/server/routes/index.js +5 -226
  83. package/ee/server/routes/license-limit.js +29 -0
  84. package/ee/server/routes/review-workflows.js +112 -0
  85. package/ee/server/routes/sso.js +60 -0
  86. package/ee/server/routes/utils.js +15 -0
  87. package/ee/server/services/review-workflows/stages.js +1 -1
  88. package/ee/server/validation/review-workflows.js +7 -1
  89. package/package.json +17 -17
  90. package/server/routes/index.js +16 -11
  91. package/webpack.alias.js +0 -1
  92. package/admin/src/content-manager/pages/ListSettingsView/utils/api.js +0 -10
  93. package/build/3081.bcf9a12f.chunk.js +0 -108
  94. package/build/462.8fff7f3b.chunk.js +0 -71
  95. package/build/5542.b8240e3f.chunk.js +0 -70
  96. package/build/6404.68405699.chunk.js +0 -100
  97. package/build/7725.f717acdd.chunk.js +0 -213
  98. package/build/Admin_homePage.9f7c0bb1.chunk.js +0 -73
  99. package/build/Admin_marketplace.a60cde15.chunk.js +0 -31
  100. package/build/Admin_pluginsPage.9e6fa51c.chunk.js +0 -6
  101. package/build/Admin_settingsPage.56e9641c.chunk.js +0 -79
  102. package/build/Upload_ConfigureTheView.4fc648b5.chunk.js +0 -1
  103. package/build/admin-roles-list.c759daa3.chunk.js +0 -31
  104. package/build/admin-users.ad5dd832.chunk.js +0 -34
  105. package/build/audit-logs-settings-page.45cb4fb5.chunk.js +0 -76
  106. package/build/content-manager.a0ff6cad.chunk.js +0 -1111
  107. package/build/content-type-builder-list-view.5ff685ec.chunk.js +0 -214
  108. package/build/email-settings-page.dc07d518.chunk.js +0 -10
  109. package/build/en-json.c7fc79af.chunk.js +0 -1
  110. package/build/i18n-settings-page.8219dd99.chunk.js +0 -60
  111. package/build/main.964e7203.js +0 -2597
  112. package/build/review-workflows-settings.089d7ec5.chunk.js +0 -106
  113. package/build/ru-json.e0662702.chunk.js +0 -1
  114. package/build/upload-settings.dd2d987c.chunk.js +0 -13
  115. package/build/upload.c8479232.chunk.js +0 -33
  116. package/build/users-advanced-settings-page.c36cfd59.chunk.js +0 -8
  117. package/build/users-email-settings-page.2716ce8e.chunk.js +0 -23
  118. package/build/users-permissions-translation-ru-json.20e177db.chunk.js +0 -1
  119. package/build/users-providers-settings-page.0d6304a5.chunk.js +0 -28
  120. package/build/webhook-edit-page.f4db86f3.chunk.js +0 -75
  121. package/build/webhook-list-page.30d73114.chunk.js +0 -71
@@ -1,9 +1,9 @@
1
1
  import React, { useRef, useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
3
4
  import { useIntl } from 'react-intl';
4
5
  import {
5
6
  FocusTrap,
6
- Box,
7
7
  Button,
8
8
  IconButtonGroup,
9
9
  Option,
@@ -33,6 +33,9 @@ import {
33
33
  CustomLinkIconButton,
34
34
  } from './WysiwygStyles';
35
35
 
36
+ /**
37
+ * TODO: refactor this mess.
38
+ */
36
39
  const WysiwygNav = ({
37
40
  disabled,
38
41
  editorRef,
@@ -56,68 +59,9 @@ const WysiwygNav = ({
56
59
 
57
60
  if (disabled || isPreviewMode) {
58
61
  return (
59
- <Box padding={2} background="neutral100">
60
- <Flex justifyContent="space-between">
61
- <Flex>
62
- <Select
63
- disabled
64
- id="selectTitle"
65
- placeholder={selectPlaceholder}
66
- size="S"
67
- aria-label={selectPlaceholder}
68
- >
69
- <Option value="h1">h1</Option>
70
- <Option value="h2">h2</Option>
71
- <Option value="h3">h3</Option>
72
- <Option value="h4">h4</Option>
73
- <Option value="h5">h5</Option>
74
- <Option value="h6">h6</Option>
75
- </Select>
76
-
77
- <MainButtons>
78
- <CustomIconButton disabled id="Bold" label="Bold" name="Bold" icon={<Bold />} />
79
- <CustomIconButton
80
- disabled
81
- id="Italic"
82
- label="Italic"
83
- name="Italic"
84
- icon={<Italic />}
85
- />
86
- <CustomIconButton
87
- disabled
88
- id="Underline"
89
- label="Underline"
90
- name="Underline"
91
- icon={<Underline />}
92
- />
93
- </MainButtons>
94
-
95
- <MoreButton disabled id="more" label="More" icon={<More />} />
96
- </Flex>
97
-
98
- {!isExpandMode && (
99
- <Button onClick={onTogglePreviewMode} variant="tertiary" id="preview">
100
- {formatMessage({
101
- id: 'components.Wysiwyg.ToggleMode.markdown-mode',
102
- defaultMessage: 'Markdown mode',
103
- })}
104
- </Button>
105
- )}
106
- </Flex>
107
- </Box>
108
- );
109
- }
110
-
111
- return (
112
- <Box padding={2} background="neutral100">
113
- <Flex justifyContent="space-between">
114
- <Flex>
115
- <Select
116
- id="selectTitle"
117
- placeholder={selectPlaceholder}
118
- size="S"
119
- onChange={(value) => onActionClick(value, editorRef)}
120
- >
62
+ <Flex padding={2} background="neutral100" justifyContent="space-between">
63
+ <StyledFlex>
64
+ <Select disabled placeholder={selectPlaceholder} size="S" label={selectPlaceholder}>
121
65
  <Option value="h1">h1</Option>
122
66
  <Option value="h2">h2</Option>
123
67
  <Option value="h3">h3</Option>
@@ -127,22 +71,10 @@ const WysiwygNav = ({
127
71
  </Select>
128
72
 
129
73
  <MainButtons>
74
+ <CustomIconButton disabled id="Bold" label="Bold" name="Bold" icon={<Bold />} />
75
+ <CustomIconButton disabled id="Italic" label="Italic" name="Italic" icon={<Italic />} />
130
76
  <CustomIconButton
131
- onClick={() => onActionClick('Bold', editorRef)}
132
- id="Bold"
133
- label="Bold"
134
- name="Bold"
135
- icon={<Bold />}
136
- />
137
- <CustomIconButton
138
- onClick={() => onActionClick('Italic', editorRef)}
139
- id="Italic"
140
- label="Italic"
141
- name="Italic"
142
- icon={<Italic />}
143
- />
144
- <CustomIconButton
145
- onClick={() => onActionClick('Underline', editorRef)}
77
+ disabled
146
78
  id="Underline"
147
79
  label="Underline"
148
80
  name="Underline"
@@ -150,90 +82,145 @@ const WysiwygNav = ({
150
82
  />
151
83
  </MainButtons>
152
84
 
153
- <MoreButton
154
- ref={buttonMoreRef}
155
- onClick={handleTogglePopover}
156
- id="more"
157
- label="More"
158
- icon={<More />}
159
- />
160
- {visiblePopover && (
161
- <Popover centered source={buttonMoreRef} spacing={4} id="popover">
162
- <FocusTrap onEscape={handleTogglePopover} restoreFocus={false}>
163
- <Flex>
164
- <IconButtonGroupMargin>
165
- <CustomIconButton
166
- onClick={() => onActionClick('Strikethrough', editorRef, handleTogglePopover)}
167
- id="Strikethrough"
168
- label="Strikethrough"
169
- name="Strikethrough"
170
- icon={<StrikeThrough />}
171
- />
172
- <CustomIconButton
173
- onClick={() => onActionClick('BulletList', editorRef, handleTogglePopover)}
174
- id="BulletList"
175
- label="BulletList"
176
- name="BulletList"
177
- icon={<BulletList />}
178
- />
179
- <CustomIconButton
180
- onClick={() => onActionClick('NumberList', editorRef, handleTogglePopover)}
181
- id="NumberList"
182
- label="NumberList"
183
- name="NumberList"
184
- icon={<NumberList />}
185
- />
186
- </IconButtonGroupMargin>
187
- <IconButtonGroup>
188
- <CustomIconButton
189
- onClick={() => onActionClick('Code', editorRef, handleTogglePopover)}
190
- id="Code"
191
- label="Code"
192
- name="Code"
193
- icon={<Code />}
194
- />
195
- <CustomIconButton
196
- onClick={() => {
197
- handleTogglePopover();
198
- onToggleMediaLib();
199
- }}
200
- id="Image"
201
- label="Image"
202
- name="Image"
203
- icon={<Image />}
204
- />
205
- <CustomLinkIconButton
206
- onClick={() => onActionClick('Link', editorRef, handleTogglePopover)}
207
- id="Link"
208
- label="Link"
209
- name="Link"
210
- // eslint-disable-next-line jsx-a11y/anchor-is-valid
211
- icon={<Link />}
212
- />
213
- <CustomIconButton
214
- onClick={() => onActionClick('Quote', editorRef, handleTogglePopover)}
215
- id="Quote"
216
- label="Quote"
217
- name="Quote"
218
- icon={<Quote />}
219
- />
220
- </IconButtonGroup>
221
- </Flex>
222
- </FocusTrap>
223
- </Popover>
224
- )}
225
- </Flex>
85
+ <MoreButton disabled id="more" label="More" icon={<More />} />
86
+ </StyledFlex>
226
87
 
227
- {onTogglePreviewMode && (
88
+ {!isExpandMode && (
228
89
  <Button onClick={onTogglePreviewMode} variant="tertiary" id="preview">
229
90
  {formatMessage({
230
- id: 'components.Wysiwyg.ToggleMode.preview-mode',
231
- defaultMessage: 'Preview mode',
91
+ id: 'components.Wysiwyg.ToggleMode.markdown-mode',
92
+ defaultMessage: 'Markdown mode',
232
93
  })}
233
94
  </Button>
234
95
  )}
235
96
  </Flex>
236
- </Box>
97
+ );
98
+ }
99
+
100
+ return (
101
+ <Flex padding={2} background="neutral100" justifyContent="space-between">
102
+ <StyledFlex>
103
+ <Select
104
+ placeholder={selectPlaceholder}
105
+ label={selectPlaceholder}
106
+ size="S"
107
+ onChange={(value) => onActionClick(value, editorRef)}
108
+ >
109
+ <Option value="h1">h1</Option>
110
+ <Option value="h2">h2</Option>
111
+ <Option value="h3">h3</Option>
112
+ <Option value="h4">h4</Option>
113
+ <Option value="h5">h5</Option>
114
+ <Option value="h6">h6</Option>
115
+ </Select>
116
+
117
+ <MainButtons>
118
+ <CustomIconButton
119
+ onClick={() => onActionClick('Bold', editorRef)}
120
+ id="Bold"
121
+ label="Bold"
122
+ name="Bold"
123
+ icon={<Bold />}
124
+ />
125
+ <CustomIconButton
126
+ onClick={() => onActionClick('Italic', editorRef)}
127
+ id="Italic"
128
+ label="Italic"
129
+ name="Italic"
130
+ icon={<Italic />}
131
+ />
132
+ <CustomIconButton
133
+ onClick={() => onActionClick('Underline', editorRef)}
134
+ id="Underline"
135
+ label="Underline"
136
+ name="Underline"
137
+ icon={<Underline />}
138
+ />
139
+ </MainButtons>
140
+
141
+ <MoreButton
142
+ ref={buttonMoreRef}
143
+ onClick={handleTogglePopover}
144
+ id="more"
145
+ label="More"
146
+ icon={<More />}
147
+ />
148
+ {visiblePopover && (
149
+ <Popover centered source={buttonMoreRef} spacing={4} id="popover">
150
+ <FocusTrap onEscape={handleTogglePopover} restoreFocus={false}>
151
+ <Flex>
152
+ <IconButtonGroupMargin>
153
+ <CustomIconButton
154
+ onClick={() => onActionClick('Strikethrough', editorRef, handleTogglePopover)}
155
+ id="Strikethrough"
156
+ label="Strikethrough"
157
+ name="Strikethrough"
158
+ icon={<StrikeThrough />}
159
+ />
160
+ <CustomIconButton
161
+ onClick={() => onActionClick('BulletList', editorRef, handleTogglePopover)}
162
+ id="BulletList"
163
+ label="BulletList"
164
+ name="BulletList"
165
+ icon={<BulletList />}
166
+ />
167
+ <CustomIconButton
168
+ onClick={() => onActionClick('NumberList', editorRef, handleTogglePopover)}
169
+ id="NumberList"
170
+ label="NumberList"
171
+ name="NumberList"
172
+ icon={<NumberList />}
173
+ />
174
+ </IconButtonGroupMargin>
175
+ <IconButtonGroup>
176
+ <CustomIconButton
177
+ onClick={() => onActionClick('Code', editorRef, handleTogglePopover)}
178
+ id="Code"
179
+ label="Code"
180
+ name="Code"
181
+ icon={<Code />}
182
+ />
183
+ <CustomIconButton
184
+ onClick={() => {
185
+ handleTogglePopover();
186
+ onToggleMediaLib();
187
+ }}
188
+ id="Image"
189
+ label="Image"
190
+ name="Image"
191
+ icon={<Image />}
192
+ />
193
+ <CustomLinkIconButton
194
+ onClick={() => onActionClick('Link', editorRef, handleTogglePopover)}
195
+ id="Link"
196
+ label="Link"
197
+ name="Link"
198
+ // eslint-disable-next-line jsx-a11y/anchor-is-valid
199
+ icon={<Link />}
200
+ />
201
+ <CustomIconButton
202
+ onClick={() => onActionClick('Quote', editorRef, handleTogglePopover)}
203
+ id="Quote"
204
+ label="Quote"
205
+ name="Quote"
206
+ icon={<Quote />}
207
+ />
208
+ </IconButtonGroup>
209
+ </Flex>
210
+ </FocusTrap>
211
+ </Popover>
212
+ )}
213
+ </StyledFlex>
214
+
215
+ {onTogglePreviewMode && (
216
+ <Button onClick={onTogglePreviewMode} variant="tertiary" id="preview">
217
+ {formatMessage({
218
+ id: 'components.Wysiwyg.ToggleMode.preview-mode',
219
+ defaultMessage: 'Preview mode',
220
+ })}
221
+ </Button>
222
+ )}
223
+ </Flex>
237
224
  );
238
225
  };
239
226
 
@@ -255,3 +242,17 @@ WysiwygNav.propTypes = {
255
242
  };
256
243
 
257
244
  export default WysiwygNav;
245
+
246
+ const StyledFlex = styled(Flex)`
247
+ /* Hide the label, every input needs a label. */
248
+ label {
249
+ border: 0;
250
+ clip: rect(0 0 0 0);
251
+ height: 1px;
252
+ margin: -1px;
253
+ overflow: hidden;
254
+ padding: 0;
255
+ position: absolute;
256
+ width: 1px;
257
+ }
258
+ `;
@@ -1,4 +1,4 @@
1
- export const EXCLUDED_SORT_OPTIONS = [
1
+ export const EXCLUDED_SORT_ATTRIBUTE_TYPES = [
2
2
  'media',
3
3
  'richtext',
4
4
  'dynamiczone',
@@ -7,7 +7,13 @@ import pick from 'lodash/pick';
7
7
  import get from 'lodash/get';
8
8
  import isEmpty from 'lodash/isEmpty';
9
9
  import { stringify } from 'qs';
10
- import { useNotification, useTracking, ConfirmDialog, Link } from '@strapi/helper-plugin';
10
+ import {
11
+ useNotification,
12
+ useTracking,
13
+ ConfirmDialog,
14
+ Link,
15
+ useFetchClient,
16
+ } from '@strapi/helper-plugin';
11
17
  import { useIntl } from 'react-intl';
12
18
  import {
13
19
  Box,
@@ -19,18 +25,19 @@ import {
19
25
  Button,
20
26
  } from '@strapi/design-system';
21
27
  import { Check, ArrowLeft } from '@strapi/icons';
28
+
22
29
  import { checkIfAttributeIsDisplayable, getTrad } from '../../utils';
23
30
  import ModelsContext from '../../contexts/ModelsContext';
24
31
  import { usePluginsQueryParams } from '../../hooks';
25
- import putCMSettingsLV from './utils/api';
26
32
  import Settings from './components/Settings';
27
33
  import SortDisplayedFields from './components/SortDisplayedFields';
28
34
  import EditFieldForm from './components/EditFieldForm';
29
35
  import init from './init';
30
36
  import reducer, { initialState } from './reducer';
31
- import { EXCLUDED_SORT_OPTIONS } from './utils/excludedSortOptions';
37
+ import { EXCLUDED_SORT_ATTRIBUTE_TYPES } from './constants';
32
38
 
33
39
  const ListSettingsView = ({ layout, slug }) => {
40
+ const { put } = useFetchClient();
34
41
  const { formatMessage } = useIntl();
35
42
  const { trackUsage } = useTracking();
36
43
  const pluginsQueryParams = usePluginsQueryParams();
@@ -130,18 +137,21 @@ const ListSettingsView = ({ layout, slug }) => {
130
137
  handleCloseModal();
131
138
  };
132
139
 
133
- const submitMutation = useMutation((body) => putCMSettingsLV(body, slug), {
134
- onSuccess() {
135
- trackUsage('didEditListSettings');
136
- refetchData();
137
- },
138
- onError() {
139
- toggleNotification({
140
- type: 'warning',
141
- message: { id: 'notification.error' },
142
- });
143
- },
144
- });
140
+ const submitMutation = useMutation(
141
+ (body) => put(`/content-manager/content-types/${slug}/configuration`, body),
142
+ {
143
+ onSuccess() {
144
+ trackUsage('didEditListSettings');
145
+ refetchData();
146
+ },
147
+ onError() {
148
+ toggleNotification({
149
+ type: 'warning',
150
+ message: { id: 'notification.error' },
151
+ });
152
+ },
153
+ }
154
+ );
145
155
  const { isLoading: isSubmittingForm } = submitMutation;
146
156
 
147
157
  const handleChangeEditLabel = ({ target: { name, value } }) => {
@@ -153,29 +163,16 @@ const ListSettingsView = ({ layout, slug }) => {
153
163
  };
154
164
 
155
165
  const listRemainingFields = Object.entries(attributes)
156
- .reduce((acc, cur) => {
157
- const [attrName, fieldSchema] = cur;
158
-
159
- const isDisplayable = checkIfAttributeIsDisplayable(fieldSchema);
160
- const isAlreadyDisplayed = displayedFields.includes(attrName);
161
-
162
- if (isDisplayable && !isAlreadyDisplayed) {
163
- acc.push(attrName);
164
- }
165
-
166
- return acc;
167
- }, [])
166
+ .filter(
167
+ ([name, attribute]) =>
168
+ checkIfAttributeIsDisplayable(attribute) && !displayedFields.includes(name)
169
+ )
170
+ .map(([name]) => name)
168
171
  .sort();
169
172
 
170
- const sortOptions = Object.entries(attributes).reduce((acc, cur) => {
171
- const [name, { type }] = cur;
172
-
173
- if (!EXCLUDED_SORT_OPTIONS.includes(type)) {
174
- acc.push(name);
175
- }
176
-
177
- return acc;
178
- }, []);
173
+ const sortOptions = Object.entries(attributes)
174
+ .filter(([, attribute]) => !EXCLUDED_SORT_ATTRIBUTE_TYPES.includes(attribute.type))
175
+ .map(([name]) => name);
179
176
 
180
177
  const move = (originalIndex, atIndex) => {
181
178
  dispatch({
@@ -44,6 +44,9 @@ const SettingsPage = lazy(() =>
44
44
  );
45
45
 
46
46
  // Simple hook easier for testing
47
+ /**
48
+ * TODO: remove this, it's bad.
49
+ */
47
50
  const useTrackUsage = () => {
48
51
  const { trackUsage } = useTracking();
49
52
  const dispatch = useDispatch();
@@ -149,7 +149,7 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
149
149
  return (
150
150
  <Form noValidate>
151
151
  <Main>
152
- <Flex direction="column" alignItems="stretch" gap={3}>
152
+ <Flex direction="column" alignItems="center" gap={3}>
153
153
  <Logo />
154
154
 
155
155
  <Typography as="h1" variant="alpha" textAlign="center">
@@ -10,7 +10,7 @@ const FilterSelect = ({ message, value, onChange, possibleFilters, onClear, cust
10
10
  return (
11
11
  <Select
12
12
  data-testid={`${message}-button`}
13
- aria-label={message}
13
+ label={message}
14
14
  placeholder={message}
15
15
  size="M"
16
16
  onChange={onChange}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { Box, Popover, Flex, FocusTrap } from '@strapi/design-system';
3
+ import styled from 'styled-components';
4
+ import { Popover, Flex, FocusTrap } from '@strapi/design-system';
4
5
  import { useIntl } from 'react-intl';
5
6
  import FilterSelect from './FilterSelect';
6
7
 
@@ -19,61 +20,57 @@ const FiltersPopover = ({
19
20
  return (
20
21
  <Popover source={source} padding={3} spacing={4} onBlur={() => {}}>
21
22
  <FocusTrap onEscape={onToggle}>
22
- <Flex direction="column" alignItems="stretch" gap={1}>
23
- <Box>
23
+ <FiltersFlex direction="column" alignItems="stretch" gap={1}>
24
+ <FilterSelect
25
+ message={formatMessage({
26
+ id: 'admin.pages.MarketPlacePage.filters.collections',
27
+ defaultMessage: 'Collections',
28
+ })}
29
+ value={query?.collections || []}
30
+ onChange={(newCollections) => {
31
+ const update = { collections: newCollections };
32
+ handleSelectChange(update);
33
+ }}
34
+ onClear={() => handleSelectClear('collections')}
35
+ possibleFilters={possibleCollections}
36
+ customizeContent={(values) =>
37
+ formatMessage(
38
+ {
39
+ id: 'admin.pages.MarketPlacePage.filters.collectionsSelected',
40
+ defaultMessage:
41
+ '{count, plural, =0 {No collections} one {# collection} other {# collections}} selected',
42
+ },
43
+ { count: values.length }
44
+ )
45
+ }
46
+ />
47
+ {npmPackageType === 'plugin' && (
24
48
  <FilterSelect
25
49
  message={formatMessage({
26
- id: 'admin.pages.MarketPlacePage.filters.collections',
27
- defaultMessage: 'Collections',
50
+ id: 'admin.pages.MarketPlacePage.filters.categories',
51
+ defaultMessage: 'Categories',
28
52
  })}
29
- value={query?.collections || []}
30
- onChange={(newCollections) => {
31
- const update = { collections: newCollections };
53
+ value={query?.categories || []}
54
+ onChange={(newCategories) => {
55
+ const update = { categories: newCategories };
32
56
  handleSelectChange(update);
33
57
  }}
34
- onClear={() => handleSelectClear('collections')}
35
- possibleFilters={possibleCollections}
58
+ onClear={() => handleSelectClear('categories')}
59
+ possibleFilters={possibleCategories}
36
60
  customizeContent={(values) =>
37
61
  formatMessage(
38
62
  {
39
- id: 'admin.pages.MarketPlacePage.filters.collectionsSelected',
63
+ id: 'admin.pages.MarketPlacePage.filters.categoriesSelected',
40
64
  defaultMessage:
41
- '{count, plural, =0 {No collections} one {# collection} other {# collections}} selected',
65
+ '{count, plural, =0 {No categories} one {# category} other {# categories}} selected',
42
66
  },
43
67
  { count: values.length }
44
68
  )
45
69
  }
70
+ name="categories"
46
71
  />
47
- </Box>
48
- {npmPackageType === 'plugin' && (
49
- <Box>
50
- <FilterSelect
51
- message={formatMessage({
52
- id: 'admin.pages.MarketPlacePage.filters.categories',
53
- defaultMessage: 'Categories',
54
- })}
55
- value={query?.categories || []}
56
- onChange={(newCategories) => {
57
- const update = { categories: newCategories };
58
- handleSelectChange(update);
59
- }}
60
- onClear={() => handleSelectClear('categories')}
61
- possibleFilters={possibleCategories}
62
- customizeContent={(values) =>
63
- formatMessage(
64
- {
65
- id: 'admin.pages.MarketPlacePage.filters.categoriesSelected',
66
- defaultMessage:
67
- '{count, plural, =0 {No categories} one {# category} other {# categories}} selected',
68
- },
69
- { count: values.length }
70
- )
71
- }
72
- name="categories"
73
- />
74
- </Box>
75
72
  )}
76
- </Flex>
73
+ </FiltersFlex>
77
74
  </FocusTrap>
78
75
  </Popover>
79
76
  );
@@ -91,3 +88,17 @@ FiltersPopover.propTypes = {
91
88
  };
92
89
 
93
90
  export default FiltersPopover;
91
+
92
+ const FiltersFlex = styled(Flex)`
93
+ /* Hide the label, every input needs a label. */
94
+ label {
95
+ border: 0;
96
+ clip: rect(0 0 0 0);
97
+ height: 1px;
98
+ margin: -1px;
99
+ overflow: hidden;
100
+ padding: 0;
101
+ position: absolute;
102
+ width: 1px;
103
+ }
104
+ `;
@@ -10,6 +10,18 @@ const SelectWrapper = styled(Box)`
10
10
  span {
11
11
  font-size: ${({ theme }) => theme.fontSizes[1]};
12
12
  }
13
+
14
+ /* Hide the label, every input needs a label. */
15
+ label {
16
+ border: 0;
17
+ clip: rect(0 0 0 0);
18
+ height: 1px;
19
+ margin: -1px;
20
+ overflow: hidden;
21
+ padding: 0;
22
+ position: absolute;
23
+ width: 1px;
24
+ }
13
25
  `;
14
26
 
15
27
  const SortSelect = ({ sortQuery, handleSelectChange }) => {
@@ -68,6 +80,10 @@ const SortSelect = ({ sortQuery, handleSelectChange }) => {
68
80
  onChange={(sortName) => {
69
81
  handleSelectChange({ sort: sortName });
70
82
  }}
83
+ label={formatMessage({
84
+ id: 'admin.pages.MarketPlacePage.sort.label',
85
+ defaultMessage: 'Sort by',
86
+ })}
71
87
  >
72
88
  {Object.entries(sortTypes).map(([sortName, messages]) => {
73
89
  return (
@@ -67,13 +67,13 @@ const SelectRoles = ({ disabled, error, onChange, value }) => {
67
67
  placeholder={placeholder}
68
68
  multi
69
69
  startIcon={startIcon}
70
- value={value}
70
+ value={value.map((v) => v.toString())}
71
71
  withTags
72
72
  required
73
73
  >
74
74
  {(data || []).map((role) => {
75
75
  return (
76
- <Option key={role.id} value={role.id}>
76
+ <Option key={role.id} value={role.id.toString()}>
77
77
  {formatMessage({
78
78
  id: `global.${role.code}`,
79
79
  defaultMessage: role.name,
@@ -326,6 +326,7 @@
326
326
  "Users.components.List.empty": "There is no users...",
327
327
  "Users.components.List.empty.withFilters": "There is no users with the applied filters...",
328
328
  "Users.components.List.empty.withSearch": "There is no users corresponding to the search ({search})...",
329
+ "admin.pages.MarketPlacePage.sort.label": "Sort by",
329
330
  "admin.pages.MarketPlacePage.filters.categories": "Categories",
330
331
  "admin.pages.MarketPlacePage.filters.categoriesSelected": "{count, plural, =0 {No categories} one {# category} other {# categories}} selected",
331
332
  "admin.pages.MarketPlacePage.filters.collections": "Collections",