Skip to content

Commit 5b86ef1

Browse files
authored
Merge pull request #2631 from digma-ai/ui-versioning
ui versioning Closes #2622
2 parents 2211ec0 + 8ed82f4 commit 5b86ef1

File tree

176 files changed

+2328
-20428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

176 files changed

+2328
-20428
lines changed

build.gradle.kts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,12 @@ tasks {
311311
"kotlinx.coroutines.debug" to "",
312312
"org.digma.plugin.report.all.errors" to "true",
313313
"org.digma.plugin.auth.debug" to "true",
314+
"org.digma.plugin.DigmaPathManager.dev.runIde" to "true",
314315

315316
//see https://kotlin.github.io/analysis-api/testing-in-k2-locally.html
316317
"idea.kotlin.plugin.use.k2" to "true",
317318

318-
// "idea.ProcessCanceledException" to "disabled"
319+
//"idea.ProcessCanceledException" to "disabled"
319320

320321

321322
//to use a local file for digma-agent or digma extension,
@@ -331,6 +332,8 @@ tasks {
331332

332333
//custom compose file url
333334
//"org.digma.plugin.custom.docker-compose.url" to "https://raw.githubusercontent.com/digma-ai/digma/refs/heads/0.2.73/docker/docker-compose.yml"
335+
//ui bundle path
336+
//"org.digma.plugin.ui.bundle.path" to "/home/shalom/Downloads/digma-ui-4.0.12.zip"
334337

335338
)
336339

@@ -347,10 +350,13 @@ tasks {
347350
exclude("**/webview/global-env-vars.txt")
348351

349352
val filesToFilter = listOf(
350-
"webview/recentactivity/recentActivityTemplate.ftl",
351-
"webview/jaegerui/jaegeruitemplate.ftl",
352-
"webview/documentation/documentation.ftl",
353-
"webview/main/maintemplate.ftl"
353+
"webview/recent-activity/env.js",
354+
"webview/jaeger-ui/env.js",
355+
"webview/documentation/env.js",
356+
"webview/dashboard/env.js",
357+
"webview/troubleshooting/env.js",
358+
"webview/main/env.js",
359+
"webview/installation-wizard/env.js"
354360
)
355361

356362

common-build-logic/src/main/kotlin/common/BuildProfile.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,8 @@ object BuildProfiles {
218218

219219
Profile.p243 to BuildProfile(
220220
profile = Profile.p243,
221-
platformVersion = "2024.3.1",
222-
riderVersion = "2024.3",
221+
platformVersion = "2024.3.1.1",
222+
riderVersion = "2024.3.2",
223223
pycharmVersion = "2024.3",
224224
riderTargetFramework = "net8.0",
225225
riderResharperVersionConstant = "PROFILE_2023_2;PROFILE_2024_3",

ide-common/build.gradle.kts

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ dependencies {
5555

5656
tasks {
5757

58-
val downloadComposeFile = register("downloadComposeFile", Download::class.java) {
58+
val downloadComposeFile by registering(Download::class) {
5959
src(
6060
listOf(
6161
"https://get.digma.ai/"
@@ -64,11 +64,37 @@ tasks {
6464

6565
val dir = File(project.sourceSets.main.get().output.resourcesDir, "docker-compose")
6666
dest(File(dir, "docker-compose.yml"))
67-
overwrite(false)
68-
onlyIfModified(true)
67+
retries(3)
6968
}
7069

70+
71+
val uiVersionFile = project.rootProject.file("ui-version")
72+
val uiVersion = uiVersionFile.readText()
73+
//the directory inside the jar to package to
74+
val uiBundleDir = File(project.sourceSets.main.get().output.resourcesDir, "ui-bundle")
75+
val uiBundleFile = File(uiBundleDir, "digma-ui-$uiVersion.zip")
76+
77+
val downloadUiBundle by registering(Download::class) {
78+
79+
inputs.files(uiVersionFile)
80+
outputs.files(uiBundleFile)
81+
82+
src(
83+
listOf(
84+
"https://github.com/digma-ai/digma-ui/releases/download/v$uiVersion/dist-jetbrains-v$uiVersion.zip"
85+
)
86+
)
87+
dest(uiBundleFile)
88+
retries(3)
89+
}
90+
91+
val createUiBundleVersionFile by registering(Copy::class) {
92+
from(uiVersionFile)
93+
into(uiBundleDir)
94+
}
95+
96+
7197
processResources {
72-
dependsOn(downloadComposeFile)
98+
dependsOn(downloadComposeFile, downloadUiBundle, createUiBundleVersionFile)
7399
}
74100
}

ide-common/src/main/java/org/digma/intellij/plugin/analytics/ConnectionTestResult.java

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

ide-common/src/main/java/org/digma/intellij/plugin/settings/SettingsComponent.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.digma.intellij.plugin.auth.account.*;
1414
import org.digma.intellij.plugin.common.*;
1515
import org.digma.intellij.plugin.errorreporting.ErrorReporter;
16+
import org.digma.intellij.plugin.updates.ui.UIVersioningService;
1617
import org.jetbrains.annotations.*;
1718

1819
import javax.swing.*;
@@ -167,6 +168,8 @@ public boolean verify(JComponent input) {
167168

168169
var backendVersionLabel = createBackendVersionLabel();
169170

171+
var uiVersionLabel = createUiVersionLabel();
172+
170173
var importExportPanel = createImportExportPanel();
171174

172175
var resetPluginButton = createResetPluginButton();
@@ -186,6 +189,7 @@ public boolean verify(JComponent input) {
186189
.addComponent(resetToDefaultsButton)
187190
.addLabeledComponent(new JBLabel("User id"), userIdLabel)
188191
.addLabeledComponent(new JBLabel("Backend version"), backendVersionLabel)
192+
.addLabeledComponent(new JBLabel("UI version"), uiVersionLabel)
189193
.addComponent(importExportPanel)
190194
.addComponent(resetPluginButton)
191195
.addComponent(pluginResetWarning)
@@ -384,6 +388,11 @@ private static JBLabel createBackendVersionLabel() {
384388
return backendVersionLabel;
385389
}
386390

391+
@NotNull
392+
private static JBLabel createUiVersionLabel() {
393+
return new JBLabel(UIVersioningService.getInstance().getCurrentUiVersion()+" ("+UIVersioningService.getInstance().getCurrentUiBundlePath()+")");
394+
}
395+
387396

388397
private JPanel createImportExportPanel() {
389398
//noinspection ExtractMethodRecommender

ide-common/src/main/java/org/digma/intellij/plugin/ui/MainToolWindowCardsController.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ public void initComponents(@NotNull ToolWindow toolWindow,
157157

158158
public void updateStateChanged(@NotNull PublicUpdateState updateState) {
159159
if (updateState.getUpdateState() == CurrentUpdateState.OK) {
160-
closeUpdateBackendPanel();
160+
closeAggressiveUpdatePanel();
161161
} else {
162-
showUpdateBackendPanel();
162+
showAggressiveUpdatePanel();
163163
}
164164
}
165165

@@ -242,7 +242,7 @@ public void troubleshootingFinished() {
242242
if (troubleshooting.isOn()) {
243243
toolWindow.getContentManager().removeContent(troubleshooting.troubleshootingContent, true);
244244
toolWindow.getContentManager().addContent(mainContent);
245-
//dispose the wizard panel which will dispose the jcef browser
245+
//dispose the troubleshooting panel which will dispose the jcef browser
246246
troubleshooting.troubleshootingPanel.dispose();
247247
troubleshooting.troubleshootingContent = null;
248248
troubleshooting.troubleshootingPanel = null;
@@ -296,25 +296,25 @@ public void showMainPanel() {
296296
}
297297
}
298298

299-
private void showUpdateBackendPanel() {
299+
private void showAggressiveUpdatePanel() {
300300

301-
Log.log(LOGGER::debug, "showUpdateBackendPanel called");
301+
Log.log(LOGGER::debug, "showAggressiveUpdatePanel called");
302302

303303
//replace the card even if wizard is on. it will not show until wizard content is removed.
304304

305305
//this may happen on startup,showMainPanel is called from the tool window factory,
306306
// but there may be a connection lost before the content was built and before this controller was initialized
307307
if (isConnectionLost.get()) {
308-
Log.log(LOGGER::debug, "Not showing MainPanel because connection lost, showing NoConnection");
308+
Log.log(LOGGER::debug, "Not showing AggressiveUpdatePanel because connection lost, showing NoConnection");
309309
showNoConnection();
310310
} else {
311311
EDT.ensureEDT(() -> showCard(MainWindowCard.UPDATE_MODE));
312312
}
313313
}
314314

315-
private void closeUpdateBackendPanel() {
315+
private void closeAggressiveUpdatePanel() {
316316

317-
Log.log(LOGGER::debug, "closeUpdateBackendPanel called");
317+
Log.log(LOGGER::debug, "closeAggressiveUpdatePanel called");
318318

319319

320320
//replace the card even if wizard is on. it will not show until wizard content is removed.

ide-common/src/main/java/org/digma/intellij/plugin/ui/RecentActivityToolWindowCardsController.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ class RecentActivityToolWindowCardsController(private val project: Project) {
9393

9494
fun updateStateChanged(updateState: PublicUpdateState) {
9595
if (updateState.updateState == CurrentUpdateState.OK) {
96-
closeUpdateBackendPanel()
96+
closeAggressiveUpdatePanel()
9797
} else {
98-
showUpdateBackendPanel()
98+
showAggressiveUpdatePanel()
9999
}
100100
}
101101

@@ -112,19 +112,19 @@ class RecentActivityToolWindowCardsController(private val project: Project) {
112112
}
113113
}
114114

115-
private fun showUpdateBackendPanel() {
116-
Log.log(logger::debug, "showUpdateBackendPanel called")
115+
private fun showAggressiveUpdatePanel() {
116+
Log.log(logger::debug, "showAggressiveUpdatePanel called")
117117

118118
if (isConnectionLost.get()) {
119-
Log.log(logger::debug, "Not showing MainPanel because connection lost, showing NoConnection")
119+
Log.log(logger::debug, "Not showing AggressiveUpdatePanel because connection lost, showing NoConnection")
120120
showNoConnection()
121121
} else {
122122
EDT.ensureEDT { showCard(RecentActivityWindowCard.UPDATE_MODE) }
123123
}
124124
}
125125

126-
private fun closeUpdateBackendPanel() {
127-
Log.log(logger::debug, "closeUpdateBackendPanel called")
126+
private fun closeAggressiveUpdatePanel() {
127+
Log.log(logger::debug, "closeAggressiveUpdatePanel called")
128128

129129
//this may happen on startup,showMainPanel is called from the tool window factory,
130130
// but there may be a connection lost before the content was built and before this controller was initialized

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package org.digma.intellij.plugin.common
22

33
import com.intellij.openapi.application.ApplicationInfo
4+
import com.intellij.openapi.components.service
45
import org.digma.intellij.plugin.model.rest.version.VersionRequest
56
import org.digma.intellij.plugin.semanticversion.SemanticVersionUtil
7+
import org.digma.intellij.plugin.updates.ui.UIVersioningService
68

79

810
// returns one of:
@@ -23,9 +25,15 @@ fun getPluginVersion(defaultIfNotFound: String = "0.0.0"): String {
2325
return SemanticVersionUtil.getPluginVersionWithoutBuildNumberAndPreRelease(defaultIfNotFound)
2426
}
2527

28+
fun getUiVersion(): String {
29+
return service<UIVersioningService>().getUiVersionForVersionRequest()
30+
}
31+
32+
33+
2634

2735
fun buildVersionRequest(): VersionRequest {
2836
return VersionRequest(
29-
getPluginVersion(), getPlatformType(), getPlatformVersion()
37+
getPluginVersion(), getPlatformType(), getPlatformVersion(), getUiVersion()
3038
)
3139
}

ide-common/src/main/kotlin/org/digma/intellij/plugin/docker/Downloader.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@ class Downloader {
6969
return
7070
}
7171

72-
val outputStream = FileOutputStream(composeFile)
73-
Log.log(logger::info, "unpacking {} to {}", COMPOSE_FILE_NAME, composeFile)
74-
com.intellij.openapi.util.io.StreamUtil.copy(inputStream, outputStream)
72+
FileOutputStream(composeFile).use {
73+
Log.log(logger::info, "unpacking {} to {}", COMPOSE_FILE_NAME, composeFile)
74+
com.intellij.openapi.util.io.StreamUtil.copy(inputStream, it)
75+
}
76+
7577
}
7678

7779

@@ -103,6 +105,7 @@ class Downloader {
103105
"download from $url",
104106
mapOf("responseCode" to responseCode.toString())
105107
)
108+
throw RuntimeException("could not download file from $url")
106109
} else {
107110
connection.inputStream.use {
108111
Files.copy(it, tempFile, StandardCopyOption.REPLACE_EXISTING)

ide-common/src/main/kotlin/org/digma/intellij/plugin/docker/LocalInstallationFacade.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ class LocalInstallationFacade {
131131
return operationInProgress.get() == OP.INSTALL
132132
}
133133

134+
fun isAnyOperationRunning(): Boolean {
135+
return operationInProgress.get() != null
136+
}
137+
134138

135139
fun isLocalEngineInstalled(): Boolean {
136140
if (operationInProgress.get() == OP.INSTALL) {

0 commit comments

Comments
 (0)