refactor(modal): add ignoreWire attribute to modal-confirmation component

This commit is contained in:
Andras Bacsai
2025-03-25 09:49:38 +01:00
parent be95695ee8
commit a73cfd8b09
2 changed files with 18 additions and 31 deletions

View File

@@ -21,6 +21,7 @@
'dispatchEvent' => false, 'dispatchEvent' => false,
'dispatchEventType' => 'success', 'dispatchEventType' => 'success',
'dispatchEventMessage' => '', 'dispatchEventMessage' => '',
'ignoreWire' => true,
]) ])
@php @php
@@ -28,7 +29,7 @@
$disableTwoStepConfirmation = data_get(InstanceSettings::get(), 'disable_two_step_confirmation'); $disableTwoStepConfirmation = data_get(InstanceSettings::get(), 'disable_two_step_confirmation');
@endphp @endphp
<div wire:ignore x-data="{ <div {{ $ignoreWire ? 'wire:ignore' : '' }} x-data="{
modalOpen: false, modalOpen: false,
step: {{ empty($checkboxes) ? 2 : 1 }}, step: {{ empty($checkboxes) ? 2 : 1 }},
initialStep: {{ empty($checkboxes) ? 2 : 1 }}, initialStep: {{ empty($checkboxes) ? 2 : 1 }},
@@ -98,8 +99,9 @@
this.selectedActions.push(id); this.selectedActions.push(id);
} }
} }
}" @keydown.escape.window="modalOpen = false; resetModal()" }"
:class="{ 'z-40': modalOpen }" class="relative w-auto h-auto"> @keydown.escape.window="modalOpen = false; resetModal()" :class="{ 'z-40': modalOpen }"
class="relative w-auto h-auto">
@if ($customButton) @if ($customButton)
@if ($buttonFullWidth) @if ($buttonFullWidth)
<x-forms.button @click="modalOpen=true" class="w-full"> <x-forms.button @click="modalOpen=true" class="w-full">
@@ -247,9 +249,7 @@
<h4 class="mb-2 text-lg font-semibold">Confirm Actions</h4> <h4 class="mb-2 text-lg font-semibold">Confirm Actions</h4>
<p class="mb-2 text-sm">{{ $confirmationLabel }}</p> <p class="mb-2 text-sm">{{ $confirmationLabel }}</p>
<div class="relative mb-2"> <div class="relative mb-2">
<x-forms.copy-button <x-forms.copy-button text="{{ $confirmationText }}" />
text="{{ $confirmationText }}"
/>
</div> </div>
<label for="userConfirmationText" <label for="userConfirmationText"

View File

@@ -15,21 +15,23 @@
<form wire:submit='submit' class="flex flex-col gap-2"> <form wire:submit='submit' class="flex flex-col gap-2">
<div class="flex gap-2"> <div class="flex gap-2">
@if ($fileStorage->is_directory) @if ($fileStorage->is_directory)
<x-modal-confirmation title="Confirm Directory Conversion to File?" buttonTitle="Convert to file" <x-modal-confirmation :ignoreWire="false" title="Confirm Directory Conversion to File?"
submitAction="convertToFile" :actions="[ buttonTitle="Convert to file" submitAction="convertToFile" :actions="[
'All files in this directory will be permanently deleted and an empty file will be created in its place.', 'All files in this directory will be permanently deleted and an empty file will be created in its place.',
]" confirmationText="{{ $fs_path }}" ]"
confirmationText="{{ $fs_path }}"
confirmationLabel="Please confirm the execution of the actions by entering the Filepath below" confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to file" /> shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to file" />
<x-modal-confirmation title="Confirm Directory Deletion?" buttonTitle="Delete Directory" isErrorButton <x-modal-confirmation :ignoreWire="false" title="Confirm Directory Deletion?" buttonTitle="Delete"
submitAction="delete" :checkboxes="$directoryDeletionCheckboxes" :actions="[ isErrorButton submitAction="delete" :checkboxes="$directoryDeletionCheckboxes" :actions="[
'The selected directory and all its contents will be permanently deleted from the container.', 'The selected directory and all its contents will be permanently deleted from the container.',
]" confirmationText="{{ $fs_path }}" ]"
confirmationText="{{ $fs_path }}"
confirmationLabel="Please confirm the execution of the actions by entering the Filepath below" confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
shortConfirmationLabel="Filepath" step3ButtonText="Permanently Delete" /> shortConfirmationLabel="Filepath" step3ButtonText="Permanently Delete" />
@else @else
@if (!$fileStorage->is_binary) @if (!$fileStorage->is_binary)
<x-modal-confirmation title="Confirm File Conversion to Directory?" <x-modal-confirmation :ignoreWire="false" title="Confirm File Conversion to Directory?"
buttonTitle="Convert to directory" submitAction="convertToDirectory" :actions="[ buttonTitle="Convert to directory" submitAction="convertToDirectory" :actions="[
'The selected file will be permanently deleted and an empty directory will be created in its place.', 'The selected file will be permanently deleted and an empty directory will be created in its place.',
]" ]"
@@ -37,27 +39,12 @@
confirmationLabel="Please confirm the execution of the actions by entering the Filepath below" confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to directory" /> shortConfirmationLabel="Filepath" :confirmWithPassword="false" step2ButtonText="Convert to directory" />
@endif @endif
<x-modal-confirmation title="Confirm File Deletion?" buttonTitle="Delete File" isErrorButton <x-modal-confirmation :ignoreWire="false" title="Confirm File Deletion?" buttonTitle="Delete"
submitAction="delete" :checkboxes="$fileDeletionCheckboxes" :actions="['The selected file will be permanently deleted from the container.']" confirmationText="{{ $fs_path }}" isErrorButton submitAction="delete" :checkboxes="$fileDeletionCheckboxes" :actions="['The selected file will be permanently deleted from the container.']"
confirmationText="{{ $fs_path }}"
confirmationLabel="Please confirm the execution of the actions by entering the Filepath below" confirmationLabel="Please confirm the execution of the actions by entering the Filepath below"
shortConfirmationLabel="Filepath" step3ButtonText="Permanently Delete" /> shortConfirmationLabel="Filepath" step3ButtonText="Permanently Delete" />
@endif @endif
{{-- @if (!$fileStorage->is_based_on_git)
<x-modal-confirmation isErrorButton buttonTitle="Delete">
<div class="px-2">This storage will be deleted. It is not reversible. <strong
class="text-error">Please
think
again.</strong><br><br></div>
<h4>Actions</h4>
@if ($fileStorage->is_directory)
<x-forms.checkbox id="permanently_delete"
label="Permanently delete directory from the server?"></x-forms.checkbox>
@else
<x-forms.checkbox id="permanently_delete"
label="Permanently delete file from the server?"></x-forms.checkbox>
@endif
</x-modal-confirmation>
@endif --}}
</div> </div>
@if (!$fileStorage->is_directory) @if (!$fileStorage->is_directory)
@if (data_get($resource, 'settings.is_preserve_repository_enabled')) @if (data_get($resource, 'settings.is_preserve_repository_enabled'))