-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Fixed action_date
in action_logs
#16469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
38efc62
Add index on action_date, copy from created_at
snipe 4e3df93
Change action_date display to date from datetime
snipe d4dc8d2
Remove action_date from loggable as a changed field
snipe 80a69bf
Revert datetime to date
snipe c825878
Added history presenter
snipe 55694fa
Added strings
snipe 7ba361b
Use date formatter for filestable
snipe cb78225
Use new presenters
snipe ef56177
Use presenter
snipe 92b2da9
Added history tab to components
snipe df54376
Add optional serial value in presenter
snipe 220537f
Updated presenter name
snipe 0b48fd1
Removed extra headers
snipe ec8ddc1
Merge branch 'develop' into fix_action_date
snipe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
<?php | ||
|
||
namespace App\Presenters; | ||
|
||
/** | ||
* Class AccessoryPresenter | ||
*/ | ||
class HistoryPresenter extends Presenter | ||
{ | ||
/** | ||
* Json Column Layout for bootstrap table | ||
* @return string | ||
*/ | ||
public static function dataTableLayout($serial = false) | ||
{ | ||
$extra = []; | ||
$layout_start = [ | ||
[ | ||
'id' => 'id', | ||
'searchable' => false, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('general.id'), | ||
'visible' => false, | ||
'class' => 'hidden-xs', | ||
], | ||
[ | ||
'field' => 'icon', | ||
'searchable' => false, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('admin/hardware/table.icon'), | ||
'visible' => true, | ||
'class' => 'hidden-xs', | ||
'formatter' => 'iconFormatter', | ||
], | ||
[ | ||
'field' => 'created_at', | ||
'searchable' => true, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('general.created_at'), | ||
'visible' => false, | ||
'formatter' => 'dateDisplayFormatter', | ||
], | ||
[ | ||
'field' => 'created_by', | ||
'searchable' => false, | ||
'sortable' => true, | ||
'title' => trans('general.created_by'), | ||
'visible' => false, | ||
'formatter' => 'usersLinkObjFormatter', | ||
], | ||
[ | ||
'field' => 'action_date', | ||
'searchable' => false, | ||
'sortable' => true, | ||
'title' => trans('general.action_date'), | ||
'visible' => false, | ||
'formatter' => 'dateDisplayFormatter', | ||
], | ||
[ | ||
'field' => 'action_type', | ||
'searchable' => true, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('general.action'), | ||
'visible' => false, | ||
], | ||
[ | ||
'field' => 'item', | ||
'searchable' => true, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('general.item'), | ||
'visible' => false, | ||
'formatter' => 'polymorphicItemFormatter', | ||
], | ||
]; | ||
|
||
|
||
if ($serial) { | ||
$extra = [ | ||
[ | ||
'field' => 'item.serial', | ||
'title' => trans('admin/hardware/table.serial'), | ||
'visible' => false, | ||
] | ||
]; | ||
} | ||
|
||
$layout_end = [ | ||
[ | ||
'field' => 'target', | ||
'searchable' => true, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('general.target'), | ||
'visible' => false, | ||
'formatter' => 'polymorphicItemFormatter', | ||
], | ||
[ | ||
'field' => 'file', | ||
'searchable' => true, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('general.file_name'), | ||
'visible' => false, | ||
'formatter' => 'fileUploadNameFormatter', | ||
], | ||
[ | ||
'field' => 'file_download', | ||
'searchable' => true, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('general.download'), | ||
'visible' => false, | ||
'formatter' => 'fileUploadFormatter', | ||
], | ||
[ | ||
'field' => 'note', | ||
'searchable' => true, | ||
'sortable' => true, | ||
'visible' => false, | ||
'title' => trans('general.notes'), | ||
'formatter' => 'notesFormatter' | ||
], | ||
[ | ||
'field' => 'signature_file', | ||
'searchable' => true, | ||
'sortable' => true, | ||
'switchable' => true, | ||
'title' => trans('general.signature'), | ||
'visible' => false, | ||
'formatter' => 'imageFormatter', | ||
], | ||
[ | ||
'field' => 'log_meta', | ||
'searchable' => false, | ||
'sortable' => false, | ||
'visible' => true, | ||
'title' => trans('admin/hardware/table.changed'), | ||
'formatter' => 'changeLogFormatter', | ||
], | ||
[ | ||
'field' => 'remote_ip', | ||
'searchable' => false, | ||
'sortable' => false, | ||
'visible' => true, | ||
'title' => trans('admin/settings/general.login_ip'), | ||
], | ||
[ | ||
'field' => 'user_agent', | ||
'searchable' => false, | ||
'sortable' => false, | ||
'visible' => true, | ||
'title' => trans('admin/settings/general.login_user_agent'), | ||
], | ||
[ | ||
'field' => 'action_source', | ||
'searchable' => false, | ||
'sortable' => false, | ||
'visible' => true, | ||
'title' => trans('general.action_source'), | ||
], | ||
]; | ||
|
||
$merged = array_merge($layout_start, $extra, $layout_end); | ||
return json_encode($merged); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
database/migrations/2025_03_06_152922_copy_created_at_to_action_date_in_action_logs.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
|
||
Schema::table('action_logs', function (Blueprint $table) { | ||
$table->index(['action_date']); | ||
}); | ||
|
||
DB::update('update '.DB::getTablePrefix().'action_logs set action_date = created_at where created_at IS NOT NULL and action_date IS NULL'); | ||
|
||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
|
||
} | ||
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this one is actually used?