Compare commits
272 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 18ddca6c27 | |||
| b31f7e6f34 | |||
| 60fdd5d6ef | |||
| 0ee7eeaa59 | |||
| 811230fb30 | |||
| 761b7791f9 | |||
| 41e89676c1 | |||
| 484ac9a404 | |||
| c1068bbc51 | |||
| b6fb712c9f | |||
| 3cb8408207 | |||
| 20dd43c093 | |||
| 977839156b | |||
| af4f63f561 | |||
| cdff4ebb8a | |||
| 59f958b085 | |||
| 097d7a0b65 | |||
| 1273777541 | |||
| b6a960879f | |||
| 4bd153104b | |||
| e099fcf600 | |||
| 89fdf401c0 | |||
| 9cc46a1819 | |||
| f7c0e5f51a | |||
| 200581e73c | |||
| 505acf833e | |||
| 1ac5b0447a | |||
| 15a2fc2d5f | |||
| a1cf6a1156 | |||
| 481545c37b | |||
| a67df87013 | |||
| d2dbe2ea2f | |||
| 98ea5e7202 | |||
| 6b5c08e99b | |||
| 11ecad136b | |||
| 3a4dccd9f0 | |||
| 0a5e55ca96 | |||
| a72741c0d9 | |||
| e7ed7006fd | |||
| 3d3013d9d6 | |||
| bccaa649dc | |||
| 7aca927937 | |||
| e229c60b22 | |||
| 4966bc6a58 | |||
| 617f292516 | |||
| 8e95004022 | |||
| 93df328853 | |||
| 657e74a2e3 | |||
| ea77f7917e | |||
| f6e5a454ae | |||
| cc7ad4b2bc | |||
| 827a599102 | |||
| b9841b762c | |||
| e636cf5d56 | |||
| a896fa66c0 | |||
| 027c1090a4 | |||
| 4e214588a7 | |||
| 9d0607f4f0 | |||
| 8cbe97d2f4 | |||
| 0d31c9037c | |||
| ffcfd9766d | |||
| 3501a52f0e | |||
| 5ca598b80a | |||
| 4e2075c638 | |||
| 0a691d4251 | |||
| 34846ae71a | |||
| ea261dd03b | |||
| eb93223d79 | |||
| b20f9cc108 | |||
| 515814e1d5 | |||
| fba9838e21 | |||
| a9c2761986 | |||
| db7e5913eb | |||
| aa27d1ea79 | |||
| cf8df2780e | |||
| 419a283c62 | |||
| 1b075a4beb | |||
| 68ff93cf17 | |||
| b22a29e877 | |||
| e601311ca3 | |||
| bb00c3993b | |||
| c9c0de46bf | |||
| 5374299cd5 | |||
| 536e2b2874 | |||
| 141acd5736 | |||
| 5f4337a18d | |||
| fec7b687f7 | |||
| cfa29ad5cb | |||
| 76ae35217c | |||
| fe651fa38e | |||
| f7b8c0c0fe | |||
| 4af3cc2486 | |||
| 3632b936e9 | |||
| 66a6d4003a | |||
| bdf73c1f06 | |||
| f032743690 | |||
| a9902b95b4 | |||
| 9d1c0b672a | |||
| 727fd8bae8 | |||
| 954103510a | |||
| 801e1f81d9 | |||
| f9861480aa | |||
| a26dfd3d6f | |||
| 1db908771f | |||
| 59651b8c24 | |||
| 7ccd48297f | |||
| d05ff6380e | |||
| 605f773a7e | |||
| c844f634c8 | |||
| 1d94398e2d | |||
| a2551dc0ad | |||
| 32821934e6 | |||
| b9c28e52cd | |||
| c94b6268cf | |||
| 439c743fd1 | |||
| 74144f1fc6 | |||
| 99a0376657 | |||
| 21b1e79672 | |||
| cfaee103b6 | |||
| c0e346992d | |||
| 04f45a16c9 | |||
| efad1da74d | |||
| 0a2b010332 | |||
| 6906c8bcf7 | |||
| ac48bfdd0d | |||
| ec99243b6f | |||
| 9932621e14 | |||
| 0fb17c78fa | |||
| 4bcca58a11 | |||
| 9fa5ba1cf7 | |||
| 88919fa0d3 | |||
| 5e43fc9cd9 | |||
| f053f42b6d | |||
| dc17e7d59d | |||
| f05ad87602 | |||
| 2efc74a687 | |||
| 85e7fbe73f | |||
| 0a21856a8d | |||
| 349e7c7eb1 | |||
| be07438915 | |||
| b31ae72153 | |||
| 1db08b1e9b | |||
| 237a3332cc | |||
| e2d0a83d51 | |||
| c546657285 | |||
| e8d5ee1a7b | |||
| 1761ebd531 | |||
| 5e5e98601f | |||
| 1cda80792b | |||
| 8740d5e618 | |||
| a619d52d17 | |||
| dd8cc14d30 | |||
| 3b7d723c2a | |||
| dc6252ff56 | |||
| 1d4e79a4f9 | |||
| 0b0e3e22d2 | |||
| f22e3c133f | |||
| 64c0a58f78 | |||
| 4182089c17 | |||
| cecf773fb7 | |||
| 973af17b85 | |||
| 6c3e88a588 | |||
| 97bbb3c8e1 | |||
| ac1cd96ecd | |||
| 689861f671 | |||
| 41fb575e80 | |||
| 6ebc4f3fc4 | |||
| de973f5613 | |||
| 279c70b3d6 | |||
| 5a73f6963f | |||
| 5101a05bca | |||
| c82caf6539 | |||
| ae1b508726 | |||
| 26c05912fc | |||
| d1033cb83a | |||
| b7458b5a37 | |||
| face8f1496 | |||
| ba6ee55bf7 | |||
| e343106af5 | |||
| 2f848eb602 | |||
| 1c7fa781ad | |||
| 66940c2f5b | |||
| a3638fe954 | |||
| 0934695a69 | |||
| 77ece5c5f1 | |||
| 1c2c1f177a | |||
| f38014099e | |||
| 10649691de | |||
| f439d0b318 | |||
| 4e977f7624 | |||
| 66841e8af7 | |||
| 051e21cbaf | |||
| e35ac6a41c | |||
| 0d33f21ee6 | |||
| 1cfd6a44d6 | |||
| 2b5b875dfe | |||
| f39427d9d9 | |||
| 74d85eadbb | |||
| 0b550cdaf6 | |||
| 288b0c25e6 | |||
| d065132bb7 | |||
| 52ef3e33f4 | |||
| d89a605579 | |||
| 9006b754a8 | |||
| 5328b4f73a | |||
| 6438374258 | |||
| d8fb4c9565 | |||
| f5cf757142 | |||
| 0a203d16cf | |||
| 8231f2b60d | |||
| 9c1e79b5a5 | |||
| 472445a2e5 | |||
| ec3d5a0f80 | |||
| cf32b01356 | |||
| c8cfce3e36 | |||
| 12ba91952e | |||
| 69b56ed582 | |||
| 1bc9b547c7 | |||
| d594d00227 | |||
| 2012b0bab9 | |||
| cfa0b0da69 | |||
| eac573c4a5 | |||
| ff370f6dbd | |||
| 7e3009cedc | |||
| 23ec674e05 | |||
| 971397c338 | |||
| f0768cd31b | |||
| 91601c77a4 | |||
| 53704ec92e | |||
| fece843505 | |||
| 35681d5346 | |||
| 193cadef27 | |||
| 2e7cba9e8a | |||
| 2e10374e2c | |||
| 9dd643338b | |||
| f75ee680a5 | |||
| 8dad933ff1 | |||
| 225d017718 | |||
| f38a8ef598 | |||
| 024c8eac2d | |||
| 932e5e137c | |||
| 3470120a0d | |||
| 28632e8970 | |||
| 6c82958c79 | |||
| 032bbae50d | |||
| d66ff29b3e | |||
| 0ea3ee837a | |||
| 7de326c296 | |||
| fa71cad843 | |||
| ae71834aa6 | |||
| 128452f580 | |||
| f306a2539d | |||
| 160f26f104 | |||
| 01c37098d4 | |||
| f78142cda4 | |||
| 6c84f701ca | |||
| 1802ddaebd | |||
| d1d48fb3da | |||
| 8ba72e8aa1 | |||
| feea04b1ce | |||
| c2e1d30153 | |||
| 993a132d20 | |||
| 1c374a2f82 | |||
| 576e7c5d35 | |||
| 07b93636eb | |||
| a2fca63d3a | |||
| ebf1dabbaa | |||
| 3647855163 | |||
| bdc7e73523 | |||
| f3b83829ca | |||
| 59b1b87cba | |||
| 206539f51e |
+46
@@ -108,6 +108,52 @@ steps:
|
|||||||
- VERSION=${DRONE_TAG}
|
- VERSION=${DRONE_TAG}
|
||||||
- VITE_API_URL=${VITE_API_URL:-/api}
|
- VITE_API_URL=${VITE_API_URL:-/api}
|
||||||
|
|
||||||
|
# -------- NEW: Create GitHub Release --------
|
||||||
|
- name: github-release
|
||||||
|
image: plugins/github-release
|
||||||
|
settings:
|
||||||
|
api_key:
|
||||||
|
from_secret: GITHUB_TOKEN
|
||||||
|
base_url: https://api.github.com/
|
||||||
|
upload_url: https://uploads.github.com/
|
||||||
|
repo: the-luap/picpeak
|
||||||
|
owner: the-luap
|
||||||
|
title: "PicPeak ${DRONE_TAG}"
|
||||||
|
note: |
|
||||||
|
# PicPeak ${DRONE_TAG}
|
||||||
|
|
||||||
|
## 🐳 Docker Images
|
||||||
|
|
||||||
|
This release includes Docker images published to GitHub Container Registry:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Backend
|
||||||
|
docker pull ghcr.io/the-luap/picpeak-backend:${DRONE_TAG}
|
||||||
|
docker pull ghcr.io/the-luap/picpeak-backend:latest
|
||||||
|
|
||||||
|
# Frontend
|
||||||
|
docker pull ghcr.io/the-luap/picpeak-frontend:${DRONE_TAG}
|
||||||
|
docker pull ghcr.io/the-luap/picpeak-frontend:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
## 📦 What's New
|
||||||
|
|
||||||
|
See the [README](https://github.com/the-luap/picpeak#readme) for features and documentation.
|
||||||
|
|
||||||
|
## 🚀 Quick Start
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Clone and deploy
|
||||||
|
git clone https://github.com/the-luap/picpeak.git
|
||||||
|
cd picpeak
|
||||||
|
|
||||||
|
# Use the tagged version
|
||||||
|
docker-compose -f docker-compose.prod.yml up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
For detailed deployment instructions, see the [Deployment Guide](https://github.com/the-luap/picpeak/blob/main/DEPLOYMENT.md).
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
event:
|
event:
|
||||||
|
|||||||
@@ -10,18 +10,120 @@ jobs:
|
|||||||
mirror:
|
mirror:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository with full history
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0 # Full history for proper mirroring
|
fetch-depth: 0 # Full history needed for finding the commit
|
||||||
|
|
||||||
- name: Setup Git
|
- name: Setup Git
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "the-luap"
|
git config --global user.name "the-luap"
|
||||||
git config --global user.email "paul-nothaft@hotmail.de"
|
git config --global user.email "paul-nothaft@hotmail.de"
|
||||||
|
|
||||||
|
- name: Debug - Show current branch and status
|
||||||
|
run: |
|
||||||
|
echo "Current branch:"
|
||||||
|
git branch -a
|
||||||
|
echo "Git status:"
|
||||||
|
git status
|
||||||
|
echo "Remote info:"
|
||||||
|
git remote -v
|
||||||
|
echo "Checking target commit exists:"
|
||||||
|
git show --oneline 7aca927937 || echo "Target commit not found!"
|
||||||
|
|
||||||
|
- name: Create completely new history from specific commit
|
||||||
|
run: |
|
||||||
|
TARGET_COMMIT="7aca927937"
|
||||||
|
|
||||||
|
# Verify the target commit exists
|
||||||
|
if ! git cat-file -e $TARGET_COMMIT^{commit}; then
|
||||||
|
echo "ERROR: Target commit $TARGET_COMMIT does not exist!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "✅ Target commit found: $(git log --oneline -1 $TARGET_COMMIT)"
|
||||||
|
|
||||||
|
# Clean up any existing github-mirror branch
|
||||||
|
git branch -D github-mirror || true
|
||||||
|
|
||||||
|
# Create a completely new orphan branch (no history)
|
||||||
|
git checkout --orphan github-mirror
|
||||||
|
|
||||||
|
# Clear the staging area completely
|
||||||
|
git rm -rf . || true
|
||||||
|
|
||||||
|
# Get the file tree from the target commit and create initial commit
|
||||||
|
echo "Creating new history starting from $TARGET_COMMIT..."
|
||||||
|
git read-tree $TARGET_COMMIT
|
||||||
|
git commit -m "Initial commit - imported from $(git log --oneline -1 $TARGET_COMMIT)"
|
||||||
|
|
||||||
|
echo "✅ Created new initial commit: $(git log --oneline -1)"
|
||||||
|
|
||||||
|
# Now get all commits after the target commit and apply their changes
|
||||||
|
COMMITS_AFTER_TARGET=$(git rev-list --reverse --no-merges $TARGET_COMMIT..main)
|
||||||
|
|
||||||
|
if [ -n "$COMMITS_AFTER_TARGET" ]; then
|
||||||
|
echo "📋 Applying changes from commits after $TARGET_COMMIT (excluding Claude commits):"
|
||||||
|
|
||||||
|
for commit in $COMMITS_AFTER_TARGET; do
|
||||||
|
# Get the commit author name
|
||||||
|
COMMIT_AUTHOR_NAME=$(git log --format="%an" -n 1 $commit)
|
||||||
|
|
||||||
|
# Skip commits by Claude
|
||||||
|
if [ "$COMMIT_AUTHOR_NAME" = "Claude" ]; then
|
||||||
|
echo "⚠️ Skipping commit by Claude: $(git log --oneline -1 $commit)"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Processing: $(git log --oneline -1 $commit)"
|
||||||
|
|
||||||
|
# Get the commit message and author info
|
||||||
|
COMMIT_MSG=$(git log --format="%B" -n 1 $commit)
|
||||||
|
COMMIT_AUTHOR=$(git log --format="%an <%ae>" -n 1 $commit)
|
||||||
|
COMMIT_DATE=$(git log --format="%ad" -n 1 $commit)
|
||||||
|
|
||||||
|
# Apply the changes from this commit
|
||||||
|
if git diff-tree --no-commit-id --name-only -r $commit | xargs -I {} git show $commit:{} > /dev/null 2>&1; then
|
||||||
|
# Apply file changes
|
||||||
|
git checkout $commit -- . || true
|
||||||
|
|
||||||
|
# Stage all changes
|
||||||
|
git add -A
|
||||||
|
|
||||||
|
# Only commit if there are changes
|
||||||
|
if ! git diff --cached --quiet; then
|
||||||
|
# Create new commit with original metadata but new SHA
|
||||||
|
GIT_AUTHOR_NAME=$(echo "$COMMIT_AUTHOR" | cut -d'<' -f1 | xargs)
|
||||||
|
GIT_AUTHOR_EMAIL=$(echo "$COMMIT_AUTHOR" | cut -d'<' -f2 | cut -d'>' -f1)
|
||||||
|
GIT_AUTHOR_DATE="$COMMIT_DATE"
|
||||||
|
|
||||||
|
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
|
||||||
|
git commit -m "$COMMIT_MSG"
|
||||||
|
echo "✅ Applied changes as new commit: $(git log --oneline -1)"
|
||||||
|
else
|
||||||
|
echo "⚠️ No changes to commit for $commit"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "⚠️ Skipping problematic commit $commit"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "✅ Finished creating new history"
|
||||||
|
else
|
||||||
|
echo "✅ No commits after target commit - history starts fresh"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== New History Summary ==="
|
||||||
|
echo "Total commits in new history: $(git rev-list --count github-mirror)"
|
||||||
|
echo "History starts with: $(git log --oneline --reverse | head -1)"
|
||||||
|
echo "Latest commit: $(git log --oneline -1)"
|
||||||
|
|
||||||
- name: Remove sensitive files and directories
|
- name: Remove sensitive files and directories
|
||||||
run: |
|
run: |
|
||||||
|
# Switch to the github-mirror branch
|
||||||
|
git checkout github-mirror
|
||||||
|
|
||||||
echo "Current files before cleanup:"
|
echo "Current files before cleanup:"
|
||||||
ls -la | head -10 || true
|
ls -la | head -10 || true
|
||||||
echo "..."
|
echo "..."
|
||||||
@@ -62,6 +164,18 @@ jobs:
|
|||||||
echo "Final file structure (top level):"
|
echo "Final file structure (top level):"
|
||||||
ls -la | head -10 || true
|
ls -la | head -10 || true
|
||||||
|
|
||||||
|
- name: Verify completely new history
|
||||||
|
run: |
|
||||||
|
git checkout github-mirror
|
||||||
|
echo "=== Final History Verification ==="
|
||||||
|
echo "Total commits in new github-mirror branch: $(git rev-list --count github-mirror)"
|
||||||
|
echo ""
|
||||||
|
echo "Complete commit history (should start from target commit content):"
|
||||||
|
git log --oneline --reverse
|
||||||
|
echo ""
|
||||||
|
echo "⚠️ Note: This is a completely NEW history with new commit SHAs"
|
||||||
|
echo "🔍 Original target commit content preserved but with new commit ID"
|
||||||
|
|
||||||
- name: Check GitHub token
|
- name: Check GitHub token
|
||||||
env:
|
env:
|
||||||
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
|
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
|
||||||
@@ -73,10 +187,13 @@ jobs:
|
|||||||
echo "GitHub token is available (length: ${#GITHUBTOKEN})"
|
echo "GitHub token is available (length: ${#GITHUBTOKEN})"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Push to GitHub
|
- name: Force push completely new history to GitHub
|
||||||
env:
|
env:
|
||||||
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
|
GITHUBTOKEN: ${{ secrets.GITHUBTOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
# Switch to github-mirror branch
|
||||||
|
git checkout github-mirror
|
||||||
|
|
||||||
# Remove existing github remote if it exists
|
# Remove existing github remote if it exists
|
||||||
git remote remove github || true
|
git remote remove github || true
|
||||||
|
|
||||||
@@ -87,13 +204,17 @@ jobs:
|
|||||||
echo "GitHub remote added:"
|
echo "GitHub remote added:"
|
||||||
git remote -v
|
git remote -v
|
||||||
|
|
||||||
# Push to GitHub main branch
|
# Force push the completely new history to GitHub main
|
||||||
echo "Pushing to GitHub..."
|
echo "🔥 FORCE PUSHING completely new history to GitHub..."
|
||||||
git push github main --force
|
echo "⚠️ This will COMPLETELY REPLACE all history on GitHub!"
|
||||||
echo "✅ Push to GitHub completed!"
|
git push github github-mirror:main --force
|
||||||
|
echo "✅ Force push completed - GitHub now has completely new history!"
|
||||||
|
|
||||||
- name: Workflow completed
|
- name: Workflow completed
|
||||||
run: |
|
run: |
|
||||||
echo "✅ Mirror to GitHub workflow completed successfully!"
|
echo "✅ Mirror to GitHub workflow completed successfully!"
|
||||||
echo "📊 Repository mirrored to: https://github.com/the-luap/picpeak"
|
echo "🔥 COMPLETE HISTORY REPLACEMENT: GitHub now has entirely new history"
|
||||||
echo "🔒 Sensitive files have been removed from the mirror"
|
echo "📊 History starts from commit content: 7aca927937"
|
||||||
|
echo "🔍 Check https://github.com/the-luap/picpeak to verify the new history"
|
||||||
|
echo "📈 Total commits pushed: $(git rev-list --count github-mirror)"
|
||||||
|
echo "🆕 All commit SHAs are NEW - no connection to previous history"
|
||||||
@@ -48,10 +48,6 @@ coverage/
|
|||||||
*.tmp
|
*.tmp
|
||||||
*.temp
|
*.temp
|
||||||
|
|
||||||
# Backup and test directories
|
|
||||||
backups/
|
|
||||||
test-archiver/
|
|
||||||
|
|
||||||
# Keep directory structure
|
# Keep directory structure
|
||||||
!storage/events/active/.gitkeep
|
!storage/events/active/.gitkeep
|
||||||
!storage/events/archived/.gitkeep
|
!storage/events/archived/.gitkeep
|
||||||
|
|||||||
@@ -94,20 +94,6 @@ Perfect for:
|
|||||||
- **Email**: SMTP with customizable templates
|
- **Email**: SMTP with customizable templates
|
||||||
- **Analytics**: Privacy-focused with Umami integration
|
- **Analytics**: Privacy-focused with Umami integration
|
||||||
|
|
||||||
## 💻 System Requirements
|
|
||||||
|
|
||||||
### Minimum Requirements
|
|
||||||
- **CPU**: 2 CPU cores
|
|
||||||
- **RAM**: 2GB minimum
|
|
||||||
- **Storage**: 20GB minimum (plus photo storage needs)
|
|
||||||
- **OS**: Linux (Ubuntu 20.04+), macOS, or Windows with WSL2
|
|
||||||
- **Node.js**: v18.0.0 or higher
|
|
||||||
- **Database**: SQLite (included) or PostgreSQL 12+
|
|
||||||
|
|
||||||
### Docker Requirements (Recommended)
|
|
||||||
- **Docker**: v20.10.0+
|
|
||||||
- **Docker Compose**: v2.0.0+
|
|
||||||
|
|
||||||
## 🤝 Contributing
|
## 🤝 Contributing
|
||||||
|
|
||||||
We love contributions! PicPeak is built by photographers, for photographers. Whether you're fixing bugs, adding features, or improving documentation, your help is welcome.
|
We love contributions! PicPeak is built by photographers, for photographers. Whether you're fixing bugs, adding features, or improving documentation, your help is welcome.
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ exports.up = async function(knex) {
|
|||||||
await knex('app_settings').insert({
|
await knex('app_settings').insert({
|
||||||
setting_key: 'general_default_welcome_message',
|
setting_key: 'general_default_welcome_message',
|
||||||
setting_value: JSON.stringify('Thank you for using our photo sharing service! We hope you enjoy your photos.'),
|
setting_value: JSON.stringify('Thank you for using our photo sharing service! We hope you enjoy your photos.'),
|
||||||
setting_type: 'general'
|
setting_type: 'general',
|
||||||
|
updated_at: new Date()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,8 @@ exports.up = async function(knex) {
|
|||||||
|
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
await knex('app_settings').insert({
|
await knex('app_settings').insert({
|
||||||
...setting
|
...setting,
|
||||||
|
updated_at: knex.fn.now()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,131 @@
|
|||||||
|
exports.up = function(knex) {
|
||||||
|
return knex.schema
|
||||||
|
// Add new settings to app_settings table
|
||||||
|
.table('app_settings', table => {
|
||||||
|
// S3 configuration enhancements
|
||||||
|
table.boolean('backup_s3_force_path_style').defaultTo(false).comment('Force path-style S3 URLs (for MinIO/self-hosted)');
|
||||||
|
table.boolean('backup_s3_ssl_enabled').defaultTo(true).comment('Enable SSL/TLS for S3 connections');
|
||||||
|
table.string('backup_s3_prefix', 255).comment('S3 key prefix for organizing backups');
|
||||||
|
|
||||||
|
// Backup features
|
||||||
|
table.boolean('backup_incremental').defaultTo(false).comment('Enable incremental backups');
|
||||||
|
table.boolean('backup_include_database').defaultTo(true).comment('Include database dumps in backups');
|
||||||
|
table.boolean('backup_manifest_enabled').defaultTo(true).comment('Generate backup manifests');
|
||||||
|
table.enum('backup_manifest_format', ['json', 'yaml']).defaultTo('json').comment('Manifest file format');
|
||||||
|
table.boolean('backup_encryption_enabled').defaultTo(false).comment('Enable backup encryption');
|
||||||
|
table.string('backup_database_schedule', 100).comment('Separate cron schedule for database-only backups');
|
||||||
|
})
|
||||||
|
|
||||||
|
// Enhance backup_runs table
|
||||||
|
.table('backup_runs', table => {
|
||||||
|
// Manifest tracking
|
||||||
|
table.string('manifest_path', 500).comment('Path to backup manifest file');
|
||||||
|
table.uuid('manifest_id').comment('Unique identifier for the manifest');
|
||||||
|
table.enum('manifest_format', ['json', 'yaml']).comment('Format of the manifest file');
|
||||||
|
|
||||||
|
// Incremental backup support
|
||||||
|
table.integer('parent_backup_id').unsigned().references('id').inTable('backup_runs').onDelete('SET NULL').comment('Parent backup for incremental backups');
|
||||||
|
table.enum('backup_mode', ['full', 'incremental', 'database']).defaultTo('full').comment('Type of backup performed');
|
||||||
|
|
||||||
|
// Add indexes for better query performance
|
||||||
|
table.index(['backup_mode', 'status'], 'idx_backup_runs_mode_status');
|
||||||
|
table.index(['parent_backup_id'], 'idx_backup_runs_parent');
|
||||||
|
table.index(['created_at', 'backup_mode'], 'idx_backup_runs_created_mode');
|
||||||
|
})
|
||||||
|
|
||||||
|
// Create backup_manifest table for storing detailed manifest metadata
|
||||||
|
.createTable('backup_manifest', table => {
|
||||||
|
table.increments('id').primary();
|
||||||
|
table.integer('backup_run_id').unsigned().notNullable().references('id').inTable('backup_runs').onDelete('CASCADE');
|
||||||
|
table.uuid('manifest_id').notNullable().unique().comment('Unique identifier matching backup_runs.manifest_id');
|
||||||
|
table.string('version', 20).notNullable().defaultTo('1.0.0').comment('Manifest schema version');
|
||||||
|
table.enum('format', ['json', 'yaml']).notNullable().defaultTo('json');
|
||||||
|
|
||||||
|
// Backup metadata
|
||||||
|
table.timestamp('backup_start').notNullable();
|
||||||
|
table.timestamp('backup_end').notNullable();
|
||||||
|
table.bigInteger('total_size').unsigned().comment('Total size of backup in bytes');
|
||||||
|
table.integer('file_count').unsigned().comment('Number of files in backup');
|
||||||
|
table.integer('photo_count').unsigned().comment('Number of photos backed up');
|
||||||
|
table.integer('event_count').unsigned().comment('Number of events backed up');
|
||||||
|
|
||||||
|
// Incremental backup metadata
|
||||||
|
table.boolean('is_incremental').defaultTo(false);
|
||||||
|
table.uuid('parent_manifest_id').comment('Parent manifest ID for incremental backups');
|
||||||
|
table.timestamp('incremental_since').comment('Timestamp for incremental backup baseline');
|
||||||
|
|
||||||
|
// Content checksums
|
||||||
|
table.string('checksum_algorithm', 50).defaultTo('sha256').comment('Algorithm used for checksums');
|
||||||
|
table.text('manifest_checksum').comment('Checksum of the manifest file itself');
|
||||||
|
|
||||||
|
// Storage information
|
||||||
|
table.string('storage_location', 500).comment('Primary storage location (local path or S3 URI)');
|
||||||
|
table.string('storage_provider', 50).comment('Storage provider (local, s3, etc.)');
|
||||||
|
|
||||||
|
// Encryption metadata
|
||||||
|
table.boolean('is_encrypted').defaultTo(false);
|
||||||
|
table.string('encryption_algorithm', 100).comment('Encryption algorithm used');
|
||||||
|
table.string('encryption_key_id', 255).comment('ID of encryption key used');
|
||||||
|
|
||||||
|
// Additional metadata as JSON
|
||||||
|
table.json('metadata').comment('Additional metadata as JSON');
|
||||||
|
|
||||||
|
// Timestamps
|
||||||
|
table.timestamps(true, true);
|
||||||
|
|
||||||
|
// Indexes
|
||||||
|
table.index(['backup_run_id'], 'idx_manifest_backup_run');
|
||||||
|
table.index(['manifest_id'], 'idx_manifest_uuid');
|
||||||
|
table.index(['parent_manifest_id'], 'idx_manifest_parent');
|
||||||
|
table.index(['backup_start', 'backup_end'], 'idx_manifest_time_range');
|
||||||
|
table.index(['is_incremental', 'created_at'], 'idx_manifest_incremental_created');
|
||||||
|
})
|
||||||
|
|
||||||
|
// Add composite indexes for common query patterns
|
||||||
|
.raw(`
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_backup_runs_recent_successful
|
||||||
|
ON backup_runs(created_at DESC)
|
||||||
|
WHERE status = 'completed' AND backup_mode = 'full';
|
||||||
|
`)
|
||||||
|
.raw(`
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_backup_runs_incremental_chain
|
||||||
|
ON backup_runs(parent_backup_id, created_at)
|
||||||
|
WHERE backup_mode = 'incremental';
|
||||||
|
`);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = function(knex) {
|
||||||
|
return knex.schema
|
||||||
|
// Drop indexes first
|
||||||
|
.raw('DROP INDEX IF EXISTS idx_backup_runs_incremental_chain;')
|
||||||
|
.raw('DROP INDEX IF EXISTS idx_backup_runs_recent_successful;')
|
||||||
|
|
||||||
|
// Drop backup_manifest table
|
||||||
|
.dropTableIfExists('backup_manifest')
|
||||||
|
|
||||||
|
// Remove columns from backup_runs table
|
||||||
|
.table('backup_runs', table => {
|
||||||
|
table.dropIndex(['backup_mode', 'status'], 'idx_backup_runs_mode_status');
|
||||||
|
table.dropIndex(['parent_backup_id'], 'idx_backup_runs_parent');
|
||||||
|
table.dropIndex(['created_at', 'backup_mode'], 'idx_backup_runs_created_mode');
|
||||||
|
|
||||||
|
table.dropColumn('manifest_path');
|
||||||
|
table.dropColumn('manifest_id');
|
||||||
|
table.dropColumn('manifest_format');
|
||||||
|
table.dropColumn('parent_backup_id');
|
||||||
|
table.dropColumn('backup_mode');
|
||||||
|
})
|
||||||
|
|
||||||
|
// Remove columns from app_settings table
|
||||||
|
.table('app_settings', table => {
|
||||||
|
table.dropColumn('backup_s3_force_path_style');
|
||||||
|
table.dropColumn('backup_s3_ssl_enabled');
|
||||||
|
table.dropColumn('backup_s3_prefix');
|
||||||
|
table.dropColumn('backup_incremental');
|
||||||
|
table.dropColumn('backup_include_database');
|
||||||
|
table.dropColumn('backup_manifest_enabled');
|
||||||
|
table.dropColumn('backup_manifest_format');
|
||||||
|
table.dropColumn('backup_encryption_enabled');
|
||||||
|
table.dropColumn('backup_database_schedule');
|
||||||
|
});
|
||||||
|
};
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
// No helpers needed for this migration
|
const { formatBoolean, parseBoolean } = require('./helpers');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add restore_runs table for tracking restore operations
|
* Add restore_runs table for tracking restore operations
|
||||||
@@ -30,9 +30,9 @@ exports.up = async function(knex) {
|
|||||||
table.string('pre_restore_backup_path', 500); // Path to pre-restore safety backup
|
table.string('pre_restore_backup_path', 500); // Path to pre-restore safety backup
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
table.boolean('is_dry_run').defaultTo(false);
|
table.boolean('is_dry_run').defaultTo(formatBoolean(false));
|
||||||
table.boolean('was_rollback_attempted').defaultTo(false);
|
table.boolean('was_rollback_attempted').defaultTo(formatBoolean(false));
|
||||||
table.boolean('was_successful').defaultTo(false);
|
table.boolean('was_successful').defaultTo(formatBoolean(false));
|
||||||
|
|
||||||
// Operator information
|
// Operator information
|
||||||
table.string('operator_type', 50).defaultTo('manual'); // manual, scheduled, api
|
table.string('operator_type', 50).defaultTo('manual'); // manual, scheduled, api
|
||||||
@@ -59,7 +59,7 @@ exports.up = async function(knex) {
|
|||||||
|
|
||||||
table.bigInteger('file_size');
|
table.bigInteger('file_size');
|
||||||
table.string('checksum', 64);
|
table.string('checksum', 64);
|
||||||
table.boolean('checksum_verified').defaultTo(false);
|
table.boolean('checksum_verified').defaultTo(formatBoolean(false));
|
||||||
|
|
||||||
table.text('error_message');
|
table.text('error_message');
|
||||||
table.timestamp('started_at');
|
table.timestamp('started_at');
|
||||||
@@ -92,43 +92,60 @@ exports.up = async function(knex) {
|
|||||||
await knex('app_settings').insert([
|
await knex('app_settings').insert([
|
||||||
{
|
{
|
||||||
setting_key: 'restore_allow_force',
|
setting_key: 'restore_allow_force',
|
||||||
setting_value: JSON.stringify(false),
|
setting_value: formatBoolean(false),
|
||||||
setting_type: 'restore'
|
setting_type: 'restore',
|
||||||
|
description: 'Allow force restore with warnings',
|
||||||
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setting_key: 'restore_require_pre_backup',
|
setting_key: 'restore_require_pre_backup',
|
||||||
setting_value: JSON.stringify(true),
|
setting_value: formatBoolean(true),
|
||||||
setting_type: 'restore'
|
setting_type: 'restore',
|
||||||
|
description: 'Require pre-restore backup',
|
||||||
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setting_key: 'restore_max_file_size_mb',
|
setting_key: 'restore_max_file_size_mb',
|
||||||
setting_value: '5000',
|
setting_value: '5000',
|
||||||
setting_type: 'restore'
|
setting_type: 'restore',
|
||||||
|
description: 'Maximum file size for restore (MB)',
|
||||||
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setting_key: 'restore_verify_checksums',
|
setting_key: 'restore_verify_checksums',
|
||||||
setting_value: JSON.stringify(true),
|
setting_value: formatBoolean(true),
|
||||||
setting_type: 'restore'
|
setting_type: 'restore',
|
||||||
|
description: 'Verify file checksums during restore',
|
||||||
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setting_key: 'restore_email_on_completion',
|
setting_key: 'restore_email_on_completion',
|
||||||
setting_value: JSON.stringify(true),
|
setting_value: formatBoolean(true),
|
||||||
setting_type: 'restore'
|
setting_type: 'restore',
|
||||||
|
description: 'Send email on restore completion',
|
||||||
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setting_key: 'restore_retention_days',
|
setting_key: 'restore_retention_days',
|
||||||
setting_value: '30',
|
setting_value: '30',
|
||||||
setting_type: 'restore'
|
setting_type: 'restore',
|
||||||
|
description: 'Days to retain restore history',
|
||||||
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// Add new email templates for restore notifications
|
// Add new email templates for restore notifications
|
||||||
const emailTemplates = [
|
const emailTemplates = [
|
||||||
{
|
{
|
||||||
template_key: 'restore_completed',
|
name: 'restore_completed',
|
||||||
subject_en: '✅ Restore Completed Successfully',
|
subject: '✅ Restore Completed Successfully',
|
||||||
subject_de: '✅ Wiederherstellung erfolgreich abgeschlossen',
|
body: `<h2>Restore Operation Completed</h2>
|
||||||
body_html_en: `<h2>Restore Operation Completed</h2>
|
|
||||||
<p>A restore operation has completed successfully.</p>
|
<p>A restore operation has completed successfully.</p>
|
||||||
|
|
||||||
<h3>Details:</h3>
|
<h3>Details:</h3>
|
||||||
@@ -141,50 +158,15 @@ exports.up = async function(knex) {
|
|||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>Please verify that all systems are functioning correctly after the restore.</p>`,
|
<p>Please verify that all systems are functioning correctly after the restore.</p>`,
|
||||||
body_html_de: `<h2>Wiederherstellungsvorgang abgeschlossen</h2>
|
language: 'en',
|
||||||
<p>Ein Wiederherstellungsvorgang wurde erfolgreich abgeschlossen.</p>
|
is_active: formatBoolean(true),
|
||||||
|
created_at: knex.fn.now(),
|
||||||
<h3>Details:</h3>
|
updated_at: knex.fn.now()
|
||||||
<ul>
|
|
||||||
<li><strong>Wiederherstellungstyp:</strong> {{restore_type}}</li>
|
|
||||||
<li><strong>Dauer:</strong> {{duration}}</li>
|
|
||||||
<li><strong>Wiederhergestellte Dateien:</strong> {{files_restored}}</li>
|
|
||||||
<li><strong>Backup-ID:</strong> {{backup_id}}</li>
|
|
||||||
<li><strong>Zeitstempel:</strong> {{timestamp}}</li>
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
<p>Bitte überprüfen Sie, ob alle Systeme nach der Wiederherstellung ordnungsgemäß funktionieren.</p>`,
|
|
||||||
body_text_en: `Restore Operation Completed
|
|
||||||
|
|
||||||
A restore operation has completed successfully.
|
|
||||||
|
|
||||||
Details:
|
|
||||||
- Restore Type: {{restore_type}}
|
|
||||||
- Duration: {{duration}}
|
|
||||||
- Files Restored: {{files_restored}}
|
|
||||||
- Backup ID: {{backup_id}}
|
|
||||||
- Timestamp: {{timestamp}}
|
|
||||||
|
|
||||||
Please verify that all systems are functioning correctly after the restore.`,
|
|
||||||
body_text_de: `Wiederherstellungsvorgang abgeschlossen
|
|
||||||
|
|
||||||
Ein Wiederherstellungsvorgang wurde erfolgreich abgeschlossen.
|
|
||||||
|
|
||||||
Details:
|
|
||||||
- Wiederherstellungstyp: {{restore_type}}
|
|
||||||
- Dauer: {{duration}}
|
|
||||||
- Wiederhergestellte Dateien: {{files_restored}}
|
|
||||||
- Backup-ID: {{backup_id}}
|
|
||||||
- Zeitstempel: {{timestamp}}
|
|
||||||
|
|
||||||
Bitte überprüfen Sie, ob alle Systeme nach der Wiederherstellung ordnungsgemäß funktionieren.`,
|
|
||||||
variables: JSON.stringify(['restore_type', 'duration', 'files_restored', 'backup_id', 'timestamp'])
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
template_key: 'restore_failed',
|
name: 'restore_failed',
|
||||||
subject_en: '❌ Restore Operation Failed',
|
subject: '❌ Restore Operation Failed',
|
||||||
subject_de: '❌ Wiederherstellungsvorgang fehlgeschlagen',
|
body: `<h2>Restore Operation Failed</h2>
|
||||||
body_html_en: `<h2>Restore Operation Failed</h2>
|
|
||||||
<p>A restore operation has failed and requires attention.</p>
|
<p>A restore operation has failed and requires attention.</p>
|
||||||
|
|
||||||
<h3>Details:</h3>
|
<h3>Details:</h3>
|
||||||
@@ -197,7 +179,36 @@ Bitte überprüfen Sie, ob alle Systeme nach der Wiederherstellung ordnungsgemä
|
|||||||
<p>Please check the system logs for more details and take appropriate action.</p>
|
<p>Please check the system logs for more details and take appropriate action.</p>
|
||||||
|
|
||||||
<p><strong>Important:</strong> If a pre-restore backup was created, it may be used for recovery.</p>`,
|
<p><strong>Important:</strong> If a pre-restore backup was created, it may be used for recovery.</p>`,
|
||||||
body_html_de: `<h2>Wiederherstellungsvorgang fehlgeschlagen</h2>
|
language: 'en',
|
||||||
|
is_active: formatBoolean(true),
|
||||||
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'restore_completed',
|
||||||
|
subject: '✅ Wiederherstellung erfolgreich abgeschlossen',
|
||||||
|
body: `<h2>Wiederherstellungsvorgang abgeschlossen</h2>
|
||||||
|
<p>Ein Wiederherstellungsvorgang wurde erfolgreich abgeschlossen.</p>
|
||||||
|
|
||||||
|
<h3>Details:</h3>
|
||||||
|
<ul>
|
||||||
|
<li><strong>Wiederherstellungstyp:</strong> {{restore_type}}</li>
|
||||||
|
<li><strong>Dauer:</strong> {{duration}}</li>
|
||||||
|
<li><strong>Wiederhergestellte Dateien:</strong> {{files_restored}}</li>
|
||||||
|
<li><strong>Backup-ID:</strong> {{backup_id}}</li>
|
||||||
|
<li><strong>Zeitstempel:</strong> {{timestamp}}</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<p>Bitte überprüfen Sie, ob alle Systeme nach der Wiederherstellung ordnungsgemäß funktionieren.</p>`,
|
||||||
|
language: 'de',
|
||||||
|
is_active: formatBoolean(true),
|
||||||
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'restore_failed',
|
||||||
|
subject: '❌ Wiederherstellungsvorgang fehlgeschlagen',
|
||||||
|
body: `<h2>Wiederherstellungsvorgang fehlgeschlagen</h2>
|
||||||
<p>Ein Wiederherstellungsvorgang ist fehlgeschlagen und erfordert Ihre Aufmerksamkeit.</p>
|
<p>Ein Wiederherstellungsvorgang ist fehlgeschlagen und erfordert Ihre Aufmerksamkeit.</p>
|
||||||
|
|
||||||
<h3>Details:</h3>
|
<h3>Details:</h3>
|
||||||
@@ -210,31 +221,10 @@ Bitte überprüfen Sie, ob alle Systeme nach der Wiederherstellung ordnungsgemä
|
|||||||
<p>Bitte überprüfen Sie die Systemprotokolle für weitere Details und ergreifen Sie entsprechende Maßnahmen.</p>
|
<p>Bitte überprüfen Sie die Systemprotokolle für weitere Details und ergreifen Sie entsprechende Maßnahmen.</p>
|
||||||
|
|
||||||
<p><strong>Wichtig:</strong> Falls ein Backup vor der Wiederherstellung erstellt wurde, kann es zur Wiederherstellung verwendet werden.</p>`,
|
<p><strong>Wichtig:</strong> Falls ein Backup vor der Wiederherstellung erstellt wurde, kann es zur Wiederherstellung verwendet werden.</p>`,
|
||||||
body_text_en: `Restore Operation Failed
|
language: 'de',
|
||||||
|
is_active: formatBoolean(true),
|
||||||
A restore operation has failed and requires attention.
|
created_at: knex.fn.now(),
|
||||||
|
updated_at: knex.fn.now()
|
||||||
Details:
|
|
||||||
- Restore Type: {{restore_type}}
|
|
||||||
- Error: {{error_message}}
|
|
||||||
- Timestamp: {{timestamp}}
|
|
||||||
|
|
||||||
Please check the system logs for more details and take appropriate action.
|
|
||||||
|
|
||||||
Important: If a pre-restore backup was created, it may be used for recovery.`,
|
|
||||||
body_text_de: `Wiederherstellungsvorgang fehlgeschlagen
|
|
||||||
|
|
||||||
Ein Wiederherstellungsvorgang ist fehlgeschlagen und erfordert Ihre Aufmerksamkeit.
|
|
||||||
|
|
||||||
Details:
|
|
||||||
- Wiederherstellungstyp: {{restore_type}}
|
|
||||||
- Fehler: {{error_message}}
|
|
||||||
- Zeitstempel: {{timestamp}}
|
|
||||||
|
|
||||||
Bitte überprüfen Sie die Systemprotokolle für weitere Details und ergreifen Sie entsprechende Maßnahmen.
|
|
||||||
|
|
||||||
Wichtig: Falls ein Backup vor der Wiederherstellung erstellt wurde, kann es zur Wiederherstellung verwendet werden.`,
|
|
||||||
variables: JSON.stringify(['restore_type', 'error_message', 'timestamp'])
|
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -244,7 +234,7 @@ Wichtig: Falls ein Backup vor der Wiederherstellung erstellt wurde, kann es zur
|
|||||||
exports.down = async function(knex) {
|
exports.down = async function(knex) {
|
||||||
// Remove email templates
|
// Remove email templates
|
||||||
await knex('email_templates')
|
await knex('email_templates')
|
||||||
.whereIn('template_key', ['restore_completed', 'restore_failed'])
|
.whereIn('name', ['restore_completed', 'restore_failed'])
|
||||||
.delete();
|
.delete();
|
||||||
|
|
||||||
// Remove settings
|
// Remove settings
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// No helpers needed for boolean values
|
const { formatBoolean } = require('./helpers');
|
||||||
|
|
||||||
exports.up = async function(knex) {
|
exports.up = async function(knex) {
|
||||||
console.log('Adding gallery feedback tables...');
|
console.log('Adding gallery feedback tables...');
|
||||||
@@ -87,7 +87,8 @@ exports.up = async function(knex) {
|
|||||||
{
|
{
|
||||||
setting_key: 'feedback_notification_email',
|
setting_key: 'feedback_notification_email',
|
||||||
setting_value: JSON.stringify(''),
|
setting_value: JSON.stringify(''),
|
||||||
setting_type: 'feedback'
|
setting_type: 'feedback',
|
||||||
|
updated_at: new Date()
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
setting_key: 'feedback_rate_limits',
|
setting_key: 'feedback_rate_limits',
|
||||||
@@ -96,7 +97,8 @@ exports.up = async function(knex) {
|
|||||||
comment: { max: 20, window: 3600 }, // 20 comments per hour
|
comment: { max: 20, window: 3600 }, // 20 comments per hour
|
||||||
like: { max: 200, window: 3600 } // 200 likes per hour
|
like: { max: 200, window: 3600 } // 200 likes per hour
|
||||||
}),
|
}),
|
||||||
setting_type: 'feedback'
|
setting_type: 'feedback',
|
||||||
|
updated_at: new Date()
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,221 +0,0 @@
|
|||||||
const { db } = require('../src/database/db');
|
|
||||||
|
|
||||||
async function up() {
|
|
||||||
console.log('Enhancing backup system...');
|
|
||||||
|
|
||||||
// Add new settings to app_settings table if they don't exist
|
|
||||||
const backupSettings = [
|
|
||||||
{
|
|
||||||
setting_key: 'backup_s3_force_path_style',
|
|
||||||
setting_value: JSON.stringify(false),
|
|
||||||
setting_type: 'backup'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
setting_key: 'backup_s3_ssl_enabled',
|
|
||||||
setting_value: JSON.stringify(true),
|
|
||||||
setting_type: 'backup'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
setting_key: 'backup_s3_prefix',
|
|
||||||
setting_value: JSON.stringify(''),
|
|
||||||
setting_type: 'backup'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
setting_key: 'backup_incremental',
|
|
||||||
setting_value: JSON.stringify(false),
|
|
||||||
setting_type: 'backup'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
setting_key: 'backup_include_database',
|
|
||||||
setting_value: JSON.stringify(true),
|
|
||||||
setting_type: 'backup'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
setting_key: 'backup_encryption_enabled',
|
|
||||||
setting_value: JSON.stringify(false),
|
|
||||||
setting_type: 'backup'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
setting_key: 'backup_database_schedule',
|
|
||||||
setting_value: JSON.stringify(''),
|
|
||||||
setting_type: 'backup'
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
// Insert settings if they don't exist
|
|
||||||
for (const setting of backupSettings) {
|
|
||||||
const exists = await db('app_settings')
|
|
||||||
.where('setting_key', setting.setting_key)
|
|
||||||
.first();
|
|
||||||
|
|
||||||
if (!exists) {
|
|
||||||
await db('app_settings').insert(setting);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check and add columns to backup_runs table
|
|
||||||
const hasBackupRunsTable = await db.schema.hasTable('backup_runs');
|
|
||||||
if (hasBackupRunsTable) {
|
|
||||||
// Check for existing columns before adding
|
|
||||||
const hasManifestPath = await db.schema.hasColumn('backup_runs', 'manifest_path');
|
|
||||||
const hasManifestId = await db.schema.hasColumn('backup_runs', 'manifest_id');
|
|
||||||
const hasManifestFormat = await db.schema.hasColumn('backup_runs', 'manifest_format');
|
|
||||||
const hasParentBackupId = await db.schema.hasColumn('backup_runs', 'parent_backup_id');
|
|
||||||
const hasBackupMode = await db.schema.hasColumn('backup_runs', 'backup_mode');
|
|
||||||
|
|
||||||
if (!hasManifestPath || !hasManifestId || !hasManifestFormat || !hasParentBackupId || !hasBackupMode) {
|
|
||||||
await db.schema.alterTable('backup_runs', (table) => {
|
|
||||||
if (!hasManifestPath) {
|
|
||||||
table.string('manifest_path', 500).comment('Path to backup manifest file');
|
|
||||||
}
|
|
||||||
if (!hasManifestId) {
|
|
||||||
table.uuid('manifest_id').comment('Unique identifier for the manifest');
|
|
||||||
}
|
|
||||||
if (!hasManifestFormat) {
|
|
||||||
table.enum('manifest_format', ['json', 'yaml']).comment('Format of the manifest file');
|
|
||||||
}
|
|
||||||
if (!hasParentBackupId) {
|
|
||||||
table.integer('parent_backup_id').unsigned().references('id').inTable('backup_runs').onDelete('SET NULL').comment('Parent backup for incremental backups');
|
|
||||||
}
|
|
||||||
if (!hasBackupMode) {
|
|
||||||
table.enum('backup_mode', ['full', 'incremental', 'database']).defaultTo('full').comment('Type of backup performed');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add indexes if they don't exist
|
|
||||||
try {
|
|
||||||
await db.raw('CREATE INDEX IF NOT EXISTS idx_backup_runs_mode_status ON backup_runs(backup_mode, status)');
|
|
||||||
await db.raw('CREATE INDEX IF NOT EXISTS idx_backup_runs_parent ON backup_runs(parent_backup_id)');
|
|
||||||
await db.raw('CREATE INDEX IF NOT EXISTS idx_backup_runs_created_mode ON backup_runs(created_at, backup_mode)');
|
|
||||||
} catch (error) {
|
|
||||||
console.log('Note: Some indexes may already exist, continuing...');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create backup_manifest table if it doesn't exist
|
|
||||||
const hasManifestTable = await db.schema.hasTable('backup_manifest');
|
|
||||||
if (!hasManifestTable) {
|
|
||||||
await db.schema.createTable('backup_manifest', (table) => {
|
|
||||||
table.increments('id').primary();
|
|
||||||
table.integer('backup_run_id').unsigned().notNullable().references('id').inTable('backup_runs').onDelete('CASCADE');
|
|
||||||
table.uuid('manifest_id').notNullable().unique().comment('Unique identifier matching backup_runs.manifest_id');
|
|
||||||
table.string('version', 20).notNullable().defaultTo('1.0.0').comment('Manifest schema version');
|
|
||||||
table.enum('format', ['json', 'yaml']).notNullable().defaultTo('json');
|
|
||||||
|
|
||||||
// Backup metadata
|
|
||||||
table.timestamp('backup_start').notNullable();
|
|
||||||
table.timestamp('backup_end').notNullable();
|
|
||||||
table.bigInteger('total_size').unsigned().comment('Total size of backup in bytes');
|
|
||||||
table.integer('file_count').unsigned().comment('Number of files in backup');
|
|
||||||
table.integer('photo_count').unsigned().comment('Number of photos backed up');
|
|
||||||
table.integer('event_count').unsigned().comment('Number of events backed up');
|
|
||||||
|
|
||||||
// Incremental backup metadata
|
|
||||||
table.boolean('is_incremental').defaultTo(false);
|
|
||||||
table.uuid('parent_manifest_id').comment('Parent manifest ID for incremental backups');
|
|
||||||
table.timestamp('incremental_since').comment('Timestamp for incremental backup baseline');
|
|
||||||
|
|
||||||
// Content checksums
|
|
||||||
table.string('checksum_algorithm', 50).defaultTo('sha256').comment('Algorithm used for checksums');
|
|
||||||
table.text('manifest_checksum').comment('Checksum of the manifest file itself');
|
|
||||||
|
|
||||||
// Storage information
|
|
||||||
table.string('storage_location', 500).comment('Primary storage location (local path or S3 URI)');
|
|
||||||
table.string('storage_provider', 50).comment('Storage provider (local, s3, etc.)');
|
|
||||||
|
|
||||||
// Encryption metadata
|
|
||||||
table.boolean('is_encrypted').defaultTo(false);
|
|
||||||
table.string('encryption_algorithm', 100).comment('Encryption algorithm used');
|
|
||||||
table.string('encryption_key_id', 255).comment('ID of encryption key used');
|
|
||||||
|
|
||||||
// Additional metadata as JSON
|
|
||||||
table.json('metadata').comment('Additional metadata as JSON');
|
|
||||||
|
|
||||||
// Timestamps
|
|
||||||
table.timestamps(true, true);
|
|
||||||
|
|
||||||
// Indexes
|
|
||||||
table.index(['backup_run_id'], 'idx_manifest_backup_run');
|
|
||||||
table.index(['manifest_id'], 'idx_manifest_uuid');
|
|
||||||
table.index(['parent_manifest_id'], 'idx_manifest_parent');
|
|
||||||
table.index(['backup_start', 'backup_end'], 'idx_manifest_time_range');
|
|
||||||
table.index(['is_incremental', 'created_at'], 'idx_manifest_incremental_created');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add composite indexes for common query patterns
|
|
||||||
try {
|
|
||||||
await db.raw(`
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_backup_runs_recent_successful
|
|
||||||
ON backup_runs(created_at DESC)
|
|
||||||
WHERE status = 'completed' AND backup_mode = 'full';
|
|
||||||
`);
|
|
||||||
await db.raw(`
|
|
||||||
CREATE INDEX IF NOT EXISTS idx_backup_runs_incremental_chain
|
|
||||||
ON backup_runs(parent_backup_id, created_at)
|
|
||||||
WHERE backup_mode = 'incremental';
|
|
||||||
`);
|
|
||||||
} catch (error) {
|
|
||||||
console.log('Note: Some composite indexes may already exist, continuing...');
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('Backup system enhancements completed');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function down() {
|
|
||||||
// Drop indexes first
|
|
||||||
try {
|
|
||||||
await db.raw('DROP INDEX IF EXISTS idx_backup_runs_incremental_chain;');
|
|
||||||
await db.raw('DROP INDEX IF EXISTS idx_backup_runs_recent_successful;');
|
|
||||||
} catch (error) {
|
|
||||||
// Ignore errors if indexes don't exist
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop backup_manifest table
|
|
||||||
await db.schema.dropTableIfExists('backup_manifest');
|
|
||||||
|
|
||||||
// Remove columns from backup_runs if they exist
|
|
||||||
const hasBackupRunsTable = await db.schema.hasTable('backup_runs');
|
|
||||||
if (hasBackupRunsTable) {
|
|
||||||
const hasBackupMode = await db.schema.hasColumn('backup_runs', 'backup_mode');
|
|
||||||
const hasParentBackupId = await db.schema.hasColumn('backup_runs', 'parent_backup_id');
|
|
||||||
const hasManifestFormat = await db.schema.hasColumn('backup_runs', 'manifest_format');
|
|
||||||
const hasManifestId = await db.schema.hasColumn('backup_runs', 'manifest_id');
|
|
||||||
const hasManifestPath = await db.schema.hasColumn('backup_runs', 'manifest_path');
|
|
||||||
|
|
||||||
if (hasBackupMode || hasParentBackupId || hasManifestFormat || hasManifestId || hasManifestPath) {
|
|
||||||
await db.schema.alterTable('backup_runs', (table) => {
|
|
||||||
if (hasBackupMode) table.dropColumn('backup_mode');
|
|
||||||
if (hasParentBackupId) table.dropColumn('parent_backup_id');
|
|
||||||
if (hasManifestFormat) table.dropColumn('manifest_format');
|
|
||||||
if (hasManifestId) table.dropColumn('manifest_id');
|
|
||||||
if (hasManifestPath) table.dropColumn('manifest_path');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Drop indexes
|
|
||||||
try {
|
|
||||||
await db.raw('DROP INDEX IF EXISTS idx_backup_runs_mode_status');
|
|
||||||
await db.raw('DROP INDEX IF EXISTS idx_backup_runs_parent');
|
|
||||||
await db.raw('DROP INDEX IF EXISTS idx_backup_runs_created_mode');
|
|
||||||
} catch (error) {
|
|
||||||
// Ignore errors if indexes don't exist
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove settings
|
|
||||||
await db('app_settings')
|
|
||||||
.whereIn('setting_key', [
|
|
||||||
'backup_s3_force_path_style',
|
|
||||||
'backup_s3_ssl_enabled',
|
|
||||||
'backup_s3_prefix',
|
|
||||||
'backup_incremental',
|
|
||||||
'backup_include_database',
|
|
||||||
'backup_encryption_enabled',
|
|
||||||
'backup_database_schedule'
|
|
||||||
])
|
|
||||||
.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = { up, down };
|
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "picpeak-backend",
|
"name": "picpeak-backend",
|
||||||
"version": "1.0.93",
|
"version": "1.0.78",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "picpeak-backend",
|
"name": "picpeak-backend",
|
||||||
"version": "1.0.93",
|
"version": "1.0.78",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.850.0",
|
"@aws-sdk/client-s3": "^3.850.0",
|
||||||
"@aws-sdk/lib-storage": "^3.850.0",
|
"@aws-sdk/lib-storage": "^3.850.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "picpeak-backend",
|
"name": "picpeak-backend",
|
||||||
"version": "1.0.93",
|
"version": "1.0.78",
|
||||||
"description": "Backend for PicPeak event photo sharing platform",
|
"description": "Backend for PicPeak event photo sharing platform",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ router.post('/', adminAuth, [
|
|||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
// Validate password strength for gallery
|
// Validate password strength for gallery
|
||||||
const passwordValidation = await validatePasswordInContext(password, 'gallery', {
|
const passwordValidation = validatePasswordInContext(password, 'gallery', {
|
||||||
eventName: event_name
|
eventName: event_name
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ router.post('/', adminAuth, [
|
|||||||
} = req.body;
|
} = req.body;
|
||||||
|
|
||||||
// Validate password strength
|
// Validate password strength
|
||||||
const passwordValidation = await validatePasswordInContext(password, 'gallery', {
|
const passwordValidation = validatePasswordInContext(password, 'gallery', {
|
||||||
eventName: event_name
|
eventName: event_name
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ router.get('/events/:eventId/feedback',
|
|||||||
pagination: {
|
pagination: {
|
||||||
page: parseInt(page),
|
page: parseInt(page),
|
||||||
limit: parseInt(limit),
|
limit: parseInt(limit),
|
||||||
total: totalCount?.count || 0,
|
total: totalCount.count || 0,
|
||||||
pages: Math.ceil((totalCount?.count || 0) / limit)
|
pages: Math.ceil((totalCount.count || 0) / limit)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -182,35 +182,7 @@ router.get('/events/:eventId/feedback-analytics',
|
|||||||
const { eventId } = req.params;
|
const { eventId } = req.params;
|
||||||
|
|
||||||
// Get summary statistics
|
// Get summary statistics
|
||||||
const summaryData = await feedbackService.getEventFeedbackSummary(eventId);
|
const summary = await feedbackService.getEventFeedbackSummary(eventId);
|
||||||
|
|
||||||
// Calculate average rating and other summary stats
|
|
||||||
const avgRatingResult = await db('photo_feedback')
|
|
||||||
.where('event_id', eventId)
|
|
||||||
.where('feedback_type', 'rating')
|
|
||||||
.avg('rating as average_rating')
|
|
||||||
.first();
|
|
||||||
|
|
||||||
const pendingModeration = await db('photo_feedback')
|
|
||||||
.where('event_id', eventId)
|
|
||||||
.where('feedback_type', 'comment')
|
|
||||||
.where('is_approved', false)
|
|
||||||
.where('is_hidden', false)
|
|
||||||
.count('* as count')
|
|
||||||
.first();
|
|
||||||
|
|
||||||
const summary = {
|
|
||||||
average_rating: parseFloat(avgRatingResult?.average_rating || 0),
|
|
||||||
total_ratings: summaryData.stats?.total_ratings || 0,
|
|
||||||
total_likes: summaryData.stats?.total_likes || 0,
|
|
||||||
total_comments: summaryData.stats?.total_comments || 0,
|
|
||||||
total_favorites: summaryData.stats?.total_favorites || 0,
|
|
||||||
pending_moderation: pendingModeration?.count || 0,
|
|
||||||
total_feedback: (summaryData.stats?.total_ratings || 0) +
|
|
||||||
(summaryData.stats?.total_likes || 0) +
|
|
||||||
(summaryData.stats?.total_comments || 0) +
|
|
||||||
(summaryData.stats?.total_favorites || 0)
|
|
||||||
};
|
|
||||||
|
|
||||||
// Get top-rated photos
|
// Get top-rated photos
|
||||||
const topRated = await db('photos')
|
const topRated = await db('photos')
|
||||||
|
|||||||
@@ -447,14 +447,9 @@ router.delete('/:eventId/photos/:photoId', adminAuth, async (req, res) => {
|
|||||||
if (photo.thumbnail_path) {
|
if (photo.thumbnail_path) {
|
||||||
const thumbPath = path.join(storagePath, 'events/active', photo.thumbnail_path);
|
const thumbPath = path.join(storagePath, 'events/active', photo.thumbnail_path);
|
||||||
try {
|
try {
|
||||||
// Check if file exists before attempting to delete
|
|
||||||
await fs.access(thumbPath);
|
|
||||||
await fs.unlink(thumbPath);
|
await fs.unlink(thumbPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Only log if it's not a "file not found" error
|
console.error('Error deleting thumbnail:', error);
|
||||||
if (error.code !== 'ENOENT') {
|
|
||||||
console.error('Error deleting thumbnail:', error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,14 +534,9 @@ router.post('/:eventId/photos/bulk-delete', adminAuth, async (req, res) => {
|
|||||||
if (photo.thumbnail_path) {
|
if (photo.thumbnail_path) {
|
||||||
const thumbPath = path.join(storagePath, photo.thumbnail_path);
|
const thumbPath = path.join(storagePath, photo.thumbnail_path);
|
||||||
try {
|
try {
|
||||||
// Check if file exists before attempting to delete
|
|
||||||
await fs.access(thumbPath);
|
|
||||||
await fs.unlink(thumbPath);
|
await fs.unlink(thumbPath);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// Only log if it's not a "file not found" error
|
console.error('Error deleting thumbnail:', error);
|
||||||
if (error.code !== 'ENOENT') {
|
|
||||||
console.error('Error deleting thumbnail:', error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ router.get('/', async (req, res) => {
|
|||||||
theme_config: settingsObject.theme_config || null,
|
theme_config: settingsObject.theme_config || null,
|
||||||
default_language: settingsObject.general_default_language || 'en',
|
default_language: settingsObject.general_default_language || 'en',
|
||||||
enable_analytics: settingsObject.general_enable_analytics !== false,
|
enable_analytics: settingsObject.general_enable_analytics !== false,
|
||||||
general_date_format: settingsObject.general_date_format || 'PPP',
|
|
||||||
enable_recaptcha: settingsObject.security_enable_recaptcha === true || settingsObject.security_enable_recaptcha === 'true',
|
enable_recaptcha: settingsObject.security_enable_recaptcha === true || settingsObject.security_enable_recaptcha === 'true',
|
||||||
recaptcha_site_key: settingsObject.security_recaptcha_site_key || null,
|
recaptcha_site_key: settingsObject.security_recaptcha_site_key || null,
|
||||||
maintenance_mode: settingsObject.general_maintenance_mode === true || settingsObject.general_maintenance_mode === 'true',
|
maintenance_mode: settingsObject.general_maintenance_mode === true || settingsObject.general_maintenance_mode === 'true',
|
||||||
|
|||||||
@@ -1,163 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Script to clean git history - removes all commits before July 17, 2025
|
|
||||||
# Safe version: Moves current main to main-old and creates new clean main
|
|
||||||
# WARNING: This will rewrite history!
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "⚠️ WARNING: This script will rewrite git history!"
|
|
||||||
echo "⚠️ All commits before July 17, 2025 will be removed."
|
|
||||||
echo "⚠️ Current main branch will be preserved as main-old"
|
|
||||||
echo ""
|
|
||||||
read -p "Are you sure you want to continue? (type 'yes' to proceed): " confirmation
|
|
||||||
|
|
||||||
if [ "$confirmation" != "yes" ]; then
|
|
||||||
echo "Operation cancelled."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check current state
|
|
||||||
CURRENT_BRANCH=$(git branch --show-current)
|
|
||||||
echo "Current branch: $CURRENT_BRANCH"
|
|
||||||
|
|
||||||
# Check if we're in the middle of a cherry-pick or rebase
|
|
||||||
if [ -d ".git/CHERRY_PICK_HEAD" ] || [ -d ".git/rebase-merge" ] || [ -d ".git/rebase-apply" ]; then
|
|
||||||
echo "ERROR: You're in the middle of a cherry-pick or rebase. Please resolve or abort it first."
|
|
||||||
echo "To abort cherry-pick: git cherry-pick --abort"
|
|
||||||
echo "To abort rebase: git rebase --abort"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean any previous attempts
|
|
||||||
echo "Cleaning up any previous attempts..."
|
|
||||||
git cherry-pick --abort 2>/dev/null || true
|
|
||||||
git rebase --abort 2>/dev/null || true
|
|
||||||
|
|
||||||
# Check if main-old already exists
|
|
||||||
if git show-ref --verify --quiet refs/heads/main-old; then
|
|
||||||
echo ""
|
|
||||||
echo "⚠️ Branch 'main-old' already exists!"
|
|
||||||
echo "Options:"
|
|
||||||
echo "1. Delete it and continue (previous backup will be lost)"
|
|
||||||
echo "2. Rename it with timestamp and continue"
|
|
||||||
echo "3. Cancel operation"
|
|
||||||
read -p "Choose option (1/2/3): " option
|
|
||||||
|
|
||||||
case $option in
|
|
||||||
1)
|
|
||||||
echo "Deleting existing main-old branch..."
|
|
||||||
git branch -D main-old
|
|
||||||
;;
|
|
||||||
2)
|
|
||||||
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
|
||||||
NEW_NAME="main-old-${TIMESTAMP}"
|
|
||||||
echo "Renaming existing main-old to ${NEW_NAME}..."
|
|
||||||
git branch -m main-old "${NEW_NAME}"
|
|
||||||
;;
|
|
||||||
3)
|
|
||||||
echo "Operation cancelled."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Invalid option. Operation cancelled."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Make sure we're on main branch
|
|
||||||
if [ "$CURRENT_BRANCH" != "main" ]; then
|
|
||||||
echo "Switching to main branch..."
|
|
||||||
git checkout main
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Move current main to main-old
|
|
||||||
echo "Moving current main branch to main-old..."
|
|
||||||
git branch -m main main-old
|
|
||||||
|
|
||||||
# Find the first commit on or after July 17, 2025
|
|
||||||
echo "Finding first commit after July 17, 2025..."
|
|
||||||
FIRST_COMMIT=$(git log --since="2025-07-17" --reverse --format="%H" | head -1)
|
|
||||||
|
|
||||||
if [ -z "$FIRST_COMMIT" ]; then
|
|
||||||
echo "ERROR: No commits found after July 17, 2025"
|
|
||||||
# Restore main branch
|
|
||||||
git branch -m main-old main
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "First commit to keep: $FIRST_COMMIT"
|
|
||||||
echo "Commit details: $(git log --oneline -1 $FIRST_COMMIT)"
|
|
||||||
|
|
||||||
# Count total commits to process
|
|
||||||
TOTAL_COMMITS=$(git log --since="2025-07-17" --oneline | wc -l)
|
|
||||||
echo "Total commits to preserve: $TOTAL_COMMITS"
|
|
||||||
|
|
||||||
# Create new orphan branch for clean main
|
|
||||||
echo "Creating new clean main branch..."
|
|
||||||
git checkout --orphan main
|
|
||||||
|
|
||||||
# Clean the working directory
|
|
||||||
git rm -rf . || true
|
|
||||||
|
|
||||||
# Get the tree from the first commit
|
|
||||||
git checkout $FIRST_COMMIT -- .
|
|
||||||
|
|
||||||
# Create new initial commit with same content
|
|
||||||
ORIGINAL_MESSAGE=$(git log --format="%B" -1 $FIRST_COMMIT)
|
|
||||||
ORIGINAL_AUTHOR=$(git log --format="%an <%ae>" -1 $FIRST_COMMIT)
|
|
||||||
ORIGINAL_DATE=$(git log --format="%ad" -1 $FIRST_COMMIT)
|
|
||||||
|
|
||||||
GIT_AUTHOR_NAME=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f1 | xargs)
|
|
||||||
GIT_AUTHOR_EMAIL=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f2 | cut -d'>' -f1)
|
|
||||||
GIT_AUTHOR_DATE="$ORIGINAL_DATE"
|
|
||||||
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
|
|
||||||
|
|
||||||
git add -A
|
|
||||||
git commit -m "Initial commit - Project start (July 17, 2025)
|
|
||||||
|
|
||||||
Original: $ORIGINAL_MESSAGE"
|
|
||||||
|
|
||||||
# Now rebase the rest of the history onto the new main
|
|
||||||
echo "Rebasing remaining commits..."
|
|
||||||
echo "This will linearize the history (merge commits will be flattened)..."
|
|
||||||
|
|
||||||
# Use rebase to apply all commits
|
|
||||||
git rebase --onto main $FIRST_COMMIT main-old || {
|
|
||||||
echo ""
|
|
||||||
echo "⚠️ Rebase encountered conflicts!"
|
|
||||||
echo ""
|
|
||||||
echo "To resolve:"
|
|
||||||
echo "1. Fix the conflicts in the listed files"
|
|
||||||
echo "2. Stage the resolved files: git add <files>"
|
|
||||||
echo "3. Continue rebase: git rebase --continue"
|
|
||||||
echo "4. If you want to abort and restore: git rebase --abort && git branch -D main && git branch -m main-old main"
|
|
||||||
echo ""
|
|
||||||
echo "After successful rebase, your main branch will have the clean history."
|
|
||||||
echo "The old history is preserved in main-old branch."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# If we get here, rebase was successful
|
|
||||||
echo ""
|
|
||||||
echo "✅ New clean history created successfully!"
|
|
||||||
echo "Total commits in new history: $(git rev-list --count HEAD)"
|
|
||||||
echo ""
|
|
||||||
echo "Branch status:"
|
|
||||||
echo " - main: Clean history starting from July 17, 2025"
|
|
||||||
echo " - main-old: Original history with all commits"
|
|
||||||
echo ""
|
|
||||||
echo "To push the new history to remote, run:"
|
|
||||||
echo " git push origin main --force"
|
|
||||||
echo ""
|
|
||||||
echo "To also push the old history backup:"
|
|
||||||
echo " git push origin main-old"
|
|
||||||
echo ""
|
|
||||||
echo "⚠️ WARNING: Force pushing will overwrite the remote repository!"
|
|
||||||
echo "⚠️ Make sure all team members are aware before pushing!"
|
|
||||||
echo ""
|
|
||||||
echo "If you need to restore the original history:"
|
|
||||||
echo " git checkout main-old"
|
|
||||||
echo " git branch -D main"
|
|
||||||
echo " git branch -m main"
|
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Script to clean git history - removes all commits before July 17, 2025
|
|
||||||
# Version 2: Handles merge commits properly
|
|
||||||
# WARNING: This is destructive and will rewrite history!
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "⚠️ WARNING: This script will permanently rewrite git history!"
|
|
||||||
echo "⚠️ All commits before July 17, 2025 will be removed."
|
|
||||||
echo "⚠️ This action cannot be undone!"
|
|
||||||
echo ""
|
|
||||||
read -p "Are you sure you want to continue? (type 'yes' to proceed): " confirmation
|
|
||||||
|
|
||||||
if [ "$confirmation" != "yes" ]; then
|
|
||||||
echo "Operation cancelled."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Check current state
|
|
||||||
CURRENT_BRANCH=$(git branch --show-current)
|
|
||||||
echo "Current branch: $CURRENT_BRANCH"
|
|
||||||
|
|
||||||
# Check if we're in the middle of a cherry-pick
|
|
||||||
if [ -d ".git/CHERRY_PICK_HEAD" ]; then
|
|
||||||
echo "ERROR: You're in the middle of a cherry-pick. Please resolve or abort it first."
|
|
||||||
echo "To abort: git cherry-pick --abort"
|
|
||||||
echo "To continue: git cherry-pick --continue"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean any previous attempts
|
|
||||||
echo "Cleaning up any previous attempts..."
|
|
||||||
git cherry-pick --abort 2>/dev/null || true
|
|
||||||
git checkout main 2>/dev/null || true
|
|
||||||
git branch -D new-main 2>/dev/null || true
|
|
||||||
|
|
||||||
# Create backup branch
|
|
||||||
echo "Creating backup branch..."
|
|
||||||
BACKUP_BRANCH="backup-before-cleanup-$(date +%Y%m%d-%H%M%S)"
|
|
||||||
git checkout -b "$BACKUP_BRANCH"
|
|
||||||
git checkout main
|
|
||||||
|
|
||||||
# Find the first commit on or after July 17, 2025
|
|
||||||
echo "Finding first commit after July 17, 2025..."
|
|
||||||
FIRST_COMMIT=$(git log --since="2025-07-17" --reverse --format="%H" | head -1)
|
|
||||||
|
|
||||||
if [ -z "$FIRST_COMMIT" ]; then
|
|
||||||
echo "ERROR: No commits found after July 17, 2025"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "First commit to keep: $FIRST_COMMIT"
|
|
||||||
echo "Commit details: $(git log --oneline -1 $FIRST_COMMIT)"
|
|
||||||
|
|
||||||
# Count total commits to process
|
|
||||||
TOTAL_COMMITS=$(git log --since="2025-07-17" --oneline | wc -l)
|
|
||||||
echo "Total commits to preserve: $TOTAL_COMMITS"
|
|
||||||
|
|
||||||
# Create new orphan branch
|
|
||||||
echo "Creating new clean history..."
|
|
||||||
git checkout --orphan new-main
|
|
||||||
|
|
||||||
# Clean the working directory
|
|
||||||
git rm -rf . || true
|
|
||||||
|
|
||||||
# Get the tree from the first commit
|
|
||||||
git checkout $FIRST_COMMIT -- .
|
|
||||||
|
|
||||||
# Create new initial commit with same content
|
|
||||||
ORIGINAL_MESSAGE=$(git log --format="%B" -1 $FIRST_COMMIT)
|
|
||||||
ORIGINAL_AUTHOR=$(git log --format="%an <%ae>" -1 $FIRST_COMMIT)
|
|
||||||
ORIGINAL_DATE=$(git log --format="%ad" -1 $FIRST_COMMIT)
|
|
||||||
|
|
||||||
GIT_AUTHOR_NAME=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f1 | xargs)
|
|
||||||
GIT_AUTHOR_EMAIL=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f2 | cut -d'>' -f1)
|
|
||||||
GIT_AUTHOR_DATE="$ORIGINAL_DATE"
|
|
||||||
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
|
|
||||||
|
|
||||||
git add -A
|
|
||||||
git commit -m "Initial commit - Project start (July 17, 2025)
|
|
||||||
|
|
||||||
Original: $ORIGINAL_MESSAGE"
|
|
||||||
|
|
||||||
# Now we'll use git rebase instead of cherry-pick to handle merges better
|
|
||||||
echo "Rebasing remaining commits..."
|
|
||||||
echo "This will linearize the history (merge commits will be flattened)..."
|
|
||||||
|
|
||||||
# Get the commit range
|
|
||||||
LAST_COMMIT=$(git rev-parse main)
|
|
||||||
|
|
||||||
# Use rebase to apply all commits
|
|
||||||
git rebase --onto new-main $FIRST_COMMIT main || {
|
|
||||||
echo ""
|
|
||||||
echo "⚠️ Rebase encountered conflicts!"
|
|
||||||
echo ""
|
|
||||||
echo "To resolve:"
|
|
||||||
echo "1. Fix the conflicts in the listed files"
|
|
||||||
echo "2. Stage the resolved files: git add <files>"
|
|
||||||
echo "3. Continue rebase: git rebase --continue"
|
|
||||||
echo "4. If you want to abort: git rebase --abort"
|
|
||||||
echo ""
|
|
||||||
echo "After successful rebase, run:"
|
|
||||||
echo " git branch -D main"
|
|
||||||
echo " git branch -m main"
|
|
||||||
echo " git push origin main --force"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# If we get here, rebase was successful
|
|
||||||
echo ""
|
|
||||||
echo "✅ New history created successfully!"
|
|
||||||
echo "Total commits in new history: $(git rev-list --count HEAD)"
|
|
||||||
echo ""
|
|
||||||
echo "Your backup branch is: $BACKUP_BRANCH"
|
|
||||||
echo ""
|
|
||||||
echo "To finalize the cleanup, run these commands:"
|
|
||||||
echo " git branch -D main"
|
|
||||||
echo " git branch -m main"
|
|
||||||
echo " git push origin main --force"
|
|
||||||
echo ""
|
|
||||||
echo "⚠️ WARNING: Force pushing will overwrite the remote repository!"
|
|
||||||
echo "⚠️ Make sure you have a backup and all team members are aware!"
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Script to clean git history - removes all commits before July 17, 2025
|
|
||||||
# WARNING: This is destructive and will rewrite history!
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "⚠️ WARNING: This script will permanently rewrite git history!"
|
|
||||||
echo "⚠️ All commits before July 17, 2025 will be removed."
|
|
||||||
echo "⚠️ This action cannot be undone!"
|
|
||||||
echo ""
|
|
||||||
read -p "Are you sure you want to continue? (type 'yes' to proceed): " confirmation
|
|
||||||
|
|
||||||
if [ "$confirmation" != "yes" ]; then
|
|
||||||
echo "Operation cancelled."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create backup branch
|
|
||||||
echo "Creating backup branch..."
|
|
||||||
git checkout -b backup-before-cleanup-$(date +%Y%m%d-%H%M%S)
|
|
||||||
git checkout main
|
|
||||||
|
|
||||||
# Find the first commit on or after July 17, 2025
|
|
||||||
echo "Finding first commit after July 17, 2025..."
|
|
||||||
FIRST_COMMIT=$(git log --since="2025-07-17" --reverse --format="%H" | head -1)
|
|
||||||
|
|
||||||
if [ -z "$FIRST_COMMIT" ]; then
|
|
||||||
echo "ERROR: No commits found after July 17, 2025"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "First commit to keep: $FIRST_COMMIT"
|
|
||||||
echo "Commit details: $(git log --oneline -1 $FIRST_COMMIT)"
|
|
||||||
|
|
||||||
# Get all commits we want to keep
|
|
||||||
COMMITS_TO_KEEP=$(git log --since="2025-07-17" --reverse --format="%H")
|
|
||||||
COMMIT_COUNT=$(echo "$COMMITS_TO_KEEP" | wc -l)
|
|
||||||
echo "Total commits to preserve: $COMMIT_COUNT"
|
|
||||||
|
|
||||||
# Create new orphan branch
|
|
||||||
echo "Creating new clean history..."
|
|
||||||
git checkout --orphan new-main
|
|
||||||
|
|
||||||
# Clean the working directory
|
|
||||||
git rm -rf . || true
|
|
||||||
|
|
||||||
# Get the tree from the first commit
|
|
||||||
git checkout $FIRST_COMMIT -- .
|
|
||||||
|
|
||||||
# Create new initial commit with same content but new message
|
|
||||||
ORIGINAL_MESSAGE=$(git log --format="%B" -1 $FIRST_COMMIT)
|
|
||||||
ORIGINAL_AUTHOR=$(git log --format="%an <%ae>" -1 $FIRST_COMMIT)
|
|
||||||
ORIGINAL_DATE=$(git log --format="%ad" -1 $FIRST_COMMIT)
|
|
||||||
|
|
||||||
GIT_AUTHOR_NAME=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f1 | xargs)
|
|
||||||
GIT_AUTHOR_EMAIL=$(echo "$ORIGINAL_AUTHOR" | cut -d'<' -f2 | cut -d'>' -f1)
|
|
||||||
GIT_AUTHOR_DATE="$ORIGINAL_DATE"
|
|
||||||
export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
|
|
||||||
|
|
||||||
git add -A
|
|
||||||
git commit -m "Initial commit - Project start (July 17, 2025)
|
|
||||||
|
|
||||||
Original: $ORIGINAL_MESSAGE"
|
|
||||||
|
|
||||||
# Cherry-pick remaining commits
|
|
||||||
echo "Applying remaining commits..."
|
|
||||||
REMAINING_COMMITS=$(git log --since="2025-07-17" --reverse --format="%H" $FIRST_COMMIT..main)
|
|
||||||
|
|
||||||
if [ -n "$REMAINING_COMMITS" ]; then
|
|
||||||
for commit in $REMAINING_COMMITS; do
|
|
||||||
echo "Applying: $(git log --oneline -1 $commit)"
|
|
||||||
git cherry-pick $commit || {
|
|
||||||
echo "ERROR: Failed to cherry-pick $commit"
|
|
||||||
echo "You may need to resolve conflicts and continue manually"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
echo "✅ New history created successfully!"
|
|
||||||
echo "Total commits in new history: $(git rev-list --count HEAD)"
|
|
||||||
echo ""
|
|
||||||
echo "To finalize the cleanup, run these commands:"
|
|
||||||
echo " git branch -D main"
|
|
||||||
echo " git branch -m main"
|
|
||||||
echo " git push origin main --force"
|
|
||||||
echo ""
|
|
||||||
echo "⚠️ WARNING: Force pushing will overwrite the remote repository!"
|
|
||||||
echo "⚠️ Make sure you have a backup and all team members are aware!"
|
|
||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "picpeak-frontend",
|
"name": "picpeak-frontend",
|
||||||
"version": "1.0.93",
|
"version": "1.0.78",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "picpeak-frontend",
|
"name": "picpeak-frontend",
|
||||||
"version": "1.0.93",
|
"version": "1.0.78",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@tanstack/react-query": "^5.0.0",
|
"@tanstack/react-query": "^5.0.0",
|
||||||
"@tiptap/extension-character-count": "^2.26.1",
|
"@tiptap/extension-character-count": "^2.26.1",
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "picpeak-frontend",
|
"name": "picpeak-frontend",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "1.0.93",
|
"version": "1.0.78",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
EventsListPage,
|
EventsListPage,
|
||||||
CreateEventPageEnhanced as CreateEventPage,
|
CreateEventPageEnhanced as CreateEventPage,
|
||||||
EventDetailsPage,
|
EventDetailsPage,
|
||||||
EventFeedbackPage,
|
|
||||||
EmailConfigPage,
|
EmailConfigPage,
|
||||||
ArchivesPage,
|
ArchivesPage,
|
||||||
AnalyticsPage,
|
AnalyticsPage,
|
||||||
@@ -121,7 +120,6 @@ function App() {
|
|||||||
<Route path="events" element={<EventsListPage />} />
|
<Route path="events" element={<EventsListPage />} />
|
||||||
<Route path="events/new" element={<CreateEventPage />} />
|
<Route path="events/new" element={<CreateEventPage />} />
|
||||||
<Route path="events/:id" element={<EventDetailsPage />} />
|
<Route path="events/:id" element={<EventDetailsPage />} />
|
||||||
<Route path="events/:id/feedback" element={<EventFeedbackPage />} />
|
|
||||||
<Route path="archives" element={<ArchivesPage />} />
|
<Route path="archives" element={<ArchivesPage />} />
|
||||||
<Route path="email" element={<EmailConfigPage />} />
|
<Route path="email" element={<EmailConfigPage />} />
|
||||||
<Route path="analytics" element={<AnalyticsPage />} />
|
<Route path="analytics" element={<AnalyticsPage />} />
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
|
|||||||
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
|
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
|
||||||
const [isSelectionMode, setIsSelectionMode] = useState(false);
|
const [isSelectionMode, setIsSelectionMode] = useState(false);
|
||||||
const [isDeleting, setIsDeleting] = useState(false);
|
const [isDeleting, setIsDeleting] = useState(false);
|
||||||
const [deletingPhotos, setDeletingPhotos] = useState<Set<number>>(new Set());
|
const [deletingPhotoId, setDeletingPhotoId] = useState<number | null>(null);
|
||||||
|
|
||||||
const handlePhotoSelect = (photoId: number, e?: React.MouseEvent) => {
|
const handlePhotoSelect = (photoId: number, e?: React.MouseEvent) => {
|
||||||
if (e) {
|
if (e) {
|
||||||
@@ -54,18 +54,15 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
setDeletingPhotos(prev => new Set(prev).add(photo.id));
|
setDeletingPhotoId(photo.id);
|
||||||
try {
|
try {
|
||||||
await photosService.deletePhoto(eventId, photo.id);
|
await photosService.deletePhoto(eventId, photo.id);
|
||||||
toast.success('Photo deleted successfully');
|
toast.success('Photo deleted successfully');
|
||||||
onPhotosDeleted();
|
onPhotosDeleted();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error('Failed to delete photo');
|
toast.error('Failed to delete photo');
|
||||||
setDeletingPhotos(prev => {
|
} finally {
|
||||||
const newSet = new Set(prev);
|
setDeletingPhotoId(null);
|
||||||
newSet.delete(photo.id);
|
|
||||||
return newSet;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -78,18 +75,14 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setIsDeleting(true);
|
setIsDeleting(true);
|
||||||
const selectedIds = Array.from(selectedPhotos);
|
|
||||||
setDeletingPhotos(new Set(selectedIds));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await photosService.deletePhotos(eventId, selectedIds);
|
await photosService.deletePhotos(eventId, Array.from(selectedPhotos));
|
||||||
toast.success(`${count} photo${count > 1 ? 's' : ''} deleted successfully`);
|
toast.success(`${count} photo${count > 1 ? 's' : ''} deleted successfully`);
|
||||||
setSelectedPhotos(new Set());
|
setSelectedPhotos(new Set());
|
||||||
setIsSelectionMode(false);
|
setIsSelectionMode(false);
|
||||||
onPhotosDeleted();
|
onPhotosDeleted();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error('Failed to delete photos');
|
toast.error('Failed to delete photos');
|
||||||
setDeletingPhotos(new Set());
|
|
||||||
} finally {
|
} finally {
|
||||||
setIsDeleting(false);
|
setIsDeleting(false);
|
||||||
}
|
}
|
||||||
@@ -162,15 +155,13 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
|
|||||||
|
|
||||||
{/* Photo Grid */}
|
{/* Photo Grid */}
|
||||||
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4">
|
<div className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-4">
|
||||||
{photos.map((photo, index) => {
|
{photos.map((photo, index) => (
|
||||||
const isDeleting = deletingPhotos.has(photo.id);
|
<div
|
||||||
return (
|
key={photo.id}
|
||||||
<div
|
className={`relative group cursor-pointer rounded-lg overflow-hidden bg-neutral-100 ${
|
||||||
key={photo.id}
|
isSelectionMode ? 'ring-2 ring-offset-2 ' + (selectedPhotos.has(photo.id) ? 'ring-primary-500' : 'ring-transparent') : ''
|
||||||
className={`relative group cursor-pointer rounded-lg overflow-hidden bg-neutral-100 transition-opacity ${
|
}`}
|
||||||
isSelectionMode ? 'ring-2 ring-offset-2 ' + (selectedPhotos.has(photo.id) ? 'ring-primary-500' : 'ring-transparent') : ''
|
onClick={() => isSelectionMode ? handlePhotoSelect(photo.id) : onPhotoClick(photo, index)}
|
||||||
} ${isDeleting ? 'opacity-50' : ''}`}
|
|
||||||
onClick={() => !isDeleting && (isSelectionMode ? handlePhotoSelect(photo.id) : onPhotoClick(photo, index))}
|
|
||||||
>
|
>
|
||||||
{/* Selection Checkbox */}
|
{/* Selection Checkbox */}
|
||||||
{isSelectionMode && (
|
{isSelectionMode && (
|
||||||
@@ -228,8 +219,8 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
|
|||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
onClick={(e) => handleDeleteSingle(photo, e)}
|
onClick={(e) => handleDeleteSingle(photo, e)}
|
||||||
className="p-1 text-white hover:bg-white/20 rounded disabled:opacity-50"
|
className="p-1 text-white hover:bg-white/20 rounded"
|
||||||
disabled={isDeleting}
|
disabled={deletingPhotoId === photo.id}
|
||||||
>
|
>
|
||||||
<Trash2 className="w-3 h-3" />
|
<Trash2 className="w-3 h-3" />
|
||||||
</button>
|
</button>
|
||||||
@@ -247,8 +238,7 @@ export const AdminPhotoGrid: React.FC<AdminPhotoGridProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
))}
|
||||||
})}
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{photos.length === 0 && (
|
{photos.length === 0 && (
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import {
|
import {
|
||||||
Save,
|
Save,
|
||||||
Server,
|
Server,
|
||||||
@@ -12,7 +11,7 @@ import {
|
|||||||
Info,
|
Info,
|
||||||
Eye,
|
Eye,
|
||||||
EyeOff,
|
EyeOff,
|
||||||
Wifi,
|
TestTube,
|
||||||
CheckCircle,
|
CheckCircle,
|
||||||
XCircle,
|
XCircle,
|
||||||
Loader2,
|
Loader2,
|
||||||
@@ -24,40 +23,38 @@ import {
|
|||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { Button, Card, Input } from '../common';
|
import { Button, Card, Input } from '../common';
|
||||||
|
|
||||||
export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
const destinationTypes = [
|
||||||
const { t } = useTranslation();
|
{
|
||||||
|
id: 'local',
|
||||||
const destinationTypes = [
|
name: 'Local Storage',
|
||||||
{
|
icon: HardDrive,
|
||||||
id: 'local',
|
description: 'Store backups on the local server filesystem',
|
||||||
name: t('backup.configuration.destinationTypes.local.name'),
|
fields: ['backup_destination_path']
|
||||||
icon: HardDrive,
|
},
|
||||||
description: t('backup.configuration.destinationTypes.local.description'),
|
{
|
||||||
fields: ['backup_destination_path']
|
id: 'rsync',
|
||||||
},
|
name: 'Remote Server (Rsync)',
|
||||||
{
|
icon: Server,
|
||||||
id: 'rsync',
|
description: 'Sync backups to a remote server via SSH/Rsync',
|
||||||
name: t('backup.configuration.destinationTypes.rsync.name'),
|
fields: ['backup_rsync_host', 'backup_rsync_user', 'backup_rsync_path', 'backup_rsync_ssh_key']
|
||||||
icon: Server,
|
},
|
||||||
description: t('backup.configuration.destinationTypes.rsync.description'),
|
{
|
||||||
fields: ['backup_rsync_host', 'backup_rsync_user', 'backup_rsync_path', 'backup_rsync_ssh_key']
|
id: 's3',
|
||||||
},
|
name: 'S3 Compatible Storage',
|
||||||
{
|
icon: Cloud,
|
||||||
id: 's3',
|
description: 'Store backups in Amazon S3 or compatible object storage',
|
||||||
name: t('backup.configuration.destinationTypes.s3.name'),
|
fields: ['backup_s3_endpoint', 'backup_s3_bucket', 'backup_s3_access_key', 'backup_s3_secret_key', 'backup_s3_region']
|
||||||
icon: Cloud,
|
}
|
||||||
description: t('backup.configuration.destinationTypes.s3.description'),
|
];
|
||||||
fields: ['backup_s3_endpoint', 'backup_s3_bucket', 'backup_s3_access_key', 'backup_s3_secret_key', 'backup_s3_region']
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
const scheduleOptions = [
|
const scheduleOptions = [
|
||||||
{ value: 'hourly', label: t('backup.configuration.schedule.options.hourly') },
|
{ value: 'hourly', label: 'Every hour' },
|
||||||
{ value: 'daily', label: t('backup.configuration.schedule.options.daily') },
|
{ value: 'daily', label: 'Daily' },
|
||||||
{ value: 'weekly', label: t('backup.configuration.schedule.options.weekly') },
|
{ value: 'weekly', label: 'Weekly' },
|
||||||
{ value: 'custom', label: t('backup.configuration.schedule.options.custom') }
|
{ value: 'custom', label: 'Custom cron expression' }
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
backup_enabled: false,
|
backup_enabled: false,
|
||||||
backup_destination_type: 'local',
|
backup_destination_type: 'local',
|
||||||
@@ -124,7 +121,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (missingFields.length > 0) {
|
if (missingFields.length > 0) {
|
||||||
toast.error(t('backup.configuration.messages.requiredFields'));
|
toast.error('Please fill in all required fields');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,9 +133,9 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
try {
|
try {
|
||||||
// TODO: Implement connection test endpoint
|
// TODO: Implement connection test endpoint
|
||||||
await new Promise(resolve => setTimeout(resolve, 2000));
|
await new Promise(resolve => setTimeout(resolve, 2000));
|
||||||
toast.success(t('backup.configuration.messages.connectionSuccess'));
|
toast.success('Connection test successful!');
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
toast.error(t('backup.configuration.messages.connectionFailed') + ': ' + error.message);
|
toast.error('Connection test failed: ' + error.message);
|
||||||
} finally {
|
} finally {
|
||||||
setTestingConnection(false);
|
setTestingConnection(false);
|
||||||
}
|
}
|
||||||
@@ -152,9 +149,9 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<h3 className="text-lg font-semibold text-gray-900">{t('backup.configuration.enableBackup')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900">Backup Service</h3>
|
||||||
<p className="mt-1 text-sm text-gray-600">
|
<p className="mt-1 text-sm text-gray-600">
|
||||||
{t('backup.configuration.enableBackupHelp')}
|
Enable automatic backups to protect your data
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<label className="relative inline-flex items-center cursor-pointer">
|
<label className="relative inline-flex items-center cursor-pointer">
|
||||||
@@ -171,7 +168,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
|
|
||||||
{/* Destination Configuration */}
|
{/* Destination Configuration */}
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-4">{t('backup.configuration.destinationType')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-4">Backup Destination</h3>
|
||||||
|
|
||||||
{/* Destination Type Selection */}
|
{/* Destination Type Selection */}
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
|
||||||
@@ -206,17 +203,17 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.destinationPath')}
|
Backup Directory Path
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={formData.backup_destination_path}
|
value={formData.backup_destination_path}
|
||||||
onChange={(e) => handleChange('backup_destination_path', e.target.value)}
|
onChange={(e) => handleChange('backup_destination_path', e.target.value)}
|
||||||
placeholder={t('backup.configuration.fields.destinationPathPlaceholder')}
|
placeholder="/path/to/backup/directory"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<p className="mt-1 text-xs text-gray-500">
|
<p className="mt-1 text-xs text-gray-500">
|
||||||
{t('backup.configuration.fields.destinationPathHelp')}
|
Absolute path where backups will be stored
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -227,50 +224,50 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.rsyncHost')}
|
SSH Host
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={formData.backup_rsync_host}
|
value={formData.backup_rsync_host}
|
||||||
onChange={(e) => handleChange('backup_rsync_host', e.target.value)}
|
onChange={(e) => handleChange('backup_rsync_host', e.target.value)}
|
||||||
placeholder={t('backup.configuration.fields.rsyncHostPlaceholder')}
|
placeholder="backup.example.com"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.rsyncUser')}
|
SSH User
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={formData.backup_rsync_user}
|
value={formData.backup_rsync_user}
|
||||||
onChange={(e) => handleChange('backup_rsync_user', e.target.value)}
|
onChange={(e) => handleChange('backup_rsync_user', e.target.value)}
|
||||||
placeholder={t('backup.configuration.fields.rsyncUserPlaceholder')}
|
placeholder="backup-user"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.rsyncPath')}
|
Remote Path
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={formData.backup_rsync_path}
|
value={formData.backup_rsync_path}
|
||||||
onChange={(e) => handleChange('backup_rsync_path', e.target.value)}
|
onChange={(e) => handleChange('backup_rsync_path', e.target.value)}
|
||||||
placeholder={t('backup.configuration.fields.rsyncPathPlaceholder')}
|
placeholder="/home/backup/photo-sharing"
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.rsyncSshKey')}
|
SSH Private Key (optional)
|
||||||
</label>
|
</label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<textarea
|
<textarea
|
||||||
value={formData.backup_rsync_ssh_key}
|
value={formData.backup_rsync_ssh_key}
|
||||||
onChange={(e) => handleChange('backup_rsync_ssh_key', e.target.value)}
|
onChange={(e) => handleChange('backup_rsync_ssh_key', e.target.value)}
|
||||||
placeholder={t('backup.configuration.fields.rsyncSshKeyPlaceholder')}
|
placeholder="-----BEGIN RSA PRIVATE KEY-----"
|
||||||
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-primary focus:border-primary font-mono text-sm"
|
className="w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-primary focus:border-primary font-mono text-sm"
|
||||||
rows={4}
|
rows={4}
|
||||||
/>
|
/>
|
||||||
@@ -283,7 +280,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-xs text-gray-500">
|
<p className="mt-1 text-xs text-gray-500">
|
||||||
{t('backup.configuration.fields.rsyncSshKeyHelp')}
|
Leave empty to use system SSH keys
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
@@ -293,7 +290,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<>
|
<>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.s3Endpoint')}
|
S3 Endpoint URL
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -303,13 +300,13 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
<p className="mt-1 text-xs text-gray-500">
|
<p className="mt-1 text-xs text-gray-500">
|
||||||
{t('backup.configuration.fields.s3EndpointHelp')}
|
Use default for AWS S3, or your provider's endpoint
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.s3Bucket')}
|
Bucket Name
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -321,7 +318,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.s3Region')}
|
Region
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -334,7 +331,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.s3AccessKey')}
|
Access Key ID
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -346,7 +343,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.fields.s3SecretKey')}
|
Secret Access Key
|
||||||
</label>
|
</label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Input
|
<Input
|
||||||
@@ -382,12 +379,12 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
{testingConnection ? (
|
{testingConnection ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||||
{t('backup.configuration.testingConnection')}
|
Testing...
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Wifi className="mr-2 h-4 w-4" />
|
<TestTube className="mr-2 h-4 w-4" />
|
||||||
{t('backup.actions.testConnection')}
|
Test Connection
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -398,12 +395,12 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
|
|
||||||
{/* Schedule Configuration */}
|
{/* Schedule Configuration */}
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-4">{t('backup.configuration.schedule.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-4">Backup Schedule</h3>
|
||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.schedule.scheduleType')}
|
Schedule
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
value={formData.backup_schedule}
|
value={formData.backup_schedule}
|
||||||
@@ -421,7 +418,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
{formData.backup_schedule === 'custom' && (
|
{formData.backup_schedule === 'custom' && (
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.schedule.customCron')}
|
Cron Expression
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
@@ -430,14 +427,14 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
placeholder="0 3 * * *"
|
placeholder="0 3 * * *"
|
||||||
/>
|
/>
|
||||||
<p className="mt-1 text-xs text-gray-500">
|
<p className="mt-1 text-xs text-gray-500">
|
||||||
{t('backup.configuration.schedule.customCronHelp')}
|
Use standard cron syntax (minute hour day month weekday)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.schedule.retention')}
|
Retention Period (days)
|
||||||
</label>
|
</label>
|
||||||
<Input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
@@ -447,7 +444,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
max="365"
|
max="365"
|
||||||
/>
|
/>
|
||||||
<p className="mt-1 text-xs text-gray-500">
|
<p className="mt-1 text-xs text-gray-500">
|
||||||
{t('backup.configuration.schedule.retentionHelp')}
|
Backups older than this will be automatically deleted
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -455,7 +452,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
|
|
||||||
{/* Backup Content Selection */}
|
{/* Backup Content Selection */}
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-4">{t('backup.configuration.whatToBackup.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-4">Backup Content</h3>
|
||||||
|
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<label className="flex items-center">
|
<label className="flex items-center">
|
||||||
@@ -468,9 +465,9 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Database className="h-4 w-4 text-gray-400" />
|
<Database className="h-4 w-4 text-gray-400" />
|
||||||
<span className="text-sm font-medium text-gray-700">{t('backup.configuration.whatToBackup.database')}</span>
|
<span className="text-sm font-medium text-gray-700">Database</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-gray-500">{t('backup.configuration.whatToBackup.databaseHelp')}</p>
|
<p className="text-xs text-gray-500">All application data and settings</p>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -484,9 +481,9 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Image className="h-4 w-4 text-gray-400" />
|
<Image className="h-4 w-4 text-gray-400" />
|
||||||
<span className="text-sm font-medium text-gray-700">{t('backup.configuration.whatToBackup.photos')}</span>
|
<span className="text-sm font-medium text-gray-700">Photos</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-gray-500">{t('backup.configuration.whatToBackup.photosHelp')}</p>
|
<p className="text-xs text-gray-500">All uploaded photos and galleries</p>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -500,9 +497,9 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<FileArchive className="h-4 w-4 text-gray-400" />
|
<FileArchive className="h-4 w-4 text-gray-400" />
|
||||||
<span className="text-sm font-medium text-gray-700">{t('backup.configuration.whatToBackup.archives')}</span>
|
<span className="text-sm font-medium text-gray-700">Archives</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-gray-500">{t('backup.configuration.whatToBackup.archivesHelp')}</p>
|
<p className="text-xs text-gray-500">Expired gallery archives</p>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -516,9 +513,9 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Image className="h-4 w-4 text-gray-400" />
|
<Image className="h-4 w-4 text-gray-400" />
|
||||||
<span className="text-sm font-medium text-gray-700">{t('backup.configuration.whatToBackup.thumbnails')}</span>
|
<span className="text-sm font-medium text-gray-700">Thumbnails</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-xs text-gray-500">{t('backup.configuration.whatToBackup.thumbnailsHelp')}</p>
|
<p className="text-xs text-gray-500">Generated thumbnail images (can be regenerated)</p>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -526,7 +523,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
|
|
||||||
{/* Advanced Options */}
|
{/* Advanced Options */}
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-4">{t('backup.configuration.advancedOptions.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-4">Advanced Options</h3>
|
||||||
|
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<label className="flex items-center">
|
<label className="flex items-center">
|
||||||
@@ -537,8 +534,8 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
className="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"
|
className="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"
|
||||||
/>
|
/>
|
||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<span className="text-sm font-medium text-gray-700">{t('backup.configuration.advancedOptions.compression')}</span>
|
<span className="text-sm font-medium text-gray-700">Enable Compression</span>
|
||||||
<p className="text-xs text-gray-500">{t('backup.configuration.advancedOptions.compressionHelp')}</p>
|
<p className="text-xs text-gray-500">Reduce backup size with gzip compression</p>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
@@ -551,22 +548,22 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
className="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"
|
className="h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"
|
||||||
/>
|
/>
|
||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<span className="text-sm font-medium text-gray-700">{t('backup.configuration.advancedOptions.encryption')}</span>
|
<span className="text-sm font-medium text-gray-700">Enable Encryption</span>
|
||||||
<p className="text-xs text-gray-500">{t('backup.configuration.advancedOptions.encryptionHelp')}</p>
|
<p className="text-xs text-gray-500">Encrypt backups with AES-256</p>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
{formData.backup_encryption && (
|
{formData.backup_encryption && (
|
||||||
<div className="ml-7">
|
<div className="ml-7">
|
||||||
<label className="block text-sm font-medium text-gray-700 mb-1">
|
<label className="block text-sm font-medium text-gray-700 mb-1">
|
||||||
{t('backup.configuration.advancedOptions.encryptionPassphrase')}
|
Encryption Passphrase
|
||||||
</label>
|
</label>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<Input
|
<Input
|
||||||
type={showSecrets.encryption_passphrase ? 'text' : 'password'}
|
type={showSecrets.encryption_passphrase ? 'text' : 'password'}
|
||||||
value={formData.backup_encryption_passphrase}
|
value={formData.backup_encryption_passphrase}
|
||||||
onChange={(e) => handleChange('backup_encryption_passphrase', e.target.value)}
|
onChange={(e) => handleChange('backup_encryption_passphrase', e.target.value)}
|
||||||
placeholder={t('backup.configuration.advancedOptions.encryptionPassphraseHelp')}
|
placeholder="Enter a strong passphrase"
|
||||||
required={formData.backup_encryption}
|
required={formData.backup_encryption}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
@@ -579,7 +576,7 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
</div>
|
</div>
|
||||||
<p className="mt-1 text-xs text-red-600">
|
<p className="mt-1 text-xs text-red-600">
|
||||||
<AlertCircle className="inline h-3 w-3 mr-1" />
|
<AlertCircle className="inline h-3 w-3 mr-1" />
|
||||||
{t('backup.configuration.advancedOptions.encryptionPassphraseHelp')}
|
Store this passphrase securely! You'll need it to restore encrypted backups.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -596,12 +593,12 @@ export const BackupConfiguration = ({ config, onSave, isSaving }) => {
|
|||||||
{isSaving ? (
|
{isSaving ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||||
{t('backup.configuration.savingSettings')}
|
Saving...
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Save className="mr-2 h-4 w-4" />
|
<Save className="mr-2 h-4 w-4" />
|
||||||
{t('backup.configuration.saveSettings')}
|
Save Configuration
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import {
|
import {
|
||||||
HardDrive,
|
HardDrive,
|
||||||
Database,
|
Database,
|
||||||
@@ -47,7 +46,6 @@ const formatBytes = (bytes) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }) => {
|
export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }) => {
|
||||||
const { t } = useTranslation();
|
|
||||||
const lastBackup = status?.lastBackup;
|
const lastBackup = status?.lastBackup;
|
||||||
const statistics = lastBackup?.statistics || {};
|
const statistics = lastBackup?.statistics || {};
|
||||||
const isConfigured = config && config.backup_destination_type;
|
const isConfigured = config && config.backup_destination_type;
|
||||||
@@ -55,22 +53,22 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
|
|
||||||
// Calculate backup health score
|
// Calculate backup health score
|
||||||
const getHealthScore = () => {
|
const getHealthScore = () => {
|
||||||
if (!lastBackup) return { score: 0, status: 'critical', message: t('backup.dashboard.healthMessages.noBackups') };
|
if (!lastBackup) return { score: 0, status: 'critical', message: 'No backups found' };
|
||||||
|
|
||||||
const hoursSinceBackup = (Date.now() - new Date(lastBackup.created_at)) / (1000 * 60 * 60);
|
const hoursSinceBackup = (Date.now() - new Date(lastBackup.created_at)) / (1000 * 60 * 60);
|
||||||
|
|
||||||
if (lastBackup.status === 'failed') {
|
if (lastBackup.status === 'failed') {
|
||||||
return { score: 0, status: 'critical', message: t('backup.dashboard.healthMessages.lastBackupFailed') };
|
return { score: 0, status: 'critical', message: 'Last backup failed' };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hoursSinceBackup < 24) {
|
if (hoursSinceBackup < 24) {
|
||||||
return { score: 100, status: 'excellent', message: t('backup.dashboard.healthMessages.upToDate') };
|
return { score: 100, status: 'excellent', message: 'Backup is up to date' };
|
||||||
} else if (hoursSinceBackup < 48) {
|
} else if (hoursSinceBackup < 48) {
|
||||||
return { score: 75, status: 'good', message: t('backup.dashboard.healthMessages.recent') };
|
return { score: 75, status: 'good', message: 'Backup is recent' };
|
||||||
} else if (hoursSinceBackup < 168) { // 1 week
|
} else if (hoursSinceBackup < 168) { // 1 week
|
||||||
return { score: 50, status: 'warning', message: t('backup.dashboard.healthMessages.gettingOld') };
|
return { score: 50, status: 'warning', message: 'Backup is getting old' };
|
||||||
} else {
|
} else {
|
||||||
return { score: 25, status: 'critical', message: t('backup.dashboard.healthMessages.outdated') };
|
return { score: 25, status: 'critical', message: 'Backup is outdated' };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,10 +89,10 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
<AlertTriangle className="h-5 w-5 text-amber-400 mt-0.5" />
|
<AlertTriangle className="h-5 w-5 text-amber-400 mt-0.5" />
|
||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<h3 className="text-sm font-medium text-amber-800">
|
<h3 className="text-sm font-medium text-amber-800">
|
||||||
{t('backup.dashboard.notConfigured.title')}
|
Backup Not Configured
|
||||||
</h3>
|
</h3>
|
||||||
<p className="mt-1 text-sm text-amber-700">
|
<p className="mt-1 text-sm text-amber-700">
|
||||||
{t('backup.dashboard.notConfigured.message')}
|
Please configure backup settings in the Configuration tab before running backups.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -104,7 +102,7 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
{/* Health Score Card */}
|
{/* Health Score Card */}
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<div className="flex items-center justify-between mb-4">
|
<div className="flex items-center justify-between mb-4">
|
||||||
<h3 className="text-lg font-semibold text-gray-900">{t('backup.dashboard.health.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900">Backup Health</h3>
|
||||||
<span className={`px-3 py-1 rounded-full text-sm font-medium bg-${healthColors[health.status]}-100 text-${healthColors[health.status]}-700`}>
|
<span className={`px-3 py-1 rounded-full text-sm font-medium bg-${healthColors[health.status]}-100 text-${healthColors[health.status]}-700`}>
|
||||||
{health.status.charAt(0).toUpperCase() + health.status.slice(1)}
|
{health.status.charAt(0).toUpperCase() + health.status.slice(1)}
|
||||||
</span>
|
</span>
|
||||||
@@ -155,12 +153,12 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
{isBackupRunning ? (
|
{isBackupRunning ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||||
{t('backup.dashboard.actions.running')}
|
Running...
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Play className="mr-2 h-4 w-4" />
|
<Play className="mr-2 h-4 w-4" />
|
||||||
{t('backup.dashboard.actions.runBackupNow')}
|
Run Backup Now
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -172,23 +170,23 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
|
||||||
<StatCard
|
<StatCard
|
||||||
icon={FileArchive}
|
icon={FileArchive}
|
||||||
label={t('backup.dashboard.stats.totalBackups')}
|
label="Total Backups"
|
||||||
value={status?.totalBackups || 0}
|
value={status?.totalBackups || 0}
|
||||||
color="blue"
|
color="blue"
|
||||||
subtext={lastBackup ? `${t('backup.dashboard.stats.last')}: ${format(new Date(lastBackup.created_at), 'PP')}` : t('backup.dashboard.stats.noBackupsYet')}
|
subtext={lastBackup ? `Last: ${format(new Date(lastBackup.created_at), 'PP')}` : 'No backups yet'}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<StatCard
|
<StatCard
|
||||||
icon={HardDrive}
|
icon={HardDrive}
|
||||||
label={t('backup.dashboard.stats.backupSize')}
|
label="Backup Size"
|
||||||
value={formatBytes(statistics.total_size || 0)}
|
value={formatBytes(statistics.total_size || 0)}
|
||||||
color="green"
|
color="green"
|
||||||
subtext={`${statistics.files_processed || 0} ${t('backup.dashboard.stats.files')}`}
|
subtext={`${statistics.files_processed || 0} files`}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<StatCard
|
<StatCard
|
||||||
icon={Clock}
|
icon={Clock}
|
||||||
label={t('backup.dashboard.stats.lastDuration')}
|
label="Last Duration"
|
||||||
value={lastBackup ? `${Math.round(lastBackup.duration_seconds / 60)}m` : 'N/A'}
|
value={lastBackup ? `${Math.round(lastBackup.duration_seconds / 60)}m` : 'N/A'}
|
||||||
color="purple"
|
color="purple"
|
||||||
subtext={lastBackup ? format(new Date(lastBackup.created_at), 'p') : ''}
|
subtext={lastBackup ? format(new Date(lastBackup.created_at), 'p') : ''}
|
||||||
@@ -196,17 +194,17 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
|
|
||||||
<StatCard
|
<StatCard
|
||||||
icon={Shield}
|
icon={Shield}
|
||||||
label={t('backup.dashboard.stats.backupStatus')}
|
label="Backup Status"
|
||||||
value={isEnabled ? t('backup.dashboard.stats.active') : t('backup.dashboard.stats.inactive')}
|
value={isEnabled ? 'Active' : 'Inactive'}
|
||||||
color={isEnabled ? 'green' : 'gray'}
|
color={isEnabled ? 'green' : 'gray'}
|
||||||
subtext={config?.backup_destination_type || t('backup.dashboard.notConfigured.title')}
|
subtext={config?.backup_destination_type || 'Not configured'}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Recent Activity */}
|
{/* Recent Activity */}
|
||||||
{status?.recentBackups && status.recentBackups.length > 0 && (
|
{status?.recentBackups && status.recentBackups.length > 0 && (
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-4">{t('backup.dashboard.recentActivity.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-4">Recent Backup Activity</h3>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
{status.recentBackups.slice(0, 5).map((backup) => (
|
{status.recentBackups.slice(0, 5).map((backup) => (
|
||||||
<div key={backup.id} className="flex items-center justify-between py-3 border-b border-gray-100 last:border-0">
|
<div key={backup.id} className="flex items-center justify-between py-3 border-b border-gray-100 last:border-0">
|
||||||
@@ -220,7 +218,7 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
)}
|
)}
|
||||||
<div>
|
<div>
|
||||||
<p className="font-medium text-gray-900">
|
<p className="font-medium text-gray-900">
|
||||||
{t('backup.dashboard.backupType', { type: backup.backup_type })}
|
{backup.backup_type} backup
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-gray-500">
|
<p className="text-sm text-gray-500">
|
||||||
{format(new Date(backup.created_at), 'PPp')}
|
{format(new Date(backup.created_at), 'PPp')}
|
||||||
@@ -244,7 +242,7 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
{/* Storage Status */}
|
{/* Storage Status */}
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-6">
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-4">{t('backup.dashboard.coverage.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-4">Backup Coverage</h3>
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
@@ -254,34 +252,34 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
<span className={`px-2 py-1 rounded text-xs font-medium ${
|
<span className={`px-2 py-1 rounded text-xs font-medium ${
|
||||||
statistics.database_backed_up ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-700'
|
statistics.database_backed_up ? 'bg-green-100 text-green-700' : 'bg-gray-100 text-gray-700'
|
||||||
}`}>
|
}`}>
|
||||||
{statistics.database_backed_up ? t('backup.dashboard.coverage.included') : t('backup.dashboard.coverage.excluded')}
|
{statistics.database_backed_up ? 'Backed up' : 'Not backed up'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Image className="h-5 w-5 text-gray-400" />
|
<Image className="h-5 w-5 text-gray-400" />
|
||||||
<span className="text-gray-700">{t('backup.configuration.whatToBackup.photos')}</span>
|
<span className="text-gray-700">Photos</span>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-sm text-gray-500">
|
<span className="text-sm text-gray-500">
|
||||||
{statistics.photos_backed_up || 0} {t('common.of')} {statistics.total_photos || 0}
|
{statistics.photos_backed_up || 0} of {statistics.total_photos || 0}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<FileArchive className="h-5 w-5 text-gray-400" />
|
<FileArchive className="h-5 w-5 text-gray-400" />
|
||||||
<span className="text-gray-700">{t('backup.configuration.whatToBackup.archives')}</span>
|
<span className="text-gray-700">Archives</span>
|
||||||
</div>
|
</div>
|
||||||
<span className="text-sm text-gray-500">
|
<span className="text-sm text-gray-500">
|
||||||
{statistics.archives_backed_up || 0} {t('backup.dashboard.stats.files')}
|
{statistics.archives_backed_up || 0} files
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
|
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-4">{t('backup.dashboard.storageDestination')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-4">Destination Info</h3>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
<div className="flex items-center space-x-3">
|
<div className="flex items-center space-x-3">
|
||||||
{config?.backup_destination_type === 's3' ? (
|
{config?.backup_destination_type === 's3' ? (
|
||||||
@@ -294,8 +292,8 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
<div>
|
<div>
|
||||||
<p className="font-medium text-gray-900">
|
<p className="font-medium text-gray-900">
|
||||||
{config?.backup_destination_type
|
{config?.backup_destination_type
|
||||||
? t(`backup.configuration.destinationTypes.${config.backup_destination_type}.name`)
|
? config.backup_destination_type.toUpperCase()
|
||||||
: t('backup.dashboard.notConfigured.title')}
|
: 'Not Configured'}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-gray-500">
|
<p className="text-sm text-gray-500">
|
||||||
{config?.backup_destination_type === 's3' && config?.backup_s3_bucket
|
{config?.backup_destination_type === 's3' && config?.backup_s3_bucket
|
||||||
@@ -304,7 +302,7 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
? `Path: ${config.backup_destination_path}`
|
? `Path: ${config.backup_destination_path}`
|
||||||
: config?.backup_destination_type === 'rsync' && config?.backup_rsync_host
|
: config?.backup_destination_type === 'rsync' && config?.backup_rsync_host
|
||||||
? `Host: ${config.backup_rsync_host}`
|
? `Host: ${config.backup_rsync_host}`
|
||||||
: t('backup.dashboard.noDestinationSet')}
|
: 'No destination set'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -314,7 +312,7 @@ export const BackupDashboard = ({ status, config, onRunBackup, isBackupRunning }
|
|||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Info className="h-4 w-4 text-gray-400" />
|
<Info className="h-4 w-4 text-gray-400" />
|
||||||
<span className="text-sm text-gray-600">
|
<span className="text-sm text-gray-600">
|
||||||
{t('backup.configuration.schedule.retentionDays')} {config.backup_retention_days} {t('backup.configuration.schedule.retentionHelp').replace('days (older backups will be automatically deleted)', '')}
|
Backups retained for {config.backup_retention_days} days
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import {
|
import {
|
||||||
Download,
|
Download,
|
||||||
Eye,
|
Eye,
|
||||||
@@ -42,7 +41,6 @@ const formatBytes = (bytes) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const BackupHistory = () => {
|
export const BackupHistory = () => {
|
||||||
const { t } = useTranslation();
|
|
||||||
const [expandedRows, setExpandedRows] = useState(new Set());
|
const [expandedRows, setExpandedRows] = useState(new Set());
|
||||||
const [searchTerm, setSearchTerm] = useState('');
|
const [searchTerm, setSearchTerm] = useState('');
|
||||||
const [filterStatus, setFilterStatus] = useState('all');
|
const [filterStatus, setFilterStatus] = useState('all');
|
||||||
@@ -112,7 +110,7 @@ export const BackupHistory = () => {
|
|||||||
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" />
|
<Search className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-gray-400" />
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={t('backup.history.searchPlaceholder')}
|
placeholder="Search backups..."
|
||||||
value={searchTerm}
|
value={searchTerm}
|
||||||
onChange={(e) => setSearchTerm(e.target.value)}
|
onChange={(e) => setSearchTerm(e.target.value)}
|
||||||
className="pl-10"
|
className="pl-10"
|
||||||
@@ -151,22 +149,22 @@ export const BackupHistory = () => {
|
|||||||
<thead>
|
<thead>
|
||||||
<tr className="bg-gray-50 border-b border-gray-200">
|
<tr className="bg-gray-50 border-b border-gray-200">
|
||||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
{t('backup.history.columns.status')}
|
Status
|
||||||
</th>
|
</th>
|
||||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
{t('backup.history.columns.dateTime')}
|
Date & Time
|
||||||
</th>
|
</th>
|
||||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
{t('backup.history.columns.type')}
|
Type
|
||||||
</th>
|
</th>
|
||||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
{t('backup.history.columns.size')}
|
Size
|
||||||
</th>
|
</th>
|
||||||
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
{t('backup.history.columns.duration')}
|
Duration
|
||||||
</th>
|
</th>
|
||||||
<th className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
|
<th className="px-6 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
{t('backup.history.columns.actions')}
|
Actions
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
@@ -217,7 +215,7 @@ export const BackupHistory = () => {
|
|||||||
{formatBytes(stats.total_size || 0)}
|
{formatBytes(stats.total_size || 0)}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-xs text-gray-500">
|
<p className="text-xs text-gray-500">
|
||||||
{stats.files_processed || 0} {t('backup.dashboard.stats.files')}
|
{stats.files_processed || 0} files
|
||||||
</p>
|
</p>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
<td className="px-6 py-4 whitespace-nowrap text-sm text-gray-900">
|
||||||
@@ -230,7 +228,7 @@ export const BackupHistory = () => {
|
|||||||
<button
|
<button
|
||||||
onClick={() => toggleRowExpansion(backup.id)}
|
onClick={() => toggleRowExpansion(backup.id)}
|
||||||
className="text-gray-400 hover:text-gray-600"
|
className="text-gray-400 hover:text-gray-600"
|
||||||
title={t('backup.actions.view')}
|
title="View details"
|
||||||
>
|
>
|
||||||
{isExpanded ? <ChevronUp size={20} /> : <ChevronDown size={20} />}
|
{isExpanded ? <ChevronUp size={20} /> : <ChevronDown size={20} />}
|
||||||
</button>
|
</button>
|
||||||
@@ -238,7 +236,7 @@ export const BackupHistory = () => {
|
|||||||
<button
|
<button
|
||||||
onClick={() => window.open(`/admin/backup/download/${backup.id}`, '_blank')}
|
onClick={() => window.open(`/admin/backup/download/${backup.id}`, '_blank')}
|
||||||
className="text-gray-400 hover:text-gray-600"
|
className="text-gray-400 hover:text-gray-600"
|
||||||
title={t('backup.actions.download')}
|
title="Download backup"
|
||||||
>
|
>
|
||||||
<Download size={20} />
|
<Download size={20} />
|
||||||
</button>
|
</button>
|
||||||
@@ -246,7 +244,7 @@ export const BackupHistory = () => {
|
|||||||
<button
|
<button
|
||||||
onClick={() => handleDelete(backup)}
|
onClick={() => handleDelete(backup)}
|
||||||
className="text-gray-400 hover:text-red-600"
|
className="text-gray-400 hover:text-red-600"
|
||||||
title={t('backup.actions.delete')}
|
title="Delete backup"
|
||||||
disabled={deleteMutation.isLoading}
|
disabled={deleteMutation.isLoading}
|
||||||
>
|
>
|
||||||
<Trash2 size={20} />
|
<Trash2 size={20} />
|
||||||
@@ -262,19 +260,19 @@ export const BackupHistory = () => {
|
|||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||||
{/* Backup Details */}
|
{/* Backup Details */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<h4 className="font-medium text-gray-900">{t('backup.history.details.backupDetails')}</h4>
|
<h4 className="font-medium text-gray-900">Backup Details</h4>
|
||||||
<div className="text-sm space-y-1">
|
<div className="text-sm space-y-1">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="text-gray-500">{t('backup.history.details.destination')}:</span>
|
<span className="text-gray-500">Destination:</span>
|
||||||
<span className="text-gray-900">{backup.destination_type || 'Unknown'}</span>
|
<span className="text-gray-900">{backup.destination_type || 'Unknown'}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="text-gray-500">{t('backup.history.details.started')}:</span>
|
<span className="text-gray-500">Started:</span>
|
||||||
<span className="text-gray-900">{format(new Date(backup.created_at), 'p')}</span>
|
<span className="text-gray-900">{format(new Date(backup.created_at), 'p')}</span>
|
||||||
</div>
|
</div>
|
||||||
{backup.completed_at && (
|
{backup.completed_at && (
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="text-gray-500">{t('backup.history.details.completed')}:</span>
|
<span className="text-gray-500">Completed:</span>
|
||||||
<span className="text-gray-900">{format(new Date(backup.completed_at), 'p')}</span>
|
<span className="text-gray-900">{format(new Date(backup.completed_at), 'p')}</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -283,11 +281,11 @@ export const BackupHistory = () => {
|
|||||||
|
|
||||||
{/* Content Backed Up */}
|
{/* Content Backed Up */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<h4 className="font-medium text-gray-900">{t('backup.history.details.contentBackedUp')}</h4>
|
<h4 className="font-medium text-gray-900">Content Backed Up</h4>
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Database className={`h-4 w-4 ${stats.database_backed_up ? 'text-green-500' : 'text-gray-300'}`} />
|
<Database className={`h-4 w-4 ${stats.database_backed_up ? 'text-green-500' : 'text-gray-300'}`} />
|
||||||
<span className="text-sm text-gray-700">{t('backup.configuration.whatToBackup.database')}</span>
|
<span className="text-sm text-gray-700">Database</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Image className={`h-4 w-4 ${stats.photos_backed_up > 0 ? 'text-green-500' : 'text-gray-300'}`} />
|
<Image className={`h-4 w-4 ${stats.photos_backed_up > 0 ? 'text-green-500' : 'text-gray-300'}`} />
|
||||||
@@ -307,7 +305,7 @@ export const BackupHistory = () => {
|
|||||||
{/* Error Information */}
|
{/* Error Information */}
|
||||||
{backup.error_message && (
|
{backup.error_message && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<h4 className="font-medium text-red-900">{t('backup.history.details.errorDetails')}</h4>
|
<h4 className="font-medium text-red-900">Error Details</h4>
|
||||||
<p className="text-sm text-red-700 bg-red-50 p-2 rounded">
|
<p className="text-sm text-red-700 bg-red-50 p-2 rounded">
|
||||||
{backup.error_message}
|
{backup.error_message}
|
||||||
</p>
|
</p>
|
||||||
@@ -317,7 +315,7 @@ export const BackupHistory = () => {
|
|||||||
{/* Manifest Path */}
|
{/* Manifest Path */}
|
||||||
{backup.manifest_path && (
|
{backup.manifest_path && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<h4 className="font-medium text-gray-900">{t('backup.history.details.manifest')}</h4>
|
<h4 className="font-medium text-gray-900">Manifest</h4>
|
||||||
<p className="text-sm text-gray-600 font-mono break-all">
|
<p className="text-sm text-gray-600 font-mono break-all">
|
||||||
{backup.manifest_path}
|
{backup.manifest_path}
|
||||||
</p>
|
</p>
|
||||||
@@ -346,7 +344,7 @@ export const BackupHistory = () => {
|
|||||||
variant="secondary"
|
variant="secondary"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
{t('backup.history.pagination.previous')}
|
Previous
|
||||||
</Button>
|
</Button>
|
||||||
<Button
|
<Button
|
||||||
onClick={() => setCurrentPage(p => Math.min(pagination.pages, p + 1))}
|
onClick={() => setCurrentPage(p => Math.min(pagination.pages, p + 1))}
|
||||||
@@ -354,17 +352,17 @@ export const BackupHistory = () => {
|
|||||||
variant="secondary"
|
variant="secondary"
|
||||||
size="sm"
|
size="sm"
|
||||||
>
|
>
|
||||||
{t('backup.history.pagination.next')}
|
Next
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<div className="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
|
<div className="hidden sm:flex-1 sm:flex sm:items-center sm:justify-between">
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm text-gray-700">
|
<p className="text-sm text-gray-700">
|
||||||
{t('backup.history.pagination.showing', {
|
Showing <span className="font-medium">{(currentPage - 1) * pagination.limit + 1}</span> to{' '}
|
||||||
from: (currentPage - 1) * pagination.limit + 1,
|
<span className="font-medium">
|
||||||
to: Math.min(currentPage * pagination.limit, pagination.total),
|
{Math.min(currentPage * pagination.limit, pagination.total)}
|
||||||
total: pagination.total
|
</span>{' '}
|
||||||
})}
|
of <span className="font-medium">{pagination.total}</span> results
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
@@ -374,7 +372,7 @@ export const BackupHistory = () => {
|
|||||||
disabled={currentPage === 1}
|
disabled={currentPage === 1}
|
||||||
className="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
className="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
>
|
>
|
||||||
{t('backup.history.pagination.previous')}
|
Previous
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{[...Array(Math.min(5, pagination.pages))].map((_, i) => {
|
{[...Array(Math.min(5, pagination.pages))].map((_, i) => {
|
||||||
@@ -399,7 +397,7 @@ export const BackupHistory = () => {
|
|||||||
disabled={currentPage === pagination.pages}
|
disabled={currentPage === pagination.pages}
|
||||||
className="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
className="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"
|
||||||
>
|
>
|
||||||
{t('backup.history.pagination.next')}
|
Next
|
||||||
</button>
|
</button>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,205 +0,0 @@
|
|||||||
import React, { useState } from 'react';
|
|
||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import {
|
|
||||||
MessageSquare,
|
|
||||||
Eye,
|
|
||||||
EyeOff,
|
|
||||||
Trash2,
|
|
||||||
AlertCircle,
|
|
||||||
CheckCircle,
|
|
||||||
Clock,
|
|
||||||
User
|
|
||||||
} from 'lucide-react';
|
|
||||||
import { parseISO } from 'date-fns';
|
|
||||||
import { toast } from 'react-toastify';
|
|
||||||
|
|
||||||
import { Card, Loading, Button } from '../common';
|
|
||||||
import { feedbackService } from '../../services/feedback.service';
|
|
||||||
import { useLocalizedDate } from '../../hooks/useLocalizedDate';
|
|
||||||
|
|
||||||
interface FeedbackModerationPanelProps {
|
|
||||||
eventId: number;
|
|
||||||
className?: string;
|
|
||||||
compact?: boolean;
|
|
||||||
maxItems?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const FeedbackModerationPanel: React.FC<FeedbackModerationPanelProps> = ({
|
|
||||||
eventId,
|
|
||||||
className = '',
|
|
||||||
compact = false,
|
|
||||||
maxItems = 5
|
|
||||||
}) => {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
const { format } = useLocalizedDate();
|
|
||||||
const queryClient = useQueryClient();
|
|
||||||
const [showAll, setShowAll] = useState(false);
|
|
||||||
|
|
||||||
// Fetch pending feedback
|
|
||||||
const { data: feedbackData, isLoading } = useQuery({
|
|
||||||
queryKey: ['event-feedback-moderation', eventId],
|
|
||||||
queryFn: () => feedbackService.getEventFeedback(eventId.toString(), {
|
|
||||||
type: 'comment',
|
|
||||||
status: 'pending',
|
|
||||||
limit: showAll ? 100 : maxItems
|
|
||||||
}),
|
|
||||||
refetchInterval: 30000 // Refresh every 30 seconds
|
|
||||||
});
|
|
||||||
|
|
||||||
// Moderation mutation
|
|
||||||
const moderateMutation = useMutation({
|
|
||||||
mutationFn: ({ feedbackId, action }: { feedbackId: string; action: 'approve' | 'hide' | 'reject' }) =>
|
|
||||||
feedbackService.moderateFeedback(feedbackId, action),
|
|
||||||
onSuccess: () => {
|
|
||||||
queryClient.invalidateQueries({ queryKey: ['event-feedback-moderation', eventId] });
|
|
||||||
toast.success(t('feedback.moderationSuccess'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Delete mutation
|
|
||||||
const deleteMutation = useMutation({
|
|
||||||
mutationFn: (feedbackId: string) => feedbackService.deleteFeedback(feedbackId),
|
|
||||||
onSuccess: () => {
|
|
||||||
queryClient.invalidateQueries({ queryKey: ['event-feedback-moderation', eventId] });
|
|
||||||
toast.success(t('feedback.deleted'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (isLoading) {
|
|
||||||
return (
|
|
||||||
<Card className={className}>
|
|
||||||
<div className="p-6">
|
|
||||||
<Loading />
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const pendingComments = feedbackData?.feedback || [];
|
|
||||||
const hasPending = pendingComments.length > 0;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Card className={className}>
|
|
||||||
<div className="p-6">
|
|
||||||
<div className="flex items-center justify-between mb-4">
|
|
||||||
<h2 className="text-lg font-semibold text-neutral-900">
|
|
||||||
{t('feedback.pendingModeration', 'Pending Moderation')}
|
|
||||||
</h2>
|
|
||||||
{hasPending && (
|
|
||||||
<span className="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800">
|
|
||||||
{pendingComments.length} {t('feedback.pending', 'pending')}
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{!hasPending ? (
|
|
||||||
<div className="text-center py-8">
|
|
||||||
<CheckCircle className="w-12 h-12 text-green-500 mx-auto mb-3" />
|
|
||||||
<p className="text-neutral-600">{t('feedback.noPendingComments', 'No comments pending moderation')}</p>
|
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<div className="space-y-3">
|
|
||||||
{pendingComments.slice(0, showAll ? undefined : maxItems).map((item) => (
|
|
||||||
<div key={item.id} className="border border-neutral-200 rounded-lg p-4 hover:bg-neutral-50">
|
|
||||||
<div className="flex items-start gap-3">
|
|
||||||
<div className="flex-shrink-0">
|
|
||||||
<div className="w-10 h-10 bg-neutral-100 rounded-full flex items-center justify-center">
|
|
||||||
<User className="w-5 h-5 text-neutral-600" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex-1 min-w-0">
|
|
||||||
<div className="flex items-start justify-between gap-2">
|
|
||||||
<div className="flex-1">
|
|
||||||
<div className="flex items-center gap-2 text-sm">
|
|
||||||
<span className="font-medium text-neutral-900">
|
|
||||||
{item.guest_name || t('feedback.anonymous', 'Anonymous')}
|
|
||||||
</span>
|
|
||||||
<span className="text-neutral-500">•</span>
|
|
||||||
<span className="text-neutral-500">
|
|
||||||
{format(parseISO(item.created_at), 'MMM d, h:mm a')}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<p className="mt-1 text-sm text-neutral-700">{item.comment}</p>
|
|
||||||
{item.photo_filename && (
|
|
||||||
<p className="mt-1 text-xs text-neutral-500">
|
|
||||||
{t('feedback.onPhoto', 'On photo')}: {item.photo_filename}
|
|
||||||
</p>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* Actions */}
|
|
||||||
<div className="flex items-center gap-2 mt-3">
|
|
||||||
<Button
|
|
||||||
size="sm"
|
|
||||||
variant="ghost"
|
|
||||||
leftIcon={<CheckCircle className="w-4 h-4" />}
|
|
||||||
onClick={() => moderateMutation.mutate({
|
|
||||||
feedbackId: item.id.toString(),
|
|
||||||
action: 'approve'
|
|
||||||
})}
|
|
||||||
isLoading={moderateMutation.isPending}
|
|
||||||
>
|
|
||||||
{t('feedback.approve', 'Approve')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
size="sm"
|
|
||||||
variant="ghost"
|
|
||||||
leftIcon={<EyeOff className="w-4 h-4" />}
|
|
||||||
onClick={() => moderateMutation.mutate({
|
|
||||||
feedbackId: item.id.toString(),
|
|
||||||
action: 'hide'
|
|
||||||
})}
|
|
||||||
isLoading={moderateMutation.isPending}
|
|
||||||
>
|
|
||||||
{t('feedback.hide', 'Hide')}
|
|
||||||
</Button>
|
|
||||||
<Button
|
|
||||||
size="sm"
|
|
||||||
variant="ghost"
|
|
||||||
leftIcon={<Trash2 className="w-4 h-4" />}
|
|
||||||
onClick={() => {
|
|
||||||
if (confirm(t('feedback.confirmDelete', 'Are you sure you want to delete this comment?'))) {
|
|
||||||
deleteMutation.mutate(item.id.toString());
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
isLoading={deleteMutation.isPending}
|
|
||||||
className="text-red-600 hover:text-red-700 hover:bg-red-50"
|
|
||||||
>
|
|
||||||
{t('common.delete', 'Delete')}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
|
|
||||||
{pendingComments.length > maxItems && !showAll && (
|
|
||||||
<button
|
|
||||||
onClick={() => setShowAll(true)}
|
|
||||||
className="w-full text-center py-2 text-sm text-primary-600 hover:text-primary-700 font-medium"
|
|
||||||
>
|
|
||||||
{t('feedback.showAll', 'Show all {{count}} pending comments', { count: pendingComments.length })}
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Quick link to full feedback page */}
|
|
||||||
<div className="mt-4 pt-4 border-t border-neutral-200">
|
|
||||||
<a
|
|
||||||
href={`/admin/events/${eventId}/feedback`}
|
|
||||||
className="text-sm text-primary-600 hover:text-primary-700 font-medium flex items-center gap-1"
|
|
||||||
>
|
|
||||||
<MessageSquare className="w-4 h-4" />
|
|
||||||
{t('feedback.viewAllFeedback', 'View all feedback & settings')}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Card>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
FeedbackModerationPanel.displayName = 'FeedbackModerationPanel';
|
|
||||||
@@ -256,7 +256,7 @@ export const PhotoUpload: React.FC<PhotoUploadProps> = ({ eventId, onUploadCompl
|
|||||||
<div className="flex justify-between text-sm text-neutral-600 mb-1">
|
<div className="flex justify-between text-sm text-neutral-600 mb-1">
|
||||||
<span>
|
<span>
|
||||||
{t('upload.uploading')}
|
{t('upload.uploading')}
|
||||||
{totalChunks > 1 && ` (${t('common.chunk')} ${currentChunk}/${totalChunks})`}
|
{totalChunks > 1 && ` (${t('common.chunk') || 'Chunk'} ${currentChunk}/${totalChunks})`}
|
||||||
</span>
|
</span>
|
||||||
<span>{uploadProgress}%</span>
|
<span>{uploadProgress}%</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -268,7 +268,7 @@ export const PhotoUpload: React.FC<PhotoUploadProps> = ({ eventId, onUploadCompl
|
|||||||
</div>
|
</div>
|
||||||
{totalChunks > 1 && (
|
{totalChunks > 1 && (
|
||||||
<p className="text-xs text-neutral-500 mt-1">
|
<p className="text-xs text-neutral-500 mt-1">
|
||||||
{t('upload.uploadingChunks', { count: selectedFiles.length, total: totalChunks })}
|
{t('upload.uploadingChunks') || `Uploading ${selectedFiles.length} files in ${totalChunks} batches...`}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
import {
|
import {
|
||||||
RefreshCw,
|
RefreshCw,
|
||||||
AlertTriangle,
|
AlertTriangle,
|
||||||
@@ -29,49 +28,47 @@ import { useQuery, useMutation } from '@tanstack/react-query';
|
|||||||
import { Button, Card, Input, Loading } from '../common';
|
import { Button, Card, Input, Loading } from '../common';
|
||||||
import { api } from '../../config/api';
|
import { api } from '../../config/api';
|
||||||
|
|
||||||
export const RestoreWizard = () => {
|
const steps = [
|
||||||
const { t } = useTranslation();
|
{ id: 'source', title: 'Select Source' },
|
||||||
const [currentStep, setCurrentStep] = useState(0);
|
{ id: 'backup', title: 'Choose Backup' },
|
||||||
|
{ id: 'options', title: 'Restore Options' },
|
||||||
const steps = [
|
{ id: 'confirm', title: 'Review & Confirm' },
|
||||||
{ id: 'source', title: t('backup.restore.steps.selectSource') },
|
{ id: 'progress', title: 'Restore Progress' }
|
||||||
{ id: 'backup', title: t('backup.restore.steps.chooseBackup') },
|
];
|
||||||
{ id: 'options', title: t('backup.restore.steps.restoreOptions') },
|
|
||||||
{ id: 'confirm', title: t('backup.restore.steps.reviewConfirm') },
|
|
||||||
{ id: 'progress', title: t('backup.restore.steps.restoreProgress') }
|
|
||||||
];
|
|
||||||
|
|
||||||
const restoreTypes = [
|
const restoreTypes = [
|
||||||
{
|
{
|
||||||
id: 'full',
|
id: 'full',
|
||||||
name: t('backup.restore.restoreTypes.full.name'),
|
name: 'Full Restore',
|
||||||
description: t('backup.restore.restoreTypes.full.description'),
|
description: 'Restore everything including database, photos, and archives',
|
||||||
icon: RefreshCw,
|
icon: RefreshCw,
|
||||||
warning: t('backup.restore.restoreTypes.full.warning')
|
warning: 'This will replace all current data'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'database',
|
id: 'database',
|
||||||
name: t('backup.restore.restoreTypes.database.name'),
|
name: 'Database Only',
|
||||||
description: t('backup.restore.restoreTypes.database.description'),
|
description: 'Restore only the database (settings, events, users)',
|
||||||
icon: Database,
|
icon: Database,
|
||||||
warning: t('backup.restore.restoreTypes.database.warning')
|
warning: 'Current database will be replaced'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'files',
|
id: 'files',
|
||||||
name: t('backup.restore.restoreTypes.files.name'),
|
name: 'Files Only',
|
||||||
description: t('backup.restore.restoreTypes.files.description'),
|
description: 'Restore only photos and archives',
|
||||||
icon: Image,
|
icon: Image,
|
||||||
warning: t('backup.restore.restoreTypes.files.warning')
|
warning: 'Existing files may be overwritten'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'selective',
|
id: 'selective',
|
||||||
name: t('backup.restore.restoreTypes.selective.name'),
|
name: 'Selective Restore',
|
||||||
description: t('backup.restore.restoreTypes.selective.description'),
|
description: 'Choose specific items to restore',
|
||||||
icon: CheckCircle,
|
icon: CheckCircle,
|
||||||
warning: t('backup.restore.restoreTypes.selective.warning')
|
warning: 'Only selected items will be restored'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
export const RestoreWizard = () => {
|
||||||
|
const [currentStep, setCurrentStep] = useState(0);
|
||||||
const [restoreData, setRestoreData] = useState({
|
const [restoreData, setRestoreData] = useState({
|
||||||
source: null,
|
source: null,
|
||||||
sourceConfig: {},
|
sourceConfig: {},
|
||||||
@@ -187,8 +184,8 @@ export const RestoreWizard = () => {
|
|||||||
const renderSourceSelection = () => (
|
const renderSourceSelection = () => (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-2">{t('backup.restore.source.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-2">Select Backup Source</h3>
|
||||||
<p className="text-sm text-gray-600">{t('backup.restore.source.subtitle')}</p>
|
<p className="text-sm text-gray-600">Choose where to restore the backup from</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
@@ -203,8 +200,8 @@ export const RestoreWizard = () => {
|
|||||||
<HardDrive className={`h-12 w-12 mb-3 mx-auto ${
|
<HardDrive className={`h-12 w-12 mb-3 mx-auto ${
|
||||||
restoreData.source === 'local' ? 'text-primary' : 'text-gray-400'
|
restoreData.source === 'local' ? 'text-primary' : 'text-gray-400'
|
||||||
}`} />
|
}`} />
|
||||||
<h4 className="font-medium text-gray-900">{t('backup.restore.source.local.name')}</h4>
|
<h4 className="font-medium text-gray-900">Local Backup</h4>
|
||||||
<p className="text-xs text-gray-500 mt-1">{t('backup.restore.source.local.description')}</p>
|
<p className="text-xs text-gray-500 mt-1">Restore from local filesystem</p>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -218,8 +215,8 @@ export const RestoreWizard = () => {
|
|||||||
<Cloud className={`h-12 w-12 mb-3 mx-auto ${
|
<Cloud className={`h-12 w-12 mb-3 mx-auto ${
|
||||||
restoreData.source === 's3' ? 'text-primary' : 'text-gray-400'
|
restoreData.source === 's3' ? 'text-primary' : 'text-gray-400'
|
||||||
}`} />
|
}`} />
|
||||||
<h4 className="font-medium text-gray-900">{t('backup.restore.source.s3.name')}</h4>
|
<h4 className="font-medium text-gray-900">S3 Storage</h4>
|
||||||
<p className="text-xs text-gray-500 mt-1">{t('backup.restore.source.s3.description')}</p>
|
<p className="text-xs text-gray-500 mt-1">Restore from S3 bucket</p>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@@ -233,18 +230,18 @@ export const RestoreWizard = () => {
|
|||||||
<Upload className={`h-12 w-12 mb-3 mx-auto ${
|
<Upload className={`h-12 w-12 mb-3 mx-auto ${
|
||||||
restoreData.source === 'upload' ? 'text-primary' : 'text-gray-400'
|
restoreData.source === 'upload' ? 'text-primary' : 'text-gray-400'
|
||||||
}`} />
|
}`} />
|
||||||
<h4 className="font-medium text-gray-900">{t('backup.restore.source.upload.name')}</h4>
|
<h4 className="font-medium text-gray-900">Upload Backup</h4>
|
||||||
<p className="text-xs text-gray-500 mt-1">{t('backup.restore.source.upload.description')}</p>
|
<p className="text-xs text-gray-500 mt-1">Upload a backup file</p>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Source-specific configuration */}
|
{/* Source-specific configuration */}
|
||||||
{restoreData.source === 's3' && (
|
{restoreData.source === 's3' && (
|
||||||
<Card className="p-4 space-y-4">
|
<Card className="p-4 space-y-4">
|
||||||
<h4 className="font-medium text-gray-900">{t('backup.restore.source.configuration.s3')}</h4>
|
<h4 className="font-medium text-gray-900">S3 Configuration</h4>
|
||||||
<div className="grid grid-cols-2 gap-4">
|
<div className="grid grid-cols-2 gap-4">
|
||||||
<Input
|
<Input
|
||||||
placeholder={t('backup.restore.source.configuration.endpoint')}
|
placeholder="S3 Endpoint URL"
|
||||||
value={restoreData.sourceConfig.s3Endpoint || ''}
|
value={restoreData.sourceConfig.s3Endpoint || ''}
|
||||||
onChange={(e) => setRestoreData(prev => ({
|
onChange={(e) => setRestoreData(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
@@ -252,7 +249,7 @@ export const RestoreWizard = () => {
|
|||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
placeholder={t('backup.restore.source.configuration.bucket')}
|
placeholder="Bucket Name"
|
||||||
value={restoreData.sourceConfig.s3Bucket || ''}
|
value={restoreData.sourceConfig.s3Bucket || ''}
|
||||||
onChange={(e) => setRestoreData(prev => ({
|
onChange={(e) => setRestoreData(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
@@ -260,7 +257,7 @@ export const RestoreWizard = () => {
|
|||||||
}))}
|
}))}
|
||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
placeholder={t('backup.restore.source.configuration.accessKey')}
|
placeholder="Access Key ID"
|
||||||
value={restoreData.sourceConfig.s3AccessKey || ''}
|
value={restoreData.sourceConfig.s3AccessKey || ''}
|
||||||
onChange={(e) => setRestoreData(prev => ({
|
onChange={(e) => setRestoreData(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
@@ -269,7 +266,7 @@ export const RestoreWizard = () => {
|
|||||||
/>
|
/>
|
||||||
<Input
|
<Input
|
||||||
type="password"
|
type="password"
|
||||||
placeholder={t('backup.restore.source.configuration.secretKey')}
|
placeholder="Secret Access Key"
|
||||||
value={restoreData.sourceConfig.s3SecretKey || ''}
|
value={restoreData.sourceConfig.s3SecretKey || ''}
|
||||||
onChange={(e) => setRestoreData(prev => ({
|
onChange={(e) => setRestoreData(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
@@ -284,7 +281,7 @@ export const RestoreWizard = () => {
|
|||||||
<Card className="p-4">
|
<Card className="p-4">
|
||||||
<div className="text-center py-8">
|
<div className="text-center py-8">
|
||||||
<Upload className="h-12 w-12 mx-auto mb-3 text-gray-400" />
|
<Upload className="h-12 w-12 mx-auto mb-3 text-gray-400" />
|
||||||
<p className="text-sm text-gray-600">{t('backup.restore.source.upload.comingSoon')}</p>
|
<p className="text-sm text-gray-600">Upload functionality coming soon</p>
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
@@ -294,8 +291,8 @@ export const RestoreWizard = () => {
|
|||||||
const renderBackupSelection = () => (
|
const renderBackupSelection = () => (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-2">{t('backup.restore.backup.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-2">Choose Backup to Restore</h3>
|
||||||
<p className="text-sm text-gray-600">{t('backup.restore.backup.subtitle')}</p>
|
<p className="text-sm text-gray-600">Select from available backups</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{loadingBackups ? (
|
{loadingBackups ? (
|
||||||
@@ -303,7 +300,7 @@ export const RestoreWizard = () => {
|
|||||||
) : availableBackups?.length === 0 ? (
|
) : availableBackups?.length === 0 ? (
|
||||||
<Card className="p-8 text-center">
|
<Card className="p-8 text-center">
|
||||||
<FileArchive className="h-12 w-12 mx-auto mb-3 text-gray-300" />
|
<FileArchive className="h-12 w-12 mx-auto mb-3 text-gray-300" />
|
||||||
<p className="text-gray-500">{t('backup.restore.backup.noBackupsFound')}</p>
|
<p className="text-gray-500">No backups found in selected source</p>
|
||||||
</Card>
|
</Card>
|
||||||
) : (
|
) : (
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
@@ -330,10 +327,10 @@ export const RestoreWizard = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p className="font-medium text-gray-900">
|
<p className="font-medium text-gray-900">
|
||||||
{format(new Date(backup.created_at), 'PPP')} {t('backup.restore.backup.at')} {format(new Date(backup.created_at), 'p')}
|
{format(new Date(backup.created_at), 'PPP')} at {format(new Date(backup.created_at), 'p')}
|
||||||
</p>
|
</p>
|
||||||
<p className="text-sm text-gray-500">
|
<p className="text-sm text-gray-500">
|
||||||
{t('backup.dashboard.backupType', { type: backup.backup_type })} • {formatBytes(backup.total_size || 0)}
|
{backup.backup_type} backup • {formatBytes(backup.total_size || 0)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -351,13 +348,13 @@ export const RestoreWizard = () => {
|
|||||||
<div className="flex items-start space-x-3">
|
<div className="flex items-start space-x-3">
|
||||||
<Shield className="h-5 w-5 text-amber-600 mt-0.5" />
|
<Shield className="h-5 w-5 text-amber-600 mt-0.5" />
|
||||||
<div className="flex-1">
|
<div className="flex-1">
|
||||||
<p className="text-sm font-medium text-amber-900">{t('backup.restore.backup.encrypted')}</p>
|
<p className="text-sm font-medium text-amber-900">Encrypted Backup</p>
|
||||||
<p className="text-sm text-amber-700 mt-1">
|
<p className="text-sm text-amber-700 mt-1">
|
||||||
{t('backup.restore.backup.encryptedMessage')}
|
You'll need to provide the encryption passphrase to restore this backup.
|
||||||
</p>
|
</p>
|
||||||
<Input
|
<Input
|
||||||
type="password"
|
type="password"
|
||||||
placeholder={t('backup.restore.backup.enterPassphrase')}
|
placeholder="Enter encryption passphrase"
|
||||||
className="mt-3"
|
className="mt-3"
|
||||||
value={restoreData.encryptionPassphrase}
|
value={restoreData.encryptionPassphrase}
|
||||||
onChange={(e) => setRestoreData(prev => ({
|
onChange={(e) => setRestoreData(prev => ({
|
||||||
@@ -375,8 +372,8 @@ export const RestoreWizard = () => {
|
|||||||
const renderRestoreOptions = () => (
|
const renderRestoreOptions = () => (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-2">{t('backup.restore.options.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-2">Restore Options</h3>
|
||||||
<p className="text-sm text-gray-600">{t('backup.restore.options.subtitle')}</p>
|
<p className="text-sm text-gray-600">Choose what to restore</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||||
@@ -412,7 +409,7 @@ export const RestoreWizard = () => {
|
|||||||
|
|
||||||
{/* Additional Options */}
|
{/* Additional Options */}
|
||||||
<Card className="p-4 space-y-4">
|
<Card className="p-4 space-y-4">
|
||||||
<h4 className="font-medium text-gray-900">{t('backup.restore.options.additionalOptions.title')}</h4>
|
<h4 className="font-medium text-gray-900">Additional Options</h4>
|
||||||
|
|
||||||
<label className="flex items-start space-x-3">
|
<label className="flex items-start space-x-3">
|
||||||
<input
|
<input
|
||||||
@@ -425,9 +422,9 @@ export const RestoreWizard = () => {
|
|||||||
className="mt-1 h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"
|
className="mt-1 h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm font-medium text-gray-700">{t('backup.restore.options.additionalOptions.skipPreBackup')}</p>
|
<p className="text-sm font-medium text-gray-700">Skip Pre-Restore Backup</p>
|
||||||
<p className="text-xs text-gray-500">
|
<p className="text-xs text-gray-500">
|
||||||
{t('backup.restore.options.additionalOptions.skipPreBackupHelp')}
|
By default, a backup is created before restore. Check this to skip it.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
@@ -443,9 +440,9 @@ export const RestoreWizard = () => {
|
|||||||
className="mt-1 h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"
|
className="mt-1 h-4 w-4 text-primary focus:ring-primary border-gray-300 rounded"
|
||||||
/>
|
/>
|
||||||
<div>
|
<div>
|
||||||
<p className="text-sm font-medium text-gray-700">{t('backup.restore.options.additionalOptions.force')}</p>
|
<p className="text-sm font-medium text-gray-700">Force Restore</p>
|
||||||
<p className="text-xs text-gray-500">
|
<p className="text-xs text-gray-500">
|
||||||
{t('backup.restore.options.additionalOptions.forceHelp')}
|
Override safety checks and warnings (use with caution)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</label>
|
</label>
|
||||||
@@ -456,8 +453,8 @@ export const RestoreWizard = () => {
|
|||||||
const renderConfirmation = () => (
|
const renderConfirmation = () => (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-2">{t('backup.restore.confirmation.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-2">Review & Confirm</h3>
|
||||||
<p className="text-sm text-gray-600">{t('backup.restore.confirmation.subtitle')}</p>
|
<p className="text-sm text-gray-600">Please review your restore configuration</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{validationResult ? (
|
{validationResult ? (
|
||||||
@@ -479,8 +476,8 @@ export const RestoreWizard = () => {
|
|||||||
validationResult.validation?.isValid ? 'text-green-900' : 'text-red-900'
|
validationResult.validation?.isValid ? 'text-green-900' : 'text-red-900'
|
||||||
}`}>
|
}`}>
|
||||||
{validationResult.validation?.isValid
|
{validationResult.validation?.isValid
|
||||||
? t('backup.restore.confirmation.validation.passed')
|
? 'Validation Passed'
|
||||||
: t('backup.restore.confirmation.validation.failed')}
|
: 'Validation Failed'}
|
||||||
</p>
|
</p>
|
||||||
{validationResult.validation?.errors?.length > 0 && (
|
{validationResult.validation?.errors?.length > 0 && (
|
||||||
<ul className="mt-2 text-sm text-red-700 list-disc list-inside">
|
<ul className="mt-2 text-sm text-red-700 list-disc list-inside">
|
||||||
@@ -496,20 +493,20 @@ export const RestoreWizard = () => {
|
|||||||
{/* Space Check */}
|
{/* Space Check */}
|
||||||
{validationResult.spaceCheck && (
|
{validationResult.spaceCheck && (
|
||||||
<Card className="p-4">
|
<Card className="p-4">
|
||||||
<h4 className="font-medium text-gray-900 mb-3">{t('backup.restore.confirmation.spaceCheck.title')}</h4>
|
<h4 className="font-medium text-gray-900 mb-3">Storage Space</h4>
|
||||||
<div className="space-y-2 text-sm">
|
<div className="space-y-2 text-sm">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="text-gray-600">{t('backup.restore.confirmation.spaceCheck.required')}:</span>
|
<span className="text-gray-600">Required:</span>
|
||||||
<span className="font-medium">{formatBytes(validationResult.spaceCheck.required)}</span>
|
<span className="font-medium">{formatBytes(validationResult.spaceCheck.required)}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<span className="text-gray-600">{t('backup.restore.confirmation.spaceCheck.available')}:</span>
|
<span className="text-gray-600">Available:</span>
|
||||||
<span className="font-medium">{formatBytes(validationResult.spaceCheck.available)}</span>
|
<span className="font-medium">{formatBytes(validationResult.spaceCheck.available)}</span>
|
||||||
</div>
|
</div>
|
||||||
{!validationResult.spaceCheck.sufficient && (
|
{!validationResult.spaceCheck.sufficient && (
|
||||||
<p className="text-red-600 text-xs mt-2">
|
<p className="text-red-600 text-xs mt-2">
|
||||||
<AlertCircle className="inline h-3 w-3 mr-1" />
|
<AlertCircle className="inline h-3 w-3 mr-1" />
|
||||||
{t('backup.restore.confirmation.spaceCheck.insufficient')}
|
Insufficient storage space
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -518,25 +515,25 @@ export const RestoreWizard = () => {
|
|||||||
|
|
||||||
{/* Summary */}
|
{/* Summary */}
|
||||||
<Card className="p-4">
|
<Card className="p-4">
|
||||||
<h4 className="font-medium text-gray-900 mb-3">{t('backup.restore.confirmation.summary.title')}</h4>
|
<h4 className="font-medium text-gray-900 mb-3">Restore Summary</h4>
|
||||||
<dl className="space-y-2 text-sm">
|
<dl className="space-y-2 text-sm">
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<dt className="text-gray-600">{t('backup.restore.confirmation.summary.source')}:</dt>
|
<dt className="text-gray-600">Source:</dt>
|
||||||
<dd className="font-medium capitalize">{restoreData.source}</dd>
|
<dd className="font-medium capitalize">{restoreData.source}</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<dt className="text-gray-600">{t('backup.restore.confirmation.summary.backupDate')}:</dt>
|
<dt className="text-gray-600">Backup Date:</dt>
|
||||||
<dd className="font-medium">
|
<dd className="font-medium">
|
||||||
{format(new Date(restoreData.selectedBackup.created_at), 'PPp')}
|
{format(new Date(restoreData.selectedBackup.created_at), 'PPp')}
|
||||||
</dd>
|
</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<dt className="text-gray-600">{t('backup.restore.confirmation.summary.restoreType')}:</dt>
|
<dt className="text-gray-600">Restore Type:</dt>
|
||||||
<dd className="font-medium capitalize">{restoreData.restoreType}</dd>
|
<dd className="font-medium capitalize">{restoreData.restoreType}</dd>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
<dt className="text-gray-600">{t('backup.restore.confirmation.summary.preBackup')}:</dt>
|
<dt className="text-gray-600">Pre-backup:</dt>
|
||||||
<dd className="font-medium">{restoreData.skipPreBackup ? t('backup.restore.confirmation.summary.skipped') : t('backup.restore.confirmation.summary.enabled')}</dd>
|
<dd className="font-medium">{restoreData.skipPreBackup ? 'Skipped' : 'Enabled'}</dd>
|
||||||
</div>
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
</Card>
|
</Card>
|
||||||
@@ -547,10 +544,11 @@ export const RestoreWizard = () => {
|
|||||||
<AlertTriangle className="h-5 w-5 text-amber-400 mt-0.5" />
|
<AlertTriangle className="h-5 w-5 text-amber-400 mt-0.5" />
|
||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<h3 className="text-sm font-medium text-amber-800">
|
<h3 className="text-sm font-medium text-amber-800">
|
||||||
{t('backup.restore.confirmation.warning.title')}
|
Important Notice
|
||||||
</h3>
|
</h3>
|
||||||
<p className="mt-1 text-sm text-amber-700">
|
<p className="mt-1 text-sm text-amber-700">
|
||||||
{t('backup.restore.confirmation.warning.message')}
|
This restore operation will replace existing data. Make sure you have a current backup
|
||||||
|
before proceeding. This action cannot be undone.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -559,7 +557,7 @@ export const RestoreWizard = () => {
|
|||||||
) : (
|
) : (
|
||||||
<div className="text-center py-8">
|
<div className="text-center py-8">
|
||||||
<Loader2 className="h-8 w-8 animate-spin mx-auto text-primary" />
|
<Loader2 className="h-8 w-8 animate-spin mx-auto text-primary" />
|
||||||
<p className="mt-2 text-sm text-gray-600">{t('backup.restore.confirmation.validation.checking')}</p>
|
<p className="mt-2 text-sm text-gray-600">Validating restore configuration...</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -572,9 +570,9 @@ export const RestoreWizard = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="space-y-6">
|
<div className="space-y-6">
|
||||||
<div>
|
<div>
|
||||||
<h3 className="text-lg font-semibold text-gray-900 mb-2">{t('backup.restore.progress.title')}</h3>
|
<h3 className="text-lg font-semibold text-gray-900 mb-2">Restore Progress</h3>
|
||||||
<p className="text-sm text-gray-600">
|
<p className="text-sm text-gray-600">
|
||||||
{isRunning ? t('backup.restore.progress.inProgress') : t('backup.restore.progress.completed')}
|
{isRunning ? 'Restore in progress...' : 'Restore completed'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -582,7 +580,7 @@ export const RestoreWizard = () => {
|
|||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<div className="space-y-4">
|
<div className="space-y-4">
|
||||||
<div className="flex justify-between text-sm">
|
<div className="flex justify-between text-sm">
|
||||||
<span className="text-gray-600">{t('backup.restore.progress.overallProgress')}</span>
|
<span className="text-gray-600">Overall Progress</span>
|
||||||
<span className="font-medium">{progress.percentage || 0}%</span>
|
<span className="font-medium">{progress.percentage || 0}%</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="w-full bg-gray-200 rounded-full h-3">
|
<div className="w-full bg-gray-200 rounded-full h-3">
|
||||||
@@ -593,7 +591,7 @@ export const RestoreWizard = () => {
|
|||||||
</div>
|
</div>
|
||||||
{progress.currentFile && (
|
{progress.currentFile && (
|
||||||
<p className="text-sm text-gray-600">
|
<p className="text-sm text-gray-600">
|
||||||
{t('backup.restore.progress.current')}: {progress.currentFile}
|
Current: {progress.currentFile}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -601,7 +599,7 @@ export const RestoreWizard = () => {
|
|||||||
|
|
||||||
{/* Status Details */}
|
{/* Status Details */}
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h4 className="font-medium text-gray-900 mb-4">{t('backup.restore.progress.statusDetails')}</h4>
|
<h4 className="font-medium text-gray-900 mb-4">Status Details</h4>
|
||||||
<div className="space-y-3">
|
<div className="space-y-3">
|
||||||
{progress.steps?.map((step, idx) => (
|
{progress.steps?.map((step, idx) => (
|
||||||
<div key={idx} className="flex items-center space-x-3">
|
<div key={idx} className="flex items-center space-x-3">
|
||||||
@@ -631,7 +629,7 @@ export const RestoreWizard = () => {
|
|||||||
{/* Logs */}
|
{/* Logs */}
|
||||||
{progress.logs && progress.logs.length > 0 && (
|
{progress.logs && progress.logs.length > 0 && (
|
||||||
<Card className="p-6">
|
<Card className="p-6">
|
||||||
<h4 className="font-medium text-gray-900 mb-4">{t('backup.restore.progress.restoreLogs')}</h4>
|
<h4 className="font-medium text-gray-900 mb-4">Restore Logs</h4>
|
||||||
<div className="bg-gray-900 rounded-lg p-4 max-h-64 overflow-y-auto">
|
<div className="bg-gray-900 rounded-lg p-4 max-h-64 overflow-y-auto">
|
||||||
<pre className="text-xs text-gray-300 font-mono">
|
<pre className="text-xs text-gray-300 font-mono">
|
||||||
{progress.logs.join('\n')}
|
{progress.logs.join('\n')}
|
||||||
@@ -647,10 +645,10 @@ export const RestoreWizard = () => {
|
|||||||
<CheckCircle className="h-5 w-5 text-green-400 mt-0.5" />
|
<CheckCircle className="h-5 w-5 text-green-400 mt-0.5" />
|
||||||
<div className="ml-3">
|
<div className="ml-3">
|
||||||
<h3 className="text-sm font-medium text-green-800">
|
<h3 className="text-sm font-medium text-green-800">
|
||||||
{t('backup.restore.progress.success.title')}
|
Restore Completed Successfully
|
||||||
</h3>
|
</h3>
|
||||||
<p className="mt-1 text-sm text-green-700">
|
<p className="mt-1 text-sm text-green-700">
|
||||||
{t('backup.restore.progress.success.message')}
|
Your data has been restored. Please verify everything is working correctly.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -728,7 +726,7 @@ export const RestoreWizard = () => {
|
|||||||
disabled={currentStep === 0 || currentStep === 4}
|
disabled={currentStep === 0 || currentStep === 4}
|
||||||
>
|
>
|
||||||
<ChevronLeft className="mr-2 h-4 w-4" />
|
<ChevronLeft className="mr-2 h-4 w-4" />
|
||||||
{t('backup.restore.actions.back')}
|
Back
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{currentStep < 4 && (
|
{currentStep < 4 && (
|
||||||
@@ -741,12 +739,12 @@ export const RestoreWizard = () => {
|
|||||||
{restoreMutation.isLoading ? (
|
{restoreMutation.isLoading ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||||
{t('backup.restore.actions.starting')}
|
Starting...
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<RefreshCw className="mr-2 h-4 w-4" />
|
<RefreshCw className="mr-2 h-4 w-4" />
|
||||||
{t('backup.restore.actions.startRestore')}
|
Start Restore
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@@ -755,18 +753,18 @@ export const RestoreWizard = () => {
|
|||||||
{validateMutation.isLoading ? (
|
{validateMutation.isLoading ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||||
{t('backup.restore.actions.validating')}
|
Validating...
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{t('backup.restore.actions.next')}
|
Next
|
||||||
<ChevronRight className="ml-2 h-4 w-4" />
|
<ChevronRight className="ml-2 h-4 w-4" />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{t('backup.restore.actions.next')}
|
Next
|
||||||
<ChevronRight className="ml-2 h-4 w-4" />
|
<ChevronRight className="ml-2 h-4 w-4" />
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
@@ -790,7 +788,7 @@ export const RestoreWizard = () => {
|
|||||||
setValidationResult(null);
|
setValidationResult(null);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('backup.restore.actions.startNewRestore')}
|
Start New Restore
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,5 +27,4 @@ export { BackupDashboard } from './BackupDashboard';
|
|||||||
export { BackupConfiguration } from './BackupConfiguration';
|
export { BackupConfiguration } from './BackupConfiguration';
|
||||||
export { BackupHistory } from './BackupHistory';
|
export { BackupHistory } from './BackupHistory';
|
||||||
export { RestoreWizard } from './RestoreWizard';
|
export { RestoreWizard } from './RestoreWizard';
|
||||||
export { FeedbackSettings } from './FeedbackSettings';
|
export { FeedbackSettings } from './FeedbackSettings';
|
||||||
export { FeedbackModerationPanel } from './FeedbackModerationPanel';
|
|
||||||
@@ -18,7 +18,6 @@ import { GALLERY_THEME_PRESETS } from '../../types/theme.types';
|
|||||||
import { api } from '../../config/api';
|
import { api } from '../../config/api';
|
||||||
import { Upload, Menu } from 'lucide-react';
|
import { Upload, Menu } from 'lucide-react';
|
||||||
import { galleryService } from '../../services/gallery.service';
|
import { galleryService } from '../../services/gallery.service';
|
||||||
import { feedbackService } from '../../services/feedback.service';
|
|
||||||
import { useWatermarkSettings } from '../../hooks/useWatermarkSettings';
|
import { useWatermarkSettings } from '../../hooks/useWatermarkSettings';
|
||||||
|
|
||||||
interface GalleryViewProps {
|
interface GalleryViewProps {
|
||||||
@@ -49,7 +48,6 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
|
|||||||
const [sidebarOpen, setSidebarOpen] = useState(false);
|
const [sidebarOpen, setSidebarOpen] = useState(false);
|
||||||
const [isSelectionMode, setIsSelectionMode] = useState(false);
|
const [isSelectionMode, setIsSelectionMode] = useState(false);
|
||||||
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
|
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
|
||||||
const [feedbackEnabled, setFeedbackEnabled] = useState(false);
|
|
||||||
const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
|
const [isMobile, setIsMobile] = useState(window.innerWidth < 768);
|
||||||
const { watermarkEnabled } = useWatermarkSettings();
|
const { watermarkEnabled } = useWatermarkSettings();
|
||||||
|
|
||||||
@@ -78,25 +76,6 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
|
|||||||
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
|
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch feedback settings
|
|
||||||
const { data: feedbackSettings } = useQuery({
|
|
||||||
queryKey: ['gallery-feedback-settings', event.id],
|
|
||||||
queryFn: async () => {
|
|
||||||
try {
|
|
||||||
// Use public endpoint to get feedback settings
|
|
||||||
const response = await api.get(`/gallery/${slug}/feedback-settings`);
|
|
||||||
return response.data;
|
|
||||||
} catch (error) {
|
|
||||||
// If endpoint doesn't exist or returns error, default to disabled
|
|
||||||
return { feedback_enabled: false };
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onSuccess: (data) => {
|
|
||||||
setFeedbackEnabled(data?.feedback_enabled || false);
|
|
||||||
},
|
|
||||||
enabled: !!event.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Apply branding settings
|
// Apply branding settings
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (settingsData) {
|
if (settingsData) {
|
||||||
@@ -450,7 +429,6 @@ export const GalleryView: React.FC<GalleryViewProps> = ({ slug, event }) => {
|
|||||||
photos={filteredPhotos}
|
photos={filteredPhotos}
|
||||||
slug={slug}
|
slug={slug}
|
||||||
categoryId={selectedCategoryId}
|
categoryId={selectedCategoryId}
|
||||||
feedbackEnabled={feedbackEnabled}
|
|
||||||
isSelectionMode={isSelectionMode}
|
isSelectionMode={isSelectionMode}
|
||||||
selectedPhotos={selectedPhotos}
|
selectedPhotos={selectedPhotos}
|
||||||
onSelectionChange={setSelectedPhotos}
|
onSelectionChange={setSelectedPhotos}
|
||||||
|
|||||||
@@ -15,10 +15,9 @@ interface PhotoGridProps {
|
|||||||
photos: Photo[];
|
photos: Photo[];
|
||||||
slug: string;
|
slug: string;
|
||||||
categoryId?: number | null;
|
categoryId?: number | null;
|
||||||
feedbackEnabled?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PhotoGrid: React.FC<PhotoGridProps> = ({ photos, slug, categoryId, feedbackEnabled = false }) => {
|
export const PhotoGrid: React.FC<PhotoGridProps> = ({ photos, slug, categoryId }) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [selectedPhotoIndex, setSelectedPhotoIndex] = useState<number | null>(null);
|
const [selectedPhotoIndex, setSelectedPhotoIndex] = useState<number | null>(null);
|
||||||
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
|
const [selectedPhotos, setSelectedPhotos] = useState<Set<number>>(new Set());
|
||||||
@@ -205,7 +204,6 @@ export const PhotoGrid: React.FC<PhotoGridProps> = ({ photos, slug, categoryId,
|
|||||||
initialIndex={selectedPhotoIndex}
|
initialIndex={selectedPhotoIndex}
|
||||||
onClose={() => setSelectedPhotoIndex(null)}
|
onClose={() => setSelectedPhotoIndex(null)}
|
||||||
slug={slug}
|
slug={slug}
|
||||||
feedbackEnabled={feedbackEnabled}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ interface PhotoGridWithLayoutsProps {
|
|||||||
eventLogo?: string | null;
|
eventLogo?: string | null;
|
||||||
eventDate?: string;
|
eventDate?: string;
|
||||||
expiresAt?: string;
|
expiresAt?: string;
|
||||||
feedbackEnabled?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PhotoGridWithLayouts: React.FC<PhotoGridWithLayoutsProps> = ({
|
export const PhotoGridWithLayouts: React.FC<PhotoGridWithLayoutsProps> = ({
|
||||||
@@ -43,7 +42,6 @@ export const PhotoGridWithLayouts: React.FC<PhotoGridWithLayoutsProps> = ({
|
|||||||
categoryId,
|
categoryId,
|
||||||
isSelectionMode: parentSelectionMode,
|
isSelectionMode: parentSelectionMode,
|
||||||
selectedPhotos: parentSelectedPhotos,
|
selectedPhotos: parentSelectedPhotos,
|
||||||
feedbackEnabled,
|
|
||||||
onSelectionChange,
|
onSelectionChange,
|
||||||
onToggleSelectionMode: parentToggleSelectionMode,
|
onToggleSelectionMode: parentToggleSelectionMode,
|
||||||
showSelectionControls = true,
|
showSelectionControls = true,
|
||||||
@@ -261,7 +259,6 @@ export const PhotoGridWithLayouts: React.FC<PhotoGridWithLayoutsProps> = ({
|
|||||||
initialIndex={selectedPhotoIndex}
|
initialIndex={selectedPhotoIndex}
|
||||||
onClose={() => setSelectedPhotoIndex(null)}
|
onClose={() => setSelectedPhotoIndex(null)}
|
||||||
slug={slug}
|
slug={slug}
|
||||||
feedbackEnabled={feedbackEnabled || false}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ interface PhotoLightboxProps {
|
|||||||
initialIndex: number;
|
initialIndex: number;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
slug: string;
|
slug: string;
|
||||||
feedbackEnabled?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
||||||
@@ -18,7 +17,6 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
|||||||
initialIndex,
|
initialIndex,
|
||||||
onClose,
|
onClose,
|
||||||
slug,
|
slug,
|
||||||
feedbackEnabled = false,
|
|
||||||
}) => {
|
}) => {
|
||||||
const [currentIndex, setCurrentIndex] = useState(initialIndex);
|
const [currentIndex, setCurrentIndex] = useState(initialIndex);
|
||||||
const [zoom, setZoom] = useState(1);
|
const [zoom, setZoom] = useState(1);
|
||||||
@@ -229,15 +227,13 @@ export const PhotoLightbox: React.FC<PhotoLightboxProps> = ({
|
|||||||
<Download className="w-5 h-5 text-white" />
|
<Download className="w-5 h-5 text-white" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{feedbackEnabled && (
|
<button
|
||||||
<button
|
onClick={() => setShowFeedback(!showFeedback)}
|
||||||
onClick={() => setShowFeedback(!showFeedback)}
|
className="p-2 bg-white/10 hover:bg-white/20 rounded-full transition-colors"
|
||||||
className="p-2 bg-white/10 hover:bg-white/20 rounded-full transition-colors"
|
aria-label="Toggle feedback"
|
||||||
aria-label="Toggle feedback"
|
>
|
||||||
>
|
<MessageSquare className="w-5 h-5 text-white" />
|
||||||
<MessageSquare className="w-5 h-5 text-white" />
|
</button>
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ api.interceptors.response.use(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (error.response?.status === 401) {
|
if (error.response?.status === 401) {
|
||||||
// Check if it's an admin route (but not public endpoints)
|
// Check if it's an admin route
|
||||||
const isAdminRoute = error.config?.url?.includes('/admin') && !error.config?.url?.includes('/public/');
|
const isAdminRoute = error.config?.url?.includes('/admin');
|
||||||
const currentPath = window.location.pathname;
|
const currentPath = window.location.pathname;
|
||||||
|
|
||||||
if (isAdminRoute) {
|
if (isAdminRoute) {
|
||||||
|
|||||||
@@ -2,25 +2,16 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { format as dateFnsFormat, formatDistanceToNow as dateFnsFormatDistanceToNow } from 'date-fns';
|
import { format as dateFnsFormat, formatDistanceToNow as dateFnsFormatDistanceToNow } from 'date-fns';
|
||||||
import { de, enUS } from 'date-fns/locale';
|
import { de, enUS } from 'date-fns/locale';
|
||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import { publicSettingsService } from '../services/publicSettings.service';
|
import { settingsService } from '../services/settings.service';
|
||||||
|
|
||||||
// Convert old date format strings to new date-fns format
|
|
||||||
const convertDateFormat = (format: string): string => {
|
|
||||||
return format
|
|
||||||
.replace(/DD/g, 'dd') // Days: DD -> dd
|
|
||||||
.replace(/YYYY/g, 'yyyy') // Years: YYYY -> yyyy
|
|
||||||
.replace(/YY/g, 'yy'); // Short years: YY -> yy
|
|
||||||
};
|
|
||||||
|
|
||||||
export const useLocalizedDate = () => {
|
export const useLocalizedDate = () => {
|
||||||
const { i18n } = useTranslation();
|
const { i18n } = useTranslation();
|
||||||
|
|
||||||
// Fetch public settings to get the date format
|
// Fetch admin settings to get the date format
|
||||||
const { data: settings } = useQuery({
|
const { data: settings } = useQuery({
|
||||||
queryKey: ['public-settings'],
|
queryKey: ['admin-settings-general'],
|
||||||
queryFn: () => publicSettingsService.getPublicSettings(),
|
queryFn: () => settingsService.getSettingsByType('general'),
|
||||||
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
|
staleTime: 5 * 60 * 1000, // Cache for 5 minutes
|
||||||
retry: 1, // Only retry once to avoid blocking the UI
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const getLocale = () => {
|
const getLocale = () => {
|
||||||
@@ -30,18 +21,7 @@ export const useLocalizedDate = () => {
|
|||||||
const format = (date: Date | string, formatStr?: string) => {
|
const format = (date: Date | string, formatStr?: string) => {
|
||||||
const dateObj = typeof date === 'string' ? new Date(date) : date;
|
const dateObj = typeof date === 'string' ? new Date(date) : date;
|
||||||
// Use admin-configured date format if available and no format string provided
|
// Use admin-configured date format if available and no format string provided
|
||||||
let dateFormat = formatStr;
|
const dateFormat = formatStr || settings?.general_date_format || 'PPP';
|
||||||
if (!dateFormat && settings?.general_date_format) {
|
|
||||||
// Handle both string and object formats
|
|
||||||
dateFormat = typeof settings.general_date_format === 'string'
|
|
||||||
? settings.general_date_format
|
|
||||||
: settings.general_date_format.format || 'PPP';
|
|
||||||
}
|
|
||||||
dateFormat = dateFormat || 'PPP';
|
|
||||||
|
|
||||||
// Convert old format to new format
|
|
||||||
dateFormat = convertDateFormat(dateFormat);
|
|
||||||
|
|
||||||
return dateFnsFormat(dateObj, dateFormat, { locale: getLocale() });
|
return dateFnsFormat(dateObj, dateFormat, { locale: getLocale() });
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -54,12 +34,6 @@ export const useLocalizedDate = () => {
|
|||||||
format,
|
format,
|
||||||
formatDistanceToNow,
|
formatDistanceToNow,
|
||||||
locale: getLocale(),
|
locale: getLocale(),
|
||||||
dateFormat: settings?.general_date_format
|
dateFormat: settings?.general_date_format || 'PPP'
|
||||||
? convertDateFormat(
|
|
||||||
typeof settings.general_date_format === 'string'
|
|
||||||
? settings.general_date_format
|
|
||||||
: settings.general_date_format.format || 'PPP'
|
|
||||||
)
|
|
||||||
: 'PPP'
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -35,8 +35,7 @@
|
|||||||
"days": "Tage",
|
"days": "Tage",
|
||||||
"customize": "Anpassen",
|
"customize": "Anpassen",
|
||||||
"hide": "Ausblenden",
|
"hide": "Ausblenden",
|
||||||
"unknown": "Unbekannt",
|
"unknown": "Unbekannt"
|
||||||
"chunk": "Teil"
|
|
||||||
},
|
},
|
||||||
"upload": {
|
"upload": {
|
||||||
"photoCategory": "Fotokategorie",
|
"photoCategory": "Fotokategorie",
|
||||||
@@ -52,8 +51,7 @@
|
|||||||
"uploadPhotos": "Fotos hochladen",
|
"uploadPhotos": "Fotos hochladen",
|
||||||
"maxFilesReached": "Maximal 500 Dateien erlaubt",
|
"maxFilesReached": "Maximal 500 Dateien erlaubt",
|
||||||
"someFilesSkipped": "Einige Dateien wurden übersprungen (500 Dateien Limit)",
|
"someFilesSkipped": "Einige Dateien wurden übersprungen (500 Dateien Limit)",
|
||||||
"tooManyFiles": "Maximal 500 Dateien können gleichzeitig hochgeladen werden",
|
"tooManyFiles": "Maximal 500 Dateien können gleichzeitig hochgeladen werden"
|
||||||
"uploadingChunks": "Lade {{count}} Dateien in {{total}} Teilen hoch..."
|
|
||||||
},
|
},
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"dashboard": "Dashboard",
|
"dashboard": "Dashboard",
|
||||||
@@ -369,11 +367,6 @@
|
|||||||
"noEventsDescription": "Erstellen Sie Ihre erste Veranstaltung, um zu beginnen.",
|
"noEventsDescription": "Erstellen Sie Ihre erste Veranstaltung, um zu beginnen.",
|
||||||
"eventsSelected": "{{count}} Veranstaltung ausgewählt",
|
"eventsSelected": "{{count}} Veranstaltung ausgewählt",
|
||||||
"eventsSelected_plural": "{{count}} Veranstaltungen ausgewählt",
|
"eventsSelected_plural": "{{count}} Veranstaltungen ausgewählt",
|
||||||
"viewDetails": "Details anzeigen",
|
|
||||||
"archiveEventAction": "Veranstaltung archivieren",
|
|
||||||
"downloadArchiveAction": "Archiv herunterladen",
|
|
||||||
"deleteEvent": "Veranstaltung löschen",
|
|
||||||
"deleteEventConfirm": "Sind Sie sicher, dass Sie diese Veranstaltung löschen möchten?",
|
|
||||||
"bulkArchive": "Archivieren",
|
"bulkArchive": "Archivieren",
|
||||||
"confirmBulkArchive": "Sind Sie sicher, dass Sie {{count}} Veranstaltung(en) archivieren möchten?",
|
"confirmBulkArchive": "Sind Sie sicher, dass Sie {{count}} Veranstaltung(en) archivieren möchten?",
|
||||||
"confirmBulkArchiveDescription": "Diese Aktion kann nicht rückgängig gemacht werden. Archivierte Veranstaltungen sind nicht mehr öffentlich zugänglich.",
|
"confirmBulkArchiveDescription": "Diese Aktion kann nicht rückgängig gemacht werden. Archivierte Veranstaltungen sind nicht mehr öffentlich zugänglich.",
|
||||||
@@ -910,404 +903,6 @@
|
|||||||
"passwordSecurityRequirements": "Passwort erfüllt nicht die Sicherheitsanforderungen",
|
"passwordSecurityRequirements": "Passwort erfüllt nicht die Sicherheitsanforderungen",
|
||||||
"expirationRange": "Ablauf muss zwischen 1 und 365 Tagen liegen"
|
"expirationRange": "Ablauf muss zwischen 1 und 365 Tagen liegen"
|
||||||
},
|
},
|
||||||
"backup": {
|
|
||||||
"title": "Backup-Verwaltung",
|
|
||||||
"subtitle": "Verwalten Sie System-Backups, konfigurieren Sie automatisierte Backups und stellen Sie vorherige Backups wieder her.",
|
|
||||||
"tabs": {
|
|
||||||
"dashboard": "Dashboard",
|
|
||||||
"configuration": "Konfiguration",
|
|
||||||
"history": "Backup-Verlauf",
|
|
||||||
"restore": "Wiederherstellung"
|
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
"inProgress": "Backup läuft...",
|
|
||||||
"lastBackup": "Letztes Backup",
|
|
||||||
"noBackups": "Keine Backups gefunden",
|
|
||||||
"nextBackup": "Nächstes Backup",
|
|
||||||
"notScheduled": "Nicht geplant",
|
|
||||||
"enabled": "Aktiviert",
|
|
||||||
"disabled": "Deaktiviert"
|
|
||||||
},
|
|
||||||
"actions": {
|
|
||||||
"runBackupNow": "Backup jetzt starten",
|
|
||||||
"starting": "Starte...",
|
|
||||||
"running": "Läuft...",
|
|
||||||
"testConnection": "Verbindung testen",
|
|
||||||
"save": "Konfiguration speichern",
|
|
||||||
"delete": "Löschen",
|
|
||||||
"view": "Details anzeigen",
|
|
||||||
"download": "Herunterladen",
|
|
||||||
"refresh": "Aktualisieren"
|
|
||||||
},
|
|
||||||
"dashboard": {
|
|
||||||
"backupHealth": "Backup-Status",
|
|
||||||
"healthStatus": {
|
|
||||||
"excellent": "Ausgezeichnet",
|
|
||||||
"good": "Gut",
|
|
||||||
"warning": "Warnung",
|
|
||||||
"critical": "Kritisch"
|
|
||||||
},
|
|
||||||
"healthMessages": {
|
|
||||||
"noBackups": "Keine Backups gefunden",
|
|
||||||
"failed": "Letztes Backup fehlgeschlagen",
|
|
||||||
"upToDate": "Backup ist aktuell",
|
|
||||||
"recent": "Backup ist aktuell",
|
|
||||||
"old": "Backup wird alt",
|
|
||||||
"outdated": "Backup ist veraltet"
|
|
||||||
},
|
|
||||||
"stats": {
|
|
||||||
"totalBackups": "Gesamt-Backups",
|
|
||||||
"backupSize": "Backup-Größe",
|
|
||||||
"lastDuration": "Letzte Dauer",
|
|
||||||
"backupStatus": "Backup-Status",
|
|
||||||
"last": "Letztes",
|
|
||||||
"files": "Dateien",
|
|
||||||
"minutes": "{{count}}m",
|
|
||||||
"active": "Aktiv",
|
|
||||||
"inactive": "Inaktiv"
|
|
||||||
},
|
|
||||||
"recentActivity": {
|
|
||||||
"title": "Letzte Backup-Aktivitäten"
|
|
||||||
},
|
|
||||||
"notConfigured": {
|
|
||||||
"title": "Backup nicht konfiguriert",
|
|
||||||
"message": "Bitte konfigurieren Sie die Backup-Einstellungen im Konfiguration-Tab, bevor Sie Backups ausführen."
|
|
||||||
},
|
|
||||||
"coverage": {
|
|
||||||
"database": "Datenbank",
|
|
||||||
"photos": "Fotos",
|
|
||||||
"archives": "Archive",
|
|
||||||
"systemFiles": "Systemdateien",
|
|
||||||
"included": "Enthalten",
|
|
||||||
"excluded": "Ausgeschlossen",
|
|
||||||
"optional": "Optional"
|
|
||||||
},
|
|
||||||
"storageDestination": "Speicherziel",
|
|
||||||
"nextScheduledBackup": "Nächstes geplantes Backup",
|
|
||||||
"backupType": "{{type}} Backup",
|
|
||||||
"noDestinationSet": "Kein Ziel festgelegt"
|
|
||||||
},
|
|
||||||
"configuration": {
|
|
||||||
"enableBackup": "Automatisierte Backups aktivieren",
|
|
||||||
"destinationType": "Backup-Ziel",
|
|
||||||
"destinationTypes": {
|
|
||||||
"local": {
|
|
||||||
"name": "Lokaler Speicher",
|
|
||||||
"description": "Backups auf dem lokalen Server-Dateisystem speichern"
|
|
||||||
},
|
|
||||||
"rsync": {
|
|
||||||
"name": "Remote-Server (Rsync)",
|
|
||||||
"description": "Backups über SSH/Rsync auf einen Remote-Server synchronisieren"
|
|
||||||
},
|
|
||||||
"s3": {
|
|
||||||
"name": "S3-kompatibler Speicher",
|
|
||||||
"description": "Backups in Amazon S3 oder kompatiblem Objektspeicher speichern"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fields": {
|
|
||||||
"destinationPath": "Zielpfad",
|
|
||||||
"destinationPathHelp": "Lokaler Verzeichnispfad für Backup-Speicherung",
|
|
||||||
"destinationPathPlaceholder": "/pfad/zum/backup/verzeichnis",
|
|
||||||
"rsyncHost": "Remote-Host",
|
|
||||||
"rsyncHostHelp": "SSH-Hostname oder IP-Adresse",
|
|
||||||
"rsyncHostPlaceholder": "backup.beispiel.de",
|
|
||||||
"rsyncUser": "SSH-Benutzer",
|
|
||||||
"rsyncUserHelp": "Benutzername für SSH-Verbindung",
|
|
||||||
"rsyncUserPlaceholder": "backup-benutzer",
|
|
||||||
"rsyncPath": "Remote-Pfad",
|
|
||||||
"rsyncPathHelp": "Verzeichnispfad auf Remote-Server",
|
|
||||||
"rsyncPathPlaceholder": "/home/backup/foto-sharing",
|
|
||||||
"rsyncSshKey": "SSH Private Key",
|
|
||||||
"rsyncSshKeyHelp": "SSH Private Key für Authentifizierung (optional)",
|
|
||||||
"rsyncSshKeyPlaceholder": "-----BEGIN RSA PRIVATE KEY-----",
|
|
||||||
"s3Endpoint": "S3-Endpunkt",
|
|
||||||
"s3EndpointHelp": "S3 API-Endpunkt (z.B. s3.amazonaws.com)",
|
|
||||||
"s3EndpointPlaceholder": "https://s3.amazonaws.com",
|
|
||||||
"s3Bucket": "Bucket-Name",
|
|
||||||
"s3BucketHelp": "S3-Bucket für Backup-Speicherung",
|
|
||||||
"s3BucketPlaceholder": "mein-backup-bucket",
|
|
||||||
"s3AccessKey": "Zugriffsschlüssel-ID",
|
|
||||||
"s3AccessKeyHelp": "AWS/S3 Zugriffsschlüssel-ID",
|
|
||||||
"s3AccessKeyPlaceholder": "AKIAIOSFODNN7EXAMPLE",
|
|
||||||
"s3SecretKey": "Geheimer Zugriffsschlüssel",
|
|
||||||
"s3SecretKeyHelp": "AWS/S3 geheimer Zugriffsschlüssel",
|
|
||||||
"s3SecretKeyPlaceholder": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
||||||
"s3Region": "Region",
|
|
||||||
"s3RegionHelp": "S3-Region (z.B. eu-central-1)",
|
|
||||||
"s3RegionPlaceholder": "eu-central-1"
|
|
||||||
},
|
|
||||||
"schedule": {
|
|
||||||
"title": "Backup-Zeitplan",
|
|
||||||
"scheduleType": "Zeitplan-Typ",
|
|
||||||
"scheduleOptions": {
|
|
||||||
"hourly": "Jede Stunde",
|
|
||||||
"daily": "Täglich",
|
|
||||||
"weekly": "Wöchentlich",
|
|
||||||
"custom": "Benutzerdefinierter Cron-Ausdruck"
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"hourly": "Jede Stunde",
|
|
||||||
"daily": "Täglich",
|
|
||||||
"weekly": "Wöchentlich",
|
|
||||||
"custom": "Benutzerdefinierter Cron-Ausdruck"
|
|
||||||
},
|
|
||||||
"customCron": "Cron-Ausdruck",
|
|
||||||
"customCronHelp": "Geben Sie einen gültigen Cron-Ausdruck ein (z.B. 0 3 * * *)",
|
|
||||||
"retention": "Aufbewahrungszeitraum",
|
|
||||||
"retentionDays": "Backups aufbewahren für",
|
|
||||||
"retentionHelp": "Tage (ältere Backups werden automatisch gelöscht)"
|
|
||||||
},
|
|
||||||
"whatToBackup": {
|
|
||||||
"title": "Was soll gesichert werden",
|
|
||||||
"database": "Datenbank",
|
|
||||||
"databaseHelp": "Alle Veranstaltungsdaten, Einstellungen und Konfigurationen",
|
|
||||||
"photos": "Fotos",
|
|
||||||
"photosHelp": "Alle hochgeladenen Fotos in aktiven Galerien",
|
|
||||||
"archives": "Archive",
|
|
||||||
"archivesHelp": "Archivierte Veranstaltungs-ZIP-Dateien",
|
|
||||||
"thumbnails": "Miniaturbilder",
|
|
||||||
"thumbnailsHelp": "Generierte Miniaturbilder (können neu erstellt werden)",
|
|
||||||
"tempFiles": "Temporäre Dateien",
|
|
||||||
"tempFilesHelp": "Temporäre Upload- und Verarbeitungsdateien"
|
|
||||||
},
|
|
||||||
"advancedOptions": {
|
|
||||||
"title": "Erweiterte Optionen",
|
|
||||||
"compression": "Komprimierung aktivieren",
|
|
||||||
"compressionHelp": "Backup-Dateien komprimieren, um Speicherplatz zu sparen",
|
|
||||||
"encryption": "Verschlüsselung aktivieren",
|
|
||||||
"encryptionHelp": "Backups für zusätzliche Sicherheit verschlüsseln",
|
|
||||||
"encryptionPassphrase": "Verschlüsselungs-Passphrase",
|
|
||||||
"encryptionPassphraseHelp": "Starke Passphrase für Backup-Verschlüsselung",
|
|
||||||
"confirmPassphrase": "Passphrase bestätigen",
|
|
||||||
"passphrasesDontMatch": "Passphrasen stimmen nicht überein"
|
|
||||||
},
|
|
||||||
"validation": {
|
|
||||||
"requiredFields": "Bitte füllen Sie alle erforderlichen Felder aus",
|
|
||||||
"invalidCron": "Ungültiger Cron-Ausdruck",
|
|
||||||
"connectionTestFailed": "Verbindungstest fehlgeschlagen",
|
|
||||||
"connectionTestSuccess": "Verbindungstest erfolgreich!"
|
|
||||||
},
|
|
||||||
"messages": {
|
|
||||||
"requiredFields": "Bitte füllen Sie alle erforderlichen Felder aus",
|
|
||||||
"connectionSuccess": "Verbindungstest erfolgreich!",
|
|
||||||
"connectionFailed": "Verbindungstest fehlgeschlagen"
|
|
||||||
},
|
|
||||||
"testingConnection": "Teste Verbindung...",
|
|
||||||
"saveSettings": "Konfiguration speichern",
|
|
||||||
"savingSettings": "Speichern..."
|
|
||||||
},
|
|
||||||
"history": {
|
|
||||||
"searchPlaceholder": "Backups suchen...",
|
|
||||||
"allStatus": "Alle Status",
|
|
||||||
"status": {
|
|
||||||
"completed": "Abgeschlossen",
|
|
||||||
"failed": "Fehlgeschlagen",
|
|
||||||
"running": "Läuft",
|
|
||||||
"partial": "Teilweise"
|
|
||||||
},
|
|
||||||
"deleteConfirm": "Sind Sie sicher, dass Sie dieses Backup vom {{date}} löschen möchten?",
|
|
||||||
"noBackups": "Keine Backups gefunden",
|
|
||||||
"tableHeaders": {
|
|
||||||
"date": "Datum",
|
|
||||||
"type": "Typ",
|
|
||||||
"status": "Status",
|
|
||||||
"size": "Größe",
|
|
||||||
"duration": "Dauer",
|
|
||||||
"actions": "Aktionen"
|
|
||||||
},
|
|
||||||
"columns": {
|
|
||||||
"status": "Status",
|
|
||||||
"dateTime": "Datum & Zeit",
|
|
||||||
"type": "Typ",
|
|
||||||
"size": "Größe",
|
|
||||||
"duration": "Dauer",
|
|
||||||
"actions": "Aktionen"
|
|
||||||
},
|
|
||||||
"details": "Details",
|
|
||||||
"statistics": "Statistiken",
|
|
||||||
"errors": "Fehler",
|
|
||||||
"backupDetails": {
|
|
||||||
"backupId": "Backup-ID",
|
|
||||||
"startTime": "Startzeit",
|
|
||||||
"endTime": "Endzeit",
|
|
||||||
"destination": "Ziel",
|
|
||||||
"filesProcessed": "Verarbeitete Dateien",
|
|
||||||
"totalSize": "Gesamtgröße",
|
|
||||||
"compressionRatio": "Komprimierungsverhältnis",
|
|
||||||
"errorLog": "Fehlerprotokoll",
|
|
||||||
"noErrors": "Keine Fehler aufgetreten"
|
|
||||||
},
|
|
||||||
"pagination": {
|
|
||||||
"showing": "Zeige {{from}}-{{to}} von {{total}} Backups",
|
|
||||||
"previous": "Zurück",
|
|
||||||
"next": "Weiter"
|
|
||||||
},
|
|
||||||
"filter": {
|
|
||||||
"allStatus": "Alle Status",
|
|
||||||
"completed": "Abgeschlossen",
|
|
||||||
"failed": "Fehlgeschlagen",
|
|
||||||
"running": "Läuft",
|
|
||||||
"partial": "Teilweise"
|
|
||||||
},
|
|
||||||
"noBackupsFound": "Keine Backups gefunden",
|
|
||||||
"backupsWillAppear": "Backups werden hier angezeigt, sobald sie erstellt wurden",
|
|
||||||
"messages": {
|
|
||||||
"deleteSuccess": "Backup erfolgreich gelöscht"
|
|
||||||
},
|
|
||||||
"details": {
|
|
||||||
"backupDetails": "Backup-Details",
|
|
||||||
"destination": "Ziel",
|
|
||||||
"started": "Gestartet",
|
|
||||||
"completed": "Abgeschlossen",
|
|
||||||
"contentBackedUp": "Gesicherter Inhalt",
|
|
||||||
"errorDetails": "Fehlerdetails",
|
|
||||||
"manifest": "Manifest"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"restore": {
|
|
||||||
"steps": {
|
|
||||||
"selectSource": "Quelle auswählen",
|
|
||||||
"chooseBackup": "Backup auswählen",
|
|
||||||
"restoreOptions": "Wiederherstellungsoptionen",
|
|
||||||
"reviewConfirm": "Überprüfen & Bestätigen",
|
|
||||||
"progress": "Wiederherstellungsfortschritt"
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"title": "Backup-Quelle auswählen",
|
|
||||||
"subtitle": "Wählen Sie, woher das Backup wiederhergestellt werden soll",
|
|
||||||
"local": {
|
|
||||||
"name": "Lokales Backup",
|
|
||||||
"description": "Vom lokalen Dateisystem wiederherstellen"
|
|
||||||
},
|
|
||||||
"s3": {
|
|
||||||
"name": "S3-Speicher",
|
|
||||||
"description": "Aus S3-Bucket wiederherstellen"
|
|
||||||
},
|
|
||||||
"upload": {
|
|
||||||
"name": "Backup hochladen",
|
|
||||||
"description": "Eine Backup-Datei hochladen",
|
|
||||||
"comingSoon": "Upload-Funktion kommt bald"
|
|
||||||
},
|
|
||||||
"configuration": {
|
|
||||||
"s3": "S3-Konfiguration",
|
|
||||||
"endpoint": "S3-Endpunkt-URL",
|
|
||||||
"bucket": "Bucket-Name",
|
|
||||||
"accessKey": "Zugriffsschlüssel-ID",
|
|
||||||
"secretKey": "Geheimer Zugriffsschlüssel"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"backup": {
|
|
||||||
"title": "Backup für Wiederherstellung auswählen",
|
|
||||||
"subtitle": "Aus verfügbaren Backups auswählen",
|
|
||||||
"noBackupsFound": "Keine Backups in ausgewählter Quelle gefunden",
|
|
||||||
"encrypted": "Verschlüsseltes Backup",
|
|
||||||
"encryptedMessage": "Sie müssen die Verschlüsselungs-Passphrase angeben, um dieses Backup wiederherzustellen.",
|
|
||||||
"enterPassphrase": "Verschlüsselungs-Passphrase eingeben",
|
|
||||||
"at": "um"
|
|
||||||
},
|
|
||||||
"restoreTypes": {
|
|
||||||
"full": {
|
|
||||||
"name": "Vollständige Wiederherstellung",
|
|
||||||
"description": "Alles wiederherstellen, einschließlich Datenbank, Fotos und Archive",
|
|
||||||
"warning": "Dies ersetzt alle aktuellen Daten"
|
|
||||||
},
|
|
||||||
"database": {
|
|
||||||
"name": "Nur Datenbank",
|
|
||||||
"description": "Nur die Datenbank wiederherstellen (Einstellungen, Veranstaltungen, Benutzer)",
|
|
||||||
"warning": "Aktuelle Datenbank wird ersetzt"
|
|
||||||
},
|
|
||||||
"files": {
|
|
||||||
"name": "Nur Dateien",
|
|
||||||
"description": "Nur Fotos und Archive wiederherstellen",
|
|
||||||
"warning": "Vorhandene Dateien können überschrieben werden"
|
|
||||||
},
|
|
||||||
"selective": {
|
|
||||||
"name": "Selektive Wiederherstellung",
|
|
||||||
"description": "Bestimmte Elemente zur Wiederherstellung auswählen",
|
|
||||||
"warning": "Nur ausgewählte Elemente werden wiederhergestellt"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"title": "Wiederherstellungsoptionen",
|
|
||||||
"subtitle": "Wählen Sie, was wiederhergestellt werden soll",
|
|
||||||
"additionalOptions": {
|
|
||||||
"title": "Zusätzliche Optionen",
|
|
||||||
"skipPreBackup": "Vor-Wiederherstellungs-Backup überspringen",
|
|
||||||
"skipPreBackupHelp": "Standardmäßig wird vor der Wiederherstellung ein Backup erstellt. Aktivieren Sie dies, um es zu überspringen.",
|
|
||||||
"force": "Wiederherstellung erzwingen",
|
|
||||||
"forceHelp": "Sicherheitsprüfungen und Warnungen überschreiben (mit Vorsicht verwenden)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"confirmation": {
|
|
||||||
"title": "Überprüfen & Bestätigen",
|
|
||||||
"subtitle": "Bitte überprüfen Sie Ihre Wiederherstellungskonfiguration",
|
|
||||||
"validation": {
|
|
||||||
"passed": "Validierung bestanden",
|
|
||||||
"failed": "Validierung fehlgeschlagen",
|
|
||||||
"checking": "Validiere Wiederherstellungskonfiguration..."
|
|
||||||
},
|
|
||||||
"spaceCheck": {
|
|
||||||
"title": "Speicherplatz",
|
|
||||||
"required": "Erforderlich",
|
|
||||||
"available": "Verfügbar",
|
|
||||||
"insufficient": "Unzureichender Speicherplatz"
|
|
||||||
},
|
|
||||||
"summary": {
|
|
||||||
"title": "Wiederherstellungszusammenfassung",
|
|
||||||
"source": "Quelle",
|
|
||||||
"backupDate": "Backup-Datum",
|
|
||||||
"restoreType": "Wiederherstellungstyp",
|
|
||||||
"preBackup": "Vor-Backup",
|
|
||||||
"enabled": "Aktiviert",
|
|
||||||
"skipped": "Übersprungen"
|
|
||||||
},
|
|
||||||
"warning": {
|
|
||||||
"title": "Wichtiger Hinweis",
|
|
||||||
"message": "Diese Wiederherstellungsoperation ersetzt vorhandene Daten. Stellen Sie sicher, dass Sie ein aktuelles Backup haben, bevor Sie fortfahren. Diese Aktion kann nicht rückgängig gemacht werden."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"progress": {
|
|
||||||
"title": "Wiederherstellungsfortschritt",
|
|
||||||
"inProgress": "Wiederherstellung läuft...",
|
|
||||||
"completed": "Wiederherstellung abgeschlossen",
|
|
||||||
"overallProgress": "Gesamtfortschritt",
|
|
||||||
"current": "Aktuell",
|
|
||||||
"statusDetails": "Status-Details",
|
|
||||||
"restoreLogs": "Wiederherstellungsprotokolle",
|
|
||||||
"steps": {
|
|
||||||
"completed": "Abgeschlossen",
|
|
||||||
"running": "Läuft",
|
|
||||||
"failed": "Fehlgeschlagen",
|
|
||||||
"pending": "Ausstehend"
|
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"title": "Wiederherstellung erfolgreich abgeschlossen",
|
|
||||||
"message": "Ihre Daten wurden wiederhergestellt. Bitte überprüfen Sie, ob alles korrekt funktioniert."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"actions": {
|
|
||||||
"back": "Zurück",
|
|
||||||
"next": "Weiter",
|
|
||||||
"startRestore": "Wiederherstellung starten",
|
|
||||||
"starting": "Starte...",
|
|
||||||
"validating": "Validiere...",
|
|
||||||
"startNewRestore": "Neue Wiederherstellung starten"
|
|
||||||
},
|
|
||||||
"messages": {
|
|
||||||
"restoreStarted": "Wiederherstellung erfolgreich gestartet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"messages": {
|
|
||||||
"backupStarted": "Backup erfolgreich gestartet",
|
|
||||||
"backupFailed": "Backup konnte nicht gestartet werden",
|
|
||||||
"configUpdated": "Backup-Konfiguration aktualisiert",
|
|
||||||
"configUpdateFailed": "Konfiguration konnte nicht aktualisiert werden",
|
|
||||||
"backupDeleted": "Backup erfolgreich gelöscht",
|
|
||||||
"deleteFailed": "Backup konnte nicht gelöscht werden",
|
|
||||||
"testEmailSent": "Verbindungstest erfolgreich!",
|
|
||||||
"testEmailFailed": "Verbindungstest fehlgeschlagen"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"maintenance": {
|
"maintenance": {
|
||||||
"title": "Systemwartung",
|
"title": "Systemwartung",
|
||||||
"message": "Wir führen derzeit geplante Wartungsarbeiten durch, um unseren Service zu verbessern. Wir sind in Kürze wieder online.",
|
"message": "Wir führen derzeit geplante Wartungsarbeiten durch, um unseren Service zu verbessern. Wir sind in Kürze wieder online.",
|
||||||
|
|||||||
@@ -35,8 +35,7 @@
|
|||||||
"days": "days",
|
"days": "days",
|
||||||
"customize": "Customize",
|
"customize": "Customize",
|
||||||
"hide": "Hide",
|
"hide": "Hide",
|
||||||
"unknown": "Unknown",
|
"unknown": "Unknown"
|
||||||
"chunk": "Chunk"
|
|
||||||
},
|
},
|
||||||
"upload": {
|
"upload": {
|
||||||
"photoCategory": "Photo Category",
|
"photoCategory": "Photo Category",
|
||||||
@@ -52,8 +51,7 @@
|
|||||||
"uploadPhotos": "Upload Photos",
|
"uploadPhotos": "Upload Photos",
|
||||||
"maxFilesReached": "Maximum 500 files allowed",
|
"maxFilesReached": "Maximum 500 files allowed",
|
||||||
"someFilesSkipped": "Some files were skipped (500 file limit)",
|
"someFilesSkipped": "Some files were skipped (500 file limit)",
|
||||||
"tooManyFiles": "Maximum 500 files can be uploaded at once",
|
"tooManyFiles": "Maximum 500 files can be uploaded at once"
|
||||||
"uploadingChunks": "Uploading {{count}} files in {{total}} batches..."
|
|
||||||
},
|
},
|
||||||
"navigation": {
|
"navigation": {
|
||||||
"dashboard": "Dashboard",
|
"dashboard": "Dashboard",
|
||||||
@@ -955,410 +953,6 @@
|
|||||||
"datenschutz": "Privacy Policy",
|
"datenschutz": "Privacy Policy",
|
||||||
"pageUpdated": "Page updated successfully"
|
"pageUpdated": "Page updated successfully"
|
||||||
},
|
},
|
||||||
"backup": {
|
|
||||||
"title": "Backup Management",
|
|
||||||
"subtitle": "Manage system backups, configure automated backups, and restore from previous backups.",
|
|
||||||
"tabs": {
|
|
||||||
"dashboard": "Dashboard",
|
|
||||||
"configuration": "Configuration",
|
|
||||||
"history": "Backup History",
|
|
||||||
"restore": "Restore"
|
|
||||||
},
|
|
||||||
"status": {
|
|
||||||
"inProgress": "Backup in progress...",
|
|
||||||
"lastBackup": "Last backup",
|
|
||||||
"noBackups": "No backups found",
|
|
||||||
"nextBackup": "Next backup",
|
|
||||||
"notScheduled": "Not scheduled",
|
|
||||||
"enabled": "Enabled",
|
|
||||||
"disabled": "Disabled"
|
|
||||||
},
|
|
||||||
"actions": {
|
|
||||||
"runBackupNow": "Run Backup Now",
|
|
||||||
"starting": "Starting...",
|
|
||||||
"running": "Running...",
|
|
||||||
"testConnection": "Test Connection",
|
|
||||||
"save": "Save Configuration",
|
|
||||||
"delete": "Delete",
|
|
||||||
"view": "View Details",
|
|
||||||
"download": "Download",
|
|
||||||
"refresh": "Refresh"
|
|
||||||
},
|
|
||||||
"dashboard": {
|
|
||||||
"backupHealth": "Backup Health",
|
|
||||||
"healthStatus": {
|
|
||||||
"excellent": "Excellent",
|
|
||||||
"good": "Good",
|
|
||||||
"warning": "Warning",
|
|
||||||
"critical": "Critical"
|
|
||||||
},
|
|
||||||
"health": {
|
|
||||||
"title": "Backup Health"
|
|
||||||
},
|
|
||||||
"healthMessages": {
|
|
||||||
"noBackups": "No backups found",
|
|
||||||
"lastBackupFailed": "Last backup failed",
|
|
||||||
"upToDate": "Backup is up to date",
|
|
||||||
"recent": "Backup is recent",
|
|
||||||
"gettingOld": "Backup is getting old",
|
|
||||||
"outdated": "Backup is outdated"
|
|
||||||
},
|
|
||||||
"stats": {
|
|
||||||
"totalBackups": "Total Backups",
|
|
||||||
"backupSize": "Backup Size",
|
|
||||||
"lastDuration": "Last Duration",
|
|
||||||
"backupStatus": "Backup Status",
|
|
||||||
"last": "Last",
|
|
||||||
"files": "files",
|
|
||||||
"minutes": "{{count}}m",
|
|
||||||
"active": "Active",
|
|
||||||
"inactive": "Inactive",
|
|
||||||
"noBackupsYet": "No backups yet"
|
|
||||||
},
|
|
||||||
"recentActivity": {
|
|
||||||
"title": "Recent Backup Activity"
|
|
||||||
},
|
|
||||||
"notConfigured": {
|
|
||||||
"title": "Backup Not Configured",
|
|
||||||
"message": "Please configure backup settings in the Configuration tab before running backups."
|
|
||||||
},
|
|
||||||
"coverage": {
|
|
||||||
"title": "Backup Coverage",
|
|
||||||
"database": "Database",
|
|
||||||
"photos": "Photos",
|
|
||||||
"archives": "Archives",
|
|
||||||
"systemFiles": "System Files",
|
|
||||||
"included": "Included",
|
|
||||||
"excluded": "Excluded",
|
|
||||||
"optional": "Optional"
|
|
||||||
},
|
|
||||||
"storageDestination": "Storage Destination",
|
|
||||||
"nextScheduledBackup": "Next Scheduled Backup",
|
|
||||||
"backupType": "{{type}} backup",
|
|
||||||
"noDestinationSet": "No destination set"
|
|
||||||
},
|
|
||||||
"configuration": {
|
|
||||||
"enableBackup": "Enable Automated Backups",
|
|
||||||
"enableBackupHelp": "Automatically create backups according to the configured schedule",
|
|
||||||
"destinationType": "Backup Destination",
|
|
||||||
"destinationTypes": {
|
|
||||||
"local": {
|
|
||||||
"name": "Local Storage",
|
|
||||||
"description": "Store backups on the local server filesystem"
|
|
||||||
},
|
|
||||||
"rsync": {
|
|
||||||
"name": "Remote Server (Rsync)",
|
|
||||||
"description": "Sync backups to a remote server via SSH/Rsync"
|
|
||||||
},
|
|
||||||
"s3": {
|
|
||||||
"name": "S3 Compatible Storage",
|
|
||||||
"description": "Store backups in Amazon S3 or compatible object storage"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fields": {
|
|
||||||
"destinationPath": "Destination Path",
|
|
||||||
"destinationPathHelp": "Local directory path for storing backups",
|
|
||||||
"destinationPathPlaceholder": "/path/to/backup/directory",
|
|
||||||
"rsyncHost": "Remote Host",
|
|
||||||
"rsyncHostHelp": "SSH hostname or IP address",
|
|
||||||
"rsyncHostPlaceholder": "backup.example.com",
|
|
||||||
"rsyncUser": "SSH User",
|
|
||||||
"rsyncUserHelp": "Username for SSH connection",
|
|
||||||
"rsyncUserPlaceholder": "backup-user",
|
|
||||||
"rsyncPath": "Remote Path",
|
|
||||||
"rsyncPathHelp": "Directory path on remote server",
|
|
||||||
"rsyncPathPlaceholder": "/home/backup/photo-sharing",
|
|
||||||
"rsyncSshKey": "SSH Private Key",
|
|
||||||
"rsyncSshKeyHelp": "SSH private key for authentication (optional)",
|
|
||||||
"rsyncSshKeyPlaceholder": "-----BEGIN RSA PRIVATE KEY-----",
|
|
||||||
"s3Endpoint": "S3 Endpoint",
|
|
||||||
"s3EndpointHelp": "S3 API endpoint (e.g., s3.amazonaws.com)",
|
|
||||||
"s3EndpointPlaceholder": "https://s3.amazonaws.com",
|
|
||||||
"s3Bucket": "Bucket Name",
|
|
||||||
"s3BucketHelp": "S3 bucket for storing backups",
|
|
||||||
"s3BucketPlaceholder": "my-backup-bucket",
|
|
||||||
"s3AccessKey": "Access Key ID",
|
|
||||||
"s3AccessKeyHelp": "AWS/S3 access key ID",
|
|
||||||
"s3AccessKeyPlaceholder": "AKIAIOSFODNN7EXAMPLE",
|
|
||||||
"s3SecretKey": "Secret Access Key",
|
|
||||||
"s3SecretKeyHelp": "AWS/S3 secret access key",
|
|
||||||
"s3SecretKeyPlaceholder": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
|
|
||||||
"s3Region": "Region",
|
|
||||||
"s3RegionHelp": "S3 region (e.g., us-east-1)",
|
|
||||||
"s3RegionPlaceholder": "us-east-1"
|
|
||||||
},
|
|
||||||
"schedule": {
|
|
||||||
"title": "Backup Schedule",
|
|
||||||
"scheduleType": "Schedule Type",
|
|
||||||
"scheduleOptions": {
|
|
||||||
"hourly": "Every hour",
|
|
||||||
"daily": "Daily",
|
|
||||||
"weekly": "Weekly",
|
|
||||||
"custom": "Custom cron expression"
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"hourly": "Every hour",
|
|
||||||
"daily": "Daily",
|
|
||||||
"weekly": "Weekly",
|
|
||||||
"custom": "Custom cron expression"
|
|
||||||
},
|
|
||||||
"customCron": "Cron Expression",
|
|
||||||
"customCronHelp": "Enter a valid cron expression (e.g., 0 3 * * *)",
|
|
||||||
"retention": "Retention Period",
|
|
||||||
"retentionDays": "Keep backups for",
|
|
||||||
"retentionHelp": "days (older backups will be automatically deleted)"
|
|
||||||
},
|
|
||||||
"whatToBackup": {
|
|
||||||
"title": "What to Backup",
|
|
||||||
"database": "Database",
|
|
||||||
"databaseHelp": "All event data, settings, and configurations",
|
|
||||||
"photos": "Photos",
|
|
||||||
"photosHelp": "All uploaded photos in active galleries",
|
|
||||||
"archives": "Archives",
|
|
||||||
"archivesHelp": "Archived event ZIP files",
|
|
||||||
"thumbnails": "Thumbnails",
|
|
||||||
"thumbnailsHelp": "Generated thumbnail images (can be recreated)",
|
|
||||||
"tempFiles": "Temporary Files",
|
|
||||||
"tempFilesHelp": "Temporary upload and processing files"
|
|
||||||
},
|
|
||||||
"advancedOptions": {
|
|
||||||
"title": "Advanced Options",
|
|
||||||
"compression": "Enable Compression",
|
|
||||||
"compressionHelp": "Compress backup files to save storage space",
|
|
||||||
"encryption": "Enable Encryption",
|
|
||||||
"encryptionHelp": "Encrypt backups for additional security",
|
|
||||||
"encryptionPassphrase": "Encryption Passphrase",
|
|
||||||
"encryptionPassphraseHelp": "Strong passphrase for backup encryption",
|
|
||||||
"confirmPassphrase": "Confirm Passphrase",
|
|
||||||
"passphrasesDontMatch": "Passphrases don't match"
|
|
||||||
},
|
|
||||||
"validation": {
|
|
||||||
"requiredFields": "Please fill in all required fields",
|
|
||||||
"invalidCron": "Invalid cron expression",
|
|
||||||
"connectionTestFailed": "Connection test failed",
|
|
||||||
"connectionTestSuccess": "Connection test successful!"
|
|
||||||
},
|
|
||||||
"messages": {
|
|
||||||
"requiredFields": "Please fill in all required fields",
|
|
||||||
"connectionSuccess": "Connection test successful!",
|
|
||||||
"connectionFailed": "Connection test failed"
|
|
||||||
},
|
|
||||||
"testingConnection": "Testing connection...",
|
|
||||||
"saveSettings": "Save Configuration",
|
|
||||||
"savingSettings": "Saving..."
|
|
||||||
},
|
|
||||||
"history": {
|
|
||||||
"searchPlaceholder": "Search backups...",
|
|
||||||
"allStatus": "All Status",
|
|
||||||
"status": {
|
|
||||||
"completed": "Completed",
|
|
||||||
"failed": "Failed",
|
|
||||||
"running": "Running",
|
|
||||||
"partial": "Partial"
|
|
||||||
},
|
|
||||||
"deleteConfirm": "Are you sure you want to delete this backup from {{date}}?",
|
|
||||||
"noBackups": "No backups found",
|
|
||||||
"tableHeaders": {
|
|
||||||
"date": "Date",
|
|
||||||
"type": "Type",
|
|
||||||
"status": "Status",
|
|
||||||
"size": "Size",
|
|
||||||
"duration": "Duration",
|
|
||||||
"actions": "Actions"
|
|
||||||
},
|
|
||||||
"columns": {
|
|
||||||
"status": "Status",
|
|
||||||
"dateTime": "Date & Time",
|
|
||||||
"type": "Type",
|
|
||||||
"size": "Size",
|
|
||||||
"duration": "Duration",
|
|
||||||
"actions": "Actions"
|
|
||||||
},
|
|
||||||
"details": "Details",
|
|
||||||
"statistics": "Statistics",
|
|
||||||
"errors": "Errors",
|
|
||||||
"backupDetails": {
|
|
||||||
"backupId": "Backup ID",
|
|
||||||
"startTime": "Start Time",
|
|
||||||
"endTime": "End Time",
|
|
||||||
"destination": "Destination",
|
|
||||||
"filesProcessed": "Files Processed",
|
|
||||||
"totalSize": "Total Size",
|
|
||||||
"compressionRatio": "Compression Ratio",
|
|
||||||
"errorLog": "Error Log",
|
|
||||||
"noErrors": "No errors occurred"
|
|
||||||
},
|
|
||||||
"pagination": {
|
|
||||||
"showing": "Showing {{from}}-{{to}} of {{total}} backups",
|
|
||||||
"previous": "Previous",
|
|
||||||
"next": "Next"
|
|
||||||
},
|
|
||||||
"filter": {
|
|
||||||
"allStatus": "All Status",
|
|
||||||
"completed": "Completed",
|
|
||||||
"failed": "Failed",
|
|
||||||
"running": "Running",
|
|
||||||
"partial": "Partial"
|
|
||||||
},
|
|
||||||
"noBackupsFound": "No backups found",
|
|
||||||
"backupsWillAppear": "Backups will appear here once created",
|
|
||||||
"messages": {
|
|
||||||
"deleteSuccess": "Backup deleted successfully"
|
|
||||||
},
|
|
||||||
"details": {
|
|
||||||
"backupDetails": "Backup Details",
|
|
||||||
"destination": "Destination",
|
|
||||||
"started": "Started",
|
|
||||||
"completed": "Completed",
|
|
||||||
"contentBackedUp": "Content Backed Up",
|
|
||||||
"errorDetails": "Error Details",
|
|
||||||
"manifest": "Manifest"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"restore": {
|
|
||||||
"steps": {
|
|
||||||
"selectSource": "Select Source",
|
|
||||||
"chooseBackup": "Choose Backup",
|
|
||||||
"restoreOptions": "Restore Options",
|
|
||||||
"reviewConfirm": "Review & Confirm",
|
|
||||||
"progress": "Restore Progress"
|
|
||||||
},
|
|
||||||
"source": {
|
|
||||||
"title": "Select Backup Source",
|
|
||||||
"subtitle": "Choose where to restore the backup from",
|
|
||||||
"local": {
|
|
||||||
"name": "Local Backup",
|
|
||||||
"description": "Restore from local filesystem"
|
|
||||||
},
|
|
||||||
"s3": {
|
|
||||||
"name": "S3 Storage",
|
|
||||||
"description": "Restore from S3 bucket"
|
|
||||||
},
|
|
||||||
"upload": {
|
|
||||||
"name": "Upload Backup",
|
|
||||||
"description": "Upload a backup file",
|
|
||||||
"comingSoon": "Upload functionality coming soon"
|
|
||||||
},
|
|
||||||
"configuration": {
|
|
||||||
"s3": "S3 Configuration",
|
|
||||||
"endpoint": "S3 Endpoint URL",
|
|
||||||
"bucket": "Bucket Name",
|
|
||||||
"accessKey": "Access Key ID",
|
|
||||||
"secretKey": "Secret Access Key"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"backup": {
|
|
||||||
"title": "Choose Backup to Restore",
|
|
||||||
"subtitle": "Select from available backups",
|
|
||||||
"noBackupsFound": "No backups found in selected source",
|
|
||||||
"encrypted": "Encrypted Backup",
|
|
||||||
"encryptedMessage": "You'll need to provide the encryption passphrase to restore this backup.",
|
|
||||||
"enterPassphrase": "Enter encryption passphrase",
|
|
||||||
"at": "at"
|
|
||||||
},
|
|
||||||
"restoreTypes": {
|
|
||||||
"full": {
|
|
||||||
"name": "Full Restore",
|
|
||||||
"description": "Restore everything including database, photos, and archives",
|
|
||||||
"warning": "This will replace all current data"
|
|
||||||
},
|
|
||||||
"database": {
|
|
||||||
"name": "Database Only",
|
|
||||||
"description": "Restore only the database (settings, events, users)",
|
|
||||||
"warning": "Current database will be replaced"
|
|
||||||
},
|
|
||||||
"files": {
|
|
||||||
"name": "Files Only",
|
|
||||||
"description": "Restore only photos and archives",
|
|
||||||
"warning": "Existing files may be overwritten"
|
|
||||||
},
|
|
||||||
"selective": {
|
|
||||||
"name": "Selective Restore",
|
|
||||||
"description": "Choose specific items to restore",
|
|
||||||
"warning": "Only selected items will be restored"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"title": "Restore Options",
|
|
||||||
"subtitle": "Choose what to restore",
|
|
||||||
"additionalOptions": {
|
|
||||||
"title": "Additional Options",
|
|
||||||
"skipPreBackup": "Skip Pre-Restore Backup",
|
|
||||||
"skipPreBackupHelp": "By default, a backup is created before restore. Check this to skip it.",
|
|
||||||
"force": "Force Restore",
|
|
||||||
"forceHelp": "Override safety checks and warnings (use with caution)"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"confirmation": {
|
|
||||||
"title": "Review & Confirm",
|
|
||||||
"subtitle": "Please review your restore configuration",
|
|
||||||
"validation": {
|
|
||||||
"passed": "Validation Passed",
|
|
||||||
"failed": "Validation Failed",
|
|
||||||
"checking": "Validating restore configuration..."
|
|
||||||
},
|
|
||||||
"spaceCheck": {
|
|
||||||
"title": "Storage Space",
|
|
||||||
"required": "Required",
|
|
||||||
"available": "Available",
|
|
||||||
"insufficient": "Insufficient storage space"
|
|
||||||
},
|
|
||||||
"summary": {
|
|
||||||
"title": "Restore Summary",
|
|
||||||
"source": "Source",
|
|
||||||
"backupDate": "Backup Date",
|
|
||||||
"restoreType": "Restore Type",
|
|
||||||
"preBackup": "Pre-backup",
|
|
||||||
"enabled": "Enabled",
|
|
||||||
"skipped": "Skipped"
|
|
||||||
},
|
|
||||||
"warning": {
|
|
||||||
"title": "Important Notice",
|
|
||||||
"message": "This restore operation will replace existing data. Make sure you have a current backup before proceeding. This action cannot be undone."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"progress": {
|
|
||||||
"title": "Restore Progress",
|
|
||||||
"inProgress": "Restore in progress...",
|
|
||||||
"completed": "Restore completed",
|
|
||||||
"overallProgress": "Overall Progress",
|
|
||||||
"current": "Current",
|
|
||||||
"statusDetails": "Status Details",
|
|
||||||
"restoreLogs": "Restore Logs",
|
|
||||||
"steps": {
|
|
||||||
"completed": "Completed",
|
|
||||||
"running": "Running",
|
|
||||||
"failed": "Failed",
|
|
||||||
"pending": "Pending"
|
|
||||||
},
|
|
||||||
"success": {
|
|
||||||
"title": "Restore Completed Successfully",
|
|
||||||
"message": "Your data has been restored. Please verify everything is working correctly."
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"actions": {
|
|
||||||
"back": "Back",
|
|
||||||
"next": "Next",
|
|
||||||
"startRestore": "Start Restore",
|
|
||||||
"starting": "Starting...",
|
|
||||||
"validating": "Validating...",
|
|
||||||
"startNewRestore": "Start New Restore"
|
|
||||||
},
|
|
||||||
"messages": {
|
|
||||||
"restoreStarted": "Restore started successfully"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"messages": {
|
|
||||||
"backupStarted": "Backup started successfully",
|
|
||||||
"backupFailed": "Failed to start backup",
|
|
||||||
"configUpdated": "Backup configuration updated",
|
|
||||||
"configUpdateFailed": "Failed to update configuration",
|
|
||||||
"backupDeleted": "Backup deleted successfully",
|
|
||||||
"deleteFailed": "Failed to delete backup",
|
|
||||||
"testEmailSent": "Test connection successful!",
|
|
||||||
"testEmailFailed": "Connection test failed"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"maintenance": {
|
"maintenance": {
|
||||||
"title": "System Maintenance",
|
"title": "System Maintenance",
|
||||||
"message": "We're currently performing scheduled maintenance to improve our service. We'll be back online shortly.",
|
"message": "We're currently performing scheduled maintenance to improve our service. We'll be back online shortly.",
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import {
|
|||||||
import { toast } from 'react-toastify';
|
import { toast } from 'react-toastify';
|
||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
import { format } from 'date-fns';
|
import { format } from 'date-fns';
|
||||||
import { useTranslation } from 'react-i18next';
|
|
||||||
|
|
||||||
import { Button, Card, Loading } from '../../components/common';
|
import { Button, Card, Loading } from '../../components/common';
|
||||||
import { BackupDashboard } from '../../components/admin/BackupDashboard';
|
import { BackupDashboard } from '../../components/admin/BackupDashboard';
|
||||||
@@ -34,20 +33,17 @@ import { BackupHistory } from '../../components/admin/BackupHistory';
|
|||||||
import { RestoreWizard } from '../../components/admin/RestoreWizard';
|
import { RestoreWizard } from '../../components/admin/RestoreWizard';
|
||||||
import { api } from '../../config/api';
|
import { api } from '../../config/api';
|
||||||
|
|
||||||
// Tab components will be defined inside the component to use translations
|
// Tab components
|
||||||
|
const tabs = [
|
||||||
|
{ id: 'dashboard', label: 'Dashboard', icon: HardDrive },
|
||||||
|
{ id: 'configuration', label: 'Configuration', icon: Settings },
|
||||||
|
{ id: 'history', label: 'Backup History', icon: History },
|
||||||
|
{ id: 'restore', label: 'Restore', icon: RefreshCw }
|
||||||
|
];
|
||||||
|
|
||||||
export const BackupManagement = () => {
|
export const BackupManagement = () => {
|
||||||
const [activeTab, setActiveTab] = useState('dashboard');
|
const [activeTab, setActiveTab] = useState('dashboard');
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
// Tab components with translations
|
|
||||||
const tabs = [
|
|
||||||
{ id: 'dashboard', label: t('backup.tabs.dashboard'), icon: HardDrive },
|
|
||||||
{ id: 'configuration', label: t('backup.tabs.configuration'), icon: Settings },
|
|
||||||
{ id: 'history', label: t('backup.tabs.history'), icon: History },
|
|
||||||
{ id: 'restore', label: t('backup.tabs.restore'), icon: RefreshCw }
|
|
||||||
];
|
|
||||||
|
|
||||||
// Fetch backup status
|
// Fetch backup status
|
||||||
const { data: backupStatus, isLoading: statusLoading } = useQuery({
|
const { data: backupStatus, isLoading: statusLoading } = useQuery({
|
||||||
@@ -75,11 +71,11 @@ export const BackupManagement = () => {
|
|||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('backup.messages.backupStarted'));
|
toast.success('Backup started successfully');
|
||||||
queryClient.invalidateQueries({ queryKey: ['backup-status'] });
|
queryClient.invalidateQueries({ queryKey: ['backup-status'] });
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
const message = error.response?.data?.error || t('backup.messages.backupFailed');
|
const message = error.response?.data?.error || 'Failed to start backup';
|
||||||
toast.error(message);
|
toast.error(message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -91,11 +87,11 @@ export const BackupManagement = () => {
|
|||||||
return response.data;
|
return response.data;
|
||||||
},
|
},
|
||||||
onSuccess: () => {
|
onSuccess: () => {
|
||||||
toast.success(t('backup.messages.configUpdated'));
|
toast.success('Backup configuration updated');
|
||||||
queryClient.invalidateQueries({ queryKey: ['backup-config'] });
|
queryClient.invalidateQueries({ queryKey: ['backup-config'] });
|
||||||
},
|
},
|
||||||
onError: (error) => {
|
onError: (error) => {
|
||||||
const message = error.response?.data?.error || t('backup.messages.configUpdateFailed');
|
const message = error.response?.data?.error || 'Failed to update configuration';
|
||||||
toast.error(message);
|
toast.error(message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -112,9 +108,9 @@ export const BackupManagement = () => {
|
|||||||
<div className="p-8 max-w-7xl mx-auto">
|
<div className="p-8 max-w-7xl mx-auto">
|
||||||
{/* Header */}
|
{/* Header */}
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<h1 className="text-3xl font-bold text-gray-900 mb-2">{t('backup.title')}</h1>
|
<h1 className="text-3xl font-bold text-gray-900 mb-2">Backup Management</h1>
|
||||||
<p className="text-gray-600">
|
<p className="text-gray-600">
|
||||||
{t('backup.subtitle')}
|
Manage system backups, configure automated backups, and restore from previous backups.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -126,19 +122,19 @@ export const BackupManagement = () => {
|
|||||||
{backupStatus?.isRunning ? (
|
{backupStatus?.isRunning ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 className="h-5 w-5 text-blue-500 animate-spin" />
|
<Loader2 className="h-5 w-5 text-blue-500 animate-spin" />
|
||||||
<span className="text-blue-600 font-medium">{t('backup.status.inProgress')}</span>
|
<span className="text-blue-600 font-medium">Backup in progress...</span>
|
||||||
</>
|
</>
|
||||||
) : backupStatus?.lastBackup ? (
|
) : backupStatus?.lastBackup ? (
|
||||||
<>
|
<>
|
||||||
<CheckCircle className="h-5 w-5 text-green-500" />
|
<CheckCircle className="h-5 w-5 text-green-500" />
|
||||||
<span className="text-gray-700">
|
<span className="text-gray-700">
|
||||||
{t('backup.status.lastBackup')}: {format(new Date(backupStatus.lastBackup.created_at), 'PPp')}
|
Last backup: {format(new Date(backupStatus.lastBackup.created_at), 'PPp')}
|
||||||
</span>
|
</span>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<AlertCircle className="h-5 w-5 text-amber-500" />
|
<AlertCircle className="h-5 w-5 text-amber-500" />
|
||||||
<span className="text-gray-700">{t('backup.status.noBackups')}</span>
|
<span className="text-gray-700">No backups found</span>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -147,7 +143,7 @@ export const BackupManagement = () => {
|
|||||||
<div className="flex items-center space-x-2">
|
<div className="flex items-center space-x-2">
|
||||||
<Clock className="h-5 w-5 text-gray-400" />
|
<Clock className="h-5 w-5 text-gray-400" />
|
||||||
<span className="text-sm text-gray-600">
|
<span className="text-sm text-gray-600">
|
||||||
{t('backup.status.nextBackup')}: {backupStatus?.nextBackup || t('backup.status.notScheduled')}
|
Next backup: {backupStatus?.nextBackup || 'Not scheduled'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
@@ -163,12 +159,12 @@ export const BackupManagement = () => {
|
|||||||
{manualBackupMutation.isLoading ? (
|
{manualBackupMutation.isLoading ? (
|
||||||
<>
|
<>
|
||||||
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
|
||||||
{t('backup.actions.starting')}
|
Starting...
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Play className="mr-2 h-4 w-4" />
|
<Play className="mr-2 h-4 w-4" />
|
||||||
{t('backup.actions.runBackupNow')}
|
Run Backup Now
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -179,7 +175,7 @@ export const BackupManagement = () => {
|
|||||||
: 'bg-gray-100 text-gray-700'
|
: 'bg-gray-100 text-gray-700'
|
||||||
}`}>
|
}`}>
|
||||||
<Shield className="h-4 w-4" />
|
<Shield className="h-4 w-4" />
|
||||||
<span>{backupConfig?.backup_enabled ? t('backup.status.enabled') : t('backup.status.disabled')}</span>
|
<span>{backupConfig?.backup_enabled ? 'Enabled' : 'Disabled'}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ export const CreateEventPageEnhanced: React.FC = () => {
|
|||||||
const [formData, setFormData] = useState<FormData>({
|
const [formData, setFormData] = useState<FormData>({
|
||||||
event_type: 'wedding',
|
event_type: 'wedding',
|
||||||
event_name: '',
|
event_name: '',
|
||||||
event_date: new Date().toISOString().split('T')[0], // Initialize with ISO date format
|
event_date: format(new Date(), 'yyyy-MM-dd'),
|
||||||
host_name: '',
|
host_name: '',
|
||||||
host_email: '',
|
host_email: '',
|
||||||
admin_email: '',
|
admin_email: '',
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ import { toast } from 'react-toastify';
|
|||||||
import { useLocalizedDate } from '../../hooks/useLocalizedDate';
|
import { useLocalizedDate } from '../../hooks/useLocalizedDate';
|
||||||
|
|
||||||
import { Button, Input, Card, Loading } from '../../components/common';
|
import { Button, Input, Card, Loading } from '../../components/common';
|
||||||
import { EventCategoryManager, AdminPhotoGrid, AdminPhotoViewer, PhotoFilters, PasswordResetModal, ThemeCustomizerEnhanced, ThemeDisplay, HeroPhotoSelector, PhotoUploadModal, FeedbackSettings, FeedbackModerationPanel } from '../../components/admin';
|
import { EventCategoryManager, AdminPhotoGrid, AdminPhotoViewer, PhotoFilters, PasswordResetModal, ThemeCustomizerEnhanced, ThemeDisplay, HeroPhotoSelector, PhotoUploadModal } from '../../components/admin';
|
||||||
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
||||||
import { eventsService } from '../../services/events.service';
|
import { eventsService } from '../../services/events.service';
|
||||||
import { archiveService } from '../../services/archive.service';
|
import { archiveService } from '../../services/archive.service';
|
||||||
import { photosService, AdminPhoto } from '../../services/photos.service';
|
import { photosService, AdminPhoto } from '../../services/photos.service';
|
||||||
import { feedbackService, FeedbackSettings as FeedbackSettingsType } from '../../services/feedback.service';
|
|
||||||
import { ThemeConfig, GALLERY_THEME_PRESETS } from '../../types/theme.types';
|
import { ThemeConfig, GALLERY_THEME_PRESETS } from '../../types/theme.types';
|
||||||
|
|
||||||
export const EventDetailsPage: React.FC = () => {
|
export const EventDetailsPage: React.FC = () => {
|
||||||
@@ -56,15 +55,6 @@ export const EventDetailsPage: React.FC = () => {
|
|||||||
hero_photo_id: null as number | null,
|
hero_photo_id: null as number | null,
|
||||||
host_name: '',
|
host_name: '',
|
||||||
});
|
});
|
||||||
const [feedbackSettings, setFeedbackSettings] = useState<FeedbackSettingsType>({
|
|
||||||
feedback_enabled: false,
|
|
||||||
allow_ratings: true,
|
|
||||||
allow_likes: true,
|
|
||||||
allow_comments: true,
|
|
||||||
allow_favorites: true,
|
|
||||||
require_moderation: true,
|
|
||||||
show_public_stats: false
|
|
||||||
});
|
|
||||||
const [copiedLink, setCopiedLink] = useState(false);
|
const [copiedLink, setCopiedLink] = useState(false);
|
||||||
const [showPhotoUpload, setShowPhotoUpload] = useState(false);
|
const [showPhotoUpload, setShowPhotoUpload] = useState(false);
|
||||||
const [activeTab, setActiveTab] = useState<'overview' | 'photos' | 'categories'>('overview');
|
const [activeTab, setActiveTab] = useState<'overview' | 'photos' | 'categories'>('overview');
|
||||||
@@ -88,16 +78,6 @@ export const EventDetailsPage: React.FC = () => {
|
|||||||
enabled: !!id,
|
enabled: !!id,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fetch feedback settings
|
|
||||||
const { data: eventFeedbackSettings } = useQuery({
|
|
||||||
queryKey: ['admin-event-feedback-settings', id],
|
|
||||||
queryFn: () => feedbackService.getEventFeedbackSettings(id!),
|
|
||||||
enabled: !!id,
|
|
||||||
onSuccess: (data) => {
|
|
||||||
setFeedbackSettings(data);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Statistics are now fetched with the event details from the admin API
|
// Statistics are now fetched with the event details from the admin API
|
||||||
|
|
||||||
// Fetch photos (needed for both photos tab and hero photo selector)
|
// Fetch photos (needed for both photos tab and hero photo selector)
|
||||||
@@ -218,7 +198,7 @@ export const EventDetailsPage: React.FC = () => {
|
|||||||
setIsEditing(true);
|
setIsEditing(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSaveEdit = async () => {
|
const handleSaveEdit = () => {
|
||||||
// Prepare color_theme - if we have a custom theme, serialize it
|
// Prepare color_theme - if we have a custom theme, serialize it
|
||||||
let themeToSave = editForm.color_theme;
|
let themeToSave = editForm.color_theme;
|
||||||
if (currentTheme && currentPresetName === 'custom') {
|
if (currentTheme && currentPresetName === 'custom') {
|
||||||
@@ -260,16 +240,7 @@ export const EventDetailsPage: React.FC = () => {
|
|||||||
|
|
||||||
console.log('Updating event with data:', updateData);
|
console.log('Updating event with data:', updateData);
|
||||||
console.log('Theme length:', updateData.color_theme ? updateData.color_theme.length : 0);
|
console.log('Theme length:', updateData.color_theme ? updateData.color_theme.length : 0);
|
||||||
|
|
||||||
// Update event details
|
|
||||||
updateMutation.mutate(updateData);
|
updateMutation.mutate(updateData);
|
||||||
|
|
||||||
// Update feedback settings separately
|
|
||||||
try {
|
|
||||||
await feedbackService.updateEventFeedbackSettings(id!, feedbackSettings);
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to update feedback settings:', error);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCopyLink = async () => {
|
const handleCopyLink = async () => {
|
||||||
@@ -349,16 +320,14 @@ export const EventDetailsPage: React.FC = () => {
|
|||||||
{t('common.edit')}
|
{t('common.edit')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{feedbackSettings?.feedback_enabled && (
|
<Button
|
||||||
<Button
|
variant="outline"
|
||||||
variant="outline"
|
size="sm"
|
||||||
size="sm"
|
leftIcon={<MessageSquare className="w-4 h-4" />}
|
||||||
leftIcon={<MessageSquare className="w-4 h-4" />}
|
onClick={() => navigate(`/admin/events/${id}/feedback`)}
|
||||||
onClick={() => navigate(`/admin/events/${id}/feedback`)}
|
>
|
||||||
>
|
{t('feedback.manage', 'Manage Feedback')}
|
||||||
{t('feedback.manage', 'Manage Feedback')}
|
</Button>
|
||||||
</Button>
|
|
||||||
)}
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{event.share_link && (
|
{event.share_link && (
|
||||||
@@ -549,15 +518,6 @@ export const EventDetailsPage: React.FC = () => {
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Feedback Settings */}
|
|
||||||
<div className="mt-4 pt-4 border-t border-neutral-200">
|
|
||||||
<h3 className="text-sm font-semibold text-neutral-900 mb-3">{t('feedback.settings', 'Feedback Settings')}</h3>
|
|
||||||
<FeedbackSettings
|
|
||||||
settings={feedbackSettings}
|
|
||||||
onChange={setFeedbackSettings}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<dl className="space-y-4">
|
<dl className="space-y-4">
|
||||||
@@ -828,15 +788,6 @@ export const EventDetailsPage: React.FC = () => {
|
|||||||
</Card>
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Feedback Moderation Panel */}
|
|
||||||
{!event.is_archived && feedbackSettings?.feedback_enabled && (
|
|
||||||
<FeedbackModerationPanel
|
|
||||||
eventId={parseInt(id!)}
|
|
||||||
compact={true}
|
|
||||||
maxItems={3}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* Archive Status */}
|
{/* Archive Status */}
|
||||||
{event.is_archived ? (
|
{event.is_archived ? (
|
||||||
<Card padding="md">
|
<Card padding="md">
|
||||||
|
|||||||
@@ -392,7 +392,7 @@ export const EventFeedbackPage: React.FC = () => {
|
|||||||
<div className="flex items-center gap-3 mb-2">
|
<div className="flex items-center gap-3 mb-2">
|
||||||
<Star className="w-8 h-8 text-yellow-500" />
|
<Star className="w-8 h-8 text-yellow-500" />
|
||||||
<div>
|
<div>
|
||||||
<p className="text-2xl font-bold">{(analytics.summary.average_rating || 0).toFixed(1)}</p>
|
<p className="text-2xl font-bold">{analytics.summary.average_rating.toFixed(1)}</p>
|
||||||
<p className="text-sm text-neutral-600">{t('feedback.avgRating', 'Average Rating')}</p>
|
<p className="text-sm text-neutral-600">{t('feedback.avgRating', 'Average Rating')}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export const SettingsPage: React.FC = () => {
|
|||||||
enable_registration: false,
|
enable_registration: false,
|
||||||
maintenance_mode: false,
|
maintenance_mode: false,
|
||||||
default_language: 'en',
|
default_language: 'en',
|
||||||
date_format: { format: 'dd/MM/yyyy', locale: 'en-GB' }
|
date_format: { format: 'DD/MM/YYYY', locale: 'en-GB' }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Security settings state
|
// Security settings state
|
||||||
@@ -99,11 +99,7 @@ export const SettingsPage: React.FC = () => {
|
|||||||
enable_registration: settings.general_enable_registration || false,
|
enable_registration: settings.general_enable_registration || false,
|
||||||
maintenance_mode: settings.general_maintenance_mode || false,
|
maintenance_mode: settings.general_maintenance_mode || false,
|
||||||
default_language: settings.general_default_language || 'en',
|
default_language: settings.general_default_language || 'en',
|
||||||
date_format: settings.general_date_format
|
date_format: settings.general_date_format || { format: 'DD/MM/YYYY', locale: 'en-GB' }
|
||||||
? (typeof settings.general_date_format === 'string'
|
|
||||||
? { format: settings.general_date_format, locale: settings.general_date_format.includes('MM/dd') ? 'en-US' : 'en-GB' }
|
|
||||||
: settings.general_date_format)
|
|
||||||
: { format: 'dd/MM/yyyy', locale: 'en-GB' }
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Extract security settings
|
// Extract security settings
|
||||||
@@ -134,12 +130,7 @@ export const SettingsPage: React.FC = () => {
|
|||||||
// Convert to the format expected by the API
|
// Convert to the format expected by the API
|
||||||
const settingsData: Record<string, any> = {};
|
const settingsData: Record<string, any> = {};
|
||||||
Object.entries(generalSettings).forEach(([key, value]) => {
|
Object.entries(generalSettings).forEach(([key, value]) => {
|
||||||
// Special handling for date_format - only send the format string
|
settingsData[`general_${key}`] = value;
|
||||||
if (key === 'date_format' && typeof value === 'object' && value.format) {
|
|
||||||
settingsData[`general_${key}`] = value.format;
|
|
||||||
} else {
|
|
||||||
settingsData[`general_${key}`] = value;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return settingsService.updateSettings(settingsData);
|
return settingsService.updateSettings(settingsData);
|
||||||
},
|
},
|
||||||
@@ -404,10 +395,10 @@ export const SettingsPage: React.FC = () => {
|
|||||||
{t('settings.general.dateFormat')}
|
{t('settings.general.dateFormat')}
|
||||||
</label>
|
</label>
|
||||||
<select
|
<select
|
||||||
value={generalSettings.date_format?.format || 'dd/MM/yyyy'}
|
value={generalSettings.date_format?.format || 'DD/MM/YYYY'}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
const format = e.target.value;
|
const format = e.target.value;
|
||||||
const locale = format === 'MM/dd/yyyy' ? 'en-US' : 'en-GB';
|
const locale = format === 'MM/DD/YYYY' ? 'en-US' : 'en-GB';
|
||||||
setGeneralSettings(prev => ({
|
setGeneralSettings(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
date_format: { format, locale }
|
date_format: { format, locale }
|
||||||
@@ -415,10 +406,10 @@ export const SettingsPage: React.FC = () => {
|
|||||||
}}
|
}}
|
||||||
className="w-full px-3 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
|
className="w-full px-3 py-2 border border-neutral-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-primary-500 focus:border-primary-500"
|
||||||
>
|
>
|
||||||
<option value="dd/MM/yyyy">DD/MM/YYYY (European)</option>
|
<option value="DD/MM/YYYY">DD/MM/YYYY (European)</option>
|
||||||
<option value="MM/dd/yyyy">MM/DD/YYYY (US)</option>
|
<option value="MM/DD/YYYY">MM/DD/YYYY (US)</option>
|
||||||
<option value="yyyy-MM-dd">YYYY-MM-DD (ISO)</option>
|
<option value="YYYY-MM-DD">YYYY-MM-DD (ISO)</option>
|
||||||
<option value="dd.MM.yyyy">DD.MM.YYYY (German)</option>
|
<option value="DD.MM.YYYY">DD.MM.YYYY (German)</option>
|
||||||
</select>
|
</select>
|
||||||
<p className="text-xs text-neutral-500 mt-1">
|
<p className="text-xs text-neutral-500 mt-1">
|
||||||
{t('settings.general.dateFormatHelp')}
|
{t('settings.general.dateFormatHelp')}
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
import { api } from '../config/api';
|
|
||||||
|
|
||||||
export interface PublicSettings {
|
|
||||||
branding_company_name: string;
|
|
||||||
branding_company_tagline: string;
|
|
||||||
branding_support_email: string;
|
|
||||||
branding_footer_text: string;
|
|
||||||
branding_watermark_enabled: boolean;
|
|
||||||
branding_watermark_logo_url: string;
|
|
||||||
branding_watermark_position: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'center';
|
|
||||||
branding_watermark_opacity: number;
|
|
||||||
branding_watermark_size: number;
|
|
||||||
branding_favicon_url: string;
|
|
||||||
branding_logo_url: string;
|
|
||||||
theme_config: any;
|
|
||||||
default_language: string;
|
|
||||||
enable_analytics: boolean;
|
|
||||||
general_date_format: string | { format: string; locale: string };
|
|
||||||
enable_recaptcha: boolean;
|
|
||||||
recaptcha_site_key: string | null;
|
|
||||||
maintenance_mode: boolean;
|
|
||||||
umami_enabled: boolean;
|
|
||||||
umami_url: string | null;
|
|
||||||
umami_website_id: string | null;
|
|
||||||
umami_share_url: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const publicSettingsService = {
|
|
||||||
// Get public settings (no authentication required)
|
|
||||||
async getPublicSettings(): Promise<PublicSettings> {
|
|
||||||
const response = await api.get<PublicSettings>('/public/settings');
|
|
||||||
return response.data;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Reference in New Issue
Block a user