Skip to content

feat: implement cancelTranslation for the Smartling connector - #710

Draft
markdaugherty wants to merge 2 commits into
mainfrom
smartling-split-7-cancel-translation
Draft

feat: implement cancelTranslation for the Smartling connector#710
markdaugherty wants to merge 2 commits into
mainfrom
smartling-split-7-cancel-translation

Conversation

@markdaugherty

Copy link
Copy Markdown
Member

Summary

  • Implement cancelTranslation: removes a language's locale from its shared translation job (removeLocaleFromJob), polling Smartling's async-process endpoint to completion on a 202 response
  • Fix renderCancelLang/incompleteLangs/the with-cancel grid class to consistently treat 'complete' (not just 'cancelled') as non-cancellable, via a single shared canCancelLang(lang) predicate

Mark Daugherty and others added 2 commits August 31, 2026 17:03
Confirmed the correct endpoint against Smartling's official OpenAPI
spec before implementing: DELETE
.../jobs/{translationJobUid}/locales/{targetLocaleId}
(removeLocaleFromJob), not the job-level cancelJob endpoint, which
would cancel every other language sharing the same job since
sendAllLanguages bundles all target languages into one job. Polls the
returned process to completion on a 202 response.

Smartling previously had no cancelTranslation at all, so translate.js's
canCancel getter was always false and the Cancel buttons never
rendered for Smartling projects.

Also extends getStatusAll's existing "don't revert completed
languages" guard to cover 'cancelled', since the next status poll would
otherwise undo a fresh cancel the same way it was re-triggering saves
for completed languages.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 8379daf)
renderCancelLang's guard only excluded 'cancelled' status, never
'complete', so a completed language's Cancel button stayed visible as
long as some other language in the project was still in progress.
Separately, incompleteLangs counted a language as cancellable even
with no translation object at all (never sent), so "Cancel project"
could show with nothing actually cancellable.

Extracted a single canCancelLang(lang) predicate used consistently by
renderCancelLang, incompleteLangs, and the with-cancel grid-column
class, so they can't drift out of sync with each other again.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
(cherry picked from commit 0801b22)
@aem-code-sync

aem-code-sync Bot commented Aug 31, 2026

Copy link
Copy Markdown

Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
In case there are problems, just click the checkbox below to rerun the respective action.

  • Re-sync branch
Commits

*/
async function pollJobProcess(endpoint, projectId, jobUid, processUid) {
const url = `${endpoint}/jobs-api/v3/projects/${projectId}/jobs/${jobUid}/processes/${processUid}`;
const opts = { headers: { Authorization: `Bearer ${token}` } };

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.

token is module state here, so cancel/poll silently rely on connect() having run first. matches the file's existing style, just flagging in case we want it threaded through explicitly.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants