fix: [code-796]: fix encode text issue in toaster (#383)

This commit is contained in:
Calvin Lee 2023-08-31 17:01:22 +00:00 committed by Harness
parent d15aa03dfd
commit ac8f1932ba
5 changed files with 45 additions and 11 deletions

View File

@ -13,7 +13,8 @@ import {
useToaster,
FormInput,
Label,
ButtonVariation
ButtonVariation,
StringSubstitute
} from '@harnessio/uicore'
import { Icon } from '@harnessio/icons'
import { FontVariation } from '@harnessio/design-system'
@ -77,7 +78,15 @@ export function useCreateBranchModal({
hideModal()
onSuccess(response)
if (showSuccessMessage) {
showSuccess(getString('branchCreated', { branch: name }), 5000)
showSuccess(
<StringSubstitute
str={getString('branchCreated')}
vars={{
branch: name
}}
/>,
5000
)
}
})
.catch(_error => {

View File

@ -13,7 +13,8 @@ import {
useToaster,
FormInput,
Label,
ButtonVariation
ButtonVariation,
StringSubstitute
} from '@harnessio/uicore'
import { Icon } from '@harnessio/icons'
import { FontVariation } from '@harnessio/design-system'
@ -77,7 +78,15 @@ export function useCreateTagModal({
hideModal()
onSuccess(response)
if (showSuccessMessage) {
showSuccess(getString('tagCreated', { tag: name }), 5000)
showSuccess(
<StringSubstitute
str={getString('tagCreated')}
vars={{
tag: name
}}
/>,
5000
)
}
})
.catch(_error => {

View File

@ -146,7 +146,7 @@ branchSource: Branch source
branchSourceDesc: Choose a source branch
basedOn: Based on
failedToCreateBranch: Failed to create Branch. Please try again.
branchCreated: Branch {{branch}} created.
branchCreated: Branch {branch} created.
tagCreated: Tag {{tag}} created.
confirmation: Confirmation
deleteBranch: Delete Branches
@ -158,8 +158,8 @@ browseFiles: Browse Files
compare: Compare
commitString: 'Commit {commit}'
repoDeleted: Repository {{repo}} deleted.
branchDeleted: Branch {{branch}} deleted.
tagDeleted: Tag {{tag}} deleted.
branchDeleted: Branch {branch} deleted.
tagDeleted: Tag {tag} deleted.
failedToDeleteBranch: Failed to delete Branch. Please try again.
createFile: Create __path__
updateFile: Update __path__

View File

@ -1,5 +1,5 @@
import React, { useEffect, useMemo, useState } from 'react'
import { Container, TableV2 as Table, Text, Avatar, Tag, useToaster } from '@harnessio/uicore'
import { Container, TableV2 as Table, Text, Avatar, Tag, useToaster, StringSubstitute } from '@harnessio/uicore'
import { Color, Intent } from '@harnessio/design-system'
import type { CellProps, Column } from 'react-table'
import { Link, useHistory } from 'react-router-dom'
@ -128,7 +128,15 @@ export function BranchesContent({ repoMetadata, searchTerm = '', branches, onDel
action: async () => {
deleteBranch({})
.then(() => {
showSuccess(getString('branchDeleted', { branch: row.original.name }), 5000)
showSuccess(
<StringSubstitute
str={getString('branchDeleted')}
vars={{
branch: row.original.name
}}
/>,
5000
)
onDeleteSuccess()
})
.catch(error => {

View File

@ -1,5 +1,5 @@
import React, { useMemo } from 'react'
import { Container, TableV2 as Table, Text, Avatar, useToaster } from '@harnessio/uicore'
import { Container, TableV2 as Table, Text, Avatar, useToaster, StringSubstitute } from '@harnessio/uicore'
import { Color, Intent } from '@harnessio/design-system'
import type { CellProps, Column } from 'react-table'
import { Link, useHistory } from 'react-router-dom'
@ -137,7 +137,15 @@ export function TagsContent({ repoMetadata, searchTerm = '', branches, onDeleteS
action: async () => {
deleteBranch({})
.then(() => {
showSuccess(getString('tagDeleted', { branch: row.original.name }), 5000)
showSuccess(
<StringSubstitute
str={getString('tagDeleted')}
vars={{
tag: row.original.name
}}
/>,
5000
)
onDeleteSuccess()
})
.catch(error => {