Skip to content

Commit 4f8f898

Browse files
author
David Hasani
committed
skip build/plan steps
1 parent ac6f2e5 commit 4f8f898

File tree

5 files changed

+23
-31
lines changed

5 files changed

+23
-31
lines changed

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/ArtifactHandler.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class ArtifactHandler(private val project: Project, private val clientAdaptor: G
6969
when (val result = downloadArtifact(job, TransformationDownloadArtifactType.CLIENT_INSTRUCTIONS)) {
7070
is DownloadArtifactResult.Success -> {
7171
if (result.artifact !is CodeModernizerArtifact) return notifyUnableToApplyPatch("")
72+
notifyStickyInfo("patch path", result.artifact.patch.path)
7273
displayDiffUsingPatch(result.artifact.patch, job, source)
7374
}
7475
is DownloadArtifactResult.ParseZipFailure -> notifyUnableToApplyPatch(result.failureReason.errorMessage)

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerManager.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo
264264

265265
suspend fun resumePollingFromHil() {
266266
val transformationType =
267-
if (codeTransformationSession?.sessionContext?.schema != null) CodeTransformType.SQL_CONVERSION else CodeTransformType.LANGUAGE_UPGRADE
267+
if (codeTransformationSession?.sessionContext?.sqlMetadataZip != null) CodeTransformType.SQL_CONVERSION else CodeTransformType.LANGUAGE_UPGRADE
268268
val result = handleJobResumedFromHil(managerState.getLatestJobId(), codeTransformationSession as CodeModernizerSession, transformationType)
269269
postModernizationJob(result)
270270
}
@@ -348,7 +348,7 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo
348348
CodeModernizerSessionState.getInstance(project).currentJobCreationTime = currentJobResult.creationTime()
349349
codeTransformationSession = session
350350
initModernizationJobUI(false, project.getModuleOrProjectNameForFile(session.sessionContext.configurationFile))
351-
val transformationType = if (session.sessionContext.schema != null) CodeTransformType.SQL_CONVERSION else CodeTransformType.LANGUAGE_UPGRADE
351+
val transformationType = if (session.sessionContext.sqlMetadataZip != null) CodeTransformType.SQL_CONVERSION else CodeTransformType.LANGUAGE_UPGRADE
352352
codeModernizerBottomWindowPanelManager.setResumeJobUI(currentJobResult, plan, session.sessionContext.sourceJavaVersion, transformationType)
353353
session.resumeJob(currentJobResult.creationTime(), lastJobId)
354354
val result = handleJobStarted(lastJobId, session)
@@ -466,7 +466,7 @@ class CodeModernizerManager(private val project: Project) : PersistentStateCompo
466466
codeModernizerBottomWindowPanelManager.setJobRunningUI()
467467
}
468468

469-
val transformationType = if (session.sessionContext.schema != null) CodeTransformType.SQL_CONVERSION else CodeTransformType.LANGUAGE_UPGRADE
469+
val transformationType = if (session.sessionContext.sqlMetadataZip != null) CodeTransformType.SQL_CONVERSION else CodeTransformType.LANGUAGE_UPGRADE
470470

471471
return session.pollUntilJobCompletion(jobId) { new, plan ->
472472
codeModernizerBottomWindowPanelManager.handleJobTransition(new, plan, session.sessionContext.sourceJavaVersion, transformationType)

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/CodeModernizerSession.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,8 @@ class CodeModernizerSession(
458458
}
459459
}
460460

461-
// Open the transformation plan detail panel once transformation plan is available
462-
if (state.transformationPlan != null && !isTransformationPlanEditorOpened) {
461+
// Open the transformation plan detail panel once transformation plan is available (no plan for SQL conversions)
462+
if (sessionContext.sqlMetadataZip == null && state.transformationPlan != null && !isTransformationPlanEditorOpened) {
463463
tryOpenTransformationPlanEditor()
464464
isTransformationPlanEditorOpened = true
465465
}

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/panels/managers/BuildProgressSplitterPanelManager.kt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,9 @@ class BuildProgressSplitterPanelManager(private val project: Project) :
4343
val userObject = selectedNode.userObject
4444
if (userObject is BuildProgressStepTreeItem) {
4545
if (isValidStepClick(userObject.id) && userObject.transformationStepId != null) {
46-
System.out.println("Is valid stepID")
4746
buildProgressStepDetailsPanel.updateListData(userObject.transformationStepId)
4847
revalidate()
4948
repaint()
50-
} else {
51-
System.out.println("Is NOT valid stepID")
5249
}
5350
}
5451
}
@@ -127,8 +124,8 @@ class BuildProgressSplitterPanelManager(private val project: Project) :
127124
)
128125

129126
fun maybeAdd(stepId: ProgressStepId, string: String) {
130-
// don't show building message for SQL conversions since we don't build the code
131-
if (string == message("codemodernizer.toolwindow.progress.building") && transformType == CodeTransformType.SQL_CONVERSION) {
127+
// don't show building or generate plan message for SQL conversions since we don't build or generate plan
128+
if (transformType == CodeTransformType.SQL_CONVERSION && (string == message("codemodernizer.toolwindow.progress.building") || string == message("codemodernizer.toolwindow.progress.planning"))) {
132129
return
133130
}
134131
if (currentState.none { it.id == stepId }) {
@@ -145,8 +142,7 @@ class BuildProgressSplitterPanelManager(private val project: Project) :
145142
maybeAdd(ProgressStepId.UPLOADING, message("codemodernizer.toolwindow.progress.uploading"))
146143
maybeAdd(ProgressStepId.BUILDING, message("codemodernizer.toolwindow.progress.building"))
147144
}
148-
// immediately jump to planning stage for SQL conversions after upload completes since we don't build the code
149-
if (newState in setOf(TransformationStatus.PREPARED, newState == TransformationStatus.PLANNING) || transformType == CodeTransformType.SQL_CONVERSION) {
145+
if (newState in setOf(TransformationStatus.PREPARED, newState == TransformationStatus.PLANNING)) {
150146
maybeAdd(ProgressStepId.UPLOADING, message("codemodernizer.toolwindow.progress.uploading"))
151147
maybeAdd(ProgressStepId.BUILDING, message("codemodernizer.toolwindow.progress.building"))
152148
maybeAdd(ProgressStepId.PLANNING, message("codemodernizer.toolwindow.progress.planning"))
@@ -217,34 +213,38 @@ class BuildProgressSplitterPanelManager(private val project: Project) :
217213
}
218214

219215
TransformationStatus.PREPARING -> {
220-
loadingPanelText = if (transformType != CodeTransformType.SQL_CONVERSION) {
221-
message("codemodernizer.toolwindow.scan_in_progress.building", jdk.description)
216+
loadingPanelText = if (transformType == CodeTransformType.SQL_CONVERSION) {
217+
message("codemodernizer.toolwindow.scan_in_progress.transforming")
222218
} else {
223-
message("codemodernizer.toolwindow.scan_in_progress.planning")
219+
message("codemodernizer.toolwindow.scan_in_progress.building", jdk.description)
224220
}
225221
statuses.update(BuildStepStatus.DONE, ProgressStepId.UPLOADING)
226222
}
227223

228224
TransformationStatus.PREPARED -> {
229-
loadingPanelText = if (transformType != CodeTransformType.SQL_CONVERSION) {
230-
message("codemodernizer.toolwindow.scan_in_progress.building", jdk.description)
225+
loadingPanelText = if (transformType == CodeTransformType.SQL_CONVERSION) {
226+
message("codemodernizer.toolwindow.scan_in_progress.transforming")
231227
} else {
232-
message("codemodernizer.toolwindow.scan_in_progress.planning")
228+
message("codemodernizer.toolwindow.scan_in_progress.building", jdk.description)
233229
}
234230
statuses.update(BuildStepStatus.DONE, ProgressStepId.BUILDING)
235231
}
236232

237233
TransformationStatus.PLANNING -> {
238-
loadingPanelText = if (transformType != CodeTransformType.SQL_CONVERSION) {
239-
message("codemodernizer.toolwindow.scan_in_progress.building", jdk.description)
234+
loadingPanelText = if (transformType == CodeTransformType.SQL_CONVERSION) {
235+
message("codemodernizer.toolwindow.scan_in_progress.transforming")
240236
} else {
241237
message("codemodernizer.toolwindow.scan_in_progress.planning")
242238
}
243239
statuses.update(BuildStepStatus.DONE, ProgressStepId.BUILDING)
244240
}
245241

246242
TransformationStatus.PLANNED -> {
247-
loadingPanelText = message("codemodernizer.toolwindow.scan_in_progress.planning")
243+
loadingPanelText = if (transformType == CodeTransformType.SQL_CONVERSION) {
244+
message("codemodernizer.toolwindow.scan_in_progress.transforming")
245+
} else {
246+
message("codemodernizer.toolwindow.scan_in_progress.planning")
247+
}
248248
statuses.update(BuildStepStatus.DONE, ProgressStepId.PLANNING)
249249
}
250250

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/panels/managers/CodeModernizerBottomWindowPanelManager.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,6 @@ class CodeModernizerBottomWindowPanelManager(private val project: Project) : JPa
217217
}
218218
}
219219

220-
fun setProjectInvalidUI(reason: String) = setUI {
221-
banner.updateContent(reason, AllIcons.General.Error)
222-
fullSizeLoadingPanel.apply {
223-
fullSizeLoadingPanel.showFailureUI()
224-
revalidate()
225-
repaint()
226-
}
227-
}
228-
229220
fun userInitiatedStopCodeModernizationUI() = setUI {
230221
stopTimer()
231222
add(BorderLayout.CENTER, buildProgressSplitterPanelManager)
@@ -247,7 +238,7 @@ class CodeModernizerBottomWindowPanelManager(private val project: Project) : JPa
247238
TransformationStatus.PAUSED,
248239
TransformationStatus.COMPLETED,
249240
TransformationStatus.PARTIALLY_COMPLETED
250-
)
241+
) && transformType != CodeTransformType.SQL_CONVERSION // no plan for SQL conversions
251242
) {
252243
addPlanToBanner()
253244
}

0 commit comments

Comments
 (0)