diff --git a/ide-common/src/main/kotlin/org/digma/intellij/plugin/analytics/BackendUtils.kt b/ide-common/src/main/kotlin/org/digma/intellij/plugin/analytics/BackendUtils.kt index f19a771b3..e752c7673 100644 --- a/ide-common/src/main/kotlin/org/digma/intellij/plugin/analytics/BackendUtils.kt +++ b/ide-common/src/main/kotlin/org/digma/intellij/plugin/analytics/BackendUtils.kt @@ -1,11 +1,33 @@ package org.digma.intellij.plugin.analytics import com.intellij.openapi.project.Project +import org.digma.intellij.plugin.common.findActiveProject fun isCentralized(project: Project): Boolean { return BackendInfoHolder.getInstance(project).isCentralized() } -fun getVersion(project: Project): String { - return BackendInfoHolder.getInstance(project).getAbout()?.applicationVersion ?: "unknown"; -} \ No newline at end of file +fun getBackendVersion(project: Project): String { + return BackendInfoHolder.getInstance(project).getAbout()?.applicationVersion ?: "unknown" +} + +fun getBackendVersion(): String { + val project = findActiveProject() + return project?.let { + BackendInfoHolder.getInstance(it).getAbout()?.applicationVersion ?: "unknown" + } ?: "unknown" +} + +fun getBackendDeploymentType(): String { + val project = findActiveProject() + return project?.let { + BackendInfoHolder.getInstance(it).getAbout()?.deploymentType?.name ?: "unknown" + } ?: "unknown" +} + +fun isCentralized(): Boolean { + val project = findActiveProject() + return project?.let { + BackendInfoHolder.getInstance(it).getAbout()?.isCentralize ?: false + } ?:false +} diff --git a/ide-common/src/main/kotlin/org/digma/intellij/plugin/api/AboutHttpService.kt b/ide-common/src/main/kotlin/org/digma/intellij/plugin/api/AboutHttpService.kt index c2dc5914b..d6dc58331 100644 --- a/ide-common/src/main/kotlin/org/digma/intellij/plugin/api/AboutHttpService.kt +++ b/ide-common/src/main/kotlin/org/digma/intellij/plugin/api/AboutHttpService.kt @@ -13,6 +13,10 @@ import io.netty.channel.ChannelHandlerContext import io.netty.handler.codec.http.FullHttpRequest import io.netty.handler.codec.http.HttpRequest import io.netty.handler.codec.http.QueryStringDecoder +import org.digma.intellij.plugin.analytics.getBackendDeploymentType +import org.digma.intellij.plugin.analytics.getBackendVersion +import org.digma.intellij.plugin.analytics.isCentralized +import org.digma.intellij.plugin.semanticversion.SemanticVersionUtil import org.jetbrains.ide.RestService import java.io.OutputStream @@ -75,6 +79,11 @@ fun writeAboutJson(writer: JsonGenerator) { writer.writeStringField("buildNumber", build.asStringWithoutProductCode()) } + writer.writeStringField("pluginVersion", SemanticVersionUtil.getPluginVersionWithoutBuildNumberAndPreRelease("unknown")) + writer.writeStringField("backendVersion", getBackendVersion()) + writer.writeStringField("backendDeploymentType", getBackendDeploymentType()) + writer.writeBooleanField("isCentralized", isCentralized()) + writer.array("openProjects") { for (project in ProjectManager.getInstance().openProjects) { writer.writeString(project.name) diff --git a/src/main/kotlin/org/digma/intellij/plugin/ui/highlights/HighlightsMessageRouterHandler.kt b/src/main/kotlin/org/digma/intellij/plugin/ui/highlights/HighlightsMessageRouterHandler.kt index 9d0787afa..01b386875 100644 --- a/src/main/kotlin/org/digma/intellij/plugin/ui/highlights/HighlightsMessageRouterHandler.kt +++ b/src/main/kotlin/org/digma/intellij/plugin/ui/highlights/HighlightsMessageRouterHandler.kt @@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode import com.intellij.openapi.project.Project import org.apache.maven.artifact.versioning.ComparableVersion import org.cef.browser.CefBrowser -import org.digma.intellij.plugin.analytics.getVersion +import org.digma.intellij.plugin.analytics.getBackendVersion import org.digma.intellij.plugin.common.newerThan import org.digma.intellij.plugin.log.Log import org.digma.intellij.plugin.model.rest.highlights.HighlightsRequest @@ -20,7 +20,7 @@ class HighlightsMessageRouterHandler(project: Project) : BaseCommonMessageRouter override fun doOnQuery(project: Project, browser: CefBrowser, requestJsonNode: JsonNode, rawRequest: String, action: String): Boolean { - val version = getVersion(project) + val version = getBackendVersion(project) val comparableVersion = ComparableVersion(version) if (version == "unknown" || comparableVersion.newerThan(ComparableVersion("0.3.7"))) { when (action) {