diff --git a/frontend/app/components/DataManagement/Activity/EventDetailsModal.tsx b/frontend/app/components/DataManagement/Activity/EventDetailsModal.tsx new file mode 100644 index 000000000..2140d1549 --- /dev/null +++ b/frontend/app/components/DataManagement/Activity/EventDetailsModal.tsx @@ -0,0 +1,78 @@ +import React from 'react' +import { EventData } from './data/Event' +import { Segmented, Input } from 'antd'; +import { X } from 'lucide-react'; + +function EventDetailsModal({ ev, onClose }: { ev: EventData, onClose: () => void }) { + const tabs = [ + { + label: 'All Properties', + }, + { + label: 'Custom Properties', + }, + { + label: 'Default Properties', + } + ] + + const views = [ + { + label: 'icn1', + value: 'pretty', + }, + { + label: 'icn2', + value: 'json', + } + ] + const [query, setQuery] = React.useState('') + const [view, setView] = React.useState(views[0].value) + const dataFields = { ...ev.$_defaultFields, ...ev.$_customFields } + const fieldArr = Object.entries(dataFields) + const filteredArr = fieldArr.filter(([key, value]) => { + const qReg = new RegExp(query, 'ig') + return qReg.test(key) || qReg.test(value) + }) + + return ( +
+
+
Event
+
+ +
+
+
+
icn
+
{ev.name}
+
Play Session
+
+ +
+ setView(v)} + /> + setQuery(e.target.value)} + placeholder={'Find Property'} + /> +
+
+ {filteredArr.map(([key, value]) => ( +
+
{key}
+
{value}
+
+ ))} +
+
+ ) +} + +export default EventDetailsModal; \ No newline at end of file diff --git a/frontend/app/components/DataManagement/Activity/Page.tsx b/frontend/app/components/DataManagement/Activity/Page.tsx index b2cdde3de..3e84d66b0 100644 --- a/frontend/app/components/DataManagement/Activity/Page.tsx +++ b/frontend/app/components/DataManagement/Activity/Page.tsx @@ -5,6 +5,8 @@ import { MoreOutlined } from '@ant-design/icons'; import { numberWithCommas } from 'App/utils'; import { Pagination } from 'UI'; import Event from './data/Event'; +import { useModal } from 'App/components/Modal'; +import EventDetailsModal from "./EventDetailsModal"; function ActivityPage() { const [hiddenCols, setHiddenCols] = React.useState([]); @@ -16,6 +18,7 @@ function ActivityPage() { const saveRequestPayloads = () => {}; const onFilterMove = () => {}; const [editCols, setEditCols] = React.useState(false); + const { showModal, hideModal } = useModal(); const dropdownItems = [ { @@ -108,6 +111,10 @@ function ActivityPage() { ); const list = [testEv.toData(), testAutoEv.toData()]; const onPageChange = () => {}; + + const onItemClick = (ev: Event) => { + showModal(, { width: 400, right: true }); + } return (
All users activity
- +
({ + onClick: (event) => onItemClick(record) + })} + dataSource={list} + pagination={false} + columns={shownCols} + />
{'Showing '} diff --git a/frontend/app/components/DataManagement/Activity/data/Event.ts b/frontend/app/components/DataManagement/Activity/data/Event.ts index 5bda41437..da8855e73 100644 --- a/frontend/app/components/DataManagement/Activity/data/Event.ts +++ b/frontend/app/components/DataManagement/Activity/data/Event.ts @@ -4,6 +4,14 @@ interface DefaultFields { userEnvironment: string; } +export interface EventData { + name: string; + time: string; + $_isAutoCapture: boolean; + $_defaultFields: DefaultFields; + $_customFields?: Record; +} + export default class Event { name: string; time: string; @@ -29,11 +37,13 @@ export default class Event { return JSON.stringify(obj, 4); } - toData() { + toData(): EventData { const obj: any = { name: this.name, time: this.time, $_isAutoCapture: this.$_isAutoCapture, + $_defaultFields: this.defaultFields, + $_customFields: this.customFields, } Object.entries(this.defaultFields).forEach(([key, value]) => { obj[key] = value;