From 87e6fb63e1bd8349498d2dbde6210f56451cecbf Mon Sep 17 00:00:00 2001 From: Gucheng Wang Date: Sun, 7 Nov 2021 17:42:41 +0800 Subject: [PATCH] Add isTriggered to record. --- object/record.go | 2 ++ web/src/RecordListPage.js | 43 +++++++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/object/record.go b/object/record.go index f34ab173..0edd84f8 100644 --- a/object/record.go +++ b/object/record.go @@ -33,6 +33,8 @@ type Record struct { User string `xorm:"varchar(100)" json:"user"` RequestUri string `xorm:"varchar(1000)" json:"requestUri"` Action string `xorm:"varchar(1000)" json:"action"` + + IsTriggered bool `json:"isTriggered"` } func NewRecord(ctx *context.Context) *Record { diff --git a/web/src/RecordListPage.js b/web/src/RecordListPage.js index 688edd28..3687611d 100644 --- a/web/src/RecordListPage.js +++ b/web/src/RecordListPage.js @@ -14,7 +14,7 @@ import React from "react"; import {Link} from "react-router-dom"; -import {Table} from 'antd'; +import {Switch, Table} from 'antd'; import * as Setting from "./Setting"; import * as RecordBackend from "./backend/RecordBackend"; import i18next from "i18next"; @@ -57,6 +57,7 @@ class RecordListPage extends React.Component { username: "admin", requestUri: "/api/get-account", action: "login", + isTriggered: false, } } @@ -66,28 +67,35 @@ class RecordListPage extends React.Component { title: i18next.t("general:Name"), dataIndex: 'name', key: 'name', - width: '220px', + width: '320px', sorter: (a, b) => a.name.localeCompare(b.name), }, { title: i18next.t("general:ID"), dataIndex: 'id', key: 'id', - width: '100px', + width: '90px', sorter: (a, b) => a.id - b.id, }, { title: i18next.t("general:Client IP"), dataIndex: 'clientIp', key: 'clientIp', - width: '100px', + width: '150px', sorter: (a, b) => a.clientIp.localeCompare(b.clientIp), + render: (text, record, index) => { + return ( + + {text} + + ) + } }, { title: i18next.t("general:Timestamp"), dataIndex: 'createdTime', key: 'createdTime', - width: '120px', + width: '180px', sorter: (a, b) => a.createdTime.localeCompare(b.createdTime), render: (text, record, index) => { return Setting.getFormattedDate(text); @@ -97,7 +105,7 @@ class RecordListPage extends React.Component { title: i18next.t("general:Organization"), dataIndex: 'organization', key: 'organization', - width: '120px', + width: '80px', sorter: (a, b) => a.organization.localeCompare(b.organization), render: (text, record, index) => { return ( @@ -113,24 +121,43 @@ class RecordListPage extends React.Component { key: 'user', width: '120px', sorter: (a, b) => a.user.localeCompare(b.user), + render: (text, record, index) => { + return ( + + {text} + + ) + } }, { title: i18next.t("general:Request URI"), dataIndex: 'requestUri', key: 'requestUri', - width: '250px', + // width: '300px', sorter: (a, b) => a.requestUri.localeCompare(b.requestUri), }, { title: i18next.t("general:Action"), dataIndex: 'action', key: 'action', - width: '160px', + width: '200px', sorter: (a, b) => a.action.localeCompare(b.action), render: (text, record, index) => { return text; } }, + { + title: i18next.t("record:Is Triggered"), + dataIndex: 'isTriggered', + key: 'isTriggered', + width: '140px', + sorter: (a, b) => a.isTriggered - b.isTriggered, + render: (text, record, index) => { + return ( + + ) + } + }, ]; const paginationProps = {