Skip to content

Commit

Permalink
optree UI refinements and backend prep for operation list view by sna…
Browse files Browse the repository at this point in the history
…pshot id
  • Loading branch information
garethgeorge committed Nov 25, 2023
1 parent 10348a3 commit 79256fc
Show file tree
Hide file tree
Showing 18 changed files with 438 additions and 180 deletions.
28 changes: 16 additions & 12 deletions gen/go/v1/operations.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

182 changes: 96 additions & 86 deletions gen/go/v1/service.pb.go

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion internal/api/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (s *Server) AddRepo(ctx context.Context, repo *v1.Repo) (*v1.Config, error)
return c, nil
}

// ListSnapshots implements GET /v1/snapshots/{repo.id}/{plan.id?}
// ListSnapshots implements POST /v1/snapshots
func (s *Server) ListSnapshots(ctx context.Context, query *v1.ListSnapshotsRequest) (*v1.ResticSnapshotList, error) {
repo, err := s.orchestrator.GetRepo(query.RepoId)
if err != nil {
Expand Down Expand Up @@ -200,6 +200,8 @@ func (s *Server) GetOperations(ctx context.Context, req *v1.GetOperationsRequest
ops, err = s.oplog.GetByPlan(req.PlanId, collector)
} else if req.RepoId != "" {
ops, err = s.oplog.GetByRepo(req.RepoId, collector)
} else if req.SnapshotId != "" {
ops, err = s.oplog.GetBySnapshotId(req.SnapshotId, collector)
} else {
ops, err = s.oplog.GetAll()
}
Expand Down
2 changes: 1 addition & 1 deletion internal/orchestrator/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func backupHelper(ctx context.Context, orchestrator *Orchestrator, plan *v1.Plan

lastSent := time.Now() // debounce progress updates, these can endup being very frequent.
summary, err := repo.Backup(ctx, plan, func(entry *restic.BackupProgressEntry) {
if time.Since(lastSent) < 200*time.Millisecond {
if time.Since(lastSent) < 250*time.Millisecond {
return
}
lastSent = time.Now()
Expand Down
1 change: 1 addition & 0 deletions proto/v1/operations.proto
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ enum OperationStatus {
STATUS_INPROGRESS = 2;
STATUS_SUCCESS = 3;
STATUS_ERROR = 4;
STATUS_CANCELLED = 5;
}

message OperationBackup {
Expand Down
1 change: 1 addition & 0 deletions proto/v1/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ message ListSnapshotsRequest {
message GetOperationsRequest {
string repo_id = 1;
string plan_id = 2;
string snapshot_id = 4;
int64 last_n = 3; // limit to the last n operations
}

Expand Down
1 change: 1 addition & 0 deletions webui/gen/ts/v1/operations.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export enum OperationStatus {
STATUS_INPROGRESS = "STATUS_INPROGRESS",
STATUS_SUCCESS = "STATUS_SUCCESS",
STATUS_ERROR = "STATUS_ERROR",
STATUS_CANCELLED = "STATUS_CANCELLED",
}

export type OperationList = {
Expand Down
1 change: 1 addition & 0 deletions webui/gen/ts/v1/service.pb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type ListSnapshotsRequest = {
export type GetOperationsRequest = {
repoId?: string
planId?: string
snapshotId?: string
lastN?: string
}

Expand Down
106 changes: 106 additions & 0 deletions webui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions webui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"typescript": "^5.2.2"
},
"devDependencies": {
"@parcel/transformer-sass": "^2.10.3",
"events": "^3.3.0",
"stream-browserify": "^3.0.0"
}
Expand Down
Loading

0 comments on commit 79256fc

Please sign in to comment.