Merge branch 'next' into feat/disable-default-redirect
This commit is contained in:
@@ -14,6 +14,18 @@ class Index extends Component
|
||||
|
||||
public $search = '';
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if (! isCloud()) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
|
||||
if (auth()->user()->id !== 0) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$this->getSubscribers();
|
||||
}
|
||||
|
||||
public function submitSearch()
|
||||
{
|
||||
if ($this->search !== '') {
|
||||
@@ -38,17 +50,6 @@ class Index extends Component
|
||||
}
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if (! isCloud()) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
if (auth()->user()->id !== 0) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$this->getSubscribers();
|
||||
}
|
||||
|
||||
public function getSubscribers()
|
||||
{
|
||||
$this->inactive_subscribers = User::whereDoesntHave('teams', function ($query) {
|
||||
|
||||
@@ -19,7 +19,7 @@ class NavbarDeleteTeam extends Component
|
||||
|
||||
public function delete($password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class BackupEdit extends Component
|
||||
|
||||
public function delete($password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class BackupExecutions extends Component
|
||||
|
||||
public function deleteBackup($executionId, $password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ class FileStorage extends Component
|
||||
|
||||
public function delete($password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class ServiceApplicationView extends Component
|
||||
|
||||
public function delete($password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class Danger extends Component
|
||||
|
||||
public function delete($password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ class Destination extends Component
|
||||
|
||||
public function removeServer(int $network_id, int $server_id, $password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class GetLogs extends Component
|
||||
|
||||
public ?bool $showTimeStamps = true;
|
||||
|
||||
public int $numberOfLines = 100;
|
||||
public ?int $numberOfLines = 100;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
@@ -98,7 +98,7 @@ class GetLogs extends Component
|
||||
if (! $refresh && ($this->resource?->getMorphClass() === 'App\Models\Service' || str($this->container)->contains('-pr-'))) {
|
||||
return;
|
||||
}
|
||||
if ($this->numberOfLines <= 0) {
|
||||
if ($this->numberOfLines <= 0 || is_null($this->numberOfLines)) {
|
||||
$this->numberOfLines = 1000;
|
||||
}
|
||||
if ($this->container) {
|
||||
|
||||
@@ -41,7 +41,7 @@ class Show extends Component
|
||||
|
||||
public function delete($password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class Delete extends Component
|
||||
|
||||
public function delete($password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -174,7 +174,21 @@ class Form extends Component
|
||||
$this->server->settings->refresh();
|
||||
|
||||
return handleError($e, $this);
|
||||
} finally {}
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
public function saveSentinel()
|
||||
{
|
||||
try {
|
||||
$this->validate();
|
||||
$this->server->settings->save();
|
||||
$this->dispatch('success', 'Sentinel updated.');
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
} finally {
|
||||
$this->checkSyncStatus();
|
||||
}
|
||||
}
|
||||
|
||||
public function restartSentinel($notification = true)
|
||||
@@ -184,7 +198,8 @@ class Form extends Component
|
||||
$this->validate([
|
||||
'server.settings.sentinel_custom_url' => 'required|url',
|
||||
]);
|
||||
$this->server->restartSentinel();
|
||||
$this->server->settings->save();
|
||||
$this->server->restartSentinel(async: false);
|
||||
if ($notification) {
|
||||
$this->dispatch('success', 'Sentinel restarted.');
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ namespace App\Livewire\Settings;
|
||||
use App\Jobs\CheckForUpdatesJob;
|
||||
use App\Models\InstanceSettings;
|
||||
use App\Models\Server;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Livewire\Component;
|
||||
|
||||
class Index extends Component
|
||||
@@ -185,8 +187,14 @@ class Index extends Component
|
||||
return view('livewire.settings.index');
|
||||
}
|
||||
|
||||
public function toggleTwoStepConfirmation()
|
||||
public function toggleTwoStepConfirmation($password)
|
||||
{
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->settings->disable_two_step_confirmation = true;
|
||||
$this->settings->save();
|
||||
$this->disable_two_step_confirmation = true;
|
||||
|
||||
@@ -28,6 +28,9 @@ class License extends Component
|
||||
if (! isCloud()) {
|
||||
abort(404);
|
||||
}
|
||||
if (! isInstanceAdmin()) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
$this->instance_id = config('app.id');
|
||||
$this->settings = instanceSettings();
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ class SettingsOauth extends Component
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if (! isInstanceAdmin()) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
$this->oauth_settings_map = OauthSetting::all()->sortBy('provider')->reduce(function ($carry, $setting) {
|
||||
$carry[$setting->provider] = $setting;
|
||||
|
||||
|
||||
@@ -7,19 +7,19 @@ use Livewire\Component;
|
||||
|
||||
class Deployments extends Component
|
||||
{
|
||||
public $deployments_per_tag_per_server = [];
|
||||
public $deploymentsPerTagPerServer = [];
|
||||
|
||||
public $resource_ids = [];
|
||||
public $resourceIds = [];
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.tags.deployments');
|
||||
}
|
||||
|
||||
public function get_deployments()
|
||||
public function getDeployments()
|
||||
{
|
||||
try {
|
||||
$this->deployments_per_tag_per_server = ApplicationDeploymentQueue::whereIn('status', ['in_progress', 'queued'])->whereIn('application_id', $this->resource_ids)->get([
|
||||
$this->deploymentsPerTagPerServer = ApplicationDeploymentQueue::whereIn('status', ['in_progress', 'queued'])->whereIn('application_id', $this->resourceIds)->get([
|
||||
'id',
|
||||
'application_id',
|
||||
'application_name',
|
||||
@@ -29,7 +29,7 @@ class Deployments extends Component
|
||||
'server_id',
|
||||
'status',
|
||||
])->sortBy('id')->groupBy('server_name')->toArray();
|
||||
$this->dispatch('deployments', $this->deployments_per_tag_per_server);
|
||||
$this->dispatch('deployments', $this->deploymentsPerTagPerServer);
|
||||
} catch (\Exception $e) {
|
||||
return handleError($e, $this);
|
||||
}
|
||||
|
||||
@@ -5,9 +5,11 @@ namespace App\Livewire\Tags;
|
||||
use App\Http\Controllers\Api\DeployController;
|
||||
use App\Models\Tag;
|
||||
use Illuminate\Support\Collection;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Attributes\Url;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Tags | Coolify')]
|
||||
class Index extends Component
|
||||
{
|
||||
#[Url()]
|
||||
@@ -21,33 +23,47 @@ class Index extends Component
|
||||
|
||||
public $webhook = null;
|
||||
|
||||
public $deployments_per_tag_per_server = [];
|
||||
public $deploymentsPerTagPerServer = [];
|
||||
|
||||
protected $listeners = ['deployments' => 'update_deployments'];
|
||||
protected $listeners = ['deployments' => 'updateDeployments'];
|
||||
|
||||
public function update_deployments($deployments)
|
||||
public function render()
|
||||
{
|
||||
$this->deployments_per_tag_per_server = $deployments;
|
||||
return view('livewire.tags.index');
|
||||
}
|
||||
|
||||
public function tag_updated()
|
||||
public function mount()
|
||||
{
|
||||
$this->tags = Tag::ownedByCurrentTeam()->get()->unique('name')->sortBy('name');
|
||||
if ($this->tag) {
|
||||
$this->tagUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
public function updateDeployments($deployments)
|
||||
{
|
||||
$this->deploymentsPerTagPerServer = $deployments;
|
||||
}
|
||||
|
||||
public function tagUpdated()
|
||||
{
|
||||
if ($this->tag == '') {
|
||||
return;
|
||||
}
|
||||
$tag = $this->tags->where('name', $this->tag)->first();
|
||||
$sanitizedTag = htmlspecialchars($this->tag, ENT_QUOTES, 'UTF-8');
|
||||
$tag = $this->tags->where('name', $sanitizedTag)->first();
|
||||
if (! $tag) {
|
||||
$this->dispatch('error', "Tag ({$this->tag}) not found.");
|
||||
$this->dispatch('error', 'Tag ('.e($sanitizedTag).') not found.');
|
||||
$this->tag = '';
|
||||
|
||||
return;
|
||||
}
|
||||
$this->webhook = generatTagDeployWebhook($tag->name);
|
||||
$this->webhook = generateTagDeployWebhook($tag->name);
|
||||
$this->applications = $tag->applications()->get();
|
||||
$this->services = $tag->services()->get();
|
||||
}
|
||||
|
||||
public function redeploy_all()
|
||||
public function redeployAll()
|
||||
{
|
||||
try {
|
||||
$this->applications->each(function ($resource) {
|
||||
@@ -63,17 +79,4 @@ class Index extends Component
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->tags = Tag::ownedByCurrentTeam()->get()->unique('name')->sortBy('name');
|
||||
if ($this->tag) {
|
||||
$this->tag_updated();
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.tags.index');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ namespace App\Livewire\Tags;
|
||||
use App\Http\Controllers\Api\DeployController;
|
||||
use App\Models\ApplicationDeploymentQueue;
|
||||
use App\Models\Tag;
|
||||
use Livewire\Attributes\Title;
|
||||
use Livewire\Component;
|
||||
|
||||
#[Title('Tags | Coolify')]
|
||||
class Show extends Component
|
||||
{
|
||||
public $tags;
|
||||
@@ -28,7 +30,7 @@ class Show extends Component
|
||||
if (! $tag) {
|
||||
return redirect()->route('tags.index');
|
||||
}
|
||||
$this->webhook = generatTagDeployWebhook($tag->name);
|
||||
$this->webhook = generateTagDeployWebhook($tag->name);
|
||||
$this->applications = $tag->applications()->get();
|
||||
$this->services = $tag->services()->get();
|
||||
$this->tag = $tag;
|
||||
|
||||
@@ -78,7 +78,7 @@ class AdminView extends Component
|
||||
|
||||
public function delete($id, $password)
|
||||
{
|
||||
if (! InstanceSettings::get('disable_two_step_confirmation')) {
|
||||
if (! data_get(InstanceSettings::get(), 'disable_two_step_confirmation')) {
|
||||
if (! Hash::check($password, Auth::user()->password)) {
|
||||
$this->addError('password', 'The provided password is incorrect.');
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ class InviteLink extends Component
|
||||
{
|
||||
try {
|
||||
$this->validate();
|
||||
if (auth()->user()->role() === 'admin' && $this->role === 'owner') {
|
||||
throw new \Exception('Admins cannot invite owners.');
|
||||
}
|
||||
$member_emails = currentTeam()->members()->get()->pluck('email');
|
||||
if ($member_emails->contains($this->email)) {
|
||||
return handleError(livewire: $this, customErrorMessage: "$this->email is already a member of ".currentTeam()->name.'.');
|
||||
|
||||
@@ -4,10 +4,12 @@ namespace App\Livewire\Team;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
use Livewire\Attributes\Locked;
|
||||
use Livewire\Component;
|
||||
|
||||
class Member extends Component
|
||||
{
|
||||
#[Locked]
|
||||
public User $member;
|
||||
|
||||
public function makeAdmin()
|
||||
|
||||
Reference in New Issue
Block a user