Show folders in sync confirm dialog

This commit is contained in:
Gregory Schier
2025-02-09 08:35:29 -08:00
parent 325c88f251
commit 3aaa0355e1
15 changed files with 58 additions and 37 deletions

View File

@@ -7,7 +7,7 @@ import { getActiveWorkspaceId } from '../hooks/useActiveWorkspace';
import { createFastMutation } from '../hooks/useFastMutation';
import { trackEvent } from '../lib/analytics';
import { showConfirm } from '../lib/confirm';
import { fallbackRequestName } from '../lib/fallbackRequestName';
import { resolvedModelNameWithFolders } from '../lib/resolvedModelName';
import { pluralizeCount } from '../lib/pluralize';
import { showPrompt } from '../lib/prompt';
import { invokeCmd } from '../lib/tauri';
@@ -70,14 +70,15 @@ export const syncWorkspace = createFastMutation<
(o) => o.type === 'dbDelete' && o.model.model === 'workspace',
);
console.log('Filesystem changes detected', { dbOps, ops });
console.log('Directory changes detected', { dbOps, ops });
const confirmed = force
? true
: await showConfirm({
id: 'commit-sync',
title: 'Filesystem Changes Detected',
title: 'Changes Detected',
confirmText: 'Apply Changes',
color: isDeletingWorkspace ? 'danger' : 'primary',
description: (
<VStack space={3}>
{isDeletingWorkspace && (
@@ -86,8 +87,8 @@ export const syncWorkspace = createFastMutation<
</Banner>
)}
<p>
{pluralizeCount('file', dbOps.length)} in the directory have changed. Do you want to
apply the updates to your workspace?
{pluralizeCount('file', dbOps.length)} in the directory{' '}
{dbOps.length === 1 ? 'has' : 'have'} changed. Do you want to update your workspace?
</p>
<div className="overflow-y-auto max-h-[10rem]">
<table className="w-full text-sm mb-auto min-w-full max-w-full divide-y divide-surface-highlight">
@@ -105,15 +106,15 @@ export const syncWorkspace = createFastMutation<
if (op.type === 'dbCreate') {
label = 'create';
name = fallbackRequestName(op.fs.model);
name = resolvedModelNameWithFolders(op.fs.model);
color = 'text-success';
} else if (op.type === 'dbUpdate') {
label = 'update';
name = fallbackRequestName(op.fs.model);
name = resolvedModelNameWithFolders(op.fs.model);
color = 'text-info';
} else if (op.type === 'dbDelete') {
label = 'delete';
name = fallbackRequestName(op.model);
name = resolvedModelNameWithFolders(op.model);
color = 'text-danger';
} else {
return null;

View File

@@ -4,7 +4,7 @@ import { InlineCode } from '../components/core/InlineCode';
import { createFastMutation } from '../hooks/useFastMutation';
import { trackEvent } from '../lib/analytics';
import { showConfirmDelete } from '../lib/confirm';
import { fallbackRequestName } from '../lib/fallbackRequestName';
import { resolvedModelName } from '../lib/resolvedModelName';
export const deleteWebsocketRequest = createFastMutation({
mutationKey: ['delete_websocket_request'],
@@ -14,7 +14,7 @@ export const deleteWebsocketRequest = createFastMutation({
title: 'Delete WebSocket Request',
description: (
<>
Permanently delete <InlineCode>{fallbackRequestName(request)}</InlineCode>?
Permanently delete <InlineCode>{resolvedModelName(request)}</InlineCode>?
</>
),
});