@webiny/app-audit-logs 6.3.0 → 6.4.0-beta.0

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 (110) hide show
  1. package/SecurityPermission.js +11 -14
  2. package/SecurityPermission.js.map +1 -1
  3. package/components/Text.d.ts +9 -1
  4. package/components/Text.js +37 -21
  5. package/components/Text.js.map +1 -1
  6. package/config/list/AuditLogsListConfig.js +26 -27
  7. package/config/list/AuditLogsListConfig.js.map +1 -1
  8. package/config/list/Browser/Filter.js +30 -37
  9. package/config/list/Browser/Filter.js.map +1 -1
  10. package/config/list/Browser/FiltersToWhere.js +10 -13
  11. package/config/list/Browser/FiltersToWhere.js.map +1 -1
  12. package/config/list/Browser/index.js +4 -3
  13. package/config/list/Browser/index.js.map +1 -1
  14. package/config/list/index.js +0 -2
  15. package/constants/index.js +2 -1
  16. package/constants/index.js.map +1 -1
  17. package/domain/permissionsSchema.js +4 -3
  18. package/domain/permissionsSchema.js.map +1 -1
  19. package/features/permissions/abstractions.js +2 -1
  20. package/features/permissions/abstractions.js.map +1 -1
  21. package/features/permissions/feature.js +2 -1
  22. package/features/permissions/feature.js.map +1 -1
  23. package/graphql.js +4 -3
  24. package/graphql.js.map +1 -1
  25. package/hooks/graphql.js +3 -2
  26. package/hooks/graphql.js.map +1 -1
  27. package/hooks/index.js +0 -2
  28. package/hooks/schema.d.ts +4 -4
  29. package/hooks/schema.js +22 -28
  30. package/hooks/schema.js.map +1 -1
  31. package/hooks/useAuditLogsList.d.ts +3 -3
  32. package/hooks/useAuditLogsList.js +100 -93
  33. package/hooks/useAuditLogsList.js.map +1 -1
  34. package/index.js +32 -36
  35. package/index.js.map +1 -1
  36. package/package.json +12 -12
  37. package/routes.js +6 -5
  38. package/routes.js.map +1 -1
  39. package/types.js +1 -4
  40. package/utils/transformRawAuditLog.js +22 -24
  41. package/utils/transformRawAuditLog.js.map +1 -1
  42. package/views/Logs/Filters/FilterByAction.js +39 -40
  43. package/views/Logs/Filters/FilterByAction.js.map +1 -1
  44. package/views/Logs/Filters/FilterByApp.js +32 -31
  45. package/views/Logs/Filters/FilterByApp.js.map +1 -1
  46. package/views/Logs/Filters/FilterByCreatedBy.js +35 -32
  47. package/views/Logs/Filters/FilterByCreatedBy.js.map +1 -1
  48. package/views/Logs/Filters/FilterByCreatedOn.js +31 -32
  49. package/views/Logs/Filters/FilterByCreatedOn.js.map +1 -1
  50. package/views/Logs/Filters/FilterByEntity.js +39 -41
  51. package/views/Logs/Filters/FilterByEntity.js.map +1 -1
  52. package/views/Logs/Filters/FilterByEntityId.js +21 -24
  53. package/views/Logs/Filters/FilterByEntityId.js.map +1 -1
  54. package/views/Logs/Filters/FilterByInitiator.js +35 -32
  55. package/views/Logs/Filters/FilterByInitiator.js.map +1 -1
  56. package/views/Logs/Filters/FilterByTimestamp.js +31 -32
  57. package/views/Logs/Filters/FilterByTimestamp.js.map +1 -1
  58. package/views/Logs/Filters/Filters.js +17 -21
  59. package/views/Logs/Filters/Filters.js.map +1 -1
  60. package/views/Logs/Filters/index.js +0 -2
  61. package/views/Logs/Filters/styled.js +11 -15
  62. package/views/Logs/Filters/styled.js.map +1 -1
  63. package/views/Logs/Filters/types.js +0 -3
  64. package/views/Logs/Header/ButtonFilters/ButtonFilters.js +25 -44
  65. package/views/Logs/Header/ButtonFilters/ButtonFilters.js.map +1 -1
  66. package/views/Logs/Header/ButtonFilters/index.js +0 -2
  67. package/views/Logs/Header/Header.js +13 -66
  68. package/views/Logs/Header/Header.js.map +1 -1
  69. package/views/Logs/Header/index.js +0 -2
  70. package/views/Logs/LoadMoreButton/LoadMoreButton.js +9 -16
  71. package/views/Logs/LoadMoreButton/LoadMoreButton.js.map +1 -1
  72. package/views/Logs/LoadMoreButton/index.js +0 -2
  73. package/views/Logs/LoadMoreButton/styled.js +7 -15
  74. package/views/Logs/LoadMoreButton/styled.js.map +1 -1
  75. package/views/Logs/LoadingMore/index.js +12 -12
  76. package/views/Logs/LoadingMore/index.js.map +1 -1
  77. package/views/Logs/Logs.js +63 -68
  78. package/views/Logs/Logs.js.map +1 -1
  79. package/views/Logs/LogsModule.js +22 -25
  80. package/views/Logs/LogsModule.js.map +1 -1
  81. package/views/Logs/LogsView.js +64 -67
  82. package/views/Logs/LogsView.js.map +1 -1
  83. package/views/Logs/Preview/Preview.js +75 -84
  84. package/views/Logs/Preview/Preview.js.map +1 -1
  85. package/views/Logs/Preview/index.js +0 -2
  86. package/views/Logs/Preview/styled.js +29 -23
  87. package/views/Logs/Preview/styled.js.map +1 -1
  88. package/views/Logs/Table/Table.d.ts +3 -3
  89. package/views/Logs/Table/Table.js +101 -125
  90. package/views/Logs/Table/Table.js.map +1 -1
  91. package/views/Logs/Table/index.js +0 -2
  92. package/views/Logs/Table/styled.d.ts +2 -2
  93. package/views/Logs/Table/styled.js +38 -75
  94. package/views/Logs/Table/styled.js.map +1 -1
  95. package/config/list/index.js.map +0 -1
  96. package/hooks/index.js.map +0 -1
  97. package/types.js.map +0 -1
  98. package/views/Logs/Filters/index.js.map +0 -1
  99. package/views/Logs/Filters/types.js.map +0 -1
  100. package/views/Logs/Header/ButtonFilters/index.js.map +0 -1
  101. package/views/Logs/Header/index.js.map +0 -1
  102. package/views/Logs/LoadMoreButton/index.js.map +0 -1
  103. package/views/Logs/LoadingMore/styled.d.ts +0 -8
  104. package/views/Logs/LoadingMore/styled.js +0 -30
  105. package/views/Logs/LoadingMore/styled.js.map +0 -1
  106. package/views/Logs/Preview/index.js.map +0 -1
  107. package/views/Logs/Table/index.js.map +0 -1
  108. package/views/Logs/styled.d.ts +0 -8
  109. package/views/Logs/styled.js +0 -30
  110. package/views/Logs/styled.js.map +0 -1
@@ -1,91 +1,82 @@
1
- import React from "react";
1
+ import react from "react";
2
2
  import { addMinutes, format } from "date-fns";
3
- import { Cell, Grid } from "@webiny/ui/Grid/index.js";
4
- import { Dialog, DialogActions, DialogCancel, DialogContent, DialogTitle } from "@webiny/ui/Dialog/index.js";
5
- import { CodeEditor } from "@webiny/ui/CodeEditor/index.js";
6
- import { Tooltip } from "@webiny/ui/Tooltip/index.js";
3
+ import { CodeEditor, Dialog, Grid, Tooltip } from "@webiny/admin-ui";
7
4
  import { Action } from "../Table/index.js";
8
5
  import { Text } from "../../../components/Text.js";
9
6
  import { PayloadWrapper, previewDialog } from "./styled.js";
10
- export const Preview = ({
11
- auditLog,
12
- onClose,
13
- hasAccessToUsers
14
- }) => {
15
- if (!auditLog) {
16
- return null;
17
- }
18
- const date = new Date(auditLog.createdOn);
19
- return /*#__PURE__*/React.createElement(Dialog, {
20
- open: !!auditLog,
21
- onClose: onClose,
22
- className: previewDialog,
23
- size: "xl"
24
- }, /*#__PURE__*/React.createElement(DialogTitle, null, auditLog.message, /*#__PURE__*/React.createElement("div", {
25
- className: "title-actions",
26
- tabIndex: 0
27
- })), /*#__PURE__*/React.createElement(DialogContent, null, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Cell, {
28
- span: 6
29
- }, /*#__PURE__*/React.createElement(Text, {
30
- use: "overline"
31
- }, "Application"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Text, {
32
- use: "subtitle2"
33
- }, auditLog.app)), /*#__PURE__*/React.createElement(Cell, {
34
- span: 6
35
- }, /*#__PURE__*/React.createElement(Text, {
36
- use: "overline"
37
- }, "Date"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Tooltip, {
38
- placement: "right",
39
- content: `UTC: ${format(addMinutes(date, date.getTimezoneOffset()), "yyyy-MM-dd HH:mm:ss")}`
40
- }, /*#__PURE__*/React.createElement(Text, {
41
- use: "subtitle2"
42
- }, format(date, "yyyy-MM-dd HH:mm:ss (O)")))), /*#__PURE__*/React.createElement(Cell, {
43
- span: 6
44
- }, /*#__PURE__*/React.createElement(Text, {
45
- use: "overline"
46
- }, "Entity"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Text, {
47
- use: "subtitle2"
48
- }, auditLog.entity.label)), /*#__PURE__*/React.createElement(Cell, {
49
- span: 6
50
- }, /*#__PURE__*/React.createElement(Text, {
51
- use: "overline"
52
- }, "Entity Id"), /*#__PURE__*/React.createElement("br", null), auditLog.entity.link ? /*#__PURE__*/React.createElement("a", {
53
- href: auditLog.entity.link,
54
- target: "blank"
55
- }, /*#__PURE__*/React.createElement(Text, {
56
- use: "subtitle2"
57
- }, auditLog.entityId)) : /*#__PURE__*/React.createElement(Text, {
58
- use: "subtitle2"
59
- }, auditLog.entityId)), /*#__PURE__*/React.createElement(Cell, {
60
- span: 6
61
- }, /*#__PURE__*/React.createElement(Text, {
62
- use: "overline"
63
- }, "Action"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(Action, {
64
- label: auditLog.action.label,
65
- value: auditLog.action.value
66
- })), hasAccessToUsers && /*#__PURE__*/React.createElement(Cell, {
67
- span: 6
68
- }, /*#__PURE__*/React.createElement(Text, {
69
- use: "overline"
70
- }, "Initiator"), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement("a", {
71
- href: `/admin-users?id=${auditLog.createdBy.id}`,
72
- target: "blank"
73
- }, /*#__PURE__*/React.createElement(Text, {
74
- use: "subtitle2"
75
- }, auditLog.createdBy.displayName)), /*#__PURE__*/React.createElement(Text, {
76
- use: "body2"
77
- }, ` (${auditLog.createdBy.role})`)), /*#__PURE__*/React.createElement(Cell, {
78
- span: 12
79
- }, /*#__PURE__*/React.createElement(Text, {
80
- use: "overline"
81
- }, "Payload"), /*#__PURE__*/React.createElement(PayloadWrapper, null, /*#__PURE__*/React.createElement(CodeEditor, {
82
- mode: "json",
83
- theme: "chrome",
84
- value: JSON.stringify(JSON.parse(auditLog.content), null, 2),
85
- readOnly: true
86
- }))))), /*#__PURE__*/React.createElement(DialogActions, null, /*#__PURE__*/React.createElement(DialogCancel, {
87
- onClick: onClose
88
- }, "Close")));
7
+ const Preview = ({ auditLog, onClose, hasAccessToUsers })=>{
8
+ if (!auditLog) return null;
9
+ const date = new Date(auditLog.createdOn);
10
+ return /*#__PURE__*/ react.createElement(Dialog, {
11
+ open: !!auditLog,
12
+ onClose: onClose,
13
+ className: previewDialog,
14
+ size: "xl",
15
+ title: auditLog.message,
16
+ actions: /*#__PURE__*/ react.createElement(Dialog.CancelAction, {
17
+ onClick: onClose,
18
+ text: "Close"
19
+ })
20
+ }, /*#__PURE__*/ react.createElement(Grid, null, /*#__PURE__*/ react.createElement(Grid.Column, {
21
+ span: 6
22
+ }, /*#__PURE__*/ react.createElement(Text, {
23
+ use: "overline"
24
+ }, "Application"), /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement(Text, {
25
+ use: "subtitle2"
26
+ }, auditLog.app)), /*#__PURE__*/ react.createElement(Grid.Column, {
27
+ span: 6
28
+ }, /*#__PURE__*/ react.createElement(Text, {
29
+ use: "overline"
30
+ }, "Date"), /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement(Tooltip, {
31
+ side: "right",
32
+ content: `UTC: ${format(addMinutes(date, date.getTimezoneOffset()), "yyyy-MM-dd HH:mm:ss")}`,
33
+ trigger: /*#__PURE__*/ react.createElement(Text, {
34
+ use: "subtitle2"
35
+ }, format(date, "yyyy-MM-dd HH:mm:ss (O)"))
36
+ })), /*#__PURE__*/ react.createElement(Grid.Column, {
37
+ span: 6
38
+ }, /*#__PURE__*/ react.createElement(Text, {
39
+ use: "overline"
40
+ }, "Entity"), /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement(Text, {
41
+ use: "subtitle2"
42
+ }, auditLog.entity.label)), /*#__PURE__*/ react.createElement(Grid.Column, {
43
+ span: 6
44
+ }, /*#__PURE__*/ react.createElement(Text, {
45
+ use: "overline"
46
+ }, "Entity Id"), /*#__PURE__*/ react.createElement("br", null), auditLog.entity.link ? /*#__PURE__*/ react.createElement("a", {
47
+ href: auditLog.entity.link,
48
+ target: "blank"
49
+ }, /*#__PURE__*/ react.createElement(Text, {
50
+ use: "subtitle2"
51
+ }, auditLog.entityId)) : /*#__PURE__*/ react.createElement(Text, {
52
+ use: "subtitle2"
53
+ }, auditLog.entityId)), /*#__PURE__*/ react.createElement(Grid.Column, {
54
+ span: 6
55
+ }, /*#__PURE__*/ react.createElement(Text, {
56
+ use: "overline"
57
+ }, "Action"), /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement(Action, {
58
+ label: auditLog.action.label,
59
+ value: auditLog.action.value
60
+ })), hasAccessToUsers ? /*#__PURE__*/ react.createElement(Grid.Column, {
61
+ span: 6
62
+ }, /*#__PURE__*/ react.createElement(Text, {
63
+ use: "overline"
64
+ }, "Initiator"), /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement("a", {
65
+ href: `/admin-users?id=${auditLog.createdBy.id}`,
66
+ target: "blank"
67
+ }, /*#__PURE__*/ react.createElement(Text, {
68
+ use: "subtitle2"
69
+ }, auditLog.createdBy.displayName)), /*#__PURE__*/ react.createElement(Text, {
70
+ use: "body2"
71
+ }, ` (${auditLog.createdBy.role})`)) : void 0, /*#__PURE__*/ react.createElement(Grid.Column, {
72
+ span: 12
73
+ }, /*#__PURE__*/ react.createElement(Text, {
74
+ use: "overline"
75
+ }, "Payload"), /*#__PURE__*/ react.createElement(PayloadWrapper, null, /*#__PURE__*/ react.createElement(CodeEditor, {
76
+ language: "json",
77
+ value: JSON.stringify(JSON.parse(auditLog.content), null, 2)
78
+ })))));
89
79
  };
80
+ export { Preview };
90
81
 
91
82
  //# sourceMappingURL=Preview.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","addMinutes","format","Cell","Grid","Dialog","DialogActions","DialogCancel","DialogContent","DialogTitle","CodeEditor","Tooltip","Action","Text","PayloadWrapper","previewDialog","Preview","auditLog","onClose","hasAccessToUsers","date","Date","createdOn","createElement","open","className","size","message","tabIndex","span","use","app","placement","content","getTimezoneOffset","entity","label","link","href","target","entityId","action","value","createdBy","id","displayName","role","mode","theme","JSON","stringify","parse","readOnly","onClick"],"sources":["Preview.tsx"],"sourcesContent":["import React from \"react\";\nimport { addMinutes, format } from \"date-fns\";\nimport { Cell, Grid } from \"@webiny/ui/Grid/index.js\";\nimport {\n Dialog,\n DialogActions,\n DialogCancel,\n DialogContent,\n DialogTitle\n} from \"@webiny/ui/Dialog/index.js\";\nimport { CodeEditor } from \"@webiny/ui/CodeEditor/index.js\";\nimport { Tooltip } from \"@webiny/ui/Tooltip/index.js\";\nimport { Action } from \"~/views/Logs/Table/index.js\";\nimport { Text } from \"~/components/Text.js\";\nimport { PayloadWrapper, previewDialog } from \"./styled.js\";\nimport type { IAuditLog } from \"~/types.js\";\n\ninterface HeaderProps {\n auditLog: IAuditLog | null;\n onClose: () => void;\n hasAccessToUsers: boolean;\n}\n\nexport const Preview = ({ auditLog, onClose, hasAccessToUsers }: HeaderProps) => {\n if (!auditLog) {\n return null;\n }\n const date = new Date(auditLog.createdOn);\n\n return (\n <Dialog open={!!auditLog} onClose={onClose} className={previewDialog} size={\"xl\"}>\n <DialogTitle>\n {auditLog.message}\n <div className=\"title-actions\" tabIndex={0}></div>\n </DialogTitle>\n\n <DialogContent>\n <Grid>\n <Cell span={6}>\n <Text use=\"overline\">Application</Text>\n <br />\n <Text use=\"subtitle2\">{auditLog.app}</Text>\n </Cell>\n <Cell span={6}>\n <Text use=\"overline\">Date</Text>\n <br />\n <Tooltip\n placement=\"right\"\n content={`UTC: ${format(\n addMinutes(date, date.getTimezoneOffset()),\n \"yyyy-MM-dd HH:mm:ss\"\n )}`}\n >\n <Text use={\"subtitle2\"}>{format(date, \"yyyy-MM-dd HH:mm:ss (O)\")}</Text>\n </Tooltip>\n </Cell>\n <Cell span={6}>\n <Text use=\"overline\">Entity</Text>\n <br />\n <Text use=\"subtitle2\">{auditLog.entity.label}</Text>\n </Cell>\n <Cell span={6}>\n <Text use=\"overline\">Entity Id</Text>\n <br />\n {auditLog.entity.link ? (\n <a href={auditLog.entity.link} target={\"blank\"}>\n <Text use=\"subtitle2\">{auditLog.entityId}</Text>\n </a>\n ) : (\n <Text use=\"subtitle2\">{auditLog.entityId}</Text>\n )}\n </Cell>\n <Cell span={6}>\n <Text use=\"overline\">Action</Text>\n <br />\n <Action label={auditLog.action.label} value={auditLog.action.value} />\n </Cell>\n {hasAccessToUsers && (\n <Cell span={6}>\n <Text use=\"overline\">Initiator</Text>\n <br />\n <a href={`/admin-users?id=${auditLog.createdBy.id}`} target={\"blank\"}>\n <Text use={\"subtitle2\"}>{auditLog.createdBy.displayName}</Text>\n </a>\n <Text use={\"body2\"}>{` (${auditLog.createdBy.role})`}</Text>\n </Cell>\n )}\n <Cell span={12}>\n <Text use=\"overline\">Payload</Text>\n <PayloadWrapper>\n <CodeEditor\n mode=\"json\"\n theme=\"chrome\"\n value={JSON.stringify(JSON.parse(auditLog.content), null, 2)}\n readOnly\n />\n </PayloadWrapper>\n </Cell>\n </Grid>\n </DialogContent>\n <DialogActions>\n <DialogCancel onClick={onClose}>Close</DialogCancel>\n </DialogActions>\n </Dialog>\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,MAAM,QAAQ,UAAU;AAC7C,SAASC,IAAI,EAAEC,IAAI,QAAQ,0BAA0B;AACrD,SACIC,MAAM,EACNC,aAAa,EACbC,YAAY,EACZC,aAAa,EACbC,WAAW,QACR,4BAA4B;AACnC,SAASC,UAAU,QAAQ,gCAAgC;AAC3D,SAASC,OAAO,QAAQ,6BAA6B;AACrD,SAASC,MAAM;AACf,SAASC,IAAI;AACb,SAASC,cAAc,EAAEC,aAAa;AAStC,OAAO,MAAMC,OAAO,GAAGA,CAAC;EAAEC,QAAQ;EAAEC,OAAO;EAAEC;AAA8B,CAAC,KAAK;EAC7E,IAAI,CAACF,QAAQ,EAAE;IACX,OAAO,IAAI;EACf;EACA,MAAMG,IAAI,GAAG,IAAIC,IAAI,CAACJ,QAAQ,CAACK,SAAS,CAAC;EAEzC,oBACItB,KAAA,CAAAuB,aAAA,CAAClB,MAAM;I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sourcesContent":["import React from \"react\";\nimport { addMinutes, format } from \"date-fns\";\nimport { Grid, Dialog, CodeEditor, Tooltip } from \"@webiny/admin-ui\";\nimport { Action } from \"~/views/Logs/Table/index.js\";\nimport { Text } from \"~/components/Text.js\";\nimport { PayloadWrapper, previewDialog } from \"./styled.js\";\nimport type { IAuditLog } from \"~/types.js\";\n\ninterface HeaderProps {\n auditLog: IAuditLog | null;\n onClose: () => void;\n hasAccessToUsers: boolean;\n}\n\nexport const Preview = ({ auditLog, onClose, hasAccessToUsers }: HeaderProps) => {\n if (!auditLog) {\n return null;\n }\n const date = new Date(auditLog.createdOn);\n\n return (\n <Dialog\n open={!!auditLog}\n onClose={onClose}\n className={previewDialog}\n size={\"xl\"}\n title={auditLog.message}\n actions={<Dialog.CancelAction onClick={onClose} text={\"Close\"} />}\n >\n <Grid>\n <Grid.Column span={6}>\n <Text use=\"overline\">Application</Text>\n <br />\n <Text use=\"subtitle2\">{auditLog.app}</Text>\n </Grid.Column>\n <Grid.Column span={6}>\n <Text use=\"overline\">Date</Text>\n <br />\n <Tooltip\n side=\"right\"\n content={`UTC: ${format(\n addMinutes(date, date.getTimezoneOffset()),\n \"yyyy-MM-dd HH:mm:ss\"\n )}`}\n trigger={\n <Text use={\"subtitle2\"}>{format(date, \"yyyy-MM-dd HH:mm:ss (O)\")}</Text>\n }\n />\n </Grid.Column>\n <Grid.Column span={6}>\n <Text use=\"overline\">Entity</Text>\n <br />\n <Text use=\"subtitle2\">{auditLog.entity.label}</Text>\n </Grid.Column>\n <Grid.Column span={6}>\n <Text use=\"overline\">Entity Id</Text>\n <br />\n {auditLog.entity.link ? (\n <a href={auditLog.entity.link} target={\"blank\"}>\n <Text use=\"subtitle2\">{auditLog.entityId}</Text>\n </a>\n ) : (\n <Text use=\"subtitle2\">{auditLog.entityId}</Text>\n )}\n </Grid.Column>\n <Grid.Column span={6}>\n <Text use=\"overline\">Action</Text>\n <br />\n <Action label={auditLog.action.label} value={auditLog.action.value} />\n </Grid.Column>\n {\n (hasAccessToUsers ? (\n <Grid.Column span={6}>\n <Text use=\"overline\">Initiator</Text>\n <br />\n <a href={`/admin-users?id=${auditLog.createdBy.id}`} target={\"blank\"}>\n <Text use={\"subtitle2\"}>{auditLog.createdBy.displayName}</Text>\n </a>\n <Text use={\"body2\"}>{` (${auditLog.createdBy.role})`}</Text>\n </Grid.Column>\n ) : undefined) as any\n }\n <Grid.Column span={12}>\n <Text use=\"overline\">Payload</Text>\n <PayloadWrapper>\n <CodeEditor\n language=\"json\"\n value={JSON.stringify(JSON.parse(auditLog.content), null, 2)}\n />\n </PayloadWrapper>\n </Grid.Column>\n </Grid>\n </Dialog>\n );\n};\n"],"names":["Preview","auditLog","onClose","hasAccessToUsers","date","Date","Dialog","previewDialog","Grid","Text","Tooltip","format","addMinutes","Action","undefined","PayloadWrapper","CodeEditor","JSON"],"mappings":";;;;;;AAcO,MAAMA,UAAU,CAAC,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,gBAAgB,EAAe;IACxE,IAAI,CAACF,UACD,OAAO;IAEX,MAAMG,OAAO,IAAIC,KAAKJ,SAAS,SAAS;IAExC,OAAO,WAAP,GACI,oBAACK,QAAMA;QACH,MAAM,CAAC,CAACL;QACR,SAASC;QACT,WAAWK;QACX,MAAM;QACN,OAAON,SAAS,OAAO;QACvB,uBAAS,oBAACK,OAAO,YAAY;YAAC,SAASJ;YAAS,MAAM;;qBAEtD,oBAACM,MAAIA,MAAAA,WAAAA,GACD,oBAACA,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QAAC,KAAI;OAAW,8BACrB,oBAAC,2BACD,oBAACA,MAAIA;QAAC,KAAI;OAAaR,SAAS,GAAG,kBAEvC,oBAACO,KAAK,MAAM;QAAC,MAAM;qBACf,oBAACC,MAAIA;QAAC,KAAI;OAAW,uBACrB,oBAAC,2BACD,oBAACC,SAAOA;QACJ,MAAK;QACL,SAAS,CAAC,KAAK,EAAEC,OACbC,WAAWR,MAAMA,KAAK,i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AAAA,GACX,oBAACC,YAAUA;QACP,UAAS;QACT,OAAOC,KAAK,SAAS,CAACA,KAAK,KAAK,CAAChB,SAAS,OAAO,GAAG,MAAM;;AAOtF"}
@@ -1,3 +1 @@
1
1
  export * from "./Preview.js";
2
-
3
- //# sourceMappingURL=index.js.map
@@ -1,26 +1,32 @@
1
- import _styled from "@emotion/styled/base";
2
- function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
1
+ import styled from "@emotion/styled";
3
2
  import { css } from "@emotion/css";
4
- export const PayloadWrapper = /*#__PURE__*/_styled("div", process.env.NODE_ENV === "production" ? {
5
- target: "e1r0qp7f0"
6
- } : {
7
- target: "e1r0qp7f0",
8
- label: "PayloadWrapper"
9
- })(process.env.NODE_ENV === "production" ? {
10
- name: "y8n0ve",
11
- styles: "#brace-editor{height:280px!important;}.ace_print-margin,.ace_active-line,.ace_gutter-active-line,.ace_cursor-layer{display:none;}.ace_line,.ace_gutter-cell{height:12px!important;}.ace_gutter-layer{width:47px!important;}"
12
- } : {
13
- name: "y8n0ve",
14
- styles: "#brace-editor{height:280px!important;}.ace_print-margin,.ace_active-line,.ace_gutter-active-line,.ace_cursor-layer{display:none;}.ace_line,.ace_gutter-cell{height:12px!important;}.ace_gutter-layer{width:47px!important;}/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlZC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBRzJDIiwiZmlsZSI6InN0eWxlZC50c3giLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gXCJAZW1vdGlvbi9zdHlsZWRcIjtcbmltcG9ydCB7IGNzcyB9IGZyb20gXCJAZW1vdGlvbi9jc3NcIjtcblxuZXhwb3J0IGNvbnN0IFBheWxvYWRXcmFwcGVyID0gc3R5bGVkKFwiZGl2XCIpYFxuICAgICNicmFjZS1lZGl0b3Ige1xuICAgICAgICBoZWlnaHQ6IDI4MHB4ICFpbXBvcnRhbnQ7XG4gICAgfVxuXG4gICAgLmFjZV9wcmludC1tYXJnaW4sXG4gICAgLmFjZV9hY3RpdmUtbGluZSxcbiAgICAuYWNlX2d1dHRlci1hY3RpdmUtbGluZSxcbiAgICAuYWNlX2N1cnNvci1sYXllciB7XG4gICAgICAgIGRpc3BsYXk6IG5vbmU7XG4gICAgfVxuXG4gICAgLmFjZV9saW5lLFxuICAgIC5hY2VfZ3V0dGVyLWNlbGwge1xuICAgICAgICBoZWlnaHQ6IDEycHggIWltcG9ydGFudDtcbiAgICB9XG5cbiAgICAuYWNlX2d1dHRlci1sYXllciB7XG4gICAgICAgIHdpZHRoOiA0N3B4ICFpbXBvcnRhbnQ7XG4gICAgfVxuYDtcblxuZXhwb3J0IGNvbnN0IHByZXZpZXdEaWFsb2cgPSBjc3NgXG4gICAgJiAubWRjLWRpYWxvZ19fc3VyZmFjZSB7XG4gICAgICAgIHdpZHRoOiA4MDBweDtcbiAgICAgICAgbWluLXdpZHRoOiA4MDBweDtcbiAgICB9XG5gO1xuIl19 */",
15
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
16
- });
17
- export const previewDialog = /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
18
- name: "1o3ulgo",
19
- styles: "& .mdc-dialog__surface{width:800px;min-width:800px;}"
20
- } : {
21
- name: "ok8s31-previewDialog",
22
- styles: "& .mdc-dialog__surface{width:800px;min-width:800px;};label:previewDialog;/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlZC50c3giXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBeUJnQyIsImZpbGUiOiJzdHlsZWQudHN4Iiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XG5pbXBvcnQgeyBjc3MgfSBmcm9tIFwiQGVtb3Rpb24vY3NzXCI7XG5cbmV4cG9ydCBjb25zdCBQYXlsb2FkV3JhcHBlciA9IHN0eWxlZChcImRpdlwiKWBcbiAgICAjYnJhY2UtZWRpdG9yIHtcbiAgICAgICAgaGVpZ2h0OiAyODBweCAhaW1wb3J0YW50O1xuICAgIH1cblxuICAgIC5hY2VfcHJpbnQtbWFyZ2luLFxuICAgIC5hY2VfYWN0aXZlLWxpbmUsXG4gICAgLmFjZV9ndXR0ZXItYWN0aXZlLWxpbmUsXG4gICAgLmFjZV9jdXJzb3ItbGF5ZXIge1xuICAgICAgICBkaXNwbGF5OiBub25lO1xuICAgIH1cblxuICAgIC5hY2VfbGluZSxcbiAgICAuYWNlX2d1dHRlci1jZWxsIHtcbiAgICAgICAgaGVpZ2h0OiAxMnB4ICFpbXBvcnRhbnQ7XG4gICAgfVxuXG4gICAgLmFjZV9ndXR0ZXItbGF5ZXIge1xuICAgICAgICB3aWR0aDogNDdweCAhaW1wb3J0YW50O1xuICAgIH1cbmA7XG5cbmV4cG9ydCBjb25zdCBwcmV2aWV3RGlhbG9nID0gY3NzYFxuICAgICYgLm1kYy1kaWFsb2dfX3N1cmZhY2Uge1xuICAgICAgICB3aWR0aDogODAwcHg7XG4gICAgICAgIG1pbi13aWR0aDogODAwcHg7XG4gICAgfVxuYDtcbiJdfQ== */",
23
- toString: _EMOTION_STRINGIFIED_CSS_ERROR__
24
- });
3
+ const PayloadWrapper = styled("div")`
4
+ #brace-editor {
5
+ height: 280px !important;
6
+ }
7
+
8
+ .ace_print-margin,
9
+ .ace_active-line,
10
+ .ace_gutter-active-line,
11
+ .ace_cursor-layer {
12
+ display: none;
13
+ }
14
+
15
+ .ace_line,
16
+ .ace_gutter-cell {
17
+ height: 12px !important;
18
+ }
19
+
20
+ .ace_gutter-layer {
21
+ width: 47px !important;
22
+ }
23
+ `;
24
+ const previewDialog = css`
25
+ & .mdc-dialog__surface {
26
+ width: 800px;
27
+ min-width: 800px;
28
+ }
29
+ `;
30
+ export { PayloadWrapper, previewDialog };
25
31
 
26
32
  //# sourceMappingURL=styled.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["css","PayloadWrapper","_styled","process","env","NODE_ENV","target","label","name","styles","toString","_EMOTION_STRINGIFIED_CSS_ERROR__","previewDialog"],"sources":["styled.tsx"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport { css } from \"@emotion/css\";\n\nexport const PayloadWrapper = styled(\"div\")`\n #brace-editor {\n height: 280px !important;\n }\n\n .ace_print-margin,\n .ace_active-line,\n .ace_gutter-active-line,\n .ace_cursor-layer {\n display: none;\n }\n\n .ace_line,\n .ace_gutter-cell {\n height: 12px !important;\n }\n\n .ace_gutter-layer {\n width: 47px !important;\n }\n`;\n\nexport const previewDialog = css`\n & .mdc-dialog__surface {\n width: 800px;\n min-width: 800px;\n }\n`;\n"],"mappings":";;AACA,SAASA,GAAG,QAAQ,cAAc;AAElC,OAAO,MAAMC,cAAc,gBAAGC,OAAA,CAAO,KAAK,EAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAC,MAAA;AAAA;EAAAA,MAAA;EAAAC,KAAA;AAAA,EAAC,CAAAJ,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAG,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,QAAA,EAAAC;AAAA,EAoB1C;AAED,OAAO,MAAMC,aAAa,gBAAGZ,GAAG,CAAAG,OAAA,CAAAC,GAAA,CAAAC,QAAA;EAAAG,IAAA;EAAAC,MAAA;AAAA;EAAAD,IAAA;EAAAC,MAAA;EAAAC,QAAA,EAAAC;AAAA,EAK/B","ignoreList":[]}
1
+ {"version":3,"file":"views/Logs/Preview/styled.js","sources":["../../../../src/views/Logs/Preview/styled.tsx"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport { css } from \"@emotion/css\";\n\nexport const PayloadWrapper = styled(\"div\")`\n #brace-editor {\n height: 280px !important;\n }\n\n .ace_print-margin,\n .ace_active-line,\n .ace_gutter-active-line,\n .ace_cursor-layer {\n display: none;\n }\n\n .ace_line,\n .ace_gutter-cell {\n height: 12px !important;\n }\n\n .ace_gutter-layer {\n width: 47px !important;\n }\n`;\n\nexport const previewDialog = css`\n & .mdc-dialog__surface {\n width: 800px;\n min-width: 800px;\n }\n`;\n"],"names":["PayloadWrapper","styled","previewDialog","css"],"mappings":";;AAGO,MAAMA,iBAAiBC,OAAO,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;AAoB5C,CAAC;AAEM,MAAMC,gBAAgBC,GAAG,CAAC;;;;;AAKjC,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { OnSortingChange, Sorting } from "@webiny/ui/DataTable/index.js";
2
+ import type { DataTableSorting, OnDataTableSortingChange } from "@webiny/admin-ui";
3
3
  import type { ActionType, IAuditLog } from "../../../types.js";
4
4
  interface ActionProps {
5
5
  label: string;
@@ -10,8 +10,8 @@ export interface TableProps {
10
10
  records: IAuditLog[];
11
11
  loading?: boolean;
12
12
  handleRecordSelect: (auditLog: IAuditLog) => void;
13
- sorting: Sorting;
14
- onSortingChange: OnSortingChange;
13
+ sorting: DataTableSorting;
14
+ onSortingChange: OnDataTableSortingChange;
15
15
  hasAccessToUsers: boolean;
16
16
  }
17
17
  export interface EntryWithPreview extends IAuditLog {
@@ -1,132 +1,108 @@
1
- import React, { forwardRef, useMemo } from "react";
1
+ import react, { forwardRef, useMemo } from "react";
2
2
  import { addMinutes, format } from "date-fns";
3
- import { ReactComponent as PreviewIcon } from "@webiny/icons/info.svg";
4
- import { DataTable } from "@webiny/ui/DataTable/index.js";
5
- import { IconButton } from "@webiny/ui/Button/index.js";
6
- import { Tooltip } from "@webiny/ui/Tooltip/index.js";
3
+ import { ReactComponent } from "@webiny/icons/info.svg";
4
+ import { DataTable, IconButton, Tooltip } from "@webiny/admin-ui";
7
5
  import { Text } from "../../../components/Text.js";
8
- import { ActionWrapper, appColumn, previewColumn, TextGray, TimezoneText, wideColumn } from "./styled.js";
9
- export const Action = ({
10
- label,
11
- value
12
- }) => {
13
- return /*#__PURE__*/React.createElement(ActionWrapper, {
14
- value: value
15
- }, /*#__PURE__*/React.createElement(Text, {
16
- use: "subtitle1"
17
- }, label));
18
- };
19
- export const Table = /*#__PURE__*/forwardRef((props, ref) => {
20
- const {
21
- records,
22
- loading,
23
- handleRecordSelect,
24
- sorting,
25
- onSortingChange,
26
- hasAccessToUsers
27
- } = props;
28
- const columns = {
29
- createdOn: {
30
- header: "Timestamp",
31
- cell: ({
32
- createdOn
33
- }) => {
34
- const date = new Date(createdOn);
35
- return /*#__PURE__*/React.createElement(Tooltip, {
36
- placement: "right",
37
- content: `UTC: ${format(addMinutes(date, date.getTimezoneOffset()), "yyyy-MM-dd HH:mm:ss")}`
38
- }, /*#__PURE__*/React.createElement(Text, {
39
- use: "subtitle1"
40
- }, format(date, "yyyy-MM-dd HH:mm:ss")), /*#__PURE__*/React.createElement(TimezoneText, {
41
- use: "body2"
42
- }, format(date, "(O)")));
43
- },
44
- enableSorting: true
45
- },
46
- app: {
47
- header: "App/Entity",
48
- cell: ({
49
- app,
50
- entity,
51
- entityId
52
- }) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Text, {
6
+ import { ActionWrapper, TextGray, TimezoneText, appColumn, previewColumn, wideColumn } from "./styled.js";
7
+ const Action = ({ label, value })=>/*#__PURE__*/ react.createElement(ActionWrapper, {
8
+ value: value
9
+ }, /*#__PURE__*/ react.createElement(Text, {
53
10
  use: "subtitle1"
54
- }, app), entity && /*#__PURE__*/React.createElement(TextGray, {
55
- use: "body2"
56
- }, ` [Entity: ${entity.label}]`), /*#__PURE__*/React.createElement("br", null), /*#__PURE__*/React.createElement(TextGray, {
57
- use: "body2"
58
- }, `ID: `), entity.link ? /*#__PURE__*/React.createElement("a", {
59
- href: entity.link,
60
- target: "blank"
61
- }, /*#__PURE__*/React.createElement(Text, {
62
- use: "body2"
63
- }, entityId)) : /*#__PURE__*/React.createElement(Text, {
64
- use: "body2"
65
- }, entityId)),
66
- className: appColumn
67
- },
68
- action: {
69
- header: "Action",
70
- cell: ({
71
- action
72
- }) => {
73
- return /*#__PURE__*/React.createElement(Action, {
74
- label: action.label,
75
- value: action.value
76
- });
77
- }
78
- },
79
- message: {
80
- header: "Message",
81
- cell: ({
82
- message
83
- }) => /*#__PURE__*/React.createElement(Text, {
84
- use: "subtitle1"
85
- }, message),
86
- className: wideColumn
87
- },
88
- ...(hasAccessToUsers && {
89
- createdBy: {
90
- header: "Initiator",
91
- cell: ({
92
- createdBy
93
- }) => /*#__PURE__*/React.createElement("a", {
94
- href: `/admin-users?id=${createdBy.id}`,
95
- target: "blank"
96
- }, /*#__PURE__*/React.createElement(Text, {
97
- use: "subtitle1"
98
- }, createdBy.displayName || "-"))
99
- }
100
- }),
101
- preview: {
102
- header: "",
103
- cell: auditLog => /*#__PURE__*/React.createElement(IconButton, {
104
- onClick: () => handleRecordSelect(auditLog),
105
- icon: /*#__PURE__*/React.createElement(PreviewIcon, null)
106
- }),
107
- className: previewColumn
108
- }
109
- };
110
- const tableSorting = useMemo(() => {
111
- if (!Array.isArray(sorting) || sorting.length === 0) {
112
- return [{
113
- id: "savedOn",
114
- desc: true
115
- }];
116
- }
117
- return sorting;
118
- }, [sorting]);
119
- return /*#__PURE__*/React.createElement("div", {
120
- ref: ref
121
- }, /*#__PURE__*/React.createElement(DataTable, {
122
- columns: columns,
123
- data: records,
124
- loadingInitial: loading,
125
- stickyRows: 1,
126
- sorting: tableSorting,
127
- onSortingChange: onSortingChange
128
- }));
11
+ }, label));
12
+ const Table = /*#__PURE__*/ forwardRef((props, ref)=>{
13
+ const { records, loading, handleRecordSelect, sorting, onSortingChange, hasAccessToUsers } = props;
14
+ const columns = {
15
+ createdOn: {
16
+ header: "Timestamp",
17
+ cell: (row)=>{
18
+ const date = new Date(row.createdOn);
19
+ return /*#__PURE__*/ react.createElement(Tooltip, {
20
+ side: "right",
21
+ content: `UTC: ${format(addMinutes(date, date.getTimezoneOffset()), "yyyy-MM-dd HH:mm:ss")}`,
22
+ trigger: /*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Text, {
23
+ use: "subtitle1"
24
+ }, format(date, "yyyy-MM-dd HH:mm:ss")), /*#__PURE__*/ react.createElement(TimezoneText, {
25
+ use: "body2"
26
+ }, format(date, "(O)")))
27
+ });
28
+ },
29
+ enableSorting: true
30
+ },
31
+ app: {
32
+ header: "App/Entity",
33
+ cell: (row)=>/*#__PURE__*/ react.createElement(react.Fragment, null, /*#__PURE__*/ react.createElement(Text, {
34
+ use: "subtitle1"
35
+ }, row.app), row.entity && /*#__PURE__*/ react.createElement(TextGray, {
36
+ use: "body2"
37
+ }, ` [Entity: ${row.entity.label}]`), /*#__PURE__*/ react.createElement("br", null), /*#__PURE__*/ react.createElement(TextGray, {
38
+ use: "body2"
39
+ }, "ID: "), row.entity.link ? /*#__PURE__*/ react.createElement("a", {
40
+ href: row.entity.link,
41
+ target: "blank"
42
+ }, /*#__PURE__*/ react.createElement(Text, {
43
+ use: "body2"
44
+ }, row.entityId)) : /*#__PURE__*/ react.createElement(Text, {
45
+ use: "body2"
46
+ }, row.entityId)),
47
+ className: appColumn
48
+ },
49
+ action: {
50
+ header: "Action",
51
+ cell: (row)=>/*#__PURE__*/ react.createElement(Action, {
52
+ label: row.action.label,
53
+ value: row.action.value
54
+ })
55
+ },
56
+ message: {
57
+ header: "Message",
58
+ cell: (row)=>/*#__PURE__*/ react.createElement(Text, {
59
+ use: "subtitle1"
60
+ }, row.message),
61
+ className: wideColumn
62
+ },
63
+ ...hasAccessToUsers && {
64
+ createdBy: {
65
+ header: "Initiator",
66
+ cell: (row)=>/*#__PURE__*/ react.createElement("a", {
67
+ href: `/admin-users?id=${row.createdBy.id}`,
68
+ target: "blank"
69
+ }, /*#__PURE__*/ react.createElement(Text, {
70
+ use: "subtitle1"
71
+ }, row.createdBy.displayName || "-"))
72
+ }
73
+ },
74
+ preview: {
75
+ header: "",
76
+ cell: (auditLog)=>/*#__PURE__*/ react.createElement(IconButton, {
77
+ onClick: ()=>handleRecordSelect(auditLog),
78
+ icon: /*#__PURE__*/ react.createElement(ReactComponent, null)
79
+ }),
80
+ className: previewColumn
81
+ }
82
+ };
83
+ const tableSorting = useMemo(()=>{
84
+ if (!Array.isArray(sorting) || 0 === sorting.length) return [
85
+ {
86
+ id: "savedOn",
87
+ desc: true
88
+ }
89
+ ];
90
+ return sorting;
91
+ }, [
92
+ sorting
93
+ ]);
94
+ return /*#__PURE__*/ react.createElement("div", {
95
+ ref: ref
96
+ }, /*#__PURE__*/ react.createElement(DataTable, {
97
+ columns: columns,
98
+ data: records,
99
+ loading: loading,
100
+ stickyHeader: true,
101
+ sorting: tableSorting,
102
+ onSortingChange: onSortingChange
103
+ }));
129
104
  });
130
105
  Table.displayName = "Table";
106
+ export { Action, Table };
131
107
 
132
108
  //# sourceMappingURL=Table.js.map