Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runs_list): add button delete workflow run #33138

Open
wants to merge 29 commits into
base: main
Choose a base branch
from

Conversation

zsbahtiar
Copy link

@zsbahtiar zsbahtiar commented Jan 7, 2025

Submit for issue #26219
/claim #26219

Screenshot 2025-01-07 at 10 57 15 PM
Screenshot 2025-01-07 at 10 41 00 PM

Screen.Recording.2025-01-08.at.1.17.14.AM.mov

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 7, 2025
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jan 7, 2025
@github-actions github-actions bot added the modifies/templates This PR modifies the template files label Jan 7, 2025
@pull-request-size pull-request-size bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jan 7, 2025
@github-actions github-actions bot added modifies/go Pull requests that update Go code modifies/frontend labels Jan 7, 2025
@zsbahtiar zsbahtiar changed the title [WIP] feat(runs_list): add button delete workflow run feat(runs_list): add button delete workflow run Jan 7, 2025
@zsbahtiar
Copy link
Author

/claim #26219

Copy link
Contributor

@Frankkkkk Frankkkkk left a comment

Choose a reason for hiding this comment

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

Thanks for the WIP, IMHO it still needs some little changes, but it looks great and useful :)

routers/web/web.go Outdated Show resolved Hide resolved
routers/web/repo/actions/actions.go Outdated Show resolved Hide resolved
@wxiaoguang
Copy link
Contributor

It needs to be "almost" complete for #24256 & #26275 (comment)

@yp05327
Copy link
Contributor

yp05327 commented Jan 8, 2025

UI can be something like this:
image

@zsbahtiar
Copy link
Author

hi all thanks for feedback, i willl check after work

@zsbahtiar
Copy link
Author

UI can be something like this: image

make sure, we can select the workflow run except running and waiting workflow status? @yp05327 @wxiaoguang @Frankkkkk

@wxiaoguang
Copy link
Contributor

UI can be something like this:

make sure, we can select the workflow run except running and waiting workflow status? @yp05327 @wxiaoguang @Frankkkkk

select the workflow run except running and waiting workflow status

Ideally, yes

But I won't say it is a must in this PR, we should make the basic logic right before the UI work (the UI work needs more frontend skills and time to make it right)

@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 8, 2025
@zsbahtiar
Copy link
Author

hi im updated the code, please check and comment if have feedback thanks! @yp05327 @wxiaoguang @Frankkkkk

Screen.Recording.2025-01-08.at.3.22.06.PM.mov

zsbahtiar added 2 commits January 8, 2025 16:13
Copy link
Contributor

@wxiaoguang wxiaoguang left a comment

Choose a reason for hiding this comment

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

we should make the basic logic right #33138 (comment)

But I do not think the logic is complete.

It needs to be "almost" complete for #24256 & #26275 (comment)

Are all of them implemented? At least it needs some tests, otherwise the code will break in the future.

I think it's not right, it makes A user could delete B user's action.
#33138 (comment)

It seems that A user could still delete B's actions, the code lacks permission check. Correct me if I was wrong.

models/actions/run.go Outdated Show resolved Hide resolved
@zsbahtiar
Copy link
Author

we should make the basic logic right #33138 (comment)

But I do not think the logic is complete.

It needs to be "almost" complete for #24256 & #26275 (comment)

Are all of them implemented? At least it needs some tests, otherwise the code will break in the future.

I think it's not right, it makes A user could delete B user's action.
#33138 (comment)

It seems that A user could still delete B's actions, the code lacks permission check. Correct me if I was wrong.

yah the first im skip about the restriction, but try to add in this commit: 05af60b

i will try for create the test, i hope can create the test

@zsbahtiar
Copy link
Author

zsbahtiar commented Jan 9, 2025

hi all im already done add the test 8c742ab can you check? thanks
@wxiaoguang @Frankkkkk
image

@zsbahtiar zsbahtiar requested a review from wxiaoguang January 9, 2025 02:00
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 9, 2025
jobIDs, taskIDs []int64
taskLogFileNames []string
)
eg.Go(func() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

The database operations should be done in one transaction, but not in "errgroup goroutine".

)
eg.Go(func() error {
var err error
actionRuns, err = actions_model.GetRunsByIDsAndTriggerUserID(ctx, req.ActionIDs, ctx.Doer.ID)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use Doer.ID here? For example: user A is admin, an ActionRun is not created by them, then user A can't delete that ActionRun?

fileName = filepath.Join(setting.AppWorkPath, setting.AppDataPath, dirNameActionLog, taskLogFileName)
}

if err := os.Remove(fileName); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC there is a "storage" for Action logs, they could be in S3 (ObjectStorage) but not on filesystem

@inxcts
Copy link

inxcts commented Jan 9, 2025

I really like the progress on this pull request and I think this will be a very useful addition.

If I could make one suggestion, it would be to make the Delete Workflow button less prominent. I would either use an icon or go the GitHub route with the ellipsis button. I made a quick mockup (the ellipsis button would then open a small context menu with the Delete Workflow button as text).

suggestions

GitHub Example (preferred):
github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants