Skip to content

Commit

Permalink
Chore - Refactor utils files (aws#4220)
Browse files Browse the repository at this point in the history
* Chore - refactor util files for separation of concerns
  • Loading branch information
damntrecky authored and kumsmrit committed Apr 16, 2024
1 parent b1173a0 commit de430a6
Show file tree
Hide file tree
Showing 17 changed files with 360 additions and 310 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.client.GumbyClien
import software.aws.toolkits.jetbrains.services.codemodernizer.model.CodeModernizerArtifact
import software.aws.toolkits.jetbrains.services.codemodernizer.model.JobId
import software.aws.toolkits.jetbrains.services.codemodernizer.summary.CodeModernizerSummaryEditorProvider
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.TROUBLESHOOTING_URL_DOWNLOAD_DIFF
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.openTroubleshootingGuideNotificationAction
import software.aws.toolkits.jetbrains.utils.notifyStickyInfo
import software.aws.toolkits.jetbrains.utils.notifyStickyWarn
import software.aws.toolkits.resources.message
Expand Down Expand Up @@ -152,7 +154,11 @@ class ArtifactHandler(private val project: Project, private val clientAdaptor: G
message("codemodernizer.notification.warn.view_diff_failed.title"),
message("codemodernizer.notification.warn.view_diff_failed.content"),
project,
listOf(openTroubleshootingGuideNotificationAction(TROUBLESHOOTING_URL_DOWNLOAD_DIFF)),
listOf(
openTroubleshootingGuideNotificationAction(
TROUBLESHOOTING_URL_DOWNLOAD_DIFF
)
),
)
}

Expand All @@ -162,7 +168,11 @@ class ArtifactHandler(private val project: Project, private val clientAdaptor: G
message("codemodernizer.notification.warn.view_summary_failed.title"),
message("codemodernizer.notification.warn.view_summary_failed.content"),
project,
listOf(openTroubleshootingGuideNotificationAction(TROUBLESHOOTING_URL_DOWNLOAD_DIFF)),
listOf(
openTroubleshootingGuideNotificationAction(
TROUBLESHOOTING_URL_DOWNLOAD_DIFF
)
),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.state.CodeModerni
import software.aws.toolkits.jetbrains.services.codemodernizer.state.StateFlags
import software.aws.toolkits.jetbrains.services.codemodernizer.state.buildState
import software.aws.toolkits.jetbrains.services.codemodernizer.toolwindow.CodeModernizerBottomToolWindowFactory
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.STATES_WHERE_PLAN_EXIST
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.TROUBLESHOOTING_URL_MAVEN_COMMANDS
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.TROUBLESHOOTING_URL_PREREQUISITES
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.getModuleOrProjectNameForFile
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.getSupportedBuildFilesWithSupportedJdk
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.getSupportedJavaMappings
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.getSupportedModules
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.isGradleProject
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.openTroubleshootingGuideNotificationAction
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.tryGetJdk
import software.aws.toolkits.jetbrains.ui.feedback.CodeTransformFeedbackDialog
import software.aws.toolkits.jetbrains.utils.isRunningOnRemoteBackend
import software.aws.toolkits.jetbrains.utils.notifyStickyError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.model.MavenCopyCo
import software.aws.toolkits.jetbrains.services.codemodernizer.model.ZipCreationResult
import software.aws.toolkits.jetbrains.services.codemodernizer.plan.CodeModernizerPlanEditorProvider
import software.aws.toolkits.jetbrains.services.codemodernizer.state.CodeModernizerSessionState
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.STATES_AFTER_INITIAL_BUILD
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.STATES_AFTER_STARTED
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.STATES_WHERE_JOB_STOPPED_PRE_PLAN_READY
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.STATES_WHERE_PLAN_EXIST
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.getModuleOrProjectNameForFile
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.pollTransformationStatusAndPlan
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.toTransformationLanguage
import software.aws.toolkits.jetbrains.services.codewhisperer.codescan.CodeWhispererCodeScanSession
import software.aws.toolkits.resources.message
import software.aws.toolkits.telemetry.CodeTransformApiNames
Expand Down Expand Up @@ -444,6 +451,4 @@ class CodeModernizerSession(

fun getActiveJobId() = state.currentJobId
fun fetchPlan(lastJobId: JobId) = clientAdaptor.getCodeModernizationPlan(lastJobId)

fun didJobStart() = state.currentJobId != null
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import software.aws.toolkits.jetbrains.services.codemodernizer.model.JobId
import software.aws.toolkits.jetbrains.services.codemodernizer.model.ValidationResult
import software.aws.toolkits.jetbrains.services.codemodernizer.state.CodeModernizerSessionState
import software.aws.toolkits.jetbrains.services.codemodernizer.state.CodeTransformTelemetryState
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.calculateTotalLatency
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.getJavaVersionFromProjectSetting
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.getMavenVersion
import software.aws.toolkits.jetbrains.services.codemodernizer.utils.tryGetJdk
import software.aws.toolkits.telemetry.CodeTransformApiNames
import software.aws.toolkits.telemetry.CodeTransformCancelSrcComponents
import software.aws.toolkits.telemetry.CodeTransformJavaSourceVersionsAllowed
Expand Down Expand Up @@ -89,7 +93,10 @@ class CodeTransformTelemetryManager(private val project: Project) {
codeTransformJobId = jobId?.toString(),
codeTransformSessionId = sessionId,
codeTransformResultStatusMessage = codeTransformResultStatusMessage,
codeTransformRunTimeLatency = calculateTotalLatency(CodeTransformTelemetryState.instance.getStartTime(), Instant.now()),
codeTransformRunTimeLatency = calculateTotalLatency(
CodeTransformTelemetryState.instance.getStartTime(),
Instant.now()
),
codeTransformLocalJavaVersion = getJavaVersionFromProjectSetting(project),
codeTransformLocalMavenVersion = getMavenVersion(project),
)
Expand Down

This file was deleted.

Loading

0 comments on commit de430a6

Please sign in to comment.