openQA icon indicating copy to clipboard operation
openQA copied to clipboard

Add option to restart jobs upon comment submission

Open d3flex opened this issue 1 year ago • 12 comments

  • Renamed addComments to bulkJobsAction to handle both commenting and restarting jobs.
  • Added button-specific actions using form.clickedButton.
  • Updated fetchWithCSRF logic to dynamically determine request URLs based on the button clicked.
  • Introduced separate success and error messages for restarting and commenting actions.
  • Updated HTML to include "Restart and Comment" and "Comment" buttons with individual data URLs.
  • Adjusted modal to allow submission of comments or restarts through the correct action handlers.

These updates enhance the user experience by allowing users to either comment on jobs, or perform restart with a comment simultaneously from the overview page. Comments always add to the original job of the overview page. By integrating this functionality we provide a workflow for users managing multiple jobs on the overview page.

https://progress.opensuse.org/issues/166559

d3flex avatar Oct 02 '24 07:10 d3flex

overview_modal overview_modal_submitted

d3flex avatar Oct 02 '24 07:10 d3flex

please describe the relation to

  • #5946

okurz avatar Oct 02 '24 11:10 okurz

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.98%. Comparing base (ebe44db) to head (29fdf01). Report is 15 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5971   +/-   ##
=======================================
  Coverage   98.98%   98.98%           
=======================================
  Files         395      395           
  Lines       39417    39428   +11     
=======================================
+ Hits        39017    39028   +11     
  Misses        400      400           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 03 '24 12:10 codecov[bot]

fa-comment

I will take a look on 3 tmr

d3flex avatar Oct 03 '24 22:10 d3flex

please describe the relation to

The difference between this PR and the previews is that the old PR solves the problem integrating the logic in the Comments.pm passing parameters in the underline function. It was requested to implement the solution using the Job.pm. This is not the case in this PR though.

d3flex avatar Oct 07 '24 15:10 d3flex

You could base your PR on https://github.com/os-autoinst/openQA/pull/5981 but it looks like I'll have to put a little bit more work into it (as CI checks are currently failing).

Martchus avatar Oct 07 '24 16:10 Martchus

UPDATED screenshot

** image **

d3flex avatar Oct 14 '24 10:10 d3flex

I believe I addressed everything except the comments about the and substitution of or for the restart button

d3flex avatar Oct 14 '24 19:10 d3flex

Some comments on 717e152b9f66615a5752397814660c9c94024d22

  • Review commit message for main changes
  • not sure if we prefer to rename the restartJob in openqa.js
  • not sure if we prefer to provide a link for reload as it is for comments submittion. I went with auto reload for now
  • I havent writen any additional tests as for now, other than the ones from the previous commit

d3flex avatar Oct 23 '24 11:10 d3flex

[11:58:52] t/ui/12-needle-edit.t ...................... 2/? 
    #   Failed test 'no longer on needle editor'
    #   at t/ui/12-needle-edit.t line 256.
    #          got: 'openQA: Needle Editor'
    #     expected: 'openQA: opensuse-13.1-DVD-i586-Build0091-textmode@32bit test results'
    # Looks like you failed 1 test of 37.
[11:58:52] t/ui/12-needle-edit.t ...................... 3/? 
#   Failed test 'Create new needle'
#   at t/ui/12-needle-edit.t line 395.

and

Retry 4 of 5 …
[12:00:13] t/ui/26-jobs_restart.t .. 1/? 
        #   Failed test 'shows cloned job'
        #   at t/ui/26-jobs_restart.t line 102.
        #                   'http://localhost:59025/tests/99900'
        #     doesn't match '(?^u:/tests/99982)'
        # Looks like you failed 1 test of 7.

    #   Failed test 'parent job shows options for advanced restart'
    #   at t/ui/26-jobs_restart.t line 104.

        #   Failed test 'warning with link to new job appears'
        #   at t/ui/26-jobs_restart.t line 144.
        #                   ''
        #     doesn't match '(?^u:tests/99983)'
        # Looks like you failed 1 test of 2.

    #   Failed test 'force restart'
    #   at t/ui/26-jobs_restart.t line 154.

        #   Failed test 'auto refresh to restarted job'
        #   at t/ui/26-jobs_restart.t line 160.
        #                   'http://localhost:59025/tests/99946'
        #     doesn't match '(?^u:tests/99984)'
        # Looks like you failed 1 test of 3.

    #   Failed test 'successful restart'
    #   at t/ui/26-jobs_restart.t line 163.
    # Looks like you failed 3 tests of 6.
[12:00:13] t/ui/26-jobs_restart.t .. 2/?

kalikiana avatar Oct 23 '24 17:10 kalikiana

[11:58:52] t/ui/12-needle-edit.t ...................... 2/? 
    #   Failed test 'no longer on needle editor'
    #   at t/ui/12-needle-edit.t line 256.
    #          got: 'openQA: Needle Editor'
    #     expected: 'openQA: opensuse-13.1-DVD-i586-Build0091-textmode@32bit test results'
    # Looks like you failed 1 test of 37.
[11:58:52] t/ui/12-needle-edit.t ...................... 3/? 
#   Failed test 'Create new needle'
#   at t/ui/12-needle-edit.t line 395.

To be honest this seems not relevant with the changes

and

Retry 4 of 5 …
[12:00:13] t/ui/26-jobs_restart.t .. 1/? 
        #   Failed test 'shows cloned job'
        #   at t/ui/26-jobs_restart.t line 102.
        #                   'http://localhost:59025/tests/99900'
        #     doesn't match '(?^u:/tests/99982)'
        # Looks like you failed 1 test of 7.

    #   Failed test 'parent job shows options for advanced restart'
    #   at t/ui/26-jobs_restart.t line 104.

        #   Failed test 'warning with link to new job appears'
        #   at t/ui/26-jobs_restart.t line 144.
        #                   ''
        #     doesn't match '(?^u:tests/99983)'
        # Looks like you failed 1 test of 2.

    #   Failed test 'force restart'
    #   at t/ui/26-jobs_restart.t line 154.

        #   Failed test 'auto refresh to restarted job'
        #   at t/ui/26-jobs_restart.t line 160.
        #                   'http://localhost:59025/tests/99946'
        #     doesn't match '(?^u:tests/99984)'
        # Looks like you failed 1 test of 3.

    #   Failed test 'successful restart'
    #   at t/ui/26-jobs_restart.t line 163.
    # Looks like you failed 3 tests of 6.
[12:00:13] t/ui/26-jobs_restart.t .. 2/?

This part seems a regression from my patch. will fix

d3flex avatar Oct 23 '24 20:10 d3flex

A general request: Could you rebase your PRs more often on master? I personally do this whenever I push new changes. I fetch the origin, and when I see new commits, I rebase.

perlpunk avatar Oct 24 '24 12:10 perlpunk

Great PR! Please pay attention to the following items before merging:

Files matching assets/stylesheets/**:

  • [ ] Consider providing screenshots in a PR comment to show the difference visually

This is an automatically generated QA checklist based on modified files.

github-actions[bot] avatar Oct 29 '24 19:10 github-actions[bot]

Hm, I am trying out the PR locally, and I can't get it to write a comment. The restart is triggered, but no comment is written. Clicking on the "Restart and comment on x jobs" button.

edit: see my actual comments on the code for the reason and the fix

perlpunk avatar Nov 01 '24 10:11 perlpunk

Hm, I am trying out the PR locally, and I can't get it to write a comment. The restart is triggered, but no comment is written. Clicking on the "Restart and comment on x jobs" button.

Was this resolved? If yes then please mark it as such

okurz avatar Nov 02 '24 09:11 okurz

Hm, I am trying out the PR locally, and I can't get it to write a comment. The restart is triggered, but no comment is written. Clicking on the "Restart and comment on x jobs" button.

Was this resolved? If yes then please mark it as such

I just tested and worked for me.

d3flex avatar Nov 02 '24 15:11 d3flex

Was this resolved? If yes then please mark it as such

yeah, when I found out the reason for that, I commented on the actual code. I guess without this context it was confusing.

perlpunk avatar Nov 02 '24 16:11 perlpunk