Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/views/FolderMergeView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ describe('FolderMergeView', () => {
expect(wrapper.find('[data-testid="folder-merge-safety-confirmation"]').text()).toContain(
'right-add.txt',
)
expect(wrapper.find('[data-testid="folder-merge-excluded-count"]').text()).toContain(
'Suppressed: 1',
)
expect(wrapper.find('[data-testid="folder-merge-summary"]').text()).toContain('4')
await wrapper.find('[data-testid="folder-merge-confirm-safety"]').trigger('click')
await flushPromises()

Expand Down
34 changes: 28 additions & 6 deletions src/views/FolderMergeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -815,17 +815,33 @@ function openOutputFolderCompare(): void {
const selectedPlanRow = computed(
() => planRows.value.find((row) => row.id === selectedPlanRowId.value) ?? null,
)
const includedMergeRows = computed(() =>
planRows.value.filter((row) => !excludedRowIds.value.has(row.id)),
)
const excludedMergeRowCount = computed(() => excludedRowIds.value.size)
const sameOkCount = computed(
() => planRows.value.filter((row) => row.action === 'Keep output').length,
() => includedMergeRows.value.filter((row) => row.action === 'Keep output').length,
)
const conflicts = computed(() =>
planRows.value.flatMap((row) => (row.conflict ? [row.conflict] : [])),
)
const summary = computed(() => ({
actions: plan.value?.summary.actions ?? 0,
automatic: plan.value?.summary.automatic ?? 0,
conflicts: plan.value?.summary.conflicts ?? 0,
}))
const summary = computed(() => {
if (excludedRowIds.value.size === 0) {
return {
actions: plan.value?.summary.actions ?? 0,
automatic: plan.value?.summary.automatic ?? 0,
conflicts: plan.value?.summary.conflicts ?? 0,
}
}

const conflictCount = includedMergeRows.value.filter((row) => Boolean(row.conflict)).length

return {
actions: includedMergeRows.value.length,
automatic: includedMergeRows.value.length - conflictCount,
conflicts: conflictCount,
}
})
const executionSummary = computed(() => execution.value?.summary)

onMounted(() => {
Expand Down Expand Up @@ -2183,6 +2199,12 @@ watch(
count: pendingMergeSafetyRows.length,
})
}}</span>
<span
v-if="excludedMergeRowCount > 0"
data-testid="folder-merge-excluded-count"
>
{{ $t('ui.suppressed') }}: {{ excludedMergeRowCount }}
</span>
</div>
<ul>
<li
Expand Down
8 changes: 8 additions & 0 deletions src/views/FolderSyncView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,10 @@ describe('FolderSyncView', () => {
expect(wrapper.find('[data-testid="folder-sync-safety-confirmation"]').text()).toContain(
'prod/old.dll',
)
expect(wrapper.find('[data-testid="folder-sync-excluded-count"]').text()).toContain(
'Suppressed: 1',
)
expect(wrapper.find('[data-testid="folder-sync-progress"]').text()).toContain('0 / 1')
await wrapper.find('[data-testid="folder-sync-confirm-safety"]').trigger('click')
await flushPromises()

Expand All @@ -948,6 +952,10 @@ describe('FolderSyncView', () => {
],
}),
)
expect(wrapper.find('[data-testid="folder-sync-progress"]').text()).toContain('1 / 1')
expect(wrapper.find('[data-testid="folder-sync-run-status"]').text()).toContain(
'Completed 1 / 1',
)
})

it('skips the safety panel when overwrite and delete confirms are off', async () => {
Expand Down
43 changes: 34 additions & 9 deletions src/views/FolderSyncView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ const canRunSync = computed(() => previewRows.value.length > 0 && !syncRunning.v
const overriddenRowCount = computed(
() => previewRows.value.filter((row) => row.overrideAction !== row.plannedAction).length,
)
const includedSyncRows = computed(() =>
previewRows.value.filter((row) => !excludedRowIds.value.has(row.id)),
)
const includedSyncRowCount = computed(() => includedSyncRows.value.length)
const excludedSyncRowCount = computed(() => excludedRowIds.value.size)
const lastIncludedSyncTotal = ref<number | null>(null)
const syncProgressTotal = computed(() => lastIncludedSyncTotal.value ?? includedSyncRowCount.value)
const syncSessionTitle = computed(() => {
if (leftPath.value && rightPath.value) {
return syncPathPairTitle(leftPath.value, rightPath.value)
Expand Down Expand Up @@ -757,6 +764,7 @@ async function previewSync(options?: { keepRunStatus?: boolean }): Promise<void>
syncRunError.value = undefined
planAccepted.value = false
syncChromeMessage.value = ''
lastIncludedSyncTotal.value = null
}
} catch (error) {
previewError.value = error instanceof Error ? error.message : String(error)
Expand Down Expand Up @@ -837,10 +845,18 @@ async function executeSyncNow(): Promise<void> {
archiveExtensions: [...settings.archiveExtensions],
})

completedOperations.value = response.succeeded + response.failed + response.cancelled
syncLogs.value = response.logs.map(folderSyncExecutionLogLabel)
const excludedPaths = new Set(
previewRows.value
.filter((row) => excludedRowIds.value.has(row.id))
.map((row) => row.relativePath),
)
const includedLogs = response.logs.filter((log) => !excludedPaths.has(log.relativePath))

completedOperations.value = includedLogs.length
lastIncludedSyncTotal.value = includedSyncRowCount.value
syncLogs.value = includedLogs.map(folderSyncExecutionLogLabel)
syncExecutionStatusByPath.value = new Map(
response.logs.map((log) => [log.relativePath, log.status]),
includedLogs.map((log) => [log.relativePath, log.status]),
)
syncChromeMessage.value = t('status.syncCompleted', {
succeeded: response.succeeded,
Expand Down Expand Up @@ -1152,7 +1168,7 @@ const rightSyncPathFooter = computed(() => syncSelectionLabel.value)
watchEffect(() => {
statusBar.reportStatus({
comparisonStatus: previewRows.value.length > 0 ? t('status.compared') : t('status.readyIdle'),
differenceCount: previewRows.value.length > 0 ? previewRows.value.length : null,
differenceCount: includedSyncRowCount.value > 0 ? includedSyncRowCount.value : null,
filterStatus: t('status.allRows'),
source: 'folder-sync',
chromeKind: 'folder-pair',
Expand Down Expand Up @@ -1506,8 +1522,11 @@ watch(
<p class="eyebrow">{{ $t('ui.folderSync') }}</p>
<h1 data-testid="folder-sync-title">{{ syncSessionTitle }}</h1>
</div>
<div class="sync-progress">
<strong>{{ completedOperations }} / {{ previewRows.length }}</strong>
<div
class="sync-progress"
data-testid="folder-sync-progress"
>
<strong>{{ completedOperations }} / {{ syncProgressTotal }}</strong>
<span>{{ $t('ui.completed') }}</span>
</div>
</header>
Expand Down Expand Up @@ -1760,7 +1779,7 @@ watch(
</div>
<div>
<dt>{{ $t('ui.sessionInfoTotal') }}</dt>
<dd>{{ previewRows.length }}</dd>
<dd>{{ includedSyncRowCount }}</dd>
</div>
</dl>
<button
Expand Down Expand Up @@ -1854,6 +1873,12 @@ watch(
count: pendingSyncSafetyRows.length,
})
}}</span>
<span
v-if="excludedSyncRowCount > 0"
data-testid="folder-sync-excluded-count"
>
{{ $t('ui.suppressed') }}: {{ excludedSyncRowCount }}
</span>
</div>
<ul>
<li
Expand Down Expand Up @@ -2098,7 +2123,7 @@ watch(
data-testid="folder-sync-run-status"
>
<strong>{{
$t('status.completedCount', { count: completedOperations, total: previewRows.length })
$t('status.completedCount', { count: completedOperations, total: syncProgressTotal })
}}</strong>
<ul>
<li
Expand Down Expand Up @@ -2141,7 +2166,7 @@ watch(
</div>
<div>
<dt>{{ $t('ui.items') }}</dt>
<dd>{{ previewRows.length }}</dd>
<dd>{{ includedSyncRowCount }}</dd>
</div>
<div>
<dt>{{ $t('ui.completed') }}</dt>
Expand Down
Loading