Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "/transform: only show lines of code statistic in plan"
}
Original file line number Diff line number Diff line change
Expand Up @@ -595,9 +595,11 @@ export function getJobStatisticsHtml(jobStatistics: any) {
htmlString += `<div style="flex: 1; margin-left: 20px; border: 1px solid #424750; border-radius: 8px; padding: 10px;">`
// eslint-disable-next-line unicorn/no-array-for-each
jobStatistics.forEach((stat: { name: string; value: string }) => {
htmlString += `<p style="margin-bottom: 4px"><img src="${getTransformationIcon(
stat.name
)}" style="vertical-align: middle;"> ${getFormattedString(stat.name)}: ${stat.value}</p>`
if (stat.name === 'linesOfCode') {
htmlString += `<p style="margin-bottom: 4px"><img src="${getTransformationIcon(
stat.name
)}" style="vertical-align: middle;"> ${getFormattedString(stat.name)}: ${stat.value}</p>`
}
})
htmlString += `</div>`
return htmlString
Expand Down Expand Up @@ -647,8 +649,6 @@ export async function getTransformationPlan(jobId: string, profile: RegionProfil
plan += `</div><br>`
}
plan += `</div><br>`
plan += `<p style="font-size: 18px; margin-bottom: 4px;"><b>Appendix</b><br><a href="#top" style="float: right; font-size: 14px;">Scroll to top <img src="${arrowIcon}" style="vertical-align: middle;"></a></p><br>`
plan = addTableMarkdown(plan, '-1', tableMapping) // ID of '-1' reserved for appendix table; only 1 table there
return plan
} catch (e: any) {
const errorMessage = (e as Error).message
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import {
zipCode,
getTableMapping,
getFilesRecursively,
getJobStatisticsHtml,
} from '../../../codewhisperer/service/transformByQ/transformApiHandler'
import {
validateOpenProjects,
Expand Down Expand Up @@ -312,6 +313,31 @@ dependencyManagement:
assert.deepStrictEqual(actual, expected)
})

it('WHEN showing plan statistics THEN correct labels appear', () => {
const mockJobStatistics = [
{
name: 'linesOfCode',
value: '1234',
},
{
name: 'plannedDependencyChanges',
value: '0',
},
{
name: 'plannedDeprecatedApiChanges',
value: '0',
},
{
name: 'plannedFileChanges',
value: '0',
},
]
const result = getJobStatisticsHtml(mockJobStatistics)
assert.strictEqual(result.includes('Lines of code in your application'), true)
assert.strictEqual(result.includes('to be replaced'), false)
assert.strictEqual(result.includes('to be changed'), false)
})

it(`WHEN transforming a project with a Windows Maven executable THEN mavenName set correctly`, async function () {
sinon.stub(env, 'isWin').returns(true)
const tempFileName = 'mvnw.cmd'
Expand Down
Loading