forked from microsoft/azure-tools-for-java
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #998 from JetBrains/rival/fix-combo-box-renderer
Fix AppService combobox renderer
- Loading branch information
Showing
17 changed files
with
125 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,10 @@ | |
|
||
## [Unreleased] | ||
|
||
### Fixed | ||
|
||
- AppService ComboBox render logic | ||
|
||
## [4.3.8] - 2024-12-17 | ||
|
||
### Fixed | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 0 additions & 18 deletions
18
...e-dotnet/src/main/kotlin/com/microsoft/azure/toolkit/intellij/appservice/DotNetRuntime.kt
This file was deleted.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
.../microsoft/azure/toolkit/intellij/appservice/components/AppServiceComboBoxDotNetRender.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* | ||
* Copyright 2018-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the MIT license. | ||
*/ | ||
|
||
package com.microsoft.azure.toolkit.intellij.appservice.components | ||
|
||
import com.intellij.ui.SimpleListCellRenderer | ||
import com.microsoft.azure.toolkit.lib.Azure | ||
import com.microsoft.azure.toolkit.lib.appservice.AppServiceAppBase | ||
import com.microsoft.azure.toolkit.lib.appservice.AppServiceResourceModule | ||
import com.microsoft.azure.toolkit.lib.appservice.AppServiceServiceSubscription | ||
import com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig | ||
import com.microsoft.azure.toolkit.lib.appservice.config.FunctionAppConfig | ||
import com.microsoft.azure.toolkit.lib.appservice.function.AzureFunctions | ||
import com.microsoft.azure.toolkit.lib.appservice.webapp.AzureWebApp | ||
import com.microsoft.azure.toolkit.lib.auth.AzureAccount | ||
import javax.swing.JList | ||
|
||
class AppServiceComboBoxDotNetRender : SimpleListCellRenderer<AppServiceConfig>() { | ||
override fun customize( | ||
list: JList<out AppServiceConfig>, | ||
config: AppServiceConfig?, | ||
index: Int, | ||
isSelected: Boolean, | ||
cellHasFocus: Boolean | ||
) { | ||
if (config == null) return | ||
|
||
text = if (index >= 0) { | ||
getAppServiceLabel(config) | ||
} else { | ||
config.appName | ||
} | ||
accessibleContext?.accessibleDescription = config.appName | ||
} | ||
|
||
private fun getAppServiceLabel(config: AppServiceConfig): String { | ||
val module = getModule(config) | ||
val isDraft = module?.exists(config.appName, config.resourceGroup) == false | ||
val appName = config.appName | ||
val resourceGroup = config.resourceGroup | ||
val app = module?.get(config.appName, config.resourceGroup) | ||
val linuxFxVersion = app?.linuxFxVersion | ||
val os = config.runtime?.os ?: "unknown" | ||
|
||
return buildString { | ||
append("<html><div>") | ||
if (isDraft) { | ||
append("(New) ") | ||
} | ||
append(appName) | ||
append("</div>") | ||
append("<small>") | ||
append("OS: ") | ||
append(os) | ||
if (!linuxFxVersion.isNullOrEmpty()) { | ||
append(" | Runtime: ") | ||
append(linuxFxVersion) | ||
} | ||
if (!resourceGroup.isNullOrEmpty()) { | ||
append(" | Resource Group: ") | ||
append(resourceGroup) | ||
} | ||
append("</small></html>") | ||
} | ||
} | ||
|
||
private fun getModule(config: AppServiceConfig): AppServiceResourceModule<out AppServiceAppBase<*, AppServiceServiceSubscription?, *>?, AppServiceServiceSubscription?, *>? { | ||
if (config.subscriptionId.isNullOrEmpty() || !Azure.az(AzureAccount::class.java).isLoggedIn) { | ||
return null | ||
} | ||
|
||
return if (config is FunctionAppConfig) Azure.az(AzureFunctions::class.java).functionApps(config.subscriptionId) | ||
else Azure.az(AzureWebApp::class.java).webApps(config.subscriptionId) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ntellij/appservice/DotNetRuntimeConfig.kt → ...vice/dotnetRuntime/DotNetRuntimeConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters