Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui versioning Closes #2622 #2631

Merged
merged 27 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,12 @@ tasks {
"kotlinx.coroutines.debug" to "",
"org.digma.plugin.report.all.errors" to "true",
"org.digma.plugin.auth.debug" to "true",
"org.digma.plugin.DigmaPathManager.dev.runIde" to "true",

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

// "idea.ProcessCanceledException" to "disabled"
//"idea.ProcessCanceledException" to "disabled"


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

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

)

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

val filesToFilter = listOf(
"webview/recentactivity/recentActivityTemplate.ftl",
"webview/jaegerui/jaegeruitemplate.ftl",
"webview/documentation/documentation.ftl",
"webview/main/maintemplate.ftl"
"webview/recent-activity/env.js",
"webview/jaeger-ui/env.js",
"webview/documentation/env.js",
"webview/dashboard/env.js",
"webview/troubleshooting/env.js",
"webview/main/env.js",
"webview/installation-wizard/env.js"
)


Expand Down
2 changes: 1 addition & 1 deletion common-build-logic/src/main/kotlin/common/BuildProfile.kt
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ object BuildProfiles {
Profile.p243 to BuildProfile(
profile = Profile.p243,
platformVersion = "2024.3.1",
riderVersion = "2024.3",
riderVersion = "2024.3.2",
pycharmVersion = "2024.3",
riderTargetFramework = "net8.0",
riderResharperVersionConstant = "PROFILE_2023_2;PROFILE_2024_3",
Expand Down
34 changes: 30 additions & 4 deletions ide-common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dependencies {

tasks {

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

val dir = File(project.sourceSets.main.get().output.resourcesDir, "docker-compose")
dest(File(dir, "docker-compose.yml"))
overwrite(false)
onlyIfModified(true)
retries(3)
}


val uiVersionFile = project.rootProject.file("ui-version")
val uiVersion = uiVersionFile.readText()
//the directory inside the jar to package to
val uiBundleDir = File(project.sourceSets.main.get().output.resourcesDir, "ui-bundle")
val uiBundleFile = File(uiBundleDir, "digma-ui-$uiVersion.zip")

val downloadUiBundle by registering(Download::class) {

inputs.files(uiVersionFile)
outputs.files(uiBundleFile)

src(
listOf(
"https://github.com/digma-ai/digma-ui/releases/download/v$uiVersion/dist-jetbrains-v$uiVersion.zip"
)
)
dest(uiBundleFile)
retries(3)
}

val createUiBundleVersionFile by registering(Copy::class) {
from(uiVersionFile)
into(uiBundleDir)
}


processResources {
dependsOn(downloadComposeFile)
dependsOn(downloadComposeFile, downloadUiBundle, createUiBundleVersionFile)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.digma.intellij.plugin.auth.account.*;
import org.digma.intellij.plugin.common.*;
import org.digma.intellij.plugin.errorreporting.ErrorReporter;
import org.digma.intellij.plugin.updates.ui.UIVersioningService;
import org.jetbrains.annotations.*;

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

var backendVersionLabel = createBackendVersionLabel();

var uiVersionLabel = createUiVersionLabel();

var importExportPanel = createImportExportPanel();

var resetPluginButton = createResetPluginButton();
Expand All @@ -186,6 +189,7 @@ public boolean verify(JComponent input) {
.addComponent(resetToDefaultsButton)
.addLabeledComponent(new JBLabel("User id"), userIdLabel)
.addLabeledComponent(new JBLabel("Backend version"), backendVersionLabel)
.addLabeledComponent(new JBLabel("UI version"), uiVersionLabel)
.addComponent(importExportPanel)
.addComponent(resetPluginButton)
.addComponent(pluginResetWarning)
Expand Down Expand Up @@ -384,6 +388,11 @@ private static JBLabel createBackendVersionLabel() {
return backendVersionLabel;
}

@NotNull
private static JBLabel createUiVersionLabel() {
return new JBLabel(UIVersioningService.getInstance().getCurrentUiVersion()+" ("+UIVersioningService.getInstance().getCurrentUiBundlePath()+")");
}


private JPanel createImportExportPanel() {
//noinspection ExtractMethodRecommender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ public void initComponents(@NotNull ToolWindow toolWindow,

public void updateStateChanged(@NotNull PublicUpdateState updateState) {
if (updateState.getUpdateState() == CurrentUpdateState.OK) {
closeUpdateBackendPanel();
closeAggressiveUpdatePanel();
} else {
showUpdateBackendPanel();
showAggressiveUpdatePanel();
}
}

Expand Down Expand Up @@ -242,7 +242,7 @@ public void troubleshootingFinished() {
if (troubleshooting.isOn()) {
toolWindow.getContentManager().removeContent(troubleshooting.troubleshootingContent, true);
toolWindow.getContentManager().addContent(mainContent);
//dispose the wizard panel which will dispose the jcef browser
//dispose the troubleshooting panel which will dispose the jcef browser
troubleshooting.troubleshootingPanel.dispose();
troubleshooting.troubleshootingContent = null;
troubleshooting.troubleshootingPanel = null;
Expand Down Expand Up @@ -296,25 +296,25 @@ public void showMainPanel() {
}
}

private void showUpdateBackendPanel() {
private void showAggressiveUpdatePanel() {

Log.log(LOGGER::debug, "showUpdateBackendPanel called");
Log.log(LOGGER::debug, "showAggressiveUpdatePanel called");

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

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

private void closeUpdateBackendPanel() {
private void closeAggressiveUpdatePanel() {

Log.log(LOGGER::debug, "closeUpdateBackendPanel called");
Log.log(LOGGER::debug, "closeAggressiveUpdatePanel called");


//replace the card even if wizard is on. it will not show until wizard content is removed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ class RecentActivityToolWindowCardsController(private val project: Project) {

fun updateStateChanged(updateState: PublicUpdateState) {
if (updateState.updateState == CurrentUpdateState.OK) {
closeUpdateBackendPanel()
closeAggressiveUpdatePanel()
} else {
showUpdateBackendPanel()
showAggressiveUpdatePanel()
}
}

Expand All @@ -112,19 +112,19 @@ class RecentActivityToolWindowCardsController(private val project: Project) {
}
}

private fun showUpdateBackendPanel() {
Log.log(logger::debug, "showUpdateBackendPanel called")
private fun showAggressiveUpdatePanel() {
Log.log(logger::debug, "showAggressiveUpdatePanel called")

if (isConnectionLost.get()) {
Log.log(logger::debug, "Not showing MainPanel because connection lost, showing NoConnection")
Log.log(logger::debug, "Not showing AggressiveUpdatePanel because connection lost, showing NoConnection")
showNoConnection()
} else {
EDT.ensureEDT { showCard(RecentActivityWindowCard.UPDATE_MODE) }
}
}

private fun closeUpdateBackendPanel() {
Log.log(logger::debug, "closeUpdateBackendPanel called")
private fun closeAggressiveUpdatePanel() {
Log.log(logger::debug, "closeAggressiveUpdatePanel called")

//this may happen on startup,showMainPanel is called from the tool window factory,
// but there may be a connection lost before the content was built and before this controller was initialized
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package org.digma.intellij.plugin.common

import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.components.service
import org.digma.intellij.plugin.model.rest.version.VersionRequest
import org.digma.intellij.plugin.semanticversion.SemanticVersionUtil
import org.digma.intellij.plugin.updates.ui.UIVersioningService


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

fun getUiVersion(): String {
return service<UIVersioningService>().getUiVersionForVersionRequest()
}




fun buildVersionRequest(): VersionRequest {
return VersionRequest(
getPluginVersion(), getPlatformType(), getPlatformVersion()
getPluginVersion(), getPlatformType(), getPlatformVersion(), getUiVersion()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ class Downloader {
return
}

val outputStream = FileOutputStream(composeFile)
Log.log(logger::info, "unpacking {} to {}", COMPOSE_FILE_NAME, composeFile)
com.intellij.openapi.util.io.StreamUtil.copy(inputStream, outputStream)
FileOutputStream(composeFile).use {
Log.log(logger::info, "unpacking {} to {}", COMPOSE_FILE_NAME, composeFile)
com.intellij.openapi.util.io.StreamUtil.copy(inputStream, it)
}

}


Expand Down Expand Up @@ -103,6 +105,7 @@ class Downloader {
"download from $url",
mapOf("responseCode" to responseCode.toString())
)
throw RuntimeException("could not download file from $url")
} else {
connection.inputStream.use {
Files.copy(it, tempFile, StandardCopyOption.REPLACE_EXISTING)
Expand Down
Loading
Loading