Skip to content

Commit efcb935

Browse files
committed
fix: AddUserAction dispatch
Change-Id: Id3bfa5b11911494f17c23d271bf55df904811cae
1 parent 617409f commit efcb935

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

app/Jobs/AddUserAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct(int $user_id, string $ip, string $action){
6060
public function handle(IUserActionService $service){
6161
Log::debug(sprintf("AddUserAction::handle"));
6262
try{
63-
$service->addUserAction($this->user_id, $this->ip, $this->action);
63+
$service->addUserAction($this->user_id, $this->ip, $this->action, "From Site");
6464
}
6565
catch (\Exception $ex) {
6666
Log::error($ex);

app/libs/Auth/Models/User.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,7 +2018,8 @@ private function formatFieldValue(string $field, $value):string{
20182018
if($field === 'password') $value = "********";
20192019
if($value instanceof \DateTime)
20202020
$value = $value->format('Y-m-d H:i:s');
2021-
return sprintf("%s: %s", $field, $value);
2021+
if(empty($value)) $value = "EMPTY";
2022+
return $value;
20222023
}
20232024
/**
20242025
* @ORM\PreUpdate:
@@ -2072,10 +2073,10 @@ public function updating(PreUpdateEventArgs $args)
20722073

20732074
$action = sprintf
20742075
(
2075-
"User %s updated from %s to %s", $this->email, implode(", ", $old_fields_changed), implode(", ", $new_fields_changed)
2076+
"USER UPDATED from %s to %s", implode(", ", $old_fields_changed), implode(", ", $new_fields_changed)
20762077
);
20772078

2078-
Event::dispatch(new AddUserAction($this->id, IPHelper::getUserIp(), $action));
2079+
AddUserAction::dispatch($this->id, IPHelper::getUserIp(), $action);
20792080
}
20802081

20812082
}

resources/js/components/user_actions_grid.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import React, {useEffect, useState} from "react";
22
import {DataGrid, getGridDateOperators} from "@mui/x-data-grid";
33
import moment from "moment";
4+
import Tooltip from '@material-ui/core/Tooltip'
45

56
const UserActionsGrid = ({getUserActions, pageSize}) => {
67
const [page, setPage] = useState(1);
@@ -13,7 +14,14 @@ const UserActionsGrid = ({getUserActions, pageSize}) => {
1314

1415
const uaColumns = [
1516
{field: 'realm', headerName: 'From Realm', width: 380},
16-
{field: 'user_action', headerName: 'Action', width: 150},
17+
{
18+
field: 'user_action', headerName: 'Action', width: 150 ,
19+
renderCell: (params) => (
20+
<Tooltip title={params.value} >
21+
<span className="table-cell-trucate">{params.value}</span>
22+
</Tooltip>
23+
),
24+
},
1725
{field: 'from_ip', headerName: 'From IP', width: 150},
1826
{
1927
field: 'created_at',

0 commit comments

Comments
 (0)