Skip to content

Add: job to export in multiple formats#236

Open
Achiket123 wants to merge 6 commits intotheopenlane:mainfrom
Achiket123:feature/export-in-multiple-formats
Open

Add: job to export in multiple formats#236
Achiket123 wants to merge 6 commits intotheopenlane:mainfrom
Achiket123:feature/export-in-multiple-formats

Conversation

@Achiket123
Copy link
Copy Markdown
Contributor

@Achiket123 Achiket123 commented Feb 25, 2026

Hey @golanglemonade , Please review this, i had tested it with slate.js and it is working with that also.

@Achiket123 Achiket123 requested a review from a team as a code owner February 25, 2026 04:15
@github-actions github-actions bot added enhancement New feature or request jobs labels Feb 25, 2026
Copy link
Copy Markdown
Member

@golanglemonade golanglemonade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Achiket123 can you update the core/common tag here so we can see if ci passes?

Comment thread pkg/jobs/export.go
Comment on lines -218 to +286
_, err = w.olClient.UpdateExport(ctx, job.Args.ExportID, updateInput, []*graphql.Upload{upload}, goclient.WithImpersonationInterceptor(job.Args.UserID, job.Args.OrganizationID))
_, err = w.olClient.UpdateExport(ctx, job.Args.ExportID, updateInput, []*graphql.Upload{upload})
Copy link
Copy Markdown
Member

@golanglemonade golanglemonade Mar 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Achiket123 this change needs to be reverted

Achiket123 and others added 5 commits April 5, 2026 18:01
Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com>
Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 5, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
20.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Comment thread pkg/jobs/export.go
Comment on lines +683 to +686
// Add common headers if they exist
if id, ok := flat["id"]; ok && id != nil {
buf.WriteString(fmt.Sprintf("<p><strong>ID:</strong> %v</p>\n", id))
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave off id

Suggested change
// Add common headers if they exist
if id, ok := flat["id"]; ok && id != nil {
buf.WriteString(fmt.Sprintf("<p><strong>ID:</strong> %v</p>\n", id))
}
// Add common headers if they exist

Comment thread pkg/jobs/export.go
Comment on lines +687 to +695
if createdAt, ok := flat["created_at"]; ok && createdAt != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Created At:</strong> %v</p>\n", createdAt))
}
if name, ok := flat["name"]; ok && name != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Name:</strong> %v</p>\n", name))
}
if status, ok := flat["status"]; ok && status != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Status:</strong> %v</p>\n", status))
}
Copy link
Copy Markdown
Member

@golanglemonade golanglemonade Apr 5, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use these:

Suggested change
if createdAt, ok := flat["created_at"]; ok && createdAt != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Created At:</strong> %v</p>\n", createdAt))
}
if name, ok := flat["name"]; ok && name != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Name:</strong> %v</p>\n", name))
}
if status, ok := flat["status"]; ok && status != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Status:</strong> %v</p>\n", status))
}
if name, ok := flat["name"]; ok && name != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Name:</strong> %v</p>\n", name))
}
if status, ok := flat["status"]; ok && status != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Status:</strong> %v</p>\n", status))
}
if updatedAt, ok := flat["updated_at"]; ok && updatedAt != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Last Updated At:</strong> %v</p>\n", createdAt))
}
if updatedBy, ok := flat["updated_by"]; ok && updatedBy != nil {
buf.WriteString(fmt.Sprintf("<p><strong>LastUpdatedBy By:</strong> %v</p>\n", createdAt))
}
if revision, ok := flat["revision"]; ok && revision != nil {
buf.WriteString(fmt.Sprintf("<p><strong>Version:</strong> %v</p>\n", createdAt))
}

Comment thread pkg/jobs/export.go
if !strings.Contains(str, "<p>") && !strings.Contains(str, "<div>") && !strings.Contains(str, "<br") {
str = strings.ReplaceAll(str, "\n", "<br/>\n")
}
buf.WriteString(fmt.Sprintf("<div><strong>Summary:</strong><br/>\n%s</div>\n", str))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a header here

Suggested change
buf.WriteString(fmt.Sprintf("<div><strong>Summary:</strong><br/>\n%s</div>\n", str))
buf.WriteString(fmt.Sprintf("<div>%s</div>\n", str))

Comment thread pkg/jobs/export.go
Comment on lines +707 to +728
} else {
// Fallback: extract string representation for any val
buf.WriteString("<div><strong>Summary:</strong><br/>\n")
for k, v := range flat {
// skip the headers we already added
if k == "id" || k == "created_at" || k == "name" || k == "status" {
continue
}
if v != nil {
str := fmt.Sprint(v)
if strings.TrimSpace(str) != "" {
buf.WriteString(fmt.Sprintf("<strong>%s:</strong> %s<br/>\n", k, str))
}
}
}
buf.WriteString("</div>\n")
}

if buf.Len() > 0 {
results = append(results, buf.String())
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need an else. if details is empty, there is not content we want to be adding.

Suggested change
} else {
// Fallback: extract string representation for any val
buf.WriteString("<div><strong>Summary:</strong><br/>\n")
for k, v := range flat {
// skip the headers we already added
if k == "id" || k == "created_at" || k == "name" || k == "status" {
continue
}
if v != nil {
str := fmt.Sprint(v)
if strings.TrimSpace(str) != "" {
buf.WriteString(fmt.Sprintf("<strong>%s:</strong> %s<br/>\n", k, str))
}
}
}
buf.WriteString("</div>\n")
}
if buf.Len() > 0 {
results = append(results, buf.String())
}
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request jobs run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants