From 70cc01cb49bef85a461210aab106bd27dd2b3b45 Mon Sep 17 00:00:00 2001 From: garethgeorge Date: Sun, 5 May 2024 13:45:23 -0700 Subject: [PATCH] fix: hide successful hook executions in the backup view --- .../1.introduction/1.getting-started.md | 9 +++++-- proto/v1/config.proto | 10 ++++++++ proto/v1/hub.proto | 25 +++++++++++++++++++ webui/src/state/oplog.ts | 7 +++++- 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 proto/v1/hub.proto diff --git a/docs/content/1.introduction/1.getting-started.md b/docs/content/1.introduction/1.getting-started.md index d07aa910..3f05d507 100644 --- a/docs/content/1.introduction/1.getting-started.md +++ b/docs/content/1.introduction/1.getting-started.md @@ -47,8 +47,9 @@ The primary properties of a repository are: * **Flags** additional flags to provide to restic. At the moment only presence flags are supported. Common usage might include: * `-o sftp.args="-i /path/to/key"` will pass an SSH key to restic for use with SFTP repositories. - * `--force` will force rereading all files on each backup rather than relying on metadata (e.g. last modified time). This can be much slower. - * `--one-file-system` will prevent restic crossing filesystem boundaries. + * `--no-lock` will disable the use of locks in the restic repository. This can be useful for read-only repos. + * `--limit-upload 1000` will limit the upload speed to a speed in kilobytes per second (e.g. 1000KB/s). This can be useful to avoid saturating a network connection. + * `--limit-download 1000` will limit the download speed to a speed in kilobytes per second (e.g. 1000KB/s). This can be useful to avoid saturating a network connection. * **Hooks** are actions triggered by backup lifecycle events, repo hooks will apply to actions run by any plan that writes to the repo. Hooks can also be configured at the plan level. See the [hooks documentation](/docs/hooks) for more information. ::alert{type="info"} @@ -78,6 +79,10 @@ The primary properties of a plan are: * **None** - no retention policy is enforced. This is useful for append-only repos or if you'd like to manage retention manually e.g. in an external script. Note that care should be taken not to allow snapshots to grow without bound (though Backrest will typically scale and perform well with hundreds to thousands of snapshots). * **Hooks** hooks are actions that can be configured in response to backup lifecycle events. See the hooks page of the wiki for more details. + * **Backup Flags** flags that are specific to the backup command (e.g. `--force` to force a full scan of all files rather than relying on metadata). These flags are passed directly to the restic command. + * `--one-file-system` will prevent restic crossing filesystem boundaries. + * `--force` will force rereading all files on each backup rather than relying on metadata (e.g. last modified time). This can be much slower. + ::alert{type="success"} Success! Now that Backrest is configured you can sit back and let it manage your backups. You can monitor the status of your backups in the UI and restore files from snapshots as needed. diff --git a/proto/v1/config.proto b/proto/v1/config.proto index e516d7ad..f549beb0 100644 --- a/proto/v1/config.proto +++ b/proto/v1/config.proto @@ -6,6 +6,16 @@ option go_package = "github.com/garethgeorge/backrest/gen/go/v1"; import "google/protobuf/empty.proto"; +message HubConfig { + repeated InstanceInfo instances = 1 [json_name="instances"]; + + message InstanceInfo { + string id = 1 [json_name="id"]; + string secret = 2 [json_name="secret"]; // secret used to authenticate with the hub. + } +} + + // Config is the top level config object for restic UI. message Config { // modification number, used for read-modify-write consistency in the UI. Incremented on every write. diff --git a/proto/v1/hub.proto b/proto/v1/hub.proto new file mode 100644 index 00000000..d5f8d5c0 --- /dev/null +++ b/proto/v1/hub.proto @@ -0,0 +1,25 @@ +syntax = "proto3"; + +package v1; + +option go_package = "github.com/garethgeorge/backrest/gen/go/v1"; + +import "v1/config.proto"; +import "v1/restic.proto"; +import "v1/operations.proto"; +import "types/value.proto"; +import "google/protobuf/empty.proto"; +import "google/api/annotations.proto"; + +service Hub { + // GetInstances returns a list of all instances + rpc GetInstances(google.protobuf.Empty) returns (GetInstancesResponse) {} +} + +message GetInstancesResponse { + repeated Instance instances = 1; +} + +message Instance { + string id = 1; +} \ No newline at end of file diff --git a/webui/src/state/oplog.ts b/webui/src/state/oplog.ts index ed5cece0..21c5d196 100644 --- a/webui/src/state/oplog.ts +++ b/webui/src/state/oplog.ts @@ -275,7 +275,11 @@ export class BackupInfoCollector { public bulkAddOperations(ops: Operation[]): BackupInfo[] { for (const op of ops) { - this.addOrUpdateHelper(op); + if (this.filter(op)) { + this.addOrUpdateHelper(op); + } else { + this.removeOperation(op); + } } const flowIDs = _.uniq(ops.map((op) => op.flowId)); const info = flowIDs.map((flowId) => this.getBackupInfo(flowId)!); @@ -311,6 +315,7 @@ export class BackupInfoCollector { export const shouldHideOperation = (operation: Operation) => { return ( operation.op.case === "operationStats" || + (operation.op.case === "operationRunHook" && operation.status === OperationStatus.STATUS_SUCCESS) || shouldHideStatus(operation.status) ); };