mirror of
https://github.com/garethgeorge/backrest.git
synced 2025-12-12 08:45:38 +00:00
fix: UI quality of life improvements
This commit is contained in:
@@ -34,8 +34,6 @@ Username and password
|
|||||||
* If you don't want to use authentication (e.g. a local only installation or if you're using an authenticating reverse proxy) you can disabled authentication.
|
* If you don't want to use authentication (e.g. a local only installation or if you're using an authenticating reverse proxy) you can disabled authentication.
|
||||||
|
|
||||||
|
|
||||||
#### Backrest Host Name
|
|
||||||
|
|
||||||
#### Add a new repository
|
#### Add a new repository
|
||||||
|
|
||||||
A Backrest repository is implemented as a restic repository under-the-hood (more on this later). A Repo is a configuration object which identifies a storage location and the credentials that will be used to encrypt snapshots sent to that storage. You can either add an existing repo that you created on the restic CLI or create a new one in the Backrest UI. In either case, click the "Add Repo" button in the UI to configure Backrest to use your backup location.
|
A Backrest repository is implemented as a restic repository under-the-hood (more on this later). A Repo is a configuration object which identifies a storage location and the credentials that will be used to encrypt snapshots sent to that storage. You can either add an existing repo that you created on the restic CLI or create a new one in the Backrest UI. In either case, click the "Add Repo" button in the UI to configure Backrest to use your backup location.
|
||||||
|
|||||||
@@ -327,7 +327,8 @@ func (o *Orchestrator) Run(ctx context.Context) {
|
|||||||
|
|
||||||
// Clone the operation incase we need to reset changes and reschedule the task for a retry
|
// Clone the operation incase we need to reset changes and reschedule the task for a retry
|
||||||
originalOp := proto.Clone(t.Op).(*v1.Operation)
|
originalOp := proto.Clone(t.Op).(*v1.Operation)
|
||||||
if t.Op != nil {
|
if t.Op != nil && t.retryCount != 0 {
|
||||||
|
t.Op.DisplayMessage = fmt.Sprintf("running after %d retries", t.retryCount)
|
||||||
// Delete any previous hook executions for this operation incase this is a retry.
|
// Delete any previous hook executions for this operation incase this is a retry.
|
||||||
prevHookExecutionIDs := []int64{}
|
prevHookExecutionIDs := []int64{}
|
||||||
if err := o.OpLog.Query(oplog.Query{FlowID: t.Op.FlowId}, func(op *v1.Operation) error {
|
if err := o.OpLog.Query(oplog.Query{FlowID: t.Op.FlowId}, func(op *v1.Operation) error {
|
||||||
|
|||||||
@@ -44,42 +44,22 @@ export interface HookFields {
|
|||||||
|
|
||||||
export const hooksListTooltipText = (
|
export const hooksListTooltipText = (
|
||||||
<>
|
<>
|
||||||
Hooks are actions that can execute on backup lifecycle events. Available
|
Hooks let you configure actions e.g. notifications and scripts that run in
|
||||||
events are:
|
response to the backup lifecycle. See{" "}
|
||||||
<ul>
|
|
||||||
<li>On Finish Snapshot: Runs after a snapshot is finished.</li>
|
|
||||||
<li>On Start Snapshot: Runs when a snapshot is started.</li>
|
|
||||||
<li>On Snapshot Error: Runs when a snapshot fails.</li>
|
|
||||||
<li>On Any Error: Runs when any error occurs.</li>
|
|
||||||
</ul>
|
|
||||||
Arguments are available to hooks as{" "}
|
|
||||||
<a
|
<a
|
||||||
|
href="https://garethgeorge.github.io/backrest/docs/hooks"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
|
||||||
href="https://pkg.go.dev/text/template"
|
|
||||||
>
|
>
|
||||||
Go template variables
|
the hook documentation
|
||||||
|
</a>{" "}
|
||||||
|
for available options, or
|
||||||
|
<a
|
||||||
|
href="https://garethgeorge.github.io/backrest/cookbooks/command-hook-examples"
|
||||||
|
target="_blank"
|
||||||
|
>
|
||||||
|
the cookbook
|
||||||
</a>
|
</a>
|
||||||
<ul>
|
for scripting examples.
|
||||||
<li>.Task - the name of the task that triggered the hook.</li>
|
|
||||||
<li>.Event - the event that triggered the hook.</li>
|
|
||||||
<li>.Repo - the name of the repo the event applies to.</li>
|
|
||||||
<li>.Plan - the name of the plan the event applies to.</li>
|
|
||||||
<li>.Error - the error if any is available.</li>
|
|
||||||
<li>.CurTime - the time of the event.</li>
|
|
||||||
<li>
|
|
||||||
.SnapshotId - the restic snapshot structure if this is finish snapshot
|
|
||||||
operation and it completed successfully.
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
Functions
|
|
||||||
<ul>
|
|
||||||
<li>.ShellEscape - escapes a string to be used in a shell command.</li>
|
|
||||||
<li>.JsonMarshal - serializes a value to be used in a json string.</li>
|
|
||||||
<li>.Summary - prints a formatted summary of the event.</li>
|
|
||||||
<li>.FormatTime - prints time formatted as RFC3339.</li>
|
|
||||||
<li>.FormatSizeBytes - prints a formatted size in bytes.</li>
|
|
||||||
</ul>
|
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -197,9 +177,7 @@ const hookTypes: {
|
|||||||
component: ({ field }: { field: FormListFieldData }) => {
|
component: ({ field }: { field: FormListFieldData }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Tooltip title="Script to execute. Commands will not work in the docker build of Backrest.">
|
<Tooltip title="Script to execute.">Script:</Tooltip>
|
||||||
Script:
|
|
||||||
</Tooltip>
|
|
||||||
<Form.Item
|
<Form.Item
|
||||||
name={[field.name, "actionCommand", "command"]}
|
name={[field.name, "actionCommand", "command"]}
|
||||||
rules={[requiredField("command is required")]}
|
rules={[requiredField("command is required")]}
|
||||||
|
|||||||
@@ -491,7 +491,7 @@ const BackupView = ({ backup }: { backup?: FlowDisplayInfo }) => {
|
|||||||
height: "60px",
|
height: "60px",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<h3>Backup on {formatTime(backup.displayTime)}</h3>
|
<h3>{formatTime(backup.displayTime)}</h3>
|
||||||
<div style={{ position: "absolute", right: "20px" }}>
|
<div style={{ position: "absolute", right: "20px" }}>
|
||||||
{backup.status !== OperationStatus.STATUS_PENDING &&
|
{backup.status !== OperationStatus.STATUS_PENDING &&
|
||||||
backup.status !== OperationStatus.STATUS_INPROGRESS
|
backup.status !== OperationStatus.STATUS_INPROGRESS
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ export const ScheduleDefaultsInfrequent: ScheduleDefaults = {
|
|||||||
maxFrequencyHours: 30 * 24,
|
maxFrequencyHours: 30 * 24,
|
||||||
// midnight on the first day of the month
|
// midnight on the first day of the month
|
||||||
cron: "0 0 1 * *",
|
cron: "0 0 1 * *",
|
||||||
cronDropdowns: ["period", "months", "month-days"],
|
cronDropdowns: ["period", "months", "month-days", "week-days", "hours"],
|
||||||
cronPeriods: ["month"],
|
cronPeriods: ["month", "week"],
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ScheduleDefaultsDaily: ScheduleDefaults = {
|
export const ScheduleDefaultsDaily: ScheduleDefaults = {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
|
||||||
export const formatBytes = (bytes?: number | string) => {
|
export const formatBytes = (bytes?: number | string) => {
|
||||||
if (!bytes) {
|
if (!bytes) {
|
||||||
return "0B";
|
return "0B";
|
||||||
@@ -6,7 +7,6 @@ export const formatBytes = (bytes?: number | string) => {
|
|||||||
bytes = parseInt(bytes);
|
bytes = parseInt(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
const units = ["B", "KB", "MB", "GB", "TB", "PB"];
|
|
||||||
let unit = 0;
|
let unit = 0;
|
||||||
while (bytes > 1024) {
|
while (bytes > 1024) {
|
||||||
bytes /= 1024;
|
bytes /= 1024;
|
||||||
|
|||||||
Reference in New Issue
Block a user