To avoid losing any information (e.g., remote mappings with costs) or getting a mess in the data structure, we need to stop allowing to re-submit cancelled jobs.
Instead, add a button that creates a new job with new job items that point to the same source.
Comments
Comment #1
blueminds commentedSee the patch.
Comment #2
miro_dietikerHere, a quick first review.
This is absolutely right. Pushing this into the __clone() method would be wrong IMHO.
I would prefer these two swapped: First cancel, then resubmit.
The naming is inconsistent: "cancel_TRANSLATION" - then "resubmit_translation". Otherwise cancel + resubmit.
I would say we need multiple items.
First it's a list of items, then a single item. Name it so.
Also, the new job should have a special log message referring to its origin.
Comment #3
blueminds commentedcancel_translation and resubmit_translation are mutually exclusive so the order does not matter there.
Both jobs do have a message attached.
For the rest see the patch.
Comment #4
miro_dietiker:-) nice, almost there.
Here you need to clear data of the items as well.
Bonus points for test coverage. (But it requires, data isn't empty first..)
Comment #5
blueminds commentedOh yes...
Comment #6
berdirI think this would be less confusing if you write separate lines. Feels weird to set completely different things in a single multi-assignment line.
Also, uid should probably be set to the current user?
onclick confirmations seem like a completely new behavior, Drupal usually uses confirm forms?
We should use the get messages to display the message that the translator might have added, not just invent something that might not be correct.
Why is this a single action?
I'd expect a Duplicate, that *just* duplicates and then lets me go through the checkout process again?
Chances are that I *don't* want to use the same translator again, otherwise I probably wouldn't have cancelled?
word_count and the other statistics have to be re-calculated. They're not re-set, so we're not sure they are.
I think there are two main reasons to cancel a job:
a) not being happy with the translator. at all. That's where re-submit doesn't work.
b) The source might have changed, e.g. the nodes were changed and need to be translated again. So we need to make sure that everything is properly re-calculated based on what exists right now. Here a retranslate could be useful, but there might be some options, the different text results in a different quote and so on, so it's ok to click twice.
Comment #7
miro_dietikerUh, oh, interesting...
So with cloning the job + items, we are recapturing the item source...
So a "cloned" job might be different in content.
Sure, a source update is expected sometimes and makes sense. But i'm not so sure it should be implicit...
Comment #8
blueminds commentedsee the patch
Comment #9
miro_dietikerSome more detailled review. The clones seem much cleaner now. Still something more to test.
Please also check the other counter values in the test.
Not sure this pattern is that common. Possibly use separate confirmation forms?
https://api.drupal.org/api/drupal/modules%21system%21system.module/funct...
Check core and other good examples.
With this setup i can use any constructed URL admin/tmgmt/jobs/' . $job->tjid . '/xyz' that redirects. We should be more selective.
With explicit forms at the confirmation URLs we would be much more straight forward readable and less risk for uncovered accidental special cases.
Comment #10
blueminds commentedhere we go
Comment #11
berdirShouldn't resubmit_translation now be renamed to clone or duplicate or something like that?
Comment #12
blueminds commentedWas thinking about it as well as that is what we do now, but if i want to cancel a job i expect the action to be named with "cancel" and not duplicate/ clone. Also the cloning is only part of the action we do, we first do cancel the old job and then move on to duplicate it.
Comment #13
berdirOk, yes, resubmit is fine, but I don't get the _transaction suffix, that makes no sense to me. Neither in the machine name, nor the button label (maybe Cancel/Re-submit job instead?).
Even with that change, the buttons don't work anymore, we have too many of them:
We can't have two cancel buttons. Ideas? We could make cancel a link, similar to the confirm forms, but that only helps a bit...
The menu items and operation handling should be in TMGMTJobUIController.
Comment #14
berdirOh, also, the resubmit messages are no longer correct ("has been resubmitted", for example).
Comment #15
blueminds commentedThe cancel button: what is its purpose? From reading the code it should relocate to the jobs list, but it will not do so as the #type is button and not submit. Also this button is displayed only in case the job is active, so if unprocessed or submitted it is not there, why? From reading the code it servers as a back action that optionally cancels everything that I have done in the translator settings. So why not call it "Back" and display it at any job state?
Comment #16
blueminds commentedOr what about keeping the cancel button with "cancel" text and use "terminate" for the action of not wanting the translation process to continue?
Comment #17
blueminds commentedWe now do "Abort translation". This is an action that will abort the translation process and therefore cancel the job.
The cancel button remained cancel as such behaviour is in most of the times triggered by a cancel button.
Comment #18
blueminds commentedComment #20
blueminds commentedojeje...
Comment #21
berdirStill not convinced about the button labels (especially the translation part, we don't do that anywhere else). Will try to sit together with Miro and discuss it through.
Comment #22
berdirRecoverable fatal error: Argument 3 passed to tmgmt_ui_job_cancel() must be an instance of TMGMTJob, none given
No test for cancel?
I still *really* would like to see this as a link, we have too many buttons there. Have a look at how confirm_form() does this, it also supports a ?destination= override. I don't think we need to worry about the redirect queue, we don't have cancel yet on checkout anyway (although that's where we should have it and where it should probably be a button that deletes the job again and instead don't display a delete on that page, separate issue).
Also, we discussed this quite a bit here, and this is what we agreed on:
- Abort translation => Abort job.
- We discussed Abort vs. Cancel and agreed on Abort, that however means we need to do it consistently. The job state label needs to be renamed to Aborted, and we need a job item state for aborted as well. Aborted job items should not display their progress information in the view (it's still ok to view them and e.g. copy out translations in there, but it shouldn't be possible to accept or do anything with them, that right now possible, you can add translations, review it and save it as completely. Maybe only display cancel there for aborted job items and nothing else)
- We will not yet rename the constants and methods (but use abort for the new ones for job items), but open a follow-up issue for that part.
- Resubmit to translator => Resubmit. Instead, explain on the confirm form what this means more detailed, have a short but correct title/question (Resubmit as a new job?) and replace the stupid this can not be undone description (because it can) with something that explains what it does: This creates a new job with the same items which can then be submitted again.
- The abort confirm page also needs some work, it shouldn't use abort *and* cancel. Instead, "Abort this job?" and a description that explains a request to abort the job will be sent to the translator and it won't be possible to do anything with it if that succeeds
- The confirm forms are also not yet part of the operationForm() method, see delete for example. Also, looking at that, we do have a dead implementation for cancel there, which means we can replace that one.
Comment #23
miro_dietikerPerfectly summarised.
Additionally, we need to define what happens if a translator callback is fired and wants to pass translations.
The job is aborted, agree. I tend to say it should be rejected with no update applied.
On the other hand i don't see any negative effect: We have paid it, data still might come in. It will not hurt.
The question even is, in case we don't get money back, should we tell the translator to stop? :-)
Any thoughts?
Comment #24
blueminds commentedhehe, one of those where interdiff is larger than patch itself ;)
Comment #25
miro_dietikerThat's a public API. You can't just rename that within a minor release.
Also state: In case the sources meanwhile changed, the new job will reflect the update.
Me unhappy about disabled tests. :-)
Comment #26
blueminds commentedAnd what about making the methods deprecated?
Comment #28
blueminds commented#26: tmgmt-cancell_translation-2106637-9.patch queued for re-testing.
Comment #30
blueminds commentedHere is with original method names.
Comment #31
berdirNot sure what to do with the comments :( The mix with abort/cancel is a bit weird. Maybe clarify the @todo, because it now partially already uses the term "abort" ;) Just not in the method name, so it should say, @todo Rename method to isAborted() in http://drupal.org/node/....
References don't work like this. We need to create a new issue and reference to that.
We still have cancel and abort here now. We should only have one, the old cancel must be some left-over that was changed a long time ago.
Yeah, that's a hack :( $this->path is the the overview path, this could theoretically lead to crazy side effects.
We might have to override the submit callback that calls this function, where it uses $this->path for the redirect and do something differently if operation is resubmit.
Comment #32
blueminds commentedComment #34
blueminds commentedfixed submit handler
Comment #35
berdirOk, testbot happy (had to kick it a bit, first testbot committed suicide while testing the patched) and I'm happy.
Removed cancel menu callback and confirm form in ui controller before commit.
Committed and pushed!