Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

feat(agent): Creates payload and request to create/update translations for agents #321

Merged
merged 6 commits into from
Apr 29, 2021

Conversation

pratimasakinala
Copy link
Collaborator

Changes

  1. Creates new methods in the Agent Service to create & update translations for an agent.
  2. Writes tests for the new methods in the agent service.
  3. Creates a new interface for IAgentTranslationRequest that is used as the payload type while setting translation.
  4. Creates translationCreated & translationUpdated translation keys in INotificationTranslationKey.
  5. Adds these new translation keys in the language JSON files.

Purpose

Send requests to the server to create/update the agent translation as described in #318

Approach

The frontend sends requests to the new POST & PUT endpoints agent/:id/translations as defined here to create/update the translations.

Testing Steps

If you are not a member of this project, skip this step

  1. Login into the application.
  2. Go to Agent list view.
  3. Select a row & click on the icon for Setting Translation.
  4. Verify that all languages except the default (en-US) are displayed in the list of available languages to set the translation in.
  5. Click on any language from this list & input the Description value in the form.
  6. Submit the form & verify that the request is sent to the server's agent/:id/translations endpoint using a POST method.
  7. Verify that the response received is the full agent object with dynamicContent object including all languages that have translations available.
  8. Verify that upon successful creation of translation, the user is navigated to the Agent list view.

Closes #318

pratimasakinala and others added 4 commits April 16, 2021 13:38
…ds in the Agent Service to create & update translations for an agent. These methods are consumed in the agent-detail component by passing appropriate payload. Writes tests for the new methods in the agent service. creates a new interface for IAgentTranslationRequest that is used as the payload type while setting translation. creates `translationCreated` & `translationUpdated` translation keys in INotificationTranslationKey. Adds these new translation keys in the languauge JSON files.
@pratimasakinala pratimasakinala added the feature New feature or change that directly affects users label Apr 19, 2021
@pratimasakinala pratimasakinala requested a review from Karvel as a code owner April 19, 2021 20:27
@pratimasakinala pratimasakinala self-assigned this Apr 19, 2021
@pratimasakinala pratimasakinala requested review from a team, michaelachrisco, gyuhunlee, vinsonf, Karvel, AramayisO and mwallert and removed request for Karvel, mwallert and a team April 19, 2021 20:27
Copy link
Contributor

@michaelachrisco michaelachrisco left a comment

Choose a reason for hiding this comment

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

Everything looks good to me. I really like the patterns and use of easy to use services. Couple of non-blocking questions and suggestions around the tests.

Comment on lines +254 to +256
translationForLanguage.hasTranslation
? this.updateTranslation(translationPayload)
: this.createTranslation(translationPayload);
Copy link
Contributor

Choose a reason for hiding this comment

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

What happens if we trigger setTranslation and it actually goes not contain any changes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Apologies for the delayed response. Do you mean the form values don't change? The client will send a request to the server regardless of whether or not the payload value changes.

…when the language requested isnt part of the agent data.
Copy link
Contributor

@AramayisO AramayisO left a comment

Choose a reason for hiding this comment

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

Everything looks good to me. Just one non-blocking question.

@pratimasakinala pratimasakinala merged commit adc7519 into ps-locale-translation Apr 29, 2021
@pratimasakinala pratimasakinala deleted the ps-318-agent-translation branch April 29, 2021 22:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or change that directly affects users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants