Skip to content

A modern, self-hosted backup solution for secure, encrypted backups across local and cloud storage.

feat: add description field to plans

towfiqif905b9a2a213
diff --git a/backend/src/db/schema/plans.ts b/backend/src/db/schema/plans.ts
index 5da944a..bbe48f4 100644
--- a/backend/src/db/schema/plans.ts
+++ b/backend/src/db/schema/plans.ts
@@ -15,6 +15,7 @@ export const plans = sqliteTable('plans', {
.notNull()
.default(sql`(unixepoch())`),
title: text('title').notNull(),
+ description: text('description'),
isActive: integer('active', { mode: 'boolean' }).notNull().default(true),
inProgress: integer('in_progress', { mode: 'boolean' }),
updatedAt: integer('updated_at', { mode: 'timestamp' }),
diff --git a/backend/src/services/PlanService.ts b/backend/src/services/PlanService.ts
index ef8a8eb..2efea8d 100644
--- a/backend/src/services/PlanService.ts
+++ b/backend/src/services/PlanService.ts
@@ -68,6 +68,7 @@ export class PlanService {
const planId = generateUID();
const {
title,
+ description,
storage,
storagePath,
sourceConfig,
@@ -90,6 +91,7 @@ export class PlanService {
let newPlanData: NewPlan = {
id: planId,
title: title.trim(),
+ description: description?.trim() || '',
storageId: storage.id,
storagePath: theStoragePath,
method,
diff --git a/backend/src/types/plans.ts b/backend/src/types/plans.ts
index 68ef625..a81fd14 100644
--- a/backend/src/types/plans.ts
+++ b/backend/src/types/plans.ts
@@ -185,6 +185,7 @@ export type PlanStats = {
export interface NewPlanReq {
title: string;
+ description?: string;
method: string;
sourceConfig: {
includes: string[];
diff --git a/frontend/src/@types/plans.ts b/frontend/src/@types/plans.ts
index 08c312d..bae0c5f 100644
--- a/frontend/src/@types/plans.ts
+++ b/frontend/src/@types/plans.ts
@@ -156,6 +156,7 @@ export type PlanStats = {
export type Plan = {
id: string;
title: string;
+ description?: string;
method: string;
inProgress: boolean;
isActive: boolean;
@@ -180,6 +181,7 @@ export type Plan = {
export interface NewPlanSettings {
id?: string;
+ description?: string;
title: string;
method: string;
sourceConfig: {
diff --git a/frontend/src/components/Plan/PlanForm/PlanForm.tsx b/frontend/src/components/Plan/PlanForm/PlanForm.tsx
index 5ef686a..23addb4 100644
--- a/frontend/src/components/Plan/PlanForm/PlanForm.tsx
+++ b/frontend/src/components/Plan/PlanForm/PlanForm.tsx
@@ -121,6 +121,16 @@ const PlanForm = ({ title, planSettings, type, onPlanSettingsChange, onSubmit, i
onChange={(e) => onPlanSettingsChange({ ...planSettings, title: e.target.value })}
/>
</div>
+ <div className={classes.field}>
+ <label className={classes.label}>Backup Plan Description</label>
+ <input
+ className={classes.titleInput}
+ type="text"
+ placeholder="Plan Description"
+ value={planSettings.description || ''}
+ onChange={(e) => onPlanSettingsChange({ ...planSettings, description: e.target.value })}
+ />
+ </div>
{/* <PlanTypeSettings
plan={planSettings}
onUpdate={(plan: NewPlanSettings) => onPlanSettingsChange({ ...plan })}
diff --git a/frontend/src/components/Plan/PlanItems/PlanItem.tsx b/frontend/src/components/Plan/PlanItems/PlanItem.tsx
index f2c3105..fa7498c 100644
--- a/frontend/src/components/Plan/PlanItems/PlanItem.tsx
+++ b/frontend/src/components/Plan/PlanItems/PlanItem.tsx
@@ -18,6 +18,7 @@ const PlanItem = ({ plan, layout = 'list' }: PlanItemProps) => {
const {
id,
title,
+ description,
sourceConfig = { includes: [], excludes: [] },
settings,
inProgress,
@@ -111,6 +112,16 @@ const PlanItem = ({ plan, layout = 'list' }: PlanItemProps) => {
<NavLink to={`/plan/${id}`}>
<div className={classes.title}>
<h4>{title}</h4>
+ {description && (
+ <i
+ className={classes.planDescription}
+ data-tooltip-id="appTooltip"
+ data-tooltip-content={description}
+ data-tooltip-place="top"
+ >
+ <Icon type="note" size={13} />
+ </i>
+ )}
{encryption && (
<i data-tooltip-id="appTooltip" data-tooltip-content={`Encrypted`} data-tooltip-place="top">
<Icon type="encrypted" size={14} />
diff --git a/frontend/src/components/common/Icon/Icon.tsx b/frontend/src/components/common/Icon/Icon.tsx
index 93d70b0..9b4b928 100644
--- a/frontend/src/components/common/Icon/Icon.tsx
+++ b/frontend/src/components/common/Icon/Icon.tsx
@@ -1094,6 +1094,18 @@ const Icon = ({ type, color = 'currentColor', size = 16, title = '', classes = '
></path>
</IconWrapper>
)}
+ {type === 'note' && (
+ <IconWrapper size={size} viewBox="0 0 24 24">
+ <path
+ fill="none"
+ stroke={color}
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ stroke-width="2"
+ d="M21 15V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10m6-6v.172a2 2 0 0 1-.586 1.414l-3.828 3.828a2 2 0 0 1-1.414.586H15m6-6h-4a2 2 0 0 0-2 2v4M7 7h10M7 11h10M7 15h4"
+ />
+ </IconWrapper>
+ )}
{type === 'sort' && (
<IconWrapper size={size} viewBox="0 0 16 16">
<path
diff --git a/frontend/src/routes/PlanSingle/PlanSingle.module.scss b/frontend/src/routes/PlanSingle/PlanSingle.module.scss
index feccd2f..b24a097 100644
--- a/frontend/src/routes/PlanSingle/PlanSingle.module.scss
+++ b/frontend/src/routes/PlanSingle/PlanSingle.module.scss
@@ -1,3 +1,12 @@
+.planSingle {
+ .planDescription {
+ margin-left: 6px;
+ :global(.icon) {
+ color: var(--icon-color);
+ }
+ }
+}
+
.planActions {
position: relative;
.moreOptions {
@@ -50,7 +59,7 @@
}
@media only screen and (max-width: 768px) {
- .plans {
+ .planSingle {
:global([class*='_header_']) {
flex-direction: column;
align-items: flex-start;
diff --git a/frontend/src/routes/PlanSingle/PlanSingle.tsx b/frontend/src/routes/PlanSingle/PlanSingle.tsx
index 727d822..a394531 100644
--- a/frontend/src/routes/PlanSingle/PlanSingle.tsx
+++ b/frontend/src/routes/PlanSingle/PlanSingle.tsx
@@ -62,17 +62,22 @@ const PlanSingle = () => {
);
}
- const { isActive, method, title, stats, settings } = plan;
+ const { isActive, method, title, description, stats, settings } = plan;
const prune = settings.prune;
const snapshotsCount = stats.snapshots?.length || 0;
const isSync = method === 'sync';
return (
- <div className={classes.plans}>
+ <div className={classes.planSingle}>
<PageHeader
title={
<>
{title}{' '}
+ {description && (
+ <span className={classes.planDescription} data-tooltip-id="appTooltip" data-tooltip-content={description}>
+ <Icon type="note" size={13} />
+ </span>
+ )}
{!isActive && (
<span className="label warn">
<Icon size={14} type={'pause'} color="#bf8d20" /> Paused