mirror of
https://github.com/harness/drone.git
synced 2025-05-05 23:42:23 +08:00
35 lines
927 B
Go
35 lines
927 B
Go
package space
|
|
|
|
import (
|
|
"context"
|
|
apiauth "github.com/harness/gitness/internal/api/auth"
|
|
"github.com/harness/gitness/internal/auth"
|
|
"github.com/harness/gitness/types"
|
|
"github.com/harness/gitness/types/enum"
|
|
)
|
|
|
|
type ExportProgressOutput struct {
|
|
JobProgress []types.JobProgress `json:"job_progress"`
|
|
}
|
|
|
|
// ExportProgress returns progress of the export job.
|
|
func (c *Controller) ExportProgress(ctx context.Context,
|
|
session *auth.Session,
|
|
spaceRef string,
|
|
) (ExportProgressOutput, error) {
|
|
space, err := c.spaceStore.FindByRef(ctx, spaceRef)
|
|
if err != nil {
|
|
return ExportProgressOutput{}, err
|
|
}
|
|
|
|
if err = apiauth.CheckSpace(ctx, c.authorizer, session, space, enum.PermissionSpaceView, false); err != nil {
|
|
return ExportProgressOutput{}, err
|
|
}
|
|
|
|
progress, err := c.exporter.GetProgress(ctx, space)
|
|
if err != nil {
|
|
return ExportProgressOutput{}, err
|
|
}
|
|
return ExportProgressOutput{JobProgress: progress}, nil
|
|
}
|