From 76d11d83f71d3fe9f8839aecbdcd678b54dca6b0 Mon Sep 17 00:00:00 2001 From: Ravinou Date: Sun, 12 May 2024 16:35:45 +0200 Subject: [PATCH] feat: add borgbackup "append-only" mode as option to repo ! #160 --- Components/Repo/Repo.js | 13 ++++++++ Components/Repo/Repo.module.css | 7 +++++ Containers/RepoList/RepoList.js | 1 + Containers/RepoManage/RepoManage.js | 34 ++++++++++++++++++++- Containers/RepoManage/RepoManage.module.css | 8 ++--- helpers/shells/createRepo.sh | 23 +++++++++----- helpers/shells/updateRepo.sh | 15 ++++++--- pages/api/repo/add.js | 22 ++++++++++--- pages/api/repo/id/[slug]/edit.js | 26 +++++++++++----- 9 files changed, 121 insertions(+), 28 deletions(-) diff --git a/Components/Repo/Repo.js b/Components/Repo/Repo.js index 4edfd5e..2dce1ae 100644 --- a/Components/Repo/Repo.js +++ b/Components/Repo/Repo.js @@ -7,6 +7,7 @@ import { IconChevronDown, IconChevronUp, IconBellOff, + IconLockPlus, } from '@tabler/icons-react'; import timestampConverter from '../../helpers/functions/timestampConverter'; import StorageBar from '../UI/StorageBar/StorageBar'; @@ -72,6 +73,16 @@ export default function Repo(props) { } }; + const appendOnlyModeIndicator = () => { + if (props.appendOnlyMode) { + return ( +
+ +
+ ); + } + }; + return ( <> {displayDetails ? ( @@ -80,6 +91,7 @@ export default function Repo(props) {
{props.alias}
+ {appendOnlyModeIndicator()} {alertIndicator()} {props.comment && (
@@ -155,6 +167,7 @@ export default function Repo(props) {
{props.alias}
+ {appendOnlyModeIndicator()} {alertIndicator()} {props.comment && (
diff --git a/Components/Repo/Repo.module.css b/Components/Repo/Repo.module.css index ae972e8..edbf05e 100644 --- a/Components/Repo/Repo.module.css +++ b/Components/Repo/Repo.module.css @@ -157,6 +157,13 @@ margin-left: 10px; } +.appendOnlyModeIcon { + display: flex; + flex-direction: row; + align-items: center; + margin-left: 10px; +} + /* GENERAL */ .alias { font-weight: bold; diff --git a/Containers/RepoList/RepoList.js b/Containers/RepoList/RepoList.js index 8e794f1..602be5a 100644 --- a/Containers/RepoList/RepoList.js +++ b/Containers/RepoList/RepoList.js @@ -123,6 +123,7 @@ export default function RepoList() { sshPublicKey={repo.sshPublicKey} comment={repo.comment} lanCommand={repo.lanCommand} + appendOnlyMode={repo.appendOnlyMode} repoManageEditHandler={() => repoManageEditHandler(repo.id)} wizardEnv={wizardEnv} > diff --git a/Containers/RepoManage/RepoManage.js b/Containers/RepoManage/RepoManage.js index 36ebc62..251b24d 100644 --- a/Containers/RepoManage/RepoManage.js +++ b/Containers/RepoManage/RepoManage.js @@ -170,6 +170,7 @@ export default function RepoManage(props) { comment: dataForm.comment, alert: dataForm.alert.value, lanCommand: dataForm.lanCommand, + appendOnlyMode: dataForm.appendOnlyMode, }; //POST API to send new repo await fetch('/api/repo/add', { @@ -210,6 +211,7 @@ export default function RepoManage(props) { comment: dataForm.comment, alert: dataForm.alert.value, lanCommand: dataForm.lanCommand, + appendOnlyMode: dataForm.appendOnlyMode, }; await fetch('/api/repo/id/' + router.query.slug + '/edit', { method: 'PUT', @@ -426,7 +428,7 @@ export default function RepoManage(props) { )} {/* LAN COMMAND GENERATION */} -
+
+ {/* APPEND-ONLY MODE */} +
+ + + + + +
{/* ALERT */}