From 370666b5bd24bf218a39697c0f15d806668d50aa Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 21 Jan 2025 10:12:56 -0800 Subject: [PATCH 1/4] Fix indenting --- resources/views/hardware/view.blade.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 06edd36b8d5..03e3f927e2b 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -1385,19 +1385,19 @@ class="table table-striped snipe-table" @can('view', $asset->model) -
-
-
+
+
+
- + -
-
-
+
+
+
@endcan @@ -1420,4 +1420,4 @@ class="table table-striped snipe-table" @include ('partials.bootstrap-table') -@stop \ No newline at end of file +@stop From 6a35fa7ba3d20a38162675410a1aaae8a6e5716e Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 21 Jan 2025 10:14:27 -0800 Subject: [PATCH 2/4] Account for missing asset model --- resources/views/hardware/view.blade.php | 32 +++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 03e3f927e2b..ef302a7d3bb 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -1384,21 +1384,23 @@ class="table table-striped snipe-table" - @can('view', $asset->model) -
-
-
- - - -
-
-
- @endcan + @if ($asset->model) + @can('view', $asset->model) +
+
+
+ + + +
+
+
+ @endcan + @endif From e733d2a5d0d169dadbb99c8f8fc27c0cb44b7ade Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 21 Jan 2025 10:24:15 -0800 Subject: [PATCH 3/4] Backfill test --- tests/Feature/Assets/Ui/ShowAssetTest.php | 26 +++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/Feature/Assets/Ui/ShowAssetTest.php diff --git a/tests/Feature/Assets/Ui/ShowAssetTest.php b/tests/Feature/Assets/Ui/ShowAssetTest.php new file mode 100644 index 00000000000..4410198e67b --- /dev/null +++ b/tests/Feature/Assets/Ui/ShowAssetTest.php @@ -0,0 +1,26 @@ +create(); + + $asset->model_id = null; + $asset->forceSave(); + + $asset->refresh(); + + $this->assertNull($asset->fresh()->model_id, 'This test needs model_id to be null to be helpful.'); + + $this->actingAs(User::factory()->superuser()->create()) + ->get(route('hardware.show', $asset)) + ->assertOk(); + } +} From 31097bdc37380605a9d5dbd78e8b7f056a097863 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 21 Jan 2025 10:25:53 -0800 Subject: [PATCH 4/4] Formatting --- tests/Feature/Assets/Ui/ShowAssetTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Feature/Assets/Ui/ShowAssetTest.php b/tests/Feature/Assets/Ui/ShowAssetTest.php index 4410198e67b..23b6c8f31e6 100644 --- a/tests/Feature/Assets/Ui/ShowAssetTest.php +++ b/tests/Feature/Assets/Ui/ShowAssetTest.php @@ -11,7 +11,7 @@ class ShowAssetTest extends TestCase public function testPageForAssetWithMissingModelStillRenders() { $asset = Asset::factory()->create(); - + $asset->model_id = null; $asset->forceSave();