Skip to content
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ data/

reproduce_auth_500.py
debug_list_notes.py
DEPLOY_TO_HF.md
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ FROM python:3.11-slim

WORKDIR /app

# Install Node.js for frontend build
# Install Node.js 20.x for frontend build (required for React 19, Vite 7)
RUN apt-get update && \
apt-get install -y nodejs npm curl && \
apt-get install -y curl gnupg && \
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
apt-get install -y nodejs && \
rm -rf /var/lib/apt/lists/*

# Copy and install frontend dependencies
Expand Down
85 changes: 85 additions & 0 deletions GITSUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Git Summary - Delete Note Feature

## Overview
Implemented complete delete note functionality with confirmation dialog to prevent accidental deletions.

## Changes Made

### Backend (`backend/src/api/routes/notes.py`)
- **Added DELETE endpoint** (`DELETE /api/notes/{path}`)
- Deletes note file from vault filesystem
- Removes all related index entries (metadata, tags, links)
- Updates index health statistics
- Returns `204 No Content` on success
- Returns `404 Not Found` if note doesn't exist
- Returns `500 Internal Server Error` for other failures

### Frontend

#### 1. API Service (`frontend/src/services/api.ts`)
- **Added `deleteNote()` function**
- Accepts note path parameter
- Makes DELETE request to `/api/notes/{path}`
- URL-encodes path to handle special characters
- Returns Promise<void> (no content response)

#### 2. New Component (`frontend/src/components/DeleteConfirmationDialog.tsx`)
- **DeleteConfirmationDialog component**
- Reusable dialog component for confirming note deletion
- Props:
- `isOpen`: Controls dialog visibility
- `noteName`: Name of note being deleted (for confirmation message)
- `isDeleting`: Loading state during deletion
- `onConfirm`: Callback when user confirms deletion
- `onCancel`: Callback when user cancels
- Features:
- Displays note name in warning message
- "Cancel" button to abort deletion
- "Delete" button with destructive styling (red)
- Disables buttons during deletion request
- Shows "Deleting..." text while loading

#### 3. Main App (`frontend/src/pages/MainApp.tsx`)
- **Added state management**
- `isDeleteDialogOpen`: Boolean for dialog visibility
- `isDeleting`: Boolean for deletion loading state

- **Added handler function `handleDeleteNote()`**
- Calls `deleteNote()` API with current note path
- Refreshes notes list after successful deletion
- Clears current note selection
- Auto-selects first available note
- Shows success/error toast notifications
- Extracts display name from note title or path
- Handles errors gracefully with error messages

- **Connected UI**
- Passed `onDelete={() => setIsDeleteDialogOpen(true)}` to NoteViewer component
- Added DeleteConfirmationDialog component to page
- Dialog displays current note's title and handles confirmation

## User Flow
1. User clicks trash icon button in note viewer
2. DeleteConfirmationDialog modal appears showing note name
3. User can:
- Click "Cancel" to abort deletion
- Click "Delete" to confirm and delete the note
4. On deletion:
- Note is removed from filesystem and database
- Notes list refreshes
- UI auto-selects next available note
- Success toast confirms deletion

## Files Modified/Created
- ✅ `backend/src/api/routes/notes.py` - Added DELETE endpoint
- ✅ `frontend/src/services/api.ts` - Added deleteNote function
- ✅ `frontend/src/components/DeleteConfirmationDialog.tsx` - New component
- ✅ `frontend/src/pages/MainApp.tsx` - Integrated delete flow

## Testing Recommendations
- Test deleting a note and verify it's removed from UI
- Test that deleting updates note count in footer
- Test error handling (e.g., network failure)
- Test that deletion dialog closes after confirmation
- Test auto-selection of next note after deletion
- Test deletion of last note (should show empty state)
Loading