diff --git a/install.sh b/install.sh index 59a5a202..4ae51129 100755 --- a/install.sh +++ b/install.sh @@ -104,5 +104,5 @@ else exit 1 fi -echo "Logs are available at /tmp/backrest.log" +echo "Logs are available at ~/.local/share/backrest/processlogs/backrest.log" echo "Access backrest WebUI at http://localhost:9898" diff --git a/webui/src/views/AddPlanModal.tsx b/webui/src/views/AddPlanModal.tsx index 9ea21078..0e4a2152 100644 --- a/webui/src/views/AddPlanModal.tsx +++ b/webui/src/views/AddPlanModal.tsx @@ -15,7 +15,11 @@ import { } from "antd"; import React, { useEffect, useState } from "react"; import { useShowModal } from "../components/ModalManager"; -import { Plan, RetentionPolicy } from "../../gen/ts/v1/config_pb"; +import { + Plan, + RetentionPolicy, + Schedule_Clock, +} from "../../gen/ts/v1/config_pb"; import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons"; import { URIAutocomplete } from "../components/URIAutocomplete"; import { formatErrorAlert, useAlertApi } from "../components/Alerts"; @@ -32,6 +36,26 @@ import { ScheduleFormItem, } from "../components/ScheduleFormItem"; +const planDefaults = new Plan({ + schedule: { + schedule: { + case: "cron", + value: "0 * * * *", // every hour + }, + clock: Schedule_Clock.LOCAL, + }, + retention: { + policy: { + case: "policyTimeBucketed", + value: { + hourly: 24, + daily: 30, + monthly: 12, + }, + }, + }, +}); + export const AddPlanModal = ({ template }: { template: Plan | null }) => { const [confirmLoading, setConfirmLoading] = useState(false); const showModal = useShowModal(); @@ -39,7 +63,11 @@ export const AddPlanModal = ({ template }: { template: Plan | null }) => { const [config, setConfig] = useConfig(); const [form] = Form.useForm(); useEffect(() => { - form.setFieldsValue(template ? JSON.parse(template.toJsonString()) : {}); + form.setFieldsValue( + template + ? JSON.parse(template.toJsonString()) + : JSON.parse(planDefaults.toJsonString()) + ); }, [template]); if (!config) { diff --git a/webui/src/views/AddRepoModal.tsx b/webui/src/views/AddRepoModal.tsx index a91cf98a..71cb2b13 100644 --- a/webui/src/views/AddRepoModal.tsx +++ b/webui/src/views/AddRepoModal.tsx @@ -23,6 +23,8 @@ import { CommandPrefix_IONiceLevel, Hook, Repo, + Schedule, + Schedule_Clock, } from "../../gen/ts/v1/config_pb"; import { URIAutocomplete } from "../components/URIAutocomplete"; import { MinusCircleOutlined, PlusOutlined } from "@ant-design/icons"; @@ -45,6 +47,28 @@ import { import { proto3 } from "@bufbuild/protobuf"; import { isWindows } from "../state/buildcfg"; +const repoDefaults = new Repo({ + prunePolicy: { + maxUnusedPercent: 10, + schedule: { + schedule: { + case: "cron", + value: "0 0 1 * *", // 1st of the month, + }, + clock: Schedule_Clock.LAST_RUN_TIME, + }, + }, + checkPolicy: { + schedule: { + schedule: { + case: "cron", + value: "0 0 1 * *", // 1st of the month, + }, + clock: Schedule_Clock.LAST_RUN_TIME, + }, + }, +}); + export const AddRepoModal = ({ template }: { template: Repo | null }) => { const [confirmLoading, setConfirmLoading] = useState(false); const showModal = useShowModal(); @@ -52,7 +76,11 @@ export const AddRepoModal = ({ template }: { template: Repo | null }) => { const [config, setConfig] = useConfig(); const [form] = Form.useForm(); useEffect(() => { - form.setFieldsValue(template ? JSON.parse(template.toJsonString()) : {}); + form.setFieldsValue( + template + ? JSON.parse(template.toJsonString()) + : JSON.parse(repoDefaults.toJsonString()) + ); }, [template]); if (!config) {