Skip to content

Commit ec79275

Browse files
authored
Merge pull request #2490 from digma-ai/remove-unused-jcef-messages
remove deprecated jcef messages Closes #2488
2 parents 3664813 + 106659d commit ec79275

34 files changed

+8
-1242
lines changed

build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ tasks {
331331

332332
val filesToFilter = listOf(
333333
"webview/recentactivity/recentActivityTemplate.ftl",
334-
"webview/navigation/navigationtemplate.ftl",
335334
"webview/jaegerui/jaegeruitemplate.ftl",
336335
"webview/documentation/documentation.ftl",
337336
"webview/main/maintemplate.ftl"

ide-common/src/main/java/org/digma/intellij/plugin/navigation/ViewChangedEvent.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

ide-common/src/main/kotlin/org/digma/intellij/plugin/codelens/CodeLensService.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class CodeLensService(private val project: Project) : Disposable {
225225
Backgroundable.ensurePooledThreadWithoutReadAccess {
226226
val contextPayload = objectToJsonNode(ChangeScopeMessagePayload(lens))
227227
val scopeContext = ScopeContext("IDE/CODE_LENS_CLICKED", contextPayload)
228-
ScopeManager.getInstance(project).changeScope(SpanScope(lens.scopeCodeObjectId), false, null, scopeContext, null)
228+
ScopeManager.getInstance(project).changeScope(SpanScope(lens.scopeCodeObjectId), scopeContext, null)
229229
}
230230

231231
} catch (e: Exception) {

ide-common/src/main/kotlin/org/digma/intellij/plugin/navigation/MainContentViewSwitcher.kt

Lines changed: 0 additions & 186 deletions
This file was deleted.

ide-common/src/main/kotlin/org/digma/intellij/plugin/posthog/ActivityMonitor.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,6 @@ class ActivityMonitor(private val project: Project, cs: CoroutineScope) : Dispos
304304

305305
}
306306

307-
fun registerSpanLinkClicked(spanId: String, origin: UserActionOrigin) {
308-
registerUserActionWithOrigin(
309-
"span link clicked", origin, mapOf("span id" to spanId)
310-
)
311-
}
312307

313308

314309
fun registerLensClicked(lens: String) {

ide-common/src/main/kotlin/org/digma/intellij/plugin/scope/ScopeManager.kt

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import org.digma.intellij.plugin.common.CodeObjectsUtil
1010
import org.digma.intellij.plugin.common.EDT
1111
import org.digma.intellij.plugin.errorreporting.ErrorReporter
1212
import org.digma.intellij.plugin.model.rest.navigation.CodeLocation
13-
import org.digma.intellij.plugin.navigation.MainContentViewSwitcher
14-
import org.digma.intellij.plugin.navigation.View
1513
import org.digma.intellij.plugin.navigation.codenavigation.CodeNavigator
1614
import org.digma.intellij.plugin.persistence.PersistenceService
1715
import org.digma.intellij.plugin.ui.MainToolWindowCardsController
@@ -31,7 +29,6 @@ class ScopeManager(private val project: Project) {
3129

3230
fun changeToHome(
3331
isCalledFromReact: Boolean = false,
34-
forceNavigation: Boolean = false,
3532
scopeContext: ScopeContext? = null,
3633
environmentId: String? = null
3734
) {
@@ -45,14 +42,6 @@ class ScopeManager(private val project: Project) {
4542

4643
fireScopeChangedEvent(null, CodeLocation(listOf(), listOf()), false, scopeContext,environmentId)
4744

48-
if (!forceNavigation) {
49-
val contentViewSwitcher = MainContentViewSwitcher.getInstance(project)
50-
if (contentViewSwitcher.getSelectedView() != View.Assets) {
51-
contentViewSwitcher.showInsights()
52-
}
53-
}
54-
55-
5645
EDT.ensureEDT {
5746
//don't do that on first wizard launch to let user complete the installation wizard.
5847
if (!PersistenceService.getInstance().isFirstWizardLaunch()) {
@@ -70,8 +59,6 @@ class ScopeManager(private val project: Project) {
7059
//preferredView is the preferred view to show after changing scope.
7160
fun changeScope(
7261
scope: Scope,
73-
changeView: Boolean = true,
74-
preferredView: View? = null,
7562
scopeContext: ScopeContext? = null,
7663
environmentId: String? = null
7764
) {
@@ -81,7 +68,7 @@ class ScopeManager(private val project: Project) {
8168

8269
try {
8370
when (scope) {
84-
is SpanScope -> changeToSpanScope(scope, changeView, preferredView, scopeContext, environmentId)
71+
is SpanScope -> changeToSpanScope(scope, scopeContext, environmentId)
8572

8673
else -> {
8774
ErrorReporter.getInstance().reportError(
@@ -99,8 +86,6 @@ class ScopeManager(private val project: Project) {
9986

10087
private fun changeToSpanScope(
10188
scope: SpanScope,
102-
changeView: Boolean = true,
103-
preferredView: View? = null,
10489
scopeContext: ScopeContext? = null,
10590
environmentId: String? = null
10691
) {
@@ -141,10 +126,6 @@ class ScopeManager(private val project: Project) {
141126

142127
fireScopeChangedEvent(scope, codeLocation, hasErrors, scopeContext, environmentId)
143128

144-
if (changeView) {
145-
changeViewAfterScopeChange(scope, preferredView)
146-
}
147-
148129
EDT.ensureEDT {
149130
MainToolWindowCardsController.getInstance(project).closeCoveringViewsIfNecessary()
150131
ToolWindowShower.getInstance(project).showToolWindow()
@@ -163,22 +144,6 @@ class ScopeManager(private val project: Project) {
163144
}
164145

165146

166-
private fun changeViewAfterScopeChange(scope: SpanScope, preferredView: View?) {
167-
168-
//in both these cases, if there are no insights, show analytics
169-
if (preferredView == null || preferredView == View.Insights) {
170-
val insightsStats = AnalyticsService.getInstance(project).getInsightsStats(scope.spanCodeObjectId, null, null)
171-
if (insightsStats.issuesInsightsCount == 0) {
172-
MainContentViewSwitcher.getInstance(project).showAnalytics()
173-
} else {
174-
MainContentViewSwitcher.getInstance(project).showInsights()
175-
}
176-
} else {
177-
MainContentViewSwitcher.getInstance(project).showView(preferredView)
178-
}
179-
}
180-
181-
182147
private fun tryGetMethodIdForSpan(spanCodeObjectId: String): String? {
183148
return CodeNavigator.getInstance(project).findMethodCodeObjectId(spanCodeObjectId)
184149
}

src/main/java/org/digma/intellij/plugin/dashboard/DashboardMessageRouterHandler.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.intellij.openapi.project.Project;
88
import org.cef.browser.*;
99
import org.digma.intellij.plugin.analytics.*;
10-
import org.digma.intellij.plugin.dashboard.incoming.GoToSpan;
1110
import org.digma.intellij.plugin.dashboard.outgoing.*;
1211
import org.digma.intellij.plugin.errorreporting.ErrorReporter;
1312
import org.digma.intellij.plugin.log.Log;
@@ -21,7 +20,7 @@
2120

2221
import static org.digma.intellij.plugin.common.JsonUtilsKt.objectNodeToMap;
2322
import static org.digma.intellij.plugin.ui.jcef.JCEFUtilsKt.getMapFromNode;
24-
import static org.digma.intellij.plugin.ui.jcef.JCefBrowserUtilsKt.*;
23+
import static org.digma.intellij.plugin.ui.jcef.JCefBrowserUtilsKt.serializeAndExecuteWindowPostMessageJavaScript;
2524

2625
public class DashboardMessageRouterHandler extends BaseMessageRouterHandler {
2726

@@ -47,10 +46,6 @@ public boolean doOnQuery(@NotNull Project project, @NotNull CefBrowser browser,
4746

4847
case "DASHBOARD/GET_DATA" -> getData(browser, requestJsonNode);
4948

50-
case "DASHBOARD/GO_TO_SPAN" -> {
51-
GoToSpan goToSpan = jsonToObject(requestJsonNode, GoToSpan.class);
52-
DashboardService.getInstance(project).goToSpan(goToSpan);
53-
}
5449
case "DASHBOARD/GET_SERVICES" -> {
5550
pushServices(browser, requestJsonNode);
5651
}

src/main/java/org/digma/intellij/plugin/dashboard/DashboardService.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@
88
import com.intellij.openapi.project.Project;
99
import org.digma.intellij.plugin.analytics.*;
1010
import org.digma.intellij.plugin.common.EDT;
11-
import org.digma.intellij.plugin.dashboard.incoming.GoToSpan;
12-
import org.digma.intellij.plugin.log.Log;
13-
import org.digma.intellij.plugin.posthog.*;
1411
import org.digma.intellij.plugin.reload.*;
15-
import org.digma.intellij.plugin.scope.*;
1612
import org.jetbrains.annotations.NotNull;
1713

1814
import java.io.InputStream;
@@ -101,16 +97,7 @@ public String getDashboard(@NotNull Map<String, String> queryParams) throws Anal
10197
return AnalyticsService.getInstance(project).getDashboard(queryParams);
10298
}
10399

104-
public void goToSpan(GoToSpan goToSpan) {
105100

106-
Log.log(logger::debug, project, "goToSpan request {}", goToSpan);
107-
108-
ActivityMonitor.getInstance(project).registerSpanLinkClicked(goToSpan.payload().spanCodeObjectId(), UserActionOrigin.Dashboard);
109-
110-
var span = goToSpan.payload();
111-
112-
ScopeManager.getInstance(project).changeScope(new SpanScope(span.spanCodeObjectId()), false, null, null, span.environment());
113-
}
114101

115102

116103
@Override

0 commit comments

Comments
 (0)