Fix Cloudinary max selection and row selection
This commit is contained in:
parent
5da6f4c736
commit
090e29f9d9
1 changed files with 50 additions and 7 deletions
|
|
@ -44,7 +44,7 @@
|
||||||
let showCleanupModal = false
|
let showCleanupModal = false
|
||||||
let cleaningUp = false
|
let cleaningUp = false
|
||||||
|
|
||||||
$: allSelected = auditData && selectedFiles.size === auditData.orphanedFiles.length
|
$: allSelected = auditData && selectedFiles.size >= Math.min(20, auditData.orphanedFiles.length)
|
||||||
$: hasSelection = selectedFiles.size > 0
|
$: hasSelection = selectedFiles.size > 0
|
||||||
$: selectedSize =
|
$: selectedSize =
|
||||||
auditData?.orphanedFiles
|
auditData?.orphanedFiles
|
||||||
|
|
@ -90,7 +90,9 @@
|
||||||
if (allSelected) {
|
if (allSelected) {
|
||||||
selectedFiles.clear()
|
selectedFiles.clear()
|
||||||
} else {
|
} else {
|
||||||
selectedFiles = new Set(auditData?.orphanedFiles.map((f) => f.publicId) || [])
|
// Select only the first 20 files
|
||||||
|
const first20Files = auditData?.orphanedFiles.slice(0, 20).map((f) => f.publicId) || []
|
||||||
|
selectedFiles = new Set(first20Files)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -288,10 +290,13 @@
|
||||||
{:else}
|
{:else}
|
||||||
<span>{auditData.orphanedFiles.length} orphaned files found</span>
|
<span>{auditData.orphanedFiles.length} orphaned files found</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if auditData.orphanedFiles.length > 20}
|
||||||
|
<span class="limit-notice">(Max 20 at once)</span>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<Button variant="text" buttonSize="small" onclick={toggleSelectAll}>
|
<Button variant="text" buttonSize="small" onclick={toggleSelectAll}>
|
||||||
{allSelected ? 'Deselect All' : 'Select All'}
|
{allSelected ? 'Deselect All' : 'Select 20'}
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
variant="danger"
|
variant="danger"
|
||||||
|
|
@ -314,7 +319,7 @@
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="checkbox">
|
<th class="checkbox" title="Select first 20">
|
||||||
<input type="checkbox" checked={allSelected} onchange={toggleSelectAll} />
|
<input type="checkbox" checked={allSelected} onchange={toggleSelectAll} />
|
||||||
</th>
|
</th>
|
||||||
<th>Preview</th>
|
<th>Preview</th>
|
||||||
|
|
@ -326,12 +331,24 @@
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{#each auditData.orphanedFiles as file}
|
{#each auditData.orphanedFiles as file}
|
||||||
<tr class:selected={selectedFiles.has(file.publicId)}>
|
<tr
|
||||||
|
class:selected={selectedFiles.has(file.publicId)}
|
||||||
|
onclick={() => toggleFile(file.publicId)}
|
||||||
|
role="button"
|
||||||
|
tabindex="0"
|
||||||
|
onkeydown={(e) => {
|
||||||
|
if (e.key === 'Enter' || e.key === ' ') {
|
||||||
|
e.preventDefault()
|
||||||
|
toggleFile(file.publicId)
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
>
|
||||||
<td class="checkbox">
|
<td class="checkbox">
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
checked={selectedFiles.has(file.publicId)}
|
checked={selectedFiles.has(file.publicId)}
|
||||||
onchange={() => toggleFile(file.publicId)}
|
onchange={() => toggleFile(file.publicId)}
|
||||||
|
onclick={(e) => e.stopPropagation()}
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td class="preview">
|
<td class="preview">
|
||||||
|
|
@ -641,6 +658,14 @@
|
||||||
.selection-info {
|
.selection-info {
|
||||||
color: $grey-30;
|
color: $grey-30;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.5rem;
|
||||||
|
|
||||||
|
.limit-notice {
|
||||||
|
color: $yellow-60;
|
||||||
|
font-size: 0.8125rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.actions {
|
.actions {
|
||||||
|
|
@ -732,8 +757,26 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tr.selected {
|
tr {
|
||||||
background: rgba($red-60, 0.05);
|
cursor: pointer;
|
||||||
|
transition: background-color 0.15s ease;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: $grey-95;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.selected {
|
||||||
|
background: rgba($red-60, 0.05);
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: rgba($red-60, 0.08);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: 2px solid rgba($blue-60, 0.5);
|
||||||
|
outline-offset: -2px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue