Skip to content

Conversation

@dhasani23
Copy link
Contributor

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

When the server-side build fails, the pre-build logs were being downloaded but not actually shown to user.
When the transformation fails, we were unnecessarily attempting to download the results.
Make job ID more visible in Transformation Hub.

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@dhasani23 dhasani23 requested review from a team as code owners December 6, 2024 02:18
jobId,
sessionContext.targetJavaVersion
)
result.state == TransformationStatus.PARTIALLY_COMPLETED -> CodeModernizerJobCompletedResult.JobPartiallySucceeded(jobId)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We were not using sessionContext.targetJavaVersion

)

fun buildTransformResultChatContent(result: CodeModernizerJobCompletedResult, totalPatchFiles: Int): CodeTransformChatMessageContent {
fun buildTransformResultChatContent(result: CodeModernizerJobCompletedResult, totalPatchFiles: Int? = null): CodeTransformChatMessageContent {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the transformation fails, no patch files, so this can be optional as it's only used for full or partial successes.

when (result) {
is CodeModernizerJobCompletedResult.Stopped, CodeModernizerJobCompletedResult.JobAbortedBeforeStarting -> handleCodeTransformStoppedByUser()
is CodeModernizerJobCompletedResult.JobFailed -> handleCodeTransformJobFailed(result.failureReason)
is CodeModernizerJobCompletedResult.JobFailedInitialBuild -> handleCodeTransformJobFailedPreBuild(result)
Copy link
Contributor Author

@dhasani23 dhasani23 Dec 6, 2024

Choose a reason for hiding this comment

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

These make sure that 1) when the job fails, the last chat item is updated to say so and 2) when the server-side build fails, a new chat item is sent to say so + include a button to download the build logs (this button functionality was previously implemented in buildTransformResultChatContent, but it was not running).

timeTaken
)
}
} catch (exception: AlreadyDisposedException) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We already catch this exception in the caller.

fun setJobRunningUI() = setUI {
add(BorderLayout.CENTER, buildProgressSplitterPanelManager)
banner.updateContent(message("codemodernizer.toolwindow.banner.job_is_running"), AllIcons.General.BalloonInformation)
updateJobId()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Make job ID more visible in Transformation Hub by putting it at the top next to the job run time.

codemodernizer.chat.message.button.view_summary=View summary
codemodernizer.chat.message.changes_applied=I applied the changes to your project.
codemodernizer.chat.message.choose_objective=I can help you with the following tasks:\n- Upgrade your Java 8 and Java 11 codebases to Java 17, or upgrade Java 17 code with up to date libraries and other dependencies.\n- Convert embedded SQL code for Oracle to PostgreSQL database migrations in AWS DMS.\n\nWhat would you like to do? You can enter "language upgrade" or "sql conversion".
codemodernizer.chat.message.choose_objective_placeholder=Enter "language upgrade" or "sql conversion"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This String and those below were already approved.

@dhasani23
Copy link
Contributor Author

image

codemodernizer.notification.info.download.started.title=Download Started
codemodernizer.notification.info.modernize_complete.content=Amazon Q finished the transformation. You can review the diff to see the proposed changes and accept or reject them. The transformation summary has details about the files that were updated.
codemodernizer.notification.info.modernize_complete.title=Transform Complete
codemodernizer.notification.info.modernize_complete.view_diff=View diff
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming these and the rest deleted were not used?

border = BorderFactory.createEmptyBorder(0, 5, 0, 0)
}

private val infoLabelJobId = JBLabel().apply {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry just for my own understanding, this is for the ux of displaying the job id in transformation hub right

} catch (exception: AlreadyDisposedException) {
LOG.warn { "Disposed when about to create the loading panel" }
return
infoLabelRunningTime.text = if (runTime != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Again here just curious, what running time is it referring to?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "42s" in the image above

@dhasani23 dhasani23 enabled auto-merge (squash) December 9, 2024 22:27
@dhasani23 dhasani23 merged commit 6156c00 into aws:main Dec 9, 2024
11 checks passed
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 17, 2025
* fix(amazonq): show build logs when pre-build fails

* fix detekt errors

* remove unused imports

* fix detektTest

---------

Co-authored-by: David Hasani <[email protected]>
karanA-aws pushed a commit to karanA-aws/aws-toolkit-jetbrains that referenced this pull request Jan 22, 2025
* fix(amazonq): show build logs when pre-build fails

* fix detekt errors

* remove unused imports

* fix detektTest

---------

Co-authored-by: David Hasani <[email protected]>
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.

3 participants