Skip to content

Commit f68df1f

Browse files
committed
Made type searchable in action logs
Signed-off-by: snipe <[email protected]>
1 parent f0813e0 commit f68df1f

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

app/Http/Controllers/Api/ReportsController.php

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,6 @@ public function index(Request $request) : JsonResponse | array
4444
});
4545
}
4646

47-
if ($request->filled('action_type')) {
48-
$actionlogs = $actionlogs->where('action_type', '=', $request->input('action_type'))->orderBy('created_at', 'desc');
49-
}
50-
51-
if ($request->filled('created_by')) {
52-
$actionlogs = $actionlogs->where('created_by', '=', $request->input('created_by'));
53-
}
54-
55-
if ($request->filled('action_source')) {
56-
$actionlogs = $actionlogs->where('action_source', '=', $request->input('action_source'))->orderBy('created_at', 'desc');
57-
}
58-
59-
if ($request->filled('remote_ip')) {
60-
$actionlogs = $actionlogs->where('remote_ip', '=', $request->input('remote_ip'))->orderBy('created_at', 'desc');
61-
}
6247

6348
if ($request->filled('uploads')) {
6449
$actionlogs = $actionlogs->whereNotNull('filename')->orderBy('created_at', 'desc');
@@ -74,6 +59,8 @@ public function index(Request $request) : JsonResponse | array
7459
'note',
7560
'remote_ip',
7661
'user_agent',
62+
'target_type',
63+
'item_type',
7764
'action_source',
7865
'action_date',
7966
];

app/Models/Actionlog.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class Actionlog extends SnipeModel
5555
'created_by',
5656
'remote_ip',
5757
'user_agent',
58+
'item_type',
59+
'target_type',
5860
'action_source'
5961
];
6062

@@ -64,10 +66,10 @@ class Actionlog extends SnipeModel
6466
* @var array
6567
*/
6668
protected $searchableRelations = [
67-
'company' => ['name'],
68-
'adminuser' => ['first_name','last_name','username', 'email'],
69-
'user' => ['first_name','last_name','username', 'email'],
70-
'assets' => ['asset_tag','name'],
69+
'company' => ['name'],
70+
'adminuser' => ['first_name','last_name','username', 'email'],
71+
'user' => ['first_name','last_name','username', 'email'],
72+
'assets' => ['asset_tag','name'],
7173
];
7274

7375
/**

resources/views/reports/activity.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class="table table-striped snipe-table"
6464
<th class="col-sm-2" data-field="file" data-visible="false" data-formatter="fileUploadNameFormatter">
6565
{{ trans('general.file_name') }}
6666
</th>
67-
<th class="col-sm-1" data-field="type" data-formatter="itemTypeFormatter">
67+
<th class="col-sm-1" data-field="item_type" data-searchable="true" data-formatter="itemTypeFormatter">
6868
{{ trans('general.type') }}
6969
</th>
7070
<th class="col-sm-3" data-field="item.serial" data-visible="false">

0 commit comments

Comments
 (0)