From 1f947bb43e90b26a0e02a27f1abe19775c5d046d Mon Sep 17 00:00:00 2001 From: Hanxiao Liu Date: Fri, 29 May 2020 14:24:40 +0800 Subject: [PATCH 1/4] Fix can not switch to new create app service issue --- .../slimui/WebAppSlimSettingPanel.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java b/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java index 6367cc86c8..cf7d4fae94 100644 --- a/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java +++ b/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java @@ -271,17 +271,18 @@ public synchronized void fillWebApps(List> webAppLists) { lblCreateWebApp.setVisible(false); cbxWebApp.setVisible(true); cbxWebApp.addItem(CREATE_NEW_WEBAPP); - sortedWebAppLists.forEach(webAppResourceEx -> cbxWebApp.addItem(webAppResourceEx)); - // Find webapp which id equals to selected web app(when cancel creation) or configuration - // Use the first one as fallback - final String targetId = selectedWebApp == null ? webAppConfiguration.getWebAppId() : - selectedWebApp.getResource().id(); - final ResourceEx selectWebApp = sortedWebAppLists - .stream() - .filter(webAppResourceEx -> StringUtils.equals(webAppResourceEx.getResource().id(), targetId)) - .findFirst() - .orElse(sortedWebAppLists.get(0)); - cbxWebApp.setSelectedItem(selectWebApp); + String targetId = webAppConfiguration.getWebAppId(); + if (StringUtils.isEmpty(targetId) && selectedWebApp != null) { + // Use when user cancel create app service + targetId = selectedWebApp.getResource().id(); + } + for (int i = 0; i < sortedWebAppLists.size(); i++) { + final ResourceEx webAppResourceEx = sortedWebAppLists.get(i); + cbxWebApp.addItem(webAppResourceEx); + if (i == 0 || StringUtils.equals(webAppResourceEx.getResource().id(), targetId)) { + cbxWebApp.setSelectedItem(webAppResourceEx); + } + } } selectWebApp(); cbxWebApp.setEnabled(true); From 61ce4d66135a0bcee4f5c57c47d93937bfbb7f8f Mon Sep 17 00:00:00 2001 From: Hanxiao Liu Date: Fri, 29 May 2020 14:24:52 +0800 Subject: [PATCH 2/4] Fix run docker issue --- PluginsAndFeatures/azure-toolkit-for-intellij/build.gradle | 1 - .../runner/container/dockerhost/DockerHostRunState.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/PluginsAndFeatures/azure-toolkit-for-intellij/build.gradle b/PluginsAndFeatures/azure-toolkit-for-intellij/build.gradle index 3aff4dba86..7805567472 100644 --- a/PluginsAndFeatures/azure-toolkit-for-intellij/build.gradle +++ b/PluginsAndFeatures/azure-toolkit-for-intellij/build.gradle @@ -113,7 +113,6 @@ dependencies { } compile 'com.microsoft.azure:azure-tools-common:0.2.0' compile group: 'com.microsoft.azure.appplatform.v2019_05_01_preview', name: 'azure-mgmt-appplatform', version: '1.0.0-beta-2' - compile 'com.spotify:docker-client:8.16.0' compile group: 'org.dom4j', name: 'dom4j', version: '2.1.3' compile group: 'jaxen', name: 'jaxen', version: '1.2.0' diff --git a/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/container/dockerhost/DockerHostRunState.java b/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/container/dockerhost/DockerHostRunState.java index 4e9a70fbe5..4159d64ac6 100644 --- a/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/container/dockerhost/DockerHostRunState.java +++ b/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/container/dockerhost/DockerHostRunState.java @@ -25,7 +25,6 @@ import static com.microsoft.azuretools.telemetry.TelemetryConstants.DEPLOY_WEBAPP_DOCKERLOCAL; import static com.microsoft.azuretools.telemetry.TelemetryConstants.WEBAPP; -import com.google.common.collect.ImmutableList; import com.intellij.execution.process.ProcessEvent; import com.intellij.execution.process.ProcessListener; import com.intellij.execution.process.ProcessOutputTypes; @@ -43,6 +42,7 @@ import com.spotify.docker.client.DockerClient; import com.spotify.docker.client.messages.Container; +import com.spotify.docker.client.shaded.com.google.common.collect.ImmutableList; import org.jetbrains.annotations.NotNull; import java.io.FileNotFoundException; From 27a6ba6f2a11eabfba8e2f120a295457cd5e0cda Mon Sep 17 00:00:00 2001 From: Hanxiao Liu Date: Fri, 29 May 2020 15:51:37 +0800 Subject: [PATCH 3/4] Resolve comments --- .../slimui/WebAppSlimSettingPanel.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java b/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java index cf7d4fae94..b6ce6ccc9a 100644 --- a/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java +++ b/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java @@ -271,18 +271,15 @@ public synchronized void fillWebApps(List> webAppLists) { lblCreateWebApp.setVisible(false); cbxWebApp.setVisible(true); cbxWebApp.addItem(CREATE_NEW_WEBAPP); - String targetId = webAppConfiguration.getWebAppId(); - if (StringUtils.isEmpty(targetId) && selectedWebApp != null) { - // Use when user cancel create app service - targetId = selectedWebApp.getResource().id(); - } - for (int i = 0; i < sortedWebAppLists.size(); i++) { - final ResourceEx webAppResourceEx = sortedWebAppLists.get(i); - cbxWebApp.addItem(webAppResourceEx); - if (i == 0 || StringUtils.equals(webAppResourceEx.getResource().id(), targetId)) { - cbxWebApp.setSelectedItem(webAppResourceEx); - } - } + final String configurationWebAppId = webAppConfiguration.getWebAppId(); + final String targetId = (StringUtils.isEmpty(configurationWebAppId) && selectedWebApp != null) ? + selectedWebApp.getResource().id() : configurationWebAppId; + final ResourceEx selectWebApp = sortedWebAppLists + .stream() + .filter(webAppResourceEx -> StringUtils.equals(webAppResourceEx.getResource().id(), targetId)) + .findFirst() + .orElse(sortedWebAppLists.get(0)); + cbxWebApp.setSelectedItem(selectWebApp); } selectWebApp(); cbxWebApp.setEnabled(true); From 04db2f1c0bb85b15fffd6ce74914ef5ae965df27 Mon Sep 17 00:00:00 2001 From: Hanxiao Liu Date: Fri, 29 May 2020 15:56:09 +0800 Subject: [PATCH 4/4] Add missing codes --- .../webapp/webappconfig/slimui/WebAppSlimSettingPanel.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java b/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java index b6ce6ccc9a..da8f3d093d 100644 --- a/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java +++ b/PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/WebAppSlimSettingPanel.java @@ -271,9 +271,11 @@ public synchronized void fillWebApps(List> webAppLists) { lblCreateWebApp.setVisible(false); cbxWebApp.setVisible(true); cbxWebApp.addItem(CREATE_NEW_WEBAPP); + // Need calculated target id first or fill combo box will trigger event to change selectedWebApp final String configurationWebAppId = webAppConfiguration.getWebAppId(); final String targetId = (StringUtils.isEmpty(configurationWebAppId) && selectedWebApp != null) ? selectedWebApp.getResource().id() : configurationWebAppId; + sortedWebAppLists.forEach(webAppResourceEx -> cbxWebApp.addItem(webAppResourceEx)); final ResourceEx selectWebApp = sortedWebAppLists .stream() .filter(webAppResourceEx -> StringUtils.equals(webAppResourceEx.getResource().id(), targetId))