-
Notifications
You must be signed in to change notification settings - Fork 208
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
Add option to restart jobs upon comment submission #5971
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
7d7f709
to
e886fd5
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
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 ☔ View full report in Codecov by Sentry. |
e886fd5
to
b1590ed
Compare
This comment was marked as resolved.
This comment was marked as resolved.
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. |
You could base your PR on #5981 but it looks like I'll have to put a little bit more work into it (as CI checks are currently failing). |
dd44e25
to
e188f9e
Compare
7577c7e
to
c07da9d
Compare
This comment was marked as resolved.
This comment was marked as resolved.
c07da9d
to
d98507f
Compare
d98507f
to
f33859a
Compare
Some comments on 717e152
|
This comment was marked as resolved.
This comment was marked as resolved.
1a241aa
to
d2d169f
Compare
assets/javascripts/openqa.js
Outdated
setTimeout(() => { | ||
window.location.reload(); | ||
}, 2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
setTimeout(() => { | |
window.location.reload(); | |
}, 2000); | |
setTimeout(() => window.location.reload(), 2000); |
Although I don't like this whole approach of first adding an info to only reload the whole page 2 seconds later anyway. I would rather not reload the page automatically and change the info to "Changes have been applied. You may reload the page." where "reload" is a link that will reload the page. This way the info contains more useful information and one has more than 2 seconds to read it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the benefit of having time to read that a reload is required? Why not just reload right away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to the manual reload with a similar text as it is for comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see that this has been updated. As-is it looks like you still can't decide whether to reload the page or show a notification.
I suggest to show a notification. Only this way it is apparent that the operation was actually successful. Otherwise the page is just reloading but the user has to interpret this behavior as success - which is not ideal in my opinion. The notification should also explicitly list of jobs that have actually been successfully restarted so one can easily go though the list to access them if wanted. It can of course also include a link for reloading the page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake. I did the changes but I revert the file in some point after experiment with the progress bar. I have to check again that your previews comments are also here.
t/ui/10-tests_overview.t
Outdated
subtest "job template names displayed on 'Test result overview' page" => sub { | ||
$driver->get('/group_overview/1002'); | ||
is($driver->find_element('.progress-bar-unfinished')->get_text(), | ||
'1 unfinished', 'The number of unfinished jobs is right'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We normally start test names with lower case. You can also drop the "is right" in the end which is kind of a given for checks:
'1 unfinished', 'The number of unfinished jobs is right'); | |
'1 unfinished', 'expected number of unfinished jobs'); |
EDIT: I now see that you're just moving this code. My suggestion would nevertheless be a good improvement.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@b10n1k How about this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not changed in the latest diff. Ofc you can argue that you don't want to change it. Be explicit, though, rather than leaving questions unanswered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
d2d169f
to
6a99188
Compare
Great PR! Please pay attention to the following items before merging: Files matching
This is an automatically generated QA checklist based on modified files. |
assets/javascripts/openqa.js
Outdated
setTimeout(() => { | ||
window.location.reload(); | ||
}, 2000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see that this has been updated. As-is it looks like you still can't decide whether to reload the page or show a notification.
I suggest to show a notification. Only this way it is apparent that the operation was actually successful. Otherwise the page is just reloading but the user has to interpret this behavior as success - which is not ideal in my opinion. The notification should also explicitly list of jobs that have actually been successfully restarted so one can easily go though the list to access them if wanted. It can of course also include a link for reloading the page.
9f9268d
to
43d628b
Compare
This comment was marked as resolved.
This comment was marked as resolved.
779a2fd
to
2346d98
Compare
- Renamed `addComments` to `restartOrCommentJobs` 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 API endpoints via formaction. That removes action attribute from the form element. - Let "comments" be `btn-warning` and "restart" show more severe operation using `btn-danger`. - Adjusted modal to allow submission of comments or restarts through the correct action handlers. - Inform overview page with warning in case of errors in Response. - Redesign `restartOrCommentJobs` (previews addComments) to reflect the new features. 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 using the already existing API implementations. https://progress.opensuse.org/issues/166559 Signed-off-by: Ioannis Bonatakis <[email protected]>
2346d98
to
732853e
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Refactor restartJob in order to make sure that is able to handle request for multiple restarts. This follows up with some changes to the form and the javascript part of the overview.html.ep, which triggers the restart with the use of restartJob, as opposed of reimplement the logic. The advantage is that we have one common behavior and error handling on the restart operation. - An optional comment can be passed not to restartJob, which is included to the request. - restartJob handles both single and multible job restarts. - The form is designed to handle each occasion in separate functions making the code becomes more modular and easier to maintain. - The overvies's restartJobs function will restart only jobs with valid id. https://progress.opensuse.org/issues/166559 Signed-off-by: Ioannis Bonatakis <[email protected]>
732853e
to
29fdf01
Compare
Refactor restartJob in order to make sure that is able to handle request for
multiple restarts. This follows up with some changes to the form and the
javascript part of the overview.html.ep, which triggers the restart with the
use of restartJob, as opposed of reimplement the logic.
The advantage is that we have one common behavior and error handling on the
restart operation.
An optional comment can be passed not to restartJob, which is included to
the request.
restartJob handles both single and multible job restarts.
The form is designed to handle each occasion in separate functions making
the code becomes more modular and easier to maintain.
The overvies's restartJobs function will restart only jobs with valid id.- Renamed
addComments
tobulkJobsAction
to handle both commenting and restarting jobs.Updated HTML to include "Restart and Comment" and "Comment" buttons with individual data URLs.
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