mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-14 20:17:05 +00:00
feat(ui): Shadow UI redesign, domain management, and DNS autoconfigure (#11119)
Co-authored-by: ShadowArcanist <162910371+ShadowArcanist@users.noreply.github.com>
This commit is contained in:
1 parent
0b843bb07c
commit
8ae56587d5
497 files changed
+44045
-22630
No files matched your search
@@ -4,55 +4,51 @@ namespace App\Livewire\Team;
|
||||
|
||||
use App\Models\User;
|
||||
use Livewire\Component;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class AdminView extends Component
|
||||
{
|
||||
public $users;
|
||||
use WithPagination;
|
||||
|
||||
public ?string $search = '';
|
||||
public string $search = '';
|
||||
|
||||
public bool $lots_of_users = false;
|
||||
public string $teamFilter = 'all';
|
||||
|
||||
private $number_of_users_to_show = 20;
|
||||
public string $sort = 'name_asc';
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if (! isInstanceAdmin()) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$this->getUsers();
|
||||
}
|
||||
|
||||
public function submitSearch()
|
||||
public function updatedSearch(): void
|
||||
{
|
||||
if (! isInstanceAdmin()) {
|
||||
return;
|
||||
}
|
||||
if ($this->search !== '') {
|
||||
$this->users = User::where(function ($query) {
|
||||
$query->where('name', 'like', "%{$this->search}%")
|
||||
->orWhere('email', 'like', "%{$this->search}%");
|
||||
})->get()->filter(function ($user) {
|
||||
return $user->id !== auth()->id();
|
||||
});
|
||||
} else {
|
||||
$this->getUsers();
|
||||
}
|
||||
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function getUsers()
|
||||
public function updatedTeamFilter(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function updatedSort(): void
|
||||
{
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function submitSearch(): void
|
||||
{
|
||||
if (! isInstanceAdmin()) {
|
||||
return;
|
||||
}
|
||||
$users = User::where('id', '!=', auth()->id())->get();
|
||||
if ($users->count() > $this->number_of_users_to_show) {
|
||||
$this->lots_of_users = true;
|
||||
$this->users = $users->take($this->number_of_users_to_show);
|
||||
} else {
|
||||
$this->lots_of_users = false;
|
||||
$this->users = $users;
|
||||
}
|
||||
|
||||
$this->resetPage();
|
||||
}
|
||||
|
||||
public function delete($id, $password, $selectedActions = [])
|
||||
@@ -76,7 +72,7 @@ class AdminView extends Component
|
||||
|
||||
try {
|
||||
$user->delete();
|
||||
$this->getUsers();
|
||||
$this->resetPage();
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@@ -86,6 +82,31 @@ class AdminView extends Component
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.team.admin-view');
|
||||
$search = trim($this->search);
|
||||
$teamId = currentTeam()->id;
|
||||
$users = User::query()
|
||||
->where('id', '!=', auth()->id())
|
||||
->when($search !== '', function ($query) use ($search): void {
|
||||
$query->where(function ($query) use ($search): void {
|
||||
$query->where('name', 'like', "%{$search}%")
|
||||
->orWhere('email', 'like', "%{$search}%");
|
||||
});
|
||||
})
|
||||
->when($this->teamFilter === 'current', function ($query) use ($teamId): void {
|
||||
$query->whereHas('teams', fn ($teamQuery) => $teamQuery->where('teams.id', $teamId));
|
||||
})
|
||||
->when($this->teamFilter === 'outside', function ($query) use ($teamId): void {
|
||||
$query->whereDoesntHave('teams', fn ($teamQuery) => $teamQuery->where('teams.id', $teamId));
|
||||
})
|
||||
->when($this->sort === 'name_desc', fn ($query) => $query->orderByDesc('name'))
|
||||
->when($this->sort === 'email_asc', fn ($query) => $query->orderBy('email'))
|
||||
->when($this->sort === 'email_desc', fn ($query) => $query->orderByDesc('email'))
|
||||
->when($this->sort === 'name_asc', fn ($query) => $query->orderBy('name'))
|
||||
->orderBy('id')
|
||||
->paginate(10);
|
||||
|
||||
return view('livewire.team.admin-view', [
|
||||
'users' => $users,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user