From 51d5ac87c7b0d2e5f6ea7e0c70074495c75acf9f Mon Sep 17 00:00:00 2001 From: sky121113 Date: Sat, 16 May 2026 20:38:05 +0800 Subject: [PATCH] refactor: optimize command center and stock management performance with lightweight JSON and DB indexes --- ...9_add_indexes_to_remote_commands_table.php | 32 +++++++++++++++++++ .../partials/tab-history-index.blade.php | 6 ++-- .../remote/partials/tab-history.blade.php | 14 ++++---- .../partials/tab-machines-index.blade.php | 8 ++--- .../remote/partials/tab-machines.blade.php | 8 ++--- 5 files changed, 50 insertions(+), 18 deletions(-) create mode 100644 database/migrations/2026_05_16_203249_add_indexes_to_remote_commands_table.php diff --git a/database/migrations/2026_05_16_203249_add_indexes_to_remote_commands_table.php b/database/migrations/2026_05_16_203249_add_indexes_to_remote_commands_table.php new file mode 100644 index 0000000..c39e989 --- /dev/null +++ b/database/migrations/2026_05_16_203249_add_indexes_to_remote_commands_table.php @@ -0,0 +1,32 @@ +index('command_type'); + $table->index('status'); + $table->index('created_at'); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::table('remote_commands', function (Blueprint $table) { + $table->dropIndex(['command_type']); + $table->dropIndex(['status']); + $table->dropIndex(['created_at']); + }); + } +}; diff --git a/resources/views/admin/remote/partials/tab-history-index.blade.php b/resources/views/admin/remote/partials/tab-history-index.blade.php index e2f9184..a0a7b83 100644 --- a/resources/views/admin/remote/partials/tab-history-index.blade.php +++ b/resources/views/admin/remote/partials/tab-history-index.blade.php @@ -148,7 +148,7 @@ @foreach ($history as $item) - +
@@ -281,7 +281,7 @@
@forelse ($history as $item)
+ @click="selectMachine({{ Js::from($item->machine->only(['id', 'name', 'serial_no', 'image_urls'])) }})">
@@ -365,7 +365,7 @@
-