destination and dashboard confirmation
This commit is contained in:
@@ -30,10 +30,10 @@ class Dashboard extends Component
|
|||||||
|
|
||||||
public function cleanup_queue()
|
public function cleanup_queue()
|
||||||
{
|
{
|
||||||
$this->dispatch('success', 'Cleanup started.');
|
|
||||||
Artisan::queue('cleanup:application-deployment-queue', [
|
Artisan::queue('cleanup:application-deployment-queue', [
|
||||||
'--team-id' => currentTeam()->id,
|
'--team-id' => currentTeam()->id,
|
||||||
]);
|
]);
|
||||||
|
return redirect()->route('dashboard')->with('success', 'Cleanup started.');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_deployments()
|
public function get_deployments()
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Livewire\Destination;
|
namespace App\Livewire\Destination;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Form extends Component
|
class Form extends Component
|
||||||
@@ -26,8 +27,13 @@ class Form extends Component
|
|||||||
$this->destination->save();
|
$this->destination->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete($password)
|
||||||
{
|
{
|
||||||
|
if (!Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if ($this->destination->getMorphClass() === 'App\Models\StandaloneDocker') {
|
if ($this->destination->getMorphClass() === 'App\Models\StandaloneDocker') {
|
||||||
if ($this->destination->attachedTo()) {
|
if ($this->destination->attachedTo()) {
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
'checkboxes' => [],
|
'checkboxes' => [],
|
||||||
'actions' => [],
|
'actions' => [],
|
||||||
'confirmWithText' => true,
|
'confirmWithText' => true,
|
||||||
'confirmText' => 'Confirm Deletion',
|
'confirmationText' => 'Confirm Deletion',
|
||||||
'confirmationLabel' => 'Please confirm the execution of the actions by entering the Name below',
|
'confirmationLabel' => 'Please confirm the execution of the actions by entering the Name below',
|
||||||
'shortConfirmationLabel' => 'Name',
|
'shortConfirmationLabel' => 'Name',
|
||||||
'confirmWithPassword' => true,
|
'confirmWithPassword' => true,
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
deleteText: '',
|
deleteText: '',
|
||||||
password: '',
|
password: '',
|
||||||
actions: @js($actions),
|
actions: @js($actions),
|
||||||
confirmText: @js($confirmText),
|
confirmationText: @js($confirmationText),
|
||||||
userConfirmText: '',
|
userConfirmationText: '',
|
||||||
confirmWithText: @js($confirmWithText),
|
confirmWithText: @js($confirmWithText),
|
||||||
confirmWithPassword: @js($confirmWithPassword),
|
confirmWithPassword: @js($confirmWithPassword),
|
||||||
copied: false,
|
copied: false,
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
this.step = this.initialStep;
|
this.step = this.initialStep;
|
||||||
this.deleteText = '';
|
this.deleteText = '';
|
||||||
this.password = '';
|
this.password = '';
|
||||||
this.userConfirmText = '';
|
this.userConfirmationText = '';
|
||||||
this.selectedActions = @js(collect($checkboxes)->pluck('id')->all());
|
this.selectedActions = @js(collect($checkboxes)->pluck('id')->all());
|
||||||
$wire.$refresh();
|
$wire.$refresh();
|
||||||
},
|
},
|
||||||
@@ -69,8 +69,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
copyConfirmText() {
|
copyConfirmationText() {
|
||||||
navigator.clipboard.writeText(this.confirmText);
|
navigator.clipboard.writeText(this.confirmationText);
|
||||||
this.copied = true;
|
this.copied = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.copied = false;
|
this.copied = false;
|
||||||
@@ -199,8 +199,8 @@
|
|||||||
<p class="text-sm mb-2">{{ $confirmationLabel }}</p>
|
<p class="text-sm mb-2">{{ $confirmationLabel }}</p>
|
||||||
|
|
||||||
<div class="relative mb-2">
|
<div class="relative mb-2">
|
||||||
<input type="text" x-model="confirmText" class="w-full p-2 pr-10 rounded text-black input cursor-text" readonly>
|
<input type="text" x-model="confirmationText" class="w-full p-2 pr-10 rounded text-black input cursor-text" readonly>
|
||||||
<button @click="copyConfirmText()" class="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700" title="Copy confirmation text" x-ref="copyButton">
|
<button @click="copyConfirmationText()" class="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-500 hover:text-gray-700" title="Copy confirmation text" x-ref="copyButton">
|
||||||
<template x-if="!copied">
|
<template x-if="!copied">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
||||||
<path d="M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z" />
|
<path d="M8 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z" />
|
||||||
@@ -215,17 +215,16 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label for="userConfirmText" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mt-4">
|
<label for="userConfirmationText" class="block text-sm font-medium text-gray-700 dark:text-gray-300 mt-4">
|
||||||
{{ $shortConfirmationLabel }}
|
{{ $shortConfirmationLabel }}
|
||||||
</label>
|
</label>
|
||||||
<input type="text" x-model="userConfirmText" class="w-full p-2 rounded text-black input mt-1" placeholder="Type the Resource Name here">
|
<input type="text" x-model="userConfirmationText" class="w-full p-2 rounded text-black input mt-1">
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Step 3: Password confirmation -->
|
<!-- Step 3: Password confirmation -->
|
||||||
@if($confirmWithPassword)
|
<div x-show="step === 3 && confirmWithPassword">
|
||||||
<div x-show="step === 3">
|
|
||||||
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-4" role="alert">
|
<div class="bg-red-100 border-l-4 border-red-500 text-red-700 p-4 mb-4" role="alert">
|
||||||
<p class="font-bold">Final Confirmation</p>
|
<p class="font-bold">Final Confirmation</p>
|
||||||
<p>Please enter your password to confirm this destructive action.</p>
|
<p>Please enter your password to confirm this destructive action.</p>
|
||||||
@@ -241,7 +240,6 @@
|
|||||||
@enderror
|
@enderror
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Navigation buttons -->
|
<!-- Navigation buttons -->
|
||||||
<div class="flex flex-row justify-between mt-4">
|
<div class="flex flex-row justify-between mt-4">
|
||||||
@@ -263,14 +261,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template x-if="step === 2">
|
<template x-if="step === 2">
|
||||||
<x-forms.button @click="step === finalStep ? executeAction() : step++" x-bind:disabled="confirmWithText && userConfirmText !== confirmText" class="w-auto" isError>
|
<x-forms.button @click="step === finalStep ? executeAction() : step++" x-bind:disabled="confirmWithText && userConfirmationText !== confirmationText" class="w-auto" isError>
|
||||||
<span x-text="step === finalStep ? step3ButtonText : step2ButtonText"></span>
|
<span x-text="step === finalStep ? step3ButtonText : step2ButtonText"></span>
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template x-if="step === 3 || (!confirmWithPassword && step === finalStep)">
|
<template x-if="step === 3 || (!confirmWithPassword && step === finalStep)">
|
||||||
<x-forms.button
|
<x-forms.button
|
||||||
@click="submitForm()"
|
@click="submitForm()"
|
||||||
class="w-auto"
|
class="w-auto"
|
||||||
isError
|
isError
|
||||||
x-bind:disabled="confirmWithPassword && !password"
|
x-bind:disabled="confirmWithPassword && !password"
|
||||||
|
@@ -122,9 +122,24 @@
|
|||||||
@if (count($deployments_per_server) > 0)
|
@if (count($deployments_per_server) > 0)
|
||||||
<x-loading />
|
<x-loading />
|
||||||
@endif
|
@endif
|
||||||
<x-modal-confirmation isErrorButton action="cleanup_queue" buttonTitle="Cleanup Queues">
|
<x-modal-confirmation
|
||||||
This will clean up the deployment queue. <br>Please think again.
|
title="Confirm Queues Cleanup"
|
||||||
</x-modal-confirmation>
|
buttonTitle="Cleanup Queues"
|
||||||
|
isErrorButton
|
||||||
|
submitAction="cleanup_queue"
|
||||||
|
:actions="['Cleanup all running Deployment Queues']"
|
||||||
|
buttonTitle="Cleanup Queues"
|
||||||
|
:confirmWithText="false"
|
||||||
|
:confirmWithPassword="false"
|
||||||
|
step3ButtonText="Cleanup Deployment Queues"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
@if (session('success'))
|
||||||
|
<div class="alert alert-success">
|
||||||
|
{{ session('success') }}
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<div wire:poll.3000ms="get_deployments" class="grid grid-cols-1">
|
<div wire:poll.3000ms="get_deployments" class="grid grid-cols-1">
|
||||||
@forelse ($deployments_per_server as $server_name => $deployments)
|
@forelse ($deployments_per_server as $server_name => $deployments)
|
||||||
@@ -168,4 +183,6 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{-- <x-forms.button wire:click='getIptables'>Get IPTABLES</x-forms.button> --}}
|
{{-- <x-forms.button wire:click='getIptables'>Get IPTABLES</x-forms.button> --}}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@@ -6,9 +6,19 @@
|
|||||||
Save
|
Save
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
@if ($destination->network !== 'coolify')
|
@if ($destination->network !== 'coolify')
|
||||||
<x-modal-confirmation isErrorButton buttonTitle="Delete Destination">
|
<x-modal-confirmation
|
||||||
This destination will be deleted. It is not reversible. <br>Please think again.
|
title="Confirm Destination Deletion?"
|
||||||
</x-modal-confirmation>
|
buttonTitle="Delete Destination"
|
||||||
|
isErrorButton
|
||||||
|
submitAction="delete"
|
||||||
|
:actions="['This will delete the selected destination/network.']"
|
||||||
|
confirmationText="{{ $destination->name }}"
|
||||||
|
confirmationLabel="Please confirm the execution of the actions by entering the Destination Name below"
|
||||||
|
shortConfirmationLabel="Destination Name"
|
||||||
|
buttonTitle="Delete Destination"
|
||||||
|
step3ButtonText="Permanently Delete Destination"
|
||||||
|
:confirmWithPassword="true"
|
||||||
|
/>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user