@webiny/app-audit-logs 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.eb81deee7e
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/README.md +11 -1
- package/SecurityPermission.d.ts +2 -0
- package/SecurityPermission.js +15 -0
- package/SecurityPermission.js.map +1 -0
- package/components/Text.d.ts +10 -4
- package/components/Text.js +32 -22
- package/components/Text.js.map +1 -1
- package/config/list/AuditLogsListConfig.d.ts +31 -18
- package/config/list/AuditLogsListConfig.js +38 -15
- package/config/list/AuditLogsListConfig.js.map +1 -1
- package/config/list/Browser/Filter.js +30 -37
- package/config/list/Browser/Filter.js.map +1 -1
- package/config/list/Browser/FiltersToWhere.js +10 -13
- package/config/list/Browser/FiltersToWhere.js.map +1 -1
- package/config/list/Browser/index.d.ts +14 -16
- package/config/list/Browser/index.js +6 -5
- package/config/list/Browser/index.js.map +1 -1
- package/config/list/Details/PreviewTab.d.ts +15 -0
- package/config/list/Details/PreviewTab.js +32 -0
- package/config/list/Details/PreviewTab.js.map +1 -0
- package/config/list/Details/index.d.ts +8 -0
- package/config/list/Details/index.js +7 -0
- package/config/list/Details/index.js.map +1 -0
- package/config/list/index.d.ts +1 -1
- package/config/list/index.js +1 -3
- package/constants/index.js +2 -1
- package/constants/index.js.map +1 -1
- package/domain/permissionsSchema.d.ts +4 -0
- package/domain/permissionsSchema.js +8 -0
- package/domain/permissionsSchema.js.map +1 -0
- package/features/listAuditLogs/ListAuditLogsGateway.d.ts +11 -0
- package/features/listAuditLogs/ListAuditLogsGateway.js +71 -0
- package/features/listAuditLogs/ListAuditLogsGateway.js.map +1 -0
- package/features/listAuditLogs/ListAuditLogsRepository.d.ts +11 -0
- package/features/listAuditLogs/ListAuditLogsRepository.js +35 -0
- package/features/listAuditLogs/ListAuditLogsRepository.js.map +1 -0
- package/features/listAuditLogs/ListAuditLogsUseCase.d.ts +10 -0
- package/features/listAuditLogs/ListAuditLogsUseCase.js +19 -0
- package/features/listAuditLogs/ListAuditLogsUseCase.js.map +1 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsGateway.d.ts +20 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsGateway.js +5 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsGateway.js.map +1 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsRepository.d.ts +20 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsRepository.js +5 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsRepository.js.map +1 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsUseCase.d.ts +20 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsUseCase.js +5 -0
- package/features/listAuditLogs/abstractions/ListAuditLogsUseCase.js.map +1 -0
- package/features/listAuditLogs/abstractions/index.d.ts +6 -0
- package/features/listAuditLogs/abstractions/index.js +3 -0
- package/features/listAuditLogs/feature.d.ts +3 -0
- package/features/listAuditLogs/feature.js +21 -0
- package/features/listAuditLogs/feature.js.map +1 -0
- package/features/listAuditLogs/index.d.ts +1 -0
- package/features/listAuditLogs/index.js +1 -0
- package/features/permissions/abstractions.d.ts +17 -0
- package/features/permissions/abstractions.js +6 -0
- package/features/permissions/abstractions.js.map +1 -0
- package/features/permissions/feature.d.ts +14 -0
- package/features/permissions/feature.js +7 -0
- package/features/permissions/feature.js.map +1 -0
- package/graphql.d.ts +1 -1
- package/graphql.js +4 -4
- package/graphql.js.map +1 -1
- package/hooks/graphql.d.ts +9 -0
- package/hooks/graphql.js +0 -0
- package/hooks/index.d.ts +1 -1
- package/hooks/index.js +1 -3
- package/hooks/schema.d.ts +35 -0
- package/hooks/schema.js +27 -0
- package/hooks/schema.js.map +1 -0
- package/hooks/useAuditLogsList.d.ts +11 -16
- package/hooks/useAuditLogsList.js +97 -101
- package/hooks/useAuditLogsList.js.map +1 -1
- package/index.js +48 -49
- package/index.js.map +1 -1
- package/package.json +29 -34
- package/routes.d.ts +4 -0
- package/routes.js +10 -0
- package/routes.js.map +1 -0
- package/types.d.ts +48 -22
- package/types.js +1 -14
- package/utils/transformRawAuditLog.d.ts +5 -0
- package/utils/transformRawAuditLog.js +26 -0
- package/utils/transformRawAuditLog.js.map +1 -0
- package/views/Logs/Filters/FilterByAction.d.ts +1 -1
- package/views/Logs/Filters/FilterByAction.js +41 -42
- package/views/Logs/Filters/FilterByAction.js.map +1 -1
- package/views/Logs/Filters/FilterByApp.js +33 -31
- package/views/Logs/Filters/FilterByApp.js.map +1 -1
- package/views/Logs/Filters/FilterByCreatedBy.d.ts +2 -0
- package/views/Logs/Filters/FilterByCreatedBy.js +50 -0
- package/views/Logs/Filters/FilterByCreatedBy.js.map +1 -0
- package/views/Logs/Filters/FilterByCreatedOn.d.ts +2 -0
- package/views/Logs/Filters/FilterByCreatedOn.js +38 -0
- package/views/Logs/Filters/FilterByCreatedOn.js.map +1 -0
- package/views/Logs/Filters/FilterByEntity.d.ts +1 -1
- package/views/Logs/Filters/FilterByEntity.js +41 -42
- package/views/Logs/Filters/FilterByEntity.js.map +1 -1
- package/views/Logs/Filters/FilterByEntityId.d.ts +2 -0
- package/views/Logs/Filters/FilterByEntityId.js +26 -0
- package/views/Logs/Filters/FilterByEntityId.js.map +1 -0
- package/views/Logs/Filters/FilterByInitiator.js +44 -34
- package/views/Logs/Filters/FilterByInitiator.js.map +1 -1
- package/views/Logs/Filters/Filters.d.ts +5 -6
- package/views/Logs/Filters/Filters.js +66 -29
- package/views/Logs/Filters/Filters.js.map +1 -1
- package/views/Logs/Filters/index.d.ts +7 -6
- package/views/Logs/Filters/index.js +7 -8
- package/views/Logs/Filters/types.d.ts +9 -0
- package/views/Logs/Filters/types.js +0 -0
- package/views/Logs/Header/ButtonFilters/ButtonFilters.js +24 -45
- package/views/Logs/Header/ButtonFilters/ButtonFilters.js.map +1 -1
- package/views/Logs/Header/ButtonFilters/index.d.ts +1 -1
- package/views/Logs/Header/ButtonFilters/index.js +1 -3
- package/views/Logs/Header/Header.d.ts +2 -6
- package/views/Logs/Header/Header.js +12 -77
- package/views/Logs/Header/Header.js.map +1 -1
- package/views/Logs/Header/index.d.ts +1 -1
- package/views/Logs/Header/index.js +1 -3
- package/views/Logs/LoadMoreButton/LoadMoreButton.js +11 -18
- package/views/Logs/LoadMoreButton/LoadMoreButton.js.map +1 -1
- package/views/Logs/LoadMoreButton/index.d.ts +1 -1
- package/views/Logs/LoadMoreButton/index.js +1 -3
- package/views/Logs/LoadMoreButton/styled.d.ts +4 -5
- package/views/Logs/LoadMoreButton/styled.js +5 -16
- package/views/Logs/LoadMoreButton/styled.js.map +1 -1
- package/views/Logs/LoadingMore/index.js +13 -13
- package/views/Logs/LoadingMore/index.js.map +1 -1
- package/views/Logs/LogsModule.js +24 -24
- package/views/Logs/LogsModule.js.map +1 -1
- package/views/Logs/LogsView.d.ts +2 -0
- package/views/Logs/LogsView.js +73 -0
- package/views/Logs/LogsView.js.map +1 -0
- package/views/Logs/Preview/AuditLogDetailsPresenter.d.ts +13 -0
- package/views/Logs/Preview/AuditLogDetailsPresenter.js +36 -0
- package/views/Logs/Preview/AuditLogDetailsPresenter.js.map +1 -0
- package/views/Logs/Preview/Preview.d.ts +6 -4
- package/views/Logs/Preview/Preview.js +125 -88
- package/views/Logs/Preview/Preview.js.map +1 -1
- package/views/Logs/Preview/abstractions.d.ts +14 -0
- package/views/Logs/Preview/abstractions.js +5 -0
- package/views/Logs/Preview/abstractions.js.map +1 -0
- package/views/Logs/Preview/feature.d.ts +5 -0
- package/views/Logs/Preview/feature.js +22 -0
- package/views/Logs/Preview/feature.js.map +1 -0
- package/views/Logs/Preview/index.d.ts +3 -1
- package/views/Logs/Preview/index.js +2 -3
- package/views/Logs/Preview/tabs/AiPromptTabs.d.ts +2 -0
- package/views/Logs/Preview/tabs/AiPromptTabs.js +25 -0
- package/views/Logs/Preview/tabs/AiPromptTabs.js.map +1 -0
- package/views/Logs/Preview/tabs/LlmResponseTab.d.ts +4 -0
- package/views/Logs/Preview/tabs/LlmResponseTab.js +41 -0
- package/views/Logs/Preview/tabs/LlmResponseTab.js.map +1 -0
- package/views/Logs/Preview/tabs/SystemPromptTab.d.ts +4 -0
- package/views/Logs/Preview/tabs/SystemPromptTab.js +24 -0
- package/views/Logs/Preview/tabs/SystemPromptTab.js.map +1 -0
- package/views/Logs/Preview/tabs/UserPromptTab.d.ts +4 -0
- package/views/Logs/Preview/tabs/UserPromptTab.js +18 -0
- package/views/Logs/Preview/tabs/UserPromptTab.js.map +1 -0
- package/views/Logs/Preview/tabs/shared.d.ts +28 -0
- package/views/Logs/Preview/tabs/shared.js +16 -0
- package/views/Logs/Preview/tabs/shared.js.map +1 -0
- package/views/Logs/Table/Table.d.ts +10 -14
- package/views/Logs/Table/Table.js +112 -125
- package/views/Logs/Table/Table.js.map +1 -1
- package/views/Logs/Table/index.d.ts +1 -1
- package/views/Logs/Table/index.js +1 -3
- package/views/Logs/Table/styled.d.ts +1 -17
- package/views/Logs/Table/styled.js +15 -79
- package/views/Logs/Table/styled.js.map +1 -1
- package/config/list/index.js.map +0 -1
- package/hooks/index.js.map +0 -1
- package/plugins/permissionRenderer/AuditLogsPermissions.d.ts +0 -8
- package/plugins/permissionRenderer/AuditLogsPermissions.js +0 -100
- package/plugins/permissionRenderer/AuditLogsPermissions.js.map +0 -1
- package/plugins/permissionRenderer/index.d.ts +0 -1
- package/plugins/permissionRenderer/index.js +0 -32
- package/plugins/permissionRenderer/index.js.map +0 -1
- package/types.js.map +0 -1
- package/utils/transformCmsContentEntriesToRecordEntries.d.ts +0 -25
- package/utils/transformCmsContentEntriesToRecordEntries.js +0 -36
- package/utils/transformCmsContentEntriesToRecordEntries.js.map +0 -1
- package/views/Logs/Filters/FilterByTimestamp.d.ts +0 -2
- package/views/Logs/Filters/FilterByTimestamp.js +0 -40
- package/views/Logs/Filters/FilterByTimestamp.js.map +0 -1
- package/views/Logs/Filters/index.js.map +0 -1
- package/views/Logs/Filters/styled.d.ts +0 -5
- package/views/Logs/Filters/styled.js +0 -18
- package/views/Logs/Filters/styled.js.map +0 -1
- package/views/Logs/Header/ButtonFilters/index.js.map +0 -1
- package/views/Logs/Header/index.js.map +0 -1
- package/views/Logs/LoadMoreButton/index.js.map +0 -1
- package/views/Logs/LoadingMore/styled.d.ts +0 -9
- package/views/Logs/LoadingMore/styled.js +0 -32
- package/views/Logs/LoadingMore/styled.js.map +0 -1
- package/views/Logs/Logs.d.ts +0 -3
- package/views/Logs/Logs.js +0 -84
- package/views/Logs/Logs.js.map +0 -1
- package/views/Logs/Preview/index.js.map +0 -1
- package/views/Logs/Preview/styled.d.ts +0 -6
- package/views/Logs/Preview/styled.js +0 -25
- package/views/Logs/Preview/styled.js.map +0 -1
- package/views/Logs/Table/index.js.map +0 -1
- package/views/Logs/styled.d.ts +0 -9
- package/views/Logs/styled.js +0 -32
- package/views/Logs/styled.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const FilterByAction: () => React.JSX.Element
|
|
2
|
+
export declare const FilterByAction: () => React.JSX.Element;
|
|
@@ -1,47 +1,46 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react, { useMemo } from "react";
|
|
2
2
|
import { useBind, useForm } from "@webiny/form";
|
|
3
|
-
import { Select } from "@webiny/ui
|
|
4
|
-
import {
|
|
5
|
-
const getValidFilterValue = value
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
return value;
|
|
3
|
+
import { Select } from "@webiny/admin-ui";
|
|
4
|
+
import { apps } from "@webiny/common-audit-logs";
|
|
5
|
+
const getValidFilterValue = (value)=>{
|
|
6
|
+
if ("all" === value || "" === value) return;
|
|
7
|
+
return value;
|
|
10
8
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
9
|
+
const FilterByAction = ()=>{
|
|
10
|
+
const { data } = useForm();
|
|
11
|
+
const bind = useBind({
|
|
12
|
+
name: "action",
|
|
13
|
+
beforeChange (value, cb) {
|
|
14
|
+
cb(getValidFilterValue(value));
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
const options = useMemo(()=>{
|
|
18
|
+
if (!data.app) return [];
|
|
19
|
+
const entities = apps.find((app)=>app.app === data.app)?.entities || [];
|
|
20
|
+
const actions = entities.find((entity)=>entity.type === data.entity)?.actions || [];
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
label: "All",
|
|
24
|
+
value: "all"
|
|
25
|
+
},
|
|
26
|
+
...actions.map((entity)=>({
|
|
27
|
+
label: entity.displayName,
|
|
28
|
+
value: entity.type
|
|
29
|
+
}))
|
|
30
|
+
];
|
|
31
|
+
}, [
|
|
32
|
+
data
|
|
33
|
+
]);
|
|
34
|
+
const disabled = !data.app || !data.entity;
|
|
35
|
+
return /*#__PURE__*/ react.createElement(Select, {
|
|
36
|
+
...bind,
|
|
37
|
+
label: "Action",
|
|
38
|
+
size: "md",
|
|
39
|
+
placeholder: "All actions",
|
|
40
|
+
options: disabled ? [] : options,
|
|
41
|
+
disabled: disabled
|
|
42
|
+
});
|
|
45
43
|
};
|
|
44
|
+
export { FilterByAction };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=FilterByAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"views/Logs/Filters/FilterByAction.js","sources":["../../../../src/views/Logs/Filters/FilterByAction.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { useBind, useForm } from \"@webiny/form\";\nimport { Select } from \"@webiny/admin-ui\";\nimport { apps as auditLogsApps } from \"@webiny/common-audit-logs\";\nimport type { IFilterFormData } from \"~/views/Logs/Filters/types.js\";\n\nconst getValidFilterValue = (value: string): string | undefined => {\n if (value === \"all\" || value === \"\") {\n return undefined;\n }\n return value;\n};\n\nexport const FilterByAction = () => {\n const { data } = useForm<IFilterFormData>();\n const bind = useBind({\n name: \"action\",\n beforeChange(value, cb) {\n cb(getValidFilterValue(value));\n }\n });\n\n const options = useMemo(() => {\n if (!data.app) {\n return [];\n }\n\n const entities = auditLogsApps.find(app => app.app === data.app)?.entities || [];\n const actions = entities.find(entity => entity.type === data.entity)?.actions || [];\n\n return [\n { label: \"All\", value: \"all\" },\n ...actions.map(entity => ({ label: entity.displayName, value: entity.type }))\n ];\n }, [data]);\n\n const disabled = !data.app || !data.entity;\n\n return (\n <Select\n {...bind}\n label={\"Action\"}\n size={\"md\"}\n placeholder={\"All actions\"}\n options={disabled ? [] : options}\n disabled={disabled}\n />\n );\n};\n"],"names":["getValidFilterValue","value","FilterByAction","data","useForm","bind","useBind","cb","options","useMemo","entities","auditLogsApps","app","actions","entity","disabled","Select"],"mappings":";;;;AAMA,MAAMA,sBAAsB,CAACC;IACzB,IAAIA,AAAU,UAAVA,SAAmBA,AAAU,OAAVA,OACnB;IAEJ,OAAOA;AACX;AAEO,MAAMC,iBAAiB;IAC1B,MAAM,EAAEC,IAAI,EAAE,GAAGC;IACjB,MAAMC,OAAOC,QAAQ;QACjB,MAAM;QACN,cAAaL,KAAK,EAAEM,EAAE;YAClBA,GAAGP,oBAAoBC;QAC3B;IACJ;IAEA,MAAMO,UAAUC,QAAQ;QACpB,IAAI,CAACN,KAAK,GAAG,EACT,OAAO,EAAE;QAGb,MAAMO,WAAWC,KAAc,IAAI,CAACC,CAAAA,MAAOA,IAAI,GAAG,KAAKT,KAAK,GAAG,GAAG,YAAY,EAAE;QAChF,MAAMU,UAAUH,SAAS,IAAI,CAACI,CAAAA,SAAUA,OAAO,IAAI,KAAKX,KAAK,MAAM,GAAG,WAAW,EAAE;QAEnF,OAAO;YACH;gBAAE,OAAO;gBAAO,OAAO;YAAM;eAC1BU,QAAQ,GAAG,CAACC,CAAAA,SAAW;oBAAE,OAAOA,OAAO,WAAW;oBAAE,OAAOA,OAAO,IAAI;gBAAC;SAC7E;IACL,GAAG;QAACX;KAAK;IAET,MAAMY,WAAW,CAACZ,KAAK,GAAG,IAAI,CAACA,KAAK,MAAM;IAE1C,OAAO,WAAP,GACI,oBAACa,QAAMA;QACF,GAAGX,IAAI;QACR,OAAO;QACP,MAAM;QACN,aAAa;QACb,SAASU,WAAW,EAAE,GAAGP;QACzB,UAAUO;;AAGtB"}
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react from "react";
|
|
2
2
|
import { useBind, useForm } from "@webiny/form";
|
|
3
|
-
import { Select } from "@webiny/ui
|
|
4
|
-
import {
|
|
5
|
-
const getValidFilterValue = value
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
return value;
|
|
3
|
+
import { Select } from "@webiny/admin-ui";
|
|
4
|
+
import { apps } from "@webiny/common-audit-logs";
|
|
5
|
+
const getValidFilterValue = (value)=>{
|
|
6
|
+
if ("all" === value || "" === value) return;
|
|
7
|
+
return value;
|
|
10
8
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
const FilterByApp = ()=>{
|
|
10
|
+
const { setValue } = useForm();
|
|
11
|
+
const bind = useBind({
|
|
12
|
+
name: "app",
|
|
13
|
+
beforeChange (value, cb) {
|
|
14
|
+
setValue("entity", void 0);
|
|
15
|
+
setValue("action", void 0);
|
|
16
|
+
cb(getValidFilterValue(value));
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return /*#__PURE__*/ react.createElement(Select, {
|
|
20
|
+
...bind,
|
|
21
|
+
label: "Application",
|
|
22
|
+
size: "md",
|
|
23
|
+
placeholder: "All applications",
|
|
24
|
+
options: [
|
|
25
|
+
{
|
|
26
|
+
label: "All",
|
|
27
|
+
value: "all"
|
|
28
|
+
},
|
|
29
|
+
...apps.map((app)=>({
|
|
30
|
+
label: app.displayName,
|
|
31
|
+
value: app.app
|
|
32
|
+
}))
|
|
33
|
+
]
|
|
34
|
+
});
|
|
34
35
|
};
|
|
36
|
+
export { FilterByApp };
|
|
35
37
|
|
|
36
38
|
//# sourceMappingURL=FilterByApp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"views/Logs/Filters/FilterByApp.js","sources":["../../../../src/views/Logs/Filters/FilterByApp.tsx"],"sourcesContent":["import React from \"react\";\nimport { useBind, useForm } from \"@webiny/form\";\nimport { Select } from \"@webiny/admin-ui\";\nimport { apps as auditLogsApps } from \"@webiny/common-audit-logs\";\nimport type { IFilterFormData } from \"~/views/Logs/Filters/types.js\";\n\nconst getValidFilterValue = (value: string): string | undefined => {\n if (value === \"all\" || value === \"\") {\n return undefined;\n }\n return value;\n};\n\nexport const FilterByApp = () => {\n const { setValue } = useForm<IFilterFormData>();\n const bind = useBind({\n name: \"app\",\n beforeChange(value, cb) {\n setValue(\"entity\", undefined);\n setValue(\"action\", undefined);\n cb(getValidFilterValue(value));\n }\n });\n\n return (\n <Select\n {...bind}\n label={\"Application\"}\n size={\"md\"}\n placeholder={\"All applications\"}\n options={[\n { label: \"All\", value: \"all\" },\n ...auditLogsApps.map(app => ({ label: app.displayName, value: app.app }))\n ]}\n />\n );\n};\n"],"names":["getValidFilterValue","value","FilterByApp","setValue","useForm","bind","useBind","cb","undefined","Select","auditLogsApps","app"],"mappings":";;;;AAMA,MAAMA,sBAAsB,CAACC;IACzB,IAAIA,AAAU,UAAVA,SAAmBA,AAAU,OAAVA,OACnB;IAEJ,OAAOA;AACX;AAEO,MAAMC,cAAc;IACvB,MAAM,EAAEC,QAAQ,EAAE,GAAGC;IACrB,MAAMC,OAAOC,QAAQ;QACjB,MAAM;QACN,cAAaL,KAAK,EAAEM,EAAE;YAClBJ,SAAS,UAAUK;YACnBL,SAAS,UAAUK;YACnBD,GAAGP,oBAAoBC;QAC3B;IACJ;IAEA,OAAO,WAAP,GACI,oBAACQ,QAAMA;QACF,GAAGJ,IAAI;QACR,OAAO;QACP,MAAM;QACN,aAAa;QACb,SAAS;YACL;gBAAE,OAAO;gBAAO,OAAO;YAAM;eAC1BK,KAAAA,GAAiB,CAACC,CAAAA,MAAQ;oBAAE,OAAOA,IAAI,WAAW;oBAAE,OAAOA,IAAI,GAAG;gBAAC;SACzE;;AAGb"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import react, { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { useContainer } from "@webiny/app";
|
|
3
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient";
|
|
4
|
+
import { useBind } from "@webiny/form";
|
|
5
|
+
import { Select } from "@webiny/admin-ui";
|
|
6
|
+
import { LIST_USERS } from "../../../graphql.js";
|
|
7
|
+
const getValidFilterValue = (value)=>{
|
|
8
|
+
if ("all" === value || "" === value) return;
|
|
9
|
+
return value;
|
|
10
|
+
};
|
|
11
|
+
const FilterByCreatedBy = ()=>{
|
|
12
|
+
const container = useContainer();
|
|
13
|
+
const client = container.resolve(MainGraphQLClient);
|
|
14
|
+
const [users, setUsers] = useState([]);
|
|
15
|
+
useEffect(()=>{
|
|
16
|
+
client.execute({
|
|
17
|
+
query: LIST_USERS
|
|
18
|
+
}).then((response)=>{
|
|
19
|
+
setUsers(response.adminUsers.users.data || []);
|
|
20
|
+
});
|
|
21
|
+
}, []);
|
|
22
|
+
const bind = useBind({
|
|
23
|
+
name: "createdBy",
|
|
24
|
+
beforeChange (value, cb) {
|
|
25
|
+
cb(getValidFilterValue(value));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const options = useMemo(()=>[
|
|
29
|
+
{
|
|
30
|
+
label: "All",
|
|
31
|
+
value: "all"
|
|
32
|
+
},
|
|
33
|
+
...users.map((user)=>({
|
|
34
|
+
label: `${user.firstName} ${user.lastName}`,
|
|
35
|
+
value: user.id
|
|
36
|
+
}))
|
|
37
|
+
], [
|
|
38
|
+
users
|
|
39
|
+
]);
|
|
40
|
+
return /*#__PURE__*/ react.createElement(Select, {
|
|
41
|
+
...bind,
|
|
42
|
+
label: "Initiator",
|
|
43
|
+
size: "md",
|
|
44
|
+
placeholder: "Anyone",
|
|
45
|
+
options: options
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export { FilterByCreatedBy };
|
|
49
|
+
|
|
50
|
+
//# sourceMappingURL=FilterByCreatedBy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views/Logs/Filters/FilterByCreatedBy.js","sources":["../../../../src/views/Logs/Filters/FilterByCreatedBy.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { useContainer } from \"@webiny/app\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient\";\nimport { useBind } from \"@webiny/form\";\nimport { Select } from \"@webiny/admin-ui\";\nimport { LIST_USERS } from \"~/graphql.js\";\nimport type { User } from \"~/types.js\";\n\ninterface ListUsersResponse {\n adminUsers: {\n users: {\n data: User[];\n };\n };\n}\n\nconst getValidFilterValue = (value: string): string | undefined => {\n if (value === \"all\" || value === \"\") {\n return undefined;\n }\n return value;\n};\n\nexport const FilterByCreatedBy = () => {\n const container = useContainer();\n const client = container.resolve(MainGraphQLClient);\n const [users, setUsers] = useState<User[]>([]);\n\n useEffect(() => {\n client.execute<ListUsersResponse>({ query: LIST_USERS }).then(response => {\n setUsers(response.adminUsers.users.data || []);\n });\n }, []);\n\n const bind = useBind({\n name: \"createdBy\",\n beforeChange(value, cb) {\n cb(getValidFilterValue(value));\n }\n });\n\n const options = useMemo(() => {\n return [\n { label: \"All\", value: \"all\" },\n ...users.map(user => ({ label: `${user.firstName} ${user.lastName}`, value: user.id }))\n ];\n }, [users]);\n\n return (\n <Select\n {...bind}\n label={\"Initiator\"}\n size={\"md\"}\n placeholder={\"Anyone\"}\n options={options}\n />\n );\n};\n"],"names":["getValidFilterValue","value","FilterByCreatedBy","container","useContainer","client","MainGraphQLClient","users","setUsers","useState","useEffect","LIST_USERS","response","bind","useBind","cb","options","useMemo","user","Select"],"mappings":";;;;;;AAgBA,MAAMA,sBAAsB,CAACC;IACzB,IAAIA,AAAU,UAAVA,SAAmBA,AAAU,OAAVA,OACnB;IAEJ,OAAOA;AACX;AAEO,MAAMC,oBAAoB;IAC7B,MAAMC,YAAYC;IAClB,MAAMC,SAASF,UAAU,OAAO,CAACG;IACjC,MAAM,CAACC,OAAOC,SAAS,GAAGC,SAAiB,EAAE;IAE7CC,UAAU;QACNL,OAAO,OAAO,CAAoB;YAAE,OAAOM;QAAW,GAAG,IAAI,CAACC,CAAAA;YAC1DJ,SAASI,SAAS,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE;QACjD;IACJ,GAAG,EAAE;IAEL,MAAMC,OAAOC,QAAQ;QACjB,MAAM;QACN,cAAab,KAAK,EAAEc,EAAE;YAClBA,GAAGf,oBAAoBC;QAC3B;IACJ;IAEA,MAAMe,UAAUC,QAAQ,IACb;YACH;gBAAE,OAAO;gBAAO,OAAO;YAAM;eAC1BV,MAAM,GAAG,CAACW,CAAAA,OAAS;oBAAE,OAAO,GAAGA,KAAK,SAAS,CAAC,CAAC,EAAEA,KAAK,QAAQ,EAAE;oBAAE,OAAOA,KAAK,EAAE;gBAAC;SACvF,EACF;QAACX;KAAM;IAEV,OAAO,WAAP,GACI,oBAACY,QAAMA;QACF,GAAGN,IAAI;QACR,OAAO;QACP,MAAM;QACN,aAAa;QACb,SAASG;;AAGrB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { DatePicker } from "@webiny/admin-ui";
|
|
3
|
+
import { useBind } from "@webiny/form";
|
|
4
|
+
const now = new Date();
|
|
5
|
+
const FilterByCreatedOn = ()=>{
|
|
6
|
+
const bindFrom = useBind({
|
|
7
|
+
name: "createdOn_gte"
|
|
8
|
+
});
|
|
9
|
+
const bindTo = useBind({
|
|
10
|
+
name: "createdOn_lte"
|
|
11
|
+
});
|
|
12
|
+
return /*#__PURE__*/ react.createElement("div", {
|
|
13
|
+
className: "flex flex-col gap-md"
|
|
14
|
+
}, /*#__PURE__*/ react.createElement(DatePicker, {
|
|
15
|
+
label: "Created from",
|
|
16
|
+
type: "dateTimeLocal",
|
|
17
|
+
value: bindFrom.value ?? void 0,
|
|
18
|
+
onChange: (value)=>{
|
|
19
|
+
bindFrom.onChange(value ?? void 0);
|
|
20
|
+
},
|
|
21
|
+
placeholder: "Select date",
|
|
22
|
+
size: "md",
|
|
23
|
+
maxDate: now
|
|
24
|
+
}), /*#__PURE__*/ react.createElement(DatePicker, {
|
|
25
|
+
label: "Created to",
|
|
26
|
+
type: "dateTimeLocal",
|
|
27
|
+
value: bindTo.value ?? void 0,
|
|
28
|
+
onChange: (value)=>{
|
|
29
|
+
bindTo.onChange(value ?? void 0);
|
|
30
|
+
},
|
|
31
|
+
placeholder: "Select date",
|
|
32
|
+
size: "md",
|
|
33
|
+
maxDate: now
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
export { FilterByCreatedOn };
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=FilterByCreatedOn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views/Logs/Filters/FilterByCreatedOn.js","sources":["../../../../src/views/Logs/Filters/FilterByCreatedOn.tsx"],"sourcesContent":["import React from \"react\";\nimport { DatePicker } from \"@webiny/admin-ui\";\nimport { useBind } from \"@webiny/form\";\n\nconst now = new Date();\n\nexport const FilterByCreatedOn = () => {\n const bindFrom = useBind({\n name: \"createdOn_gte\"\n });\n\n const bindTo = useBind({\n name: \"createdOn_lte\"\n });\n\n return (\n <div className={\"flex flex-col gap-md\"}>\n <DatePicker\n label={\"Created from\"}\n type=\"dateTimeLocal\"\n value={bindFrom.value ?? undefined}\n onChange={value => {\n bindFrom.onChange(value ?? undefined);\n }}\n placeholder=\"Select date\"\n size=\"md\"\n maxDate={now}\n />\n <DatePicker\n label={\"Created to\"}\n type=\"dateTimeLocal\"\n value={bindTo.value ?? undefined}\n onChange={value => {\n bindTo.onChange(value ?? undefined);\n }}\n placeholder=\"Select date\"\n size=\"md\"\n maxDate={now}\n />\n </div>\n );\n};\n"],"names":["now","Date","FilterByCreatedOn","bindFrom","useBind","bindTo","DatePicker","undefined","value"],"mappings":";;;AAIA,MAAMA,MAAM,IAAIC;AAET,MAAMC,oBAAoB;IAC7B,MAAMC,WAAWC,QAAQ;QACrB,MAAM;IACV;IAEA,MAAMC,SAASD,QAAQ;QACnB,MAAM;IACV;IAEA,OAAO,WAAP,GACI,oBAAC;QAAI,WAAW;qBACZ,oBAACE,YAAUA;QACP,OAAO;QACP,MAAK;QACL,OAAOH,SAAS,KAAK,IAAII;QACzB,UAAUC,CAAAA;YACNL,SAAS,QAAQ,CAACK,SAASD;QAC/B;QACA,aAAY;QACZ,MAAK;QACL,SAASP;sBAEb,oBAACM,YAAUA;QACP,OAAO;QACP,MAAK;QACL,OAAOD,OAAO,KAAK,IAAIE;QACvB,UAAUC,CAAAA;YACNH,OAAO,QAAQ,CAACG,SAASD;QAC7B;QACA,aAAY;QACZ,MAAK;QACL,SAASP;;AAIzB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
export declare const FilterByEntity: () => React.JSX.Element
|
|
2
|
+
export declare const FilterByEntity: () => React.JSX.Element;
|
|
@@ -1,47 +1,46 @@
|
|
|
1
|
-
import
|
|
1
|
+
import react, { useMemo } from "react";
|
|
2
2
|
import { useBind, useForm } from "@webiny/form";
|
|
3
|
-
import { Select } from "@webiny/ui
|
|
4
|
-
import {
|
|
5
|
-
const getValidFilterValue = value
|
|
6
|
-
|
|
7
|
-
return
|
|
8
|
-
}
|
|
9
|
-
return value;
|
|
3
|
+
import { Select } from "@webiny/admin-ui";
|
|
4
|
+
import { apps } from "@webiny/common-audit-logs";
|
|
5
|
+
const getValidFilterValue = (value)=>{
|
|
6
|
+
if ("all" === value || "" === value) return;
|
|
7
|
+
return value;
|
|
10
8
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
9
|
+
const FilterByEntity = ()=>{
|
|
10
|
+
const { data, setValue } = useForm();
|
|
11
|
+
const bind = useBind({
|
|
12
|
+
name: "entity",
|
|
13
|
+
beforeChange (value, cb) {
|
|
14
|
+
setValue("action", void 0);
|
|
15
|
+
cb(getValidFilterValue(value));
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
const options = useMemo(()=>{
|
|
19
|
+
if (!data.app) return [];
|
|
20
|
+
const entities = apps.find((app)=>app.app === data.app)?.entities || [];
|
|
21
|
+
return [
|
|
22
|
+
{
|
|
23
|
+
label: "All",
|
|
24
|
+
value: "all"
|
|
25
|
+
},
|
|
26
|
+
...entities.map((entity)=>({
|
|
27
|
+
label: entity.displayName,
|
|
28
|
+
value: entity.type
|
|
29
|
+
}))
|
|
30
|
+
];
|
|
31
|
+
}, [
|
|
32
|
+
data.app
|
|
33
|
+
]);
|
|
34
|
+
const disabled = 0 === options.length;
|
|
35
|
+
return /*#__PURE__*/ react.createElement(Select, {
|
|
36
|
+
...bind,
|
|
37
|
+
label: "Entity",
|
|
38
|
+
size: "md",
|
|
39
|
+
placeholder: "All entities",
|
|
40
|
+
options: disabled ? [] : options,
|
|
41
|
+
disabled: disabled
|
|
42
|
+
});
|
|
45
43
|
};
|
|
44
|
+
export { FilterByEntity };
|
|
46
45
|
|
|
47
46
|
//# sourceMappingURL=FilterByEntity.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"views/Logs/Filters/FilterByEntity.js","sources":["../../../../src/views/Logs/Filters/FilterByEntity.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport { useBind, useForm } from \"@webiny/form\";\nimport { Select } from \"@webiny/admin-ui\";\nimport { apps as auditLogsApps } from \"@webiny/common-audit-logs\";\nimport type { IFilterFormData } from \"./types.js\";\n\nconst getValidFilterValue = (value: string): string | undefined => {\n if (value === \"all\" || value === \"\") {\n return undefined;\n }\n return value;\n};\n\nexport const FilterByEntity = () => {\n const { data, setValue } = useForm<IFilterFormData>();\n const bind = useBind({\n name: \"entity\",\n beforeChange(value, cb) {\n setValue(\"action\", undefined);\n cb(getValidFilterValue(value));\n }\n });\n\n const options = useMemo(() => {\n if (!data.app) {\n return [];\n }\n\n const entities = auditLogsApps.find(app => app.app === data.app)?.entities || [];\n\n return [\n { label: \"All\", value: \"all\" },\n ...entities.map(entity => ({ label: entity.displayName, value: entity.type }))\n ];\n }, [data.app]);\n\n const disabled = options.length === 0;\n\n return (\n <Select\n {...bind}\n label={\"Entity\"}\n size={\"md\"}\n placeholder={\"All entities\"}\n options={disabled ? [] : options}\n disabled={disabled}\n />\n );\n};\n"],"names":["getValidFilterValue","value","FilterByEntity","data","setValue","useForm","bind","useBind","cb","undefined","options","useMemo","entities","auditLogsApps","app","entity","disabled","Select"],"mappings":";;;;AAMA,MAAMA,sBAAsB,CAACC;IACzB,IAAIA,AAAU,UAAVA,SAAmBA,AAAU,OAAVA,OACnB;IAEJ,OAAOA;AACX;AAEO,MAAMC,iBAAiB;IAC1B,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAE,GAAGC;IAC3B,MAAMC,OAAOC,QAAQ;QACjB,MAAM;QACN,cAAaN,KAAK,EAAEO,EAAE;YAClBJ,SAAS,UAAUK;YACnBD,GAAGR,oBAAoBC;QAC3B;IACJ;IAEA,MAAMS,UAAUC,QAAQ;QACpB,IAAI,CAACR,KAAK,GAAG,EACT,OAAO,EAAE;QAGb,MAAMS,WAAWC,KAAc,IAAI,CAACC,CAAAA,MAAOA,IAAI,GAAG,KAAKX,KAAK,GAAG,GAAG,YAAY,EAAE;QAEhF,OAAO;YACH;gBAAE,OAAO;gBAAO,OAAO;YAAM;eAC1BS,SAAS,GAAG,CAACG,CAAAA,SAAW;oBAAE,OAAOA,OAAO,WAAW;oBAAE,OAAOA,OAAO,IAAI;gBAAC;SAC9E;IACL,GAAG;QAACZ,KAAK,GAAG;KAAC;IAEb,MAAMa,WAAWN,AAAmB,MAAnBA,QAAQ,MAAM;IAE/B,OAAO,WAAP,GACI,oBAACO,QAAMA;QACF,GAAGX,IAAI;QACR,OAAO;QACP,MAAM;QACN,aAAa;QACb,SAASU,WAAW,EAAE,GAAGN;QACzB,UAAUM;;AAGtB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import react from "react";
|
|
2
|
+
import { useBind, useForm } from "@webiny/form";
|
|
3
|
+
import { Input } from "@webiny/admin-ui";
|
|
4
|
+
const FilterByEntityId = ()=>{
|
|
5
|
+
const { setValue } = useForm();
|
|
6
|
+
const bind = useBind({
|
|
7
|
+
name: "entityId",
|
|
8
|
+
beforeChange (value, cb) {
|
|
9
|
+
if (!value) return void cb(void 0);
|
|
10
|
+
setValue("app", void 0);
|
|
11
|
+
setValue("entity", void 0);
|
|
12
|
+
setValue("action", void 0);
|
|
13
|
+
setValue("createdBy", void 0);
|
|
14
|
+
cb(value);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return /*#__PURE__*/ react.createElement(Input, {
|
|
18
|
+
...bind,
|
|
19
|
+
label: "Entity ID",
|
|
20
|
+
size: "md",
|
|
21
|
+
placeholder: "Enter entity ID"
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export { FilterByEntityId };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=FilterByEntityId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"views/Logs/Filters/FilterByEntityId.js","sources":["../../../../src/views/Logs/Filters/FilterByEntityId.tsx"],"sourcesContent":["import React from \"react\";\nimport { useBind, useForm } from \"@webiny/form\";\nimport { Input } from \"@webiny/admin-ui\";\nimport type { IFilterFormData } from \"~/views/Logs/Filters/types.js\";\n\nexport const FilterByEntityId = () => {\n const { setValue } = useForm<IFilterFormData>();\n const bind = useBind({\n name: \"entityId\",\n beforeChange(value, cb) {\n if (!value) {\n cb(undefined);\n return;\n }\n setValue(\"app\", undefined);\n setValue(\"entity\", undefined);\n setValue(\"action\", undefined);\n setValue(\"createdBy\", undefined);\n cb(value);\n }\n });\n\n return <Input {...bind} label={\"Entity ID\"} size={\"md\"} placeholder={\"Enter entity ID\"} />;\n};\n"],"names":["FilterByEntityId","setValue","useForm","bind","useBind","value","cb","undefined","Input"],"mappings":";;;AAKO,MAAMA,mBAAmB;IAC5B,MAAM,EAAEC,QAAQ,EAAE,GAAGC;IACrB,MAAMC,OAAOC,QAAQ;QACjB,MAAM;QACN,cAAaC,KAAK,EAAEC,EAAE;YAClB,IAAI,CAACD,OAAO,YACRC,GAAGC;YAGPN,SAAS,OAAOM;YAChBN,SAAS,UAAUM;YACnBN,SAAS,UAAUM;YACnBN,SAAS,aAAaM;YACtBD,GAAGD;QACP;IACJ;IAEA,OAAO,WAAP,GAAO,oBAACG,OAAKA;QAAE,GAAGL,IAAI;QAAE,OAAO;QAAa,MAAM;QAAM,aAAa;;AACzE"}
|
|
@@ -1,39 +1,49 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
1
|
+
import react, { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import { useContainer } from "@webiny/app";
|
|
3
|
+
import { MainGraphQLClient } from "@webiny/app/features/mainGraphQLClient";
|
|
3
4
|
import { useBind } from "@webiny/form";
|
|
4
|
-
import { Select } from "@webiny/ui
|
|
5
|
-
import { LIST_USERS } from "../../../graphql";
|
|
6
|
-
const getValidFilterValue = value
|
|
7
|
-
|
|
8
|
-
return
|
|
9
|
-
}
|
|
10
|
-
return value;
|
|
5
|
+
import { Select } from "@webiny/admin-ui";
|
|
6
|
+
import { LIST_USERS } from "../../../graphql.js";
|
|
7
|
+
const getValidFilterValue = (value)=>{
|
|
8
|
+
if ("all" === value || "" === value) return;
|
|
9
|
+
return value;
|
|
11
10
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
11
|
+
const FilterByInitiator = ()=>{
|
|
12
|
+
const container = useContainer();
|
|
13
|
+
const client = container.resolve(MainGraphQLClient);
|
|
14
|
+
const [users, setUsers] = useState([]);
|
|
15
|
+
useEffect(()=>{
|
|
16
|
+
client.execute({
|
|
17
|
+
query: LIST_USERS
|
|
18
|
+
}).then((response)=>{
|
|
19
|
+
setUsers(response.adminUsers.users.data || []);
|
|
20
|
+
});
|
|
21
|
+
}, []);
|
|
22
|
+
const bind = useBind({
|
|
23
|
+
name: "data.initiator",
|
|
24
|
+
beforeChange (value, cb) {
|
|
25
|
+
cb(getValidFilterValue(value));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
const options = useMemo(()=>[
|
|
29
|
+
{
|
|
30
|
+
label: "All",
|
|
31
|
+
value: "all"
|
|
32
|
+
},
|
|
33
|
+
...users.map((user)=>({
|
|
34
|
+
label: `${user.firstName} ${user.lastName}`,
|
|
35
|
+
value: user.id
|
|
36
|
+
}))
|
|
37
|
+
], [
|
|
38
|
+
users
|
|
39
|
+
]);
|
|
40
|
+
return /*#__PURE__*/ react.createElement(Select, {
|
|
41
|
+
...bind,
|
|
42
|
+
size: "md",
|
|
43
|
+
placeholder: "Filter by Initiator",
|
|
44
|
+
options: options
|
|
45
|
+
});
|
|
37
46
|
};
|
|
47
|
+
export { FilterByInitiator };
|
|
38
48
|
|
|
39
49
|
//# sourceMappingURL=FilterByInitiator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"views/Logs/Filters/FilterByInitiator.js","sources":["../../../../src/views/Logs/Filters/FilterByInitiator.tsx"],"sourcesContent":["import React, { useEffect, useMemo, useState } from \"react\";\nimport { useContainer } from \"@webiny/app\";\nimport { MainGraphQLClient } from \"@webiny/app/features/mainGraphQLClient\";\nimport { useBind } from \"@webiny/form\";\nimport { Select } from \"@webiny/admin-ui\";\nimport { LIST_USERS } from \"~/graphql.js\";\nimport type { User } from \"~/types.js\";\n\ninterface ListUsersResponse {\n adminUsers: {\n users: {\n data: User[];\n };\n };\n}\n\nconst getValidFilterValue = (value: string): string | undefined => {\n if (value === \"all\" || value === \"\") {\n return undefined;\n }\n return value;\n};\n\nexport const FilterByInitiator = () => {\n const container = useContainer();\n const client = container.resolve(MainGraphQLClient);\n const [users, setUsers] = useState<User[]>([]);\n\n useEffect(() => {\n client.execute<ListUsersResponse>({ query: LIST_USERS }).then(response => {\n setUsers(response.adminUsers.users.data || []);\n });\n }, []);\n\n const bind = useBind({\n name: \"data.initiator\",\n beforeChange(value, cb) {\n cb(getValidFilterValue(value));\n }\n });\n\n const options = useMemo(() => {\n return [\n { label: \"All\", value: \"all\" },\n ...users.map(user => ({ label: `${user.firstName} ${user.lastName}`, value: user.id }))\n ];\n }, [users]);\n\n return <Select {...bind} size={\"md\"} placeholder={\"Filter by Initiator\"} options={options} />;\n};\n"],"names":["getValidFilterValue","value","FilterByInitiator","container","useContainer","client","MainGraphQLClient","users","setUsers","useState","useEffect","LIST_USERS","response","bind","useBind","cb","options","useMemo","user","Select"],"mappings":";;;;;;AAgBA,MAAMA,sBAAsB,CAACC;IACzB,IAAIA,AAAU,UAAVA,SAAmBA,AAAU,OAAVA,OACnB;IAEJ,OAAOA;AACX;AAEO,MAAMC,oBAAoB;IAC7B,MAAMC,YAAYC;IAClB,MAAMC,SAASF,UAAU,OAAO,CAACG;IACjC,MAAM,CAACC,OAAOC,SAAS,GAAGC,SAAiB,EAAE;IAE7CC,UAAU;QACNL,OAAO,OAAO,CAAoB;YAAE,OAAOM;QAAW,GAAG,IAAI,CAACC,CAAAA;YAC1DJ,SAASI,SAAS,UAAU,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE;QACjD;IACJ,GAAG,EAAE;IAEL,MAAMC,OAAOC,QAAQ;QACjB,MAAM;QACN,cAAab,KAAK,EAAEc,EAAE;YAClBA,GAAGf,oBAAoBC;QAC3B;IACJ;IAEA,MAAMe,UAAUC,QAAQ,IACb;YACH;gBAAE,OAAO;gBAAO,OAAO;YAAM;eAC1BV,MAAM,GAAG,CAACW,CAAAA,OAAS;oBAAE,OAAO,GAAGA,KAAK,SAAS,CAAC,CAAC,EAAEA,KAAK,QAAQ,EAAE;oBAAE,OAAOA,KAAK,EAAE;gBAAC;SACvF,EACF;QAACX;KAAM;IAEV,OAAO,WAAP,GAAO,oBAACY,QAAMA;QAAE,GAAGN,IAAI;QAAE,MAAM;QAAM,aAAa;QAAuB,SAASG;;AACtF"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
export declare const Filters: ({ showingFilters, setFilters, hasAccessToUsers }: FiltersProps) => React.JSX.Element;
|
|
2
|
+
import type { IListAuditLogsVariablesWhere } from "../../../hooks/graphql.js";
|
|
3
|
+
interface FiltersProps {
|
|
4
|
+
setWhere: (where: Partial<IListAuditLogsVariablesWhere>) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const Filters: ({ setWhere }: FiltersProps) => React.JSX.Element;
|
|
8
7
|
export {};
|