mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-29 10:04:36 +08:00
Add a "Connect to resources" modal to the tag show page for small screens, where the tags canvas is hidden. A new toggleResource action attaches or detaches the tag on a team resource after an authorization check, then refreshes the tag's applications and services. Also improve responsive layouts: - Wrap section headings, project/environment toolbars and view toggles on narrow screens; keep modal headers from shrinking. - Move the environment settings link to an icon next to the environment name and link the project name back to its environments. - Group project icon, name and description into one "Project details" form with an unsaved-changes bar. - Show dashboard "view all" links for projects and servers only when there are more items than the dashboard limit.
56 lines
1.9 KiB
PHP
56 lines
1.9 KiB
PHP
<?php
|
|
|
|
use App\Livewire\Dashboard;
|
|
use App\Models\InstanceSettings;
|
|
use App\Models\Project;
|
|
use App\Models\Team;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Cookie;
|
|
use Illuminate\Support\Facades\Queue;
|
|
use Livewire\Livewire;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
beforeEach(function () {
|
|
Queue::fake();
|
|
|
|
InstanceSettings::unguarded(fn () => InstanceSettings::query()->create(['id' => 0]));
|
|
|
|
$this->user = User::factory()->create();
|
|
$this->team = Team::factory()->create();
|
|
$this->user->teams()->attach($this->team, ['role' => 'owner']);
|
|
|
|
$this->actingAs($this->user);
|
|
session(['currentTeam' => $this->team]);
|
|
});
|
|
|
|
it('shows the projects and servers sections as tables by default', function () {
|
|
Livewire::test(Dashboard::class)
|
|
->assertSee("viewMode: 'table'", false)
|
|
->assertDontSee("viewMode: 'grid'", false);
|
|
});
|
|
|
|
it('remembers the view of each dashboard section on its own', function () {
|
|
Livewire::test(Dashboard::class)->call('saveListView', 'dashboard_projects', 'grid');
|
|
|
|
expect(Cookie::queued("coolify_{$this->user->id}_dashboard_projects_view")?->getValue())->toBe('grid')
|
|
->and(Cookie::queued("coolify_{$this->user->id}_dashboard_servers_view"))->toBeNull();
|
|
|
|
$this->withCookie("coolify_{$this->user->id}_dashboard_projects_view", 'grid')
|
|
->get(route('dashboard'))
|
|
->assertOk()
|
|
->assertSee("viewMode: 'grid'", false)
|
|
->assertSee("viewMode: 'table'", false);
|
|
});
|
|
|
|
it('links to all projects only when the dashboard hides some of them', function () {
|
|
Project::factory()->count(8)->create(['team_id' => $this->team->id]);
|
|
|
|
Livewire::test(Dashboard::class)->assertDontSee(route('project.index'), false);
|
|
|
|
Project::factory()->create(['team_id' => $this->team->id]);
|
|
|
|
Livewire::test(Dashboard::class)->assertSee(route('project.index'), false);
|
|
});
|