From cc173aa7b1b9dda10cfb14ca179c9701d15f22f5 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Mon, 26 Aug 2024 19:50:40 -0700 Subject: [PATCH] fix: UI quality of life improvements --- .../1.introduction/1.getting-started.md | 2 - internal/orchestrator/orchestrator.go | 3 +- webui/src/components/HooksFormList.tsx | 48 +++++-------------- webui/src/components/OperationTree.tsx | 2 +- webui/src/components/ScheduleFormItem.tsx | 4 +- webui/src/lib/formatting.ts | 2 +- 6 files changed, 19 insertions(+), 42 deletions(-) diff --git a/docs/content/1.introduction/1.getting-started.md b/docs/content/1.introduction/1.getting-started.md index 91ff837..dc66d59 100644 --- a/docs/content/1.introduction/1.getting-started.md +++ b/docs/content/1.introduction/1.getting-started.md @@ -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. -#### Backrest Host Name - #### 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. diff --git a/internal/orchestrator/orchestrator.go b/internal/orchestrator/orchestrator.go index 2675524..93f7639 100644 --- a/internal/orchestrator/orchestrator.go +++ b/internal/orchestrator/orchestrator.go @@ -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 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. prevHookExecutionIDs := []int64{} if err := o.OpLog.Query(oplog.Query{FlowID: t.Op.FlowId}, func(op *v1.Operation) error { diff --git a/webui/src/components/HooksFormList.tsx b/webui/src/components/HooksFormList.tsx index 098fd82..37562ded 100644 --- a/webui/src/components/HooksFormList.tsx +++ b/webui/src/components/HooksFormList.tsx @@ -44,42 +44,22 @@ export interface HookFields { export const hooksListTooltipText = ( <> - Hooks are actions that can execute on backup lifecycle events. Available - events are: - - Arguments are available to hooks as{" "} + Hooks let you configure actions e.g. notifications and scripts that run in + response to the backup lifecycle. See{" "} - Go template variables + the hook documentation + {" "} + for available options, or + + the cookbook - - Functions - + for scripting examples. ); @@ -197,9 +177,7 @@ const hookTypes: { component: ({ field }: { field: FormListFieldData }) => { return ( <> - - Script: - + Script: { height: "60px", }} > -

Backup on {formatTime(backup.displayTime)}

+

{formatTime(backup.displayTime)}

{backup.status !== OperationStatus.STATUS_PENDING && backup.status !== OperationStatus.STATUS_INPROGRESS diff --git a/webui/src/components/ScheduleFormItem.tsx b/webui/src/components/ScheduleFormItem.tsx index 251ec90..1b7951a 100644 --- a/webui/src/components/ScheduleFormItem.tsx +++ b/webui/src/components/ScheduleFormItem.tsx @@ -15,8 +15,8 @@ export const ScheduleDefaultsInfrequent: ScheduleDefaults = { maxFrequencyHours: 30 * 24, // midnight on the first day of the month cron: "0 0 1 * *", - cronDropdowns: ["period", "months", "month-days"], - cronPeriods: ["month"], + cronDropdowns: ["period", "months", "month-days", "week-days", "hours"], + cronPeriods: ["month", "week"], }; export const ScheduleDefaultsDaily: ScheduleDefaults = { diff --git a/webui/src/lib/formatting.ts b/webui/src/lib/formatting.ts index 135a6ab..be96618 100644 --- a/webui/src/lib/formatting.ts +++ b/webui/src/lib/formatting.ts @@ -1,3 +1,4 @@ +const units = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"]; export const formatBytes = (bytes?: number | string) => { if (!bytes) { return "0B"; @@ -6,7 +7,6 @@ export const formatBytes = (bytes?: number | string) => { bytes = parseInt(bytes); } - const units = ["B", "KB", "MB", "GB", "TB", "PB"]; let unit = 0; while (bytes > 1024) { bytes /= 1024;