@strapi/admin 4.6.0-alpha.0 → 4.6.0-alpha.1

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 (87) hide show
  1. package/admin/src/content-manager/components/Inputs/index.js +5 -19
  2. package/admin/src/content-manager/hooks/useLazyComponents/index.js +44 -0
  3. package/admin/src/content-manager/pages/CollectionTypeRecursivePath/components/ErrorFallback.js +13 -0
  4. package/admin/src/content-manager/pages/CollectionTypeRecursivePath/index.js +2 -1
  5. package/admin/src/content-manager/pages/EditView/GridRow/index.js +62 -0
  6. package/admin/src/content-manager/pages/EditView/index.js +74 -154
  7. package/admin/src/content-manager/pages/EditView/selectors.js +14 -0
  8. package/admin/src/content-manager/pages/EditView/utils/createAttributesLayout.js +11 -6
  9. package/admin/src/content-manager/pages/EditView/utils/getCustomFieldUidsFromLayout.js +18 -0
  10. package/admin/src/content-manager/pages/EditView/utils/index.js +1 -0
  11. package/admin/src/content-manager/pages/EditViewLayoutManager/index.js +1 -1
  12. package/admin/src/hooks/useSettingsMenu/init.js +7 -0
  13. package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/DynamicTable/TableRows/CellValue.js +19 -0
  14. package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/DynamicTable/TableRows/index.js +65 -0
  15. package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/ModalDialog/ActionItem.js +25 -0
  16. package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/ModalDialog/index.js +76 -0
  17. package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/hooks/useFormatTimeStamp.js +24 -0
  18. package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/index.js +84 -0
  19. package/admin/src/pages/SettingsPage/pages/AuditLogs/ListView/utils/tableHeaders.js +37 -0
  20. package/admin/src/pages/SettingsPage/pages/AuditLogs/ProtectedListPage/index.js +12 -0
  21. package/admin/src/pages/SettingsPage/utils/defaultRoutes.js +11 -0
  22. package/admin/src/permissions/defaultPermissions.js +4 -0
  23. package/admin/src/translations/en.json +7 -0
  24. package/admin/src/translations/ru.json +789 -489
  25. package/build/{1233.32d6888d.chunk.js → 1233.80b05d66.chunk.js} +11 -11
  26. package/build/1920.74a262e7.chunk.js +245 -0
  27. package/build/2438.61291207.chunk.js +2183 -0
  28. package/build/2517.9b4940f3.chunk.js +117 -0
  29. package/build/4306.f03c2b46.chunk.js +98 -0
  30. package/build/{4318.daf31770.chunk.js → 4318.7931eee7.chunk.js} +2 -2
  31. package/build/{805.a1894307.chunk.js → 805.e991a370.chunk.js} +6 -6
  32. package/build/9707.a0cc4ad8.chunk.js +70 -0
  33. package/build/{Admin-authenticatedApp.cfc3b4c9.chunk.js → Admin-authenticatedApp.ac85652e.chunk.js} +2 -2
  34. package/build/{Admin_homePage.b4db4df8.chunk.js → Admin_homePage.54e33c2d.chunk.js} +1 -1
  35. package/build/{Admin_marketplace.fa51405b.chunk.js → Admin_marketplace.8219fda6.chunk.js} +1 -1
  36. package/build/{Admin_pluginsPage.14d2840f.chunk.js → Admin_pluginsPage.3c872de7.chunk.js} +1 -1
  37. package/build/{Admin_profilePage.6c2c8398.chunk.js → Admin_profilePage.e9fcce92.chunk.js} +1 -1
  38. package/build/{Admin_settingsPage.5e740514.chunk.js → Admin_settingsPage.d3f48e9e.chunk.js} +15 -15
  39. package/build/admin-app.77179e07.chunk.js +112 -0
  40. package/build/admin-audit-logs.334ee871.chunk.js +1 -0
  41. package/build/admin-edit-roles-page.23f15909.chunk.js +1 -0
  42. package/build/{admin-edit-users.d254c128.chunk.js → admin-edit-users.283b49ed.chunk.js} +1 -1
  43. package/build/{admin-users.7c423e41.chunk.js → admin-users.a0748674.chunk.js} +1 -1
  44. package/build/{api-tokens-create-page.4ca2778d.chunk.js → api-tokens-create-page.93dd0689.chunk.js} +1 -1
  45. package/build/{api-tokens-edit-page.70a791c2.chunk.js → api-tokens-edit-page.b0adac81.chunk.js} +1 -1
  46. package/build/{api-tokens-list-page.fe994b6b.chunk.js → api-tokens-list-page.700e575f.chunk.js} +1 -1
  47. package/build/content-manager.01e04e11.chunk.js +1200 -0
  48. package/build/content-type-builder-list-view.4412efc3.chunk.js +201 -0
  49. package/build/content-type-builder.aa4ec633.chunk.js +145 -0
  50. package/build/email-settings-page.d44a57cb.chunk.js +15 -0
  51. package/build/en-json.57917cb1.chunk.js +1 -0
  52. package/build/index.html +1 -1
  53. package/build/main.f31112a5.js +2034 -0
  54. package/build/ru-json.8830286f.chunk.js +1 -0
  55. package/build/runtime~main.81f05721.js +2 -0
  56. package/build/sso-settings-page.9f091262.chunk.js +1 -0
  57. package/build/upload-settings.450cab1a.chunk.js +18 -0
  58. package/build/upload.a73936d9.chunk.js +64 -0
  59. package/build/users-advanced-settings-page.dc23bc56.chunk.js +13 -0
  60. package/build/users-email-settings-page.6541d372.chunk.js +28 -0
  61. package/build/users-providers-settings-page.e11a2f64.chunk.js +33 -0
  62. package/build/webhook-edit-page.14ad1e6e.chunk.js +75 -0
  63. package/build/{webhook-list-page.42533b59.chunk.js → webhook-list-page.b87821f2.chunk.js} +1 -1
  64. package/ee/server/services/passport/provider-registry.js +1 -1
  65. package/package.json +9 -9
  66. package/build/2438.afe24949.chunk.js +0 -2525
  67. package/build/2517.5cc235ba.chunk.js +0 -117
  68. package/build/4306.53359960.chunk.js +0 -98
  69. package/build/8881.bfdb6877.chunk.js +0 -245
  70. package/build/9707.932a3c12.chunk.js +0 -70
  71. package/build/admin-app.ee1211cb.chunk.js +0 -112
  72. package/build/admin-edit-roles-page.c7c338b3.chunk.js +0 -1
  73. package/build/content-manager.794d3373.chunk.js +0 -1200
  74. package/build/content-type-builder-list-view.95012cf0.chunk.js +0 -201
  75. package/build/content-type-builder.95b9d6a2.chunk.js +0 -145
  76. package/build/email-settings-page.4bb3606f.chunk.js +0 -15
  77. package/build/en-json.7dd57947.chunk.js +0 -1
  78. package/build/main.a6470578.js +0 -2031
  79. package/build/ru-json.d7cfc2ff.chunk.js +0 -1
  80. package/build/runtime~main.6e7d95b9.js +0 -2
  81. package/build/sso-settings-page.eb30a02e.chunk.js +0 -1
  82. package/build/upload-settings.3010911f.chunk.js +0 -18
  83. package/build/upload.9f19f2e8.chunk.js +0 -64
  84. package/build/users-advanced-settings-page.9df41d67.chunk.js +0 -13
  85. package/build/users-email-settings-page.56d82eaf.chunk.js +0 -28
  86. package/build/users-providers-settings-page.96bb7da0.chunk.js +0 -33
  87. package/build/webhook-edit-page.c5efc08b.chunk.js +0 -75
@@ -0,0 +1,65 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useIntl } from 'react-intl';
4
+ import { IconButton } from '@strapi/design-system/IconButton';
5
+ import { Flex } from '@strapi/design-system/Flex';
6
+ import { Typography } from '@strapi/design-system/Typography';
7
+ import { Tbody, Td, Tr } from '@strapi/design-system/Table';
8
+ import Eye from '@strapi/icons/Eye';
9
+ import { onRowClick, stopPropagation } from '@strapi/helper-plugin';
10
+ import CellValue from './CellValue';
11
+
12
+ const TableRows = ({ headers, rows, onModalToggle }) => {
13
+ const { formatMessage } = useIntl();
14
+
15
+ return (
16
+ <Tbody>
17
+ {rows.map((data) => {
18
+ return (
19
+ <Tr
20
+ key={data.id}
21
+ {...onRowClick({
22
+ fn: () => onModalToggle(data.id),
23
+ })}
24
+ >
25
+ {headers.map(({ key, name }) => {
26
+ return (
27
+ <Td key={key}>
28
+ <Typography textColor="neutral800">
29
+ <CellValue type={key} value={data[name]} />
30
+ </Typography>
31
+ </Td>
32
+ );
33
+ })}
34
+
35
+ <Td {...stopPropagation}>
36
+ <Flex justifyContent="end">
37
+ <IconButton
38
+ onClick={() => onModalToggle(data.id)}
39
+ aria-label={formatMessage(
40
+ { id: 'app.component.table.view', defaultMessage: '{target} details' },
41
+ { target: `${data.action} action` }
42
+ )}
43
+ noBorder
44
+ icon={<Eye />}
45
+ />
46
+ </Flex>
47
+ </Td>
48
+ </Tr>
49
+ );
50
+ })}
51
+ </Tbody>
52
+ );
53
+ };
54
+
55
+ TableRows.defaultProps = {
56
+ rows: [],
57
+ };
58
+
59
+ TableRows.propTypes = {
60
+ headers: PropTypes.array.isRequired,
61
+ rows: PropTypes.array,
62
+ onModalToggle: PropTypes.func.isRequired,
63
+ };
64
+
65
+ export default TableRows;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useIntl } from 'react-intl';
4
+ import { Flex } from '@strapi/design-system/Flex';
5
+ import { Typography } from '@strapi/design-system/Typography';
6
+
7
+ const ActionItem = ({ actionLabel, actionName }) => {
8
+ const { formatMessage } = useIntl();
9
+
10
+ return (
11
+ <Flex direction="column" alignItems="baseline" gap={1}>
12
+ <Typography textColor="neutral600" variant="sigma">
13
+ {formatMessage(actionLabel)}
14
+ </Typography>
15
+ <Typography textColor="neutral600">{actionName}</Typography>
16
+ </Flex>
17
+ );
18
+ };
19
+
20
+ ActionItem.propTypes = {
21
+ actionLabel: PropTypes.object.isRequired,
22
+ actionName: PropTypes.string.isRequired,
23
+ };
24
+
25
+ export default ActionItem;
@@ -0,0 +1,76 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useIntl } from 'react-intl';
4
+ import { ModalLayout, ModalHeader, ModalBody } from '@strapi/design-system/ModalLayout';
5
+ import { Breadcrumbs, Crumb } from '@strapi/design-system/Breadcrumbs';
6
+ import { Grid } from '@strapi/design-system/Grid';
7
+ import { Box } from '@strapi/design-system/Box';
8
+ import { Typography } from '@strapi/design-system/Typography';
9
+ import { pxToRem } from '@strapi/helper-plugin';
10
+ import useFormatTimeStamp from '../hooks/useFormatTimeStamp';
11
+ import ActionItem from './ActionItem';
12
+
13
+ const ModalDialog = ({ onToggle, data: { date, user, action } }) => {
14
+ const { formatMessage } = useIntl();
15
+ const formatTimeStamp = useFormatTimeStamp();
16
+ const formattedDate = formatTimeStamp(date);
17
+
18
+ return (
19
+ <ModalLayout onClose={onToggle} labelledBy="title">
20
+ <ModalHeader>
21
+ <Breadcrumbs label={formattedDate}>
22
+ <Crumb>{formattedDate}</Crumb>
23
+ </Breadcrumbs>
24
+ </ModalHeader>
25
+ <ModalBody>
26
+ <Box marginBottom={pxToRem(12)}>
27
+ <Typography variant="delta" id="title">
28
+ {formatMessage({
29
+ id: 'Settings.permissions.auditLogs.details',
30
+ defaultMessage: 'Log Details',
31
+ })}
32
+ </Typography>
33
+ </Box>
34
+ <Grid
35
+ gap={4}
36
+ gridCols={2}
37
+ paddingTop={4}
38
+ paddingBottom={4}
39
+ paddingLeft={6}
40
+ paddingRight={6}
41
+ background="neutral100"
42
+ hasRadius
43
+ >
44
+ <ActionItem
45
+ actionLabel={{
46
+ id: 'Settings.permissions.auditLogs.action',
47
+ defaultMessage: 'Action',
48
+ }}
49
+ actionName={action}
50
+ />
51
+ <ActionItem
52
+ actionLabel={{
53
+ id: 'Settings.permissions.auditLogs.date',
54
+ defaultMessage: 'Date',
55
+ }}
56
+ actionName={formattedDate}
57
+ />
58
+ <ActionItem
59
+ actionLabel={{
60
+ id: 'Settings.permissions.auditLogs.user',
61
+ defaultMessage: 'User',
62
+ }}
63
+ actionName={user}
64
+ />
65
+ </Grid>
66
+ </ModalBody>
67
+ </ModalLayout>
68
+ );
69
+ };
70
+
71
+ ModalDialog.propTypes = {
72
+ onToggle: PropTypes.func.isRequired,
73
+ data: PropTypes.object.isRequired,
74
+ };
75
+
76
+ export default ModalDialog;
@@ -0,0 +1,24 @@
1
+ import { useIntl } from 'react-intl';
2
+ import parseISO from 'date-fns/parseISO';
3
+
4
+ const useFormatTimeStamp = () => {
5
+ const { formatDate } = useIntl();
6
+
7
+ const formatTimeStamp = (value) => {
8
+ const date = parseISO(value);
9
+
10
+ const formattedDate = formatDate(date, {
11
+ dateStyle: 'long',
12
+ });
13
+ const formattedTime = formatDate(date, {
14
+ timeStyle: 'medium',
15
+ hourCycle: 'h24',
16
+ });
17
+
18
+ return `${formattedDate}, ${formattedTime}`;
19
+ };
20
+
21
+ return formatTimeStamp;
22
+ };
23
+
24
+ export default useFormatTimeStamp;
@@ -0,0 +1,84 @@
1
+ import React, { useState } from 'react';
2
+ import { SettingsPageTitle, DynamicTable } from '@strapi/helper-plugin';
3
+ import { HeaderLayout, ContentLayout } from '@strapi/design-system/Layout';
4
+ import { Main } from '@strapi/design-system/Main';
5
+ import { useIntl } from 'react-intl';
6
+ import TableRows from './DynamicTable/TableRows';
7
+ import tableHeaders from './utils/tableHeaders';
8
+ import ModalDialog from './ModalDialog';
9
+
10
+ const data = [
11
+ {
12
+ id: 1,
13
+ action: 'Update',
14
+ date: '2022-11-14T23:04:00.000Z',
15
+ user: 'John Doe',
16
+ },
17
+ {
18
+ id: 2,
19
+ action: 'Create',
20
+ date: '2022-11-04T18:24:00.000Z',
21
+ user: 'Kai Doe',
22
+ },
23
+ {
24
+ id: 3,
25
+ action: 'Delete',
26
+ date: '2022-10-09T11:26:00.000Z',
27
+ user: 'John Doe',
28
+ },
29
+ {
30
+ id: 4,
31
+ action: 'Log in',
32
+ date: '2022-10-09T11:24:00.000Z',
33
+ user: 'Kai Doe',
34
+ },
35
+ ];
36
+
37
+ const ListView = () => {
38
+ const { formatMessage } = useIntl();
39
+ const [isModalOpen, setIsModalOpen] = useState(false);
40
+ const [detailsActionData, setDetailsActionData] = useState(null);
41
+
42
+ const title = formatMessage({
43
+ id: 'global.auditLogs',
44
+ defaultMessage: 'Audit Logs',
45
+ });
46
+
47
+ const headers = tableHeaders.map((header) => ({
48
+ ...header,
49
+ metadatas: {
50
+ ...header.metadatas,
51
+ label: formatMessage(header.metadatas.label),
52
+ },
53
+ }));
54
+
55
+ const handleToggle = (id) => {
56
+ setIsModalOpen((prev) => !prev);
57
+
58
+ if (id) {
59
+ const actionData = data.find((action) => action.id === id);
60
+ setDetailsActionData(actionData);
61
+ }
62
+ };
63
+
64
+ return (
65
+ <Main>
66
+ <SettingsPageTitle name={title} />
67
+ <HeaderLayout
68
+ title={title}
69
+ subtitle={formatMessage({
70
+ id: 'Settings.permissions.auditLogs.listview.header.subtitle',
71
+ defaultMessage: 'Logs of all the activities that happened on your environment',
72
+ })}
73
+ />
74
+ <ContentLayout>
75
+ <DynamicTable contentType="Audit logs" headers={headers} rows={data} withBulkActions>
76
+ <TableRows headers={headers} rows={data} onModalToggle={handleToggle} />
77
+ </DynamicTable>
78
+ </ContentLayout>
79
+ {isModalOpen && <ModalDialog onToggle={handleToggle} data={detailsActionData} />}
80
+ </Main>
81
+ );
82
+ };
83
+
84
+ export default ListView;
@@ -0,0 +1,37 @@
1
+ const tableHeaders = [
2
+ {
3
+ name: 'action',
4
+ key: 'action',
5
+ metadatas: {
6
+ label: {
7
+ id: 'Settings.permissions.auditLogs.action',
8
+ defaultMessage: 'Action',
9
+ },
10
+ sortable: true,
11
+ },
12
+ },
13
+ {
14
+ name: 'date',
15
+ key: 'date',
16
+ metadatas: {
17
+ label: {
18
+ id: 'Settings.permissions.auditLogs.date',
19
+ defaultMessage: 'Date',
20
+ },
21
+ sortable: true,
22
+ },
23
+ },
24
+ {
25
+ key: 'user',
26
+ name: 'user',
27
+ metadatas: {
28
+ label: {
29
+ id: 'Settings.permissions.auditLogs.user',
30
+ defaultMessage: 'User',
31
+ },
32
+ sortable: true,
33
+ },
34
+ },
35
+ ];
36
+
37
+ export default tableHeaders;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import { CheckPagePermissions } from '@strapi/helper-plugin';
3
+ import adminPermissions from '../../../../../permissions';
4
+ import ListView from '../ListView';
5
+
6
+ const ProtectedListPage = () => (
7
+ <CheckPagePermissions permissions={adminPermissions.settings.auditLogs.main}>
8
+ <ListView />
9
+ </CheckPagePermissions>
10
+ );
11
+
12
+ export default ProtectedListPage;
@@ -57,6 +57,17 @@ const defaultRoutes = [
57
57
  to: '/settings/users/:id',
58
58
  exact: true,
59
59
  },
60
+ {
61
+ async Component() {
62
+ const component = await import(
63
+ /* webpackChunkName: "admin-audit-logs" */ '../pages/AuditLogs/ProtectedListPage'
64
+ );
65
+
66
+ return component;
67
+ },
68
+ to: '/settings/audit-logs',
69
+ exact: true,
70
+ },
60
71
  {
61
72
  async Component() {
62
73
  const component = await import(
@@ -34,6 +34,10 @@ const permissions = {
34
34
  uninstall: [{ action: 'admin::marketplace.plugins.uninstall', subject: null }],
35
35
  },
36
36
  settings: {
37
+ auditLogs: {
38
+ // Note:update to admin::auditLogs permissions when set in BE
39
+ main: [{ action: 'admin::roles.create', subject: null }],
40
+ },
37
41
  roles: {
38
42
  main: [
39
43
  { action: 'admin::roles.create', subject: null },
@@ -175,6 +175,11 @@
175
175
  "Settings.permissions.users.strapi-super-admin": "Super Admin",
176
176
  "Settings.permissions.users.strapi-editor": "Editor",
177
177
  "Settings.permissions.users.strapi-author": "Author",
178
+ "Settings.permissions.auditLogs.action": "Action",
179
+ "Settings.permissions.auditLogs.date": "Date",
180
+ "Settings.permissions.auditLogs.user": "User",
181
+ "Settings.permissions.auditLogs.details": "Log Details",
182
+ "Settings.permissions.auditLogs.listview.header.subtitle": "Logs of all the activities that happened on your environment",
178
183
  "Settings.profile.form.notify.data.loaded": "Your profile data has been loaded",
179
184
  "Settings.profile.form.section.experience.clear.select": "Clear the interface language selected",
180
185
  "Settings.profile.form.section.experience.here": "here",
@@ -303,6 +308,7 @@
303
308
  "app.component.search.label": "Search for {target}",
304
309
  "app.component.table.duplicate": "Duplicate {target}",
305
310
  "app.component.table.edit": "Edit {target}",
311
+ "app.component.table.view": "{target} details",
306
312
  "app.component.table.select.one-entry": "Select {target}",
307
313
  "app.components.BlockLink.blog": "Blog",
308
314
  "app.components.BlockLink.blog.content": "Read the latest news about Strapi and the ecosystem.",
@@ -772,6 +778,7 @@
772
778
  "global.settings": "Settings",
773
779
  "global.type": "Type",
774
780
  "global.users": "Users",
781
+ "global.auditLogs": "Audit Logs",
775
782
  "notification.contentType.relations.conflict": "Content type has conflicting relations",
776
783
  "notification.default.title": "Information:",
777
784
  "notification.error": "An error occurred",