Skip to content

Commit c3089e2

Browse files
manodnyabrli
andauthored
Include Link for instructions to update SAM CLI in notification for upgrade required (#3566)
* Update notification * changed action text for upgrading * changed action text for upgrading * Update resources/resources/software/aws/toolkits/resources/MessagesBundle.properties * new link added --------- Co-authored-by: Richard Li <[email protected]>
1 parent e937683 commit c3089e2

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

jetbrains-core/src/software/aws/toolkits/jetbrains/services/lambda/actions/SyncServerlessAppAction.kt

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import com.intellij.execution.configurations.GeneralCommandLine
77
import com.intellij.execution.executors.DefaultRunExecutor
88
import com.intellij.execution.runners.ExecutionEnvironmentBuilder
99
import com.intellij.execution.util.ExecUtil
10+
import com.intellij.ide.BrowserUtil
11+
import com.intellij.notification.NotificationAction
1012
import com.intellij.openapi.actionSystem.AnAction
1113
import com.intellij.openapi.actionSystem.AnActionEvent
1214
import com.intellij.openapi.actionSystem.PlatformDataKeys
@@ -53,6 +55,7 @@ import software.aws.toolkits.telemetry.LambdaPackageType
5355
import software.aws.toolkits.telemetry.Result
5456
import software.aws.toolkits.telemetry.SamTelemetry
5557
import software.aws.toolkits.telemetry.SyncedResources
58+
import java.net.URI
5659

5760
class SyncServerlessAppAction : AnAction(
5861
message("serverless.application.sync"),
@@ -73,6 +76,7 @@ class SyncServerlessAppAction : AnAction(
7376
project = project,
7477
content = (samExecutable as ExecutableInstance.BadExecutable).validationError
7578
)
79+
LOG.warn { "Invalid SAM CLI Executable" }
7680
return@thenAccept
7781
}
7882

@@ -86,7 +90,24 @@ class SyncServerlessAppAction : AnAction(
8690
"sam.cli.version.upgrade.required",
8791
execVersion.parsedVersion, minVersion.parsedVersion
8892
),
89-
project = project
93+
project = project,
94+
listOf(
95+
NotificationAction.createSimple(message("sam.cli.version.upgrade.reason")) {
96+
BrowserUtil.browse(
97+
URI(
98+
"https://aws.amazon.com/about-aws/whats-new/2023/03/aws-toolkits-jetbrains-vs-code-sam-accelerate/"
99+
)
100+
)
101+
},
102+
NotificationAction.createSimple(message("sam.cli.version.upgrade.instructions")) {
103+
BrowserUtil.browse(
104+
URI(
105+
"https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/" +
106+
"manage-sam-cli-versions.html#manage-sam-cli-versions-upgrade"
107+
)
108+
)
109+
}
110+
)
90111
)
91112
return@thenAccept
92113
}
@@ -95,6 +116,7 @@ class SyncServerlessAppAction : AnAction(
95116

96117
validateTemplateFile(project, templateFile)?.let {
97118
notifyError(content = it, project = project)
119+
LOG.warn { it }
98120
return@thenAccept
99121
}
100122

@@ -161,6 +183,14 @@ class SyncServerlessAppAction : AnAction(
161183
null -> return@runInEdt
162184
true -> {
163185
Messages.showWarningDialog(message("lambda.debug.docker.not_connected"), message("docker.not.found"))
186+
SamTelemetry.sync(
187+
project = project,
188+
result = Result.Failed,
189+
syncedResources = syncedResourceType,
190+
lambdaPackageType = lambdaType,
191+
version = SamCommon.getVersionString(),
192+
reason = "Docker not available"
193+
)
164194
return@runInEdt
165195
}
166196

resources/resources/software/aws/toolkits/resources/MessagesBundle.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,9 @@ sam.build.failed=SAM build command failed
10831083
sam.build.running=Running SAM build
10841084
sam.build.succeeded=SAM build command succeeded
10851085
sam.build.title=SAM build
1086-
sam.cli.version.upgrade.required=SAM CLI version is {0}, but {1} or higher is required, upgrade it to continue.
1086+
sam.cli.version.upgrade.instructions=Learn more about upgrading SAM CLI
1087+
sam.cli.version.upgrade.reason=Learn more about SAM sync improvements...
1088+
sam.cli.version.upgrade.required=Your SAM CLI version is {0} and does not include performance improvements for Sync Serverless Applications. To continue, please upgrade to SAM CLI version {1} or higher.
10871089
sam.cli.version.warning=SAM CLI version
10881090
sam.debug.attach=Attach Debugger
10891091
sam.debug.attach.parent=Attempt Debugger Attachment

0 commit comments

Comments
 (0)