Skip to content

Commit 1d32087

Browse files
committed
Merge branch 'release' into release.next
2 parents 4747f4e + ddb501b commit 1d32087

File tree

8 files changed

+79
-57
lines changed

8 files changed

+79
-57
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/resources/META-INF/plugin.xml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<idea-plugin url="https://github.com/Microsoft/azure-tools-for-java">
22
<id>com.microsoft.tooling.msservices.intellij.azure</id>
33
<name>Azure Toolkit for IntelliJ</name>
4-
<version>3.50.0</version>
4+
<version>3.50.1</version>
55
<vendor email="[email protected]" url="http://www.microsoft.com">Microsoft</vendor>
66

77
<description><![CDATA[
@@ -24,16 +24,13 @@
2424
<change-notes>
2525
<![CDATA[
2626
<html>
27-
<h3>3.50.0</h3>
28-
<h4>Added</h4>
27+
<h3>3.50.1</h3>
28+
<h4>Fixes</h4>
2929
<ul>
30-
<li>Development workflow for Azure Database for MySQL
31-
<ul>
32-
<li>Connect Azure Database for MySQL Server to local project from Azure Explorer or application.properties file</li>
33-
<li>Automatically inject datasource connection properties into runtime environment for local run</li>
34-
<li>Publish Azure Web App with datasource connection properties in application settings</li>
35-
</ul>
36-
</li>
30+
<li>Fixes: Can't deploy to Azure Web App when there is "Connect Azure Resource" in before launch</li>
31+
<li>Fixes: InvalidParameterException occurs when close a streaming log</li>
32+
<li>Fixes: Failed when select file to deploy to Azure Web App</li>
33+
<li>Fixes: Failed to create MySQL instance as resource provider is not registered</li>
3734
</ul>
3835
<p>You may get the full change log <a
3936
href="https://github.com/Microsoft/azure-tools-for-java/blob/develop/CHANGELOG.md">here</a></p>

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/link/LinkMySQLToModuleDialog.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
import com.microsoft.azure.toolkit.intellij.link.mysql.JdbcUrl;
1515
import com.microsoft.azure.toolkit.intellij.link.mysql.MySQLResourceConfig;
1616
import com.microsoft.azure.toolkit.intellij.link.po.MySQLResourcePO;
17+
import com.microsoft.azure.toolkit.intellij.mysql.action.LinkMySQLAction;
1718
import com.microsoft.azure.toolkit.lib.common.form.AzureForm;
19+
import com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle;
20+
import com.microsoft.azure.toolkit.lib.common.operation.IAzureOperationTitle;
1821
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
1922
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
2023
import com.microsoft.azure.toolkit.lib.link.AzureLinkService;
@@ -30,7 +33,7 @@
3033
public class LinkMySQLToModuleDialog extends AzureDialog<LinkConfig<MySQLResourceConfig, ModuleResourceConfig>> {
3134

3235
private static final String PROMPT_TITLE = "Azure Explorer";
33-
private static final String[] PROMPT_OPTIONS = new String[] {"Yes", "No"};
36+
private static final String[] PROMPT_OPTIONS = new String[]{"Yes", "No"};
3437
private static final String PROMPT_MESSAGE = "This resource already existed in your local environment. Do you want to override it?";
3538
private JPanel rootPanel;
3639
private BasicLinkMySQLPanel basicPanel;
@@ -87,8 +90,8 @@ private void doLink(LinkConfig<MySQLResourceConfig, ModuleResourceConfig> linkCo
8790
boolean storageResource = true;
8891
if (Objects.nonNull(existedResourcePO)) {
8992
if (!StringUtils.equals(resourceConfig.getUrl(), existedResourcePO.getUrl()) ||
90-
!StringUtils.equals(resourceConfig.getUsername(), existedResourcePO.getUsername()) ||
91-
resourceConfig.getPasswordConfig().getPasswordSaveType() != existedResourcePO.getPasswordSave()) {
93+
!StringUtils.equals(resourceConfig.getUsername(), existedResourcePO.getUsername()) ||
94+
resourceConfig.getPasswordConfig().getPasswordSaveType() != existedResourcePO.getPasswordSave()) {
9295
storageResource = DefaultLoader.getUIHelper().showConfirmation(PROMPT_MESSAGE, PROMPT_TITLE, PROMPT_OPTIONS, null);
9396
}
9497
}
@@ -98,9 +101,12 @@ private void doLink(LinkConfig<MySQLResourceConfig, ModuleResourceConfig> linkCo
98101
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
99102
indicator.setIndeterminate(true);
100103
AzureLinkService.getInstance().link(project, linkConfig, finalStorageResource);
104+
final String message = String.format("The connection between database %s and project %s has been successfully created.",
105+
resourceConfig.getDatabase().name(), project.getName());
106+
DefaultLoader.getUIHelper().showInfoNotification(LinkMySQLAction.ACTION_NAME, message);
101107
};
102-
String progressMessage = "Connecting Azure Database for MySQL with Module...";
103-
final AzureTask task = new AzureTask(null, progressMessage, false, runnable);
108+
final IAzureOperationTitle title = AzureOperationBundle.title("azure-mysql.azure-mysql-link-to-module");
109+
final AzureTask task = new AzureTask(null, title, false, runnable);
104110
AzureTaskManager.getInstance().runInBackground(task);
105111
}
106112

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/mysql/action/MySQLConnectToServerAction.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.intellij.openapi.extensions.PluginId;
1010
import com.intellij.openapi.project.Project;
1111
import com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitRuntimeException;
12+
import com.microsoft.azuretools.ActionConstants;
1213
import com.microsoft.azuretools.authmanage.AuthMethodManager;
1314
import com.microsoft.intellij.actions.AzureSignInAction;
1415
import com.microsoft.intellij.AzurePlugin;
@@ -61,6 +62,16 @@ public void actionPerformed(NodeActionEvent e) {
6162
});
6263
}
6364

65+
@Override
66+
protected String getServiceName(NodeActionEvent event) {
67+
return ActionConstants.parse(ActionConstants.MySQL.CONNECT_TO_SERVER).getServiceName();
68+
}
69+
70+
@Override
71+
protected String getOperationName(NodeActionEvent event) {
72+
return ActionConstants.parse(ActionConstants.MySQL.CONNECT_TO_SERVER).getOperationName();
73+
}
74+
6475
private void doActionPerformed(NodeActionEvent e, boolean isLoggedIn, Project project) {
6576
try {
6677
if (!isLoggedIn ||

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/lib/mysql/AzureMySQLService.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
import com.microsoft.azuretools.ActionConstants;
1515
import com.microsoft.azuretools.authmanage.AuthMethodManager;
1616
import com.microsoft.azuretools.core.mvp.model.mysql.MySQLMvpModel;
17-
import com.microsoft.azuretools.telemetrywrapper.Operation;
18-
import com.microsoft.azuretools.telemetrywrapper.TelemetryManager;
17+
import com.microsoft.azuretools.telemetry.TelemetryConstants;
18+
import com.microsoft.azuretools.telemetrywrapper.*;
19+
20+
import java.util.Collections;
21+
import java.util.Map;
1922

2023
public class AzureMySQLService {
2124
private static final AzureMySQLService instance = new AzureMySQLService();
@@ -36,10 +39,11 @@ public Server createMySQL(final AzureMySQLConfig config) {
3639
final Operation operation = TelemetryManager.createOperation(ActionConstants.MySQL.CREATE);
3740
try {
3841
operation.start();
39-
String subscrptionId = config.getSubscription().subscriptionId();
42+
final String subscriptionId = config.getSubscription().subscriptionId();
43+
EventUtil.logEvent(EventType.info, operation, Collections.singletonMap(TelemetryConstants.SUBSCRIPTIONID, subscriptionId));
4044
// create resource group if necessary.
4145
if (config.getResourceGroup() instanceof Draft) {
42-
Azure azure = AuthMethodManager.getInstance().getAzureClient(subscrptionId);
46+
Azure azure = AuthMethodManager.getInstance().getAzureClient(subscriptionId);
4347
ResourceGroup newResourceGroup = azure.resourceGroups().define(config.getResourceGroup().name()).withRegion(config.getRegion()).create();
4448
config.setResourceGroup(newResourceGroup);
4549
}
@@ -48,13 +52,14 @@ public Server createMySQL(final AzureMySQLConfig config) {
4852
parameters.withAdministratorLogin(config.getAdminUsername())
4953
.withAdministratorLoginPassword(String.valueOf(config.getPassword()))
5054
.withVersion(config.getVersion());
51-
Server server = MySQLMvpModel.create(subscrptionId, config.getResourceGroup().name(), config.getServerName(), config.getRegion(), parameters);
55+
Server server = MySQLMvpModel.create(subscriptionId, config.getResourceGroup().name(), config.getServerName(), config.getRegion(), parameters);
5256
// update access from azure services
53-
MySQLMvpModel.FirewallRuleMvpModel.updateAllowAccessFromAzureServices(subscrptionId, server, config.isAllowAccessFromAzureServices());
57+
MySQLMvpModel.FirewallRuleMvpModel.updateAllowAccessFromAzureServices(subscriptionId, server, config.isAllowAccessFromAzureServices());
5458
// update access from local machine
55-
MySQLMvpModel.FirewallRuleMvpModel.updateAllowAccessToLocalMachine(subscrptionId, server, config.isAllowAccessFromLocalMachine());
59+
MySQLMvpModel.FirewallRuleMvpModel.updateAllowAccessToLocalMachine(subscriptionId, server, config.isAllowAccessFromLocalMachine());
5660
return server;
5761
} catch (final RuntimeException e) {
62+
EventUtil.logError(operation, ErrorType.systemError, e, null, null);
5863
throw e;
5964
} finally {
6065
operation.complete();

Utils/azure-explorer-common/src/com/microsoft/tooling/msservices/serviceexplorer/BasicActionBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ protected void actionPerformed(NodeActionEvent e) {
116116
runnable.run();
117117
}
118118
};
119+
// TODO (Qianjin) : remove after migrate all telemetry data by @AzureOperation annotation.
120+
final String actionName2 = Optional.ofNullable(action).map(AzureActionEnum::getName).orElse(null);
121+
String realActionName = StringUtils.firstNonBlank(actionName, actionName2, "unknown").toLowerCase();
122+
delegate = new DelegateActionListener.TelemetricActionListener(delegate, MODULE_NAME_TO_SERVICE_NAME_MAP.get(moduleName), realActionName);
119123
if (backgroundable) {
120124
delegate = new DelegateActionListener.BackgroundActionListener(delegate,
121125
getProgressMessage(doingName), backgroundCancellable, backgroundConditionalModal);
122126
}
123127
if (promptable) {
124128
delegate = new DelegateActionListener.PromptActionListener(delegate, getPromptMessage(actionName));
125129
}
126-
// TODO (Qianjin) : remove after migrate all telemetry data by @AzureOperation annotation.
127-
final String actionName2 = Optional.ofNullable(action).map(AzureActionEnum::getName).orElse(null);
128-
String realActionName = StringUtils.firstNonBlank(actionName, actionName2, "unknown").toLowerCase();
129-
delegate = new DelegateActionListener.TelemetricActionListener(delegate, MODULE_NAME_TO_SERVICE_NAME_MAP.get(moduleName), realActionName);
130130
return delegate;
131131
}
132132

Utils/azure-explorer-common/src/com/microsoft/tooling/msservices/serviceexplorer/DelegateActionListener.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
package com.microsoft.tooling.msservices.serviceexplorer;
77

88
import com.google.common.base.Preconditions;
9+
import com.microsoft.azure.toolkit.lib.common.operation.IAzureOperationTitle;
910
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
1011
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
1112
import com.microsoft.azuretools.ActionConstants;
@@ -76,7 +77,13 @@ public void actionPerformed(NodeActionEvent e) {
7677
}
7778
};
7879
final Object project = e.getAction().getNode().getProject();
79-
AzureTask task = new AzureTask(project, progressMessage, cancellable, runnable);
80+
// todo: Add titles properties for services in common library
81+
AzureTask task = new AzureTask(project, new IAzureOperationTitle.Simple(progressMessage) {
82+
@Override
83+
public String getName() {
84+
return String.format("%s.%s", BackgroundActionListener.super.getServiceName(e), BackgroundActionListener.super.getOperationName(e));
85+
}
86+
}, cancellable, runnable);
8087
if (conditionalModal) {
8188
AzureTaskManager.getInstance().runInModal(task);
8289
} else {
@@ -88,7 +95,7 @@ public void actionPerformed(NodeActionEvent e) {
8895

8996
static final class PromptActionListener extends DelegateActionListener {
9097
private static final String PROMPT_TITLE = "Azure Explorer";
91-
private static final String[] PROMPT_OPTIONS = new String[] {"Yes", "No"};
98+
private static final String[] PROMPT_OPTIONS = new String[]{"Yes", "No"};
9299

93100
private String promptMessage;
94101

Utils/azure-explorer-common/src/com/microsoft/tooling/msservices/serviceexplorer/azure/mysql/MySQLNode.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
import com.microsoft.azuretools.ActionConstants;
1212
import com.microsoft.azuretools.azurecommons.helpers.Nullable;
1313
import com.microsoft.azuretools.core.mvp.model.mysql.MySQLMvpModel;
14+
import com.microsoft.azuretools.telemetry.TelemetryConstants;
15+
import com.microsoft.azuretools.telemetry.TelemetryProperties;
1416
import com.microsoft.tooling.msservices.components.DefaultLoader;
1517
import com.microsoft.tooling.msservices.serviceexplorer.AzureActionEnum;
1618
import com.microsoft.tooling.msservices.serviceexplorer.AzureIconSymbol;
@@ -22,9 +24,11 @@
2224
import com.microsoft.tooling.msservices.serviceexplorer.Sortable;
2325
import lombok.Getter;
2426

27+
import java.util.Collections;
2528
import java.util.List;
29+
import java.util.Map;
2630

27-
public class MySQLNode extends Node {
31+
public class MySQLNode extends Node implements TelemetryProperties {
2832

2933
private static final ServerState SERVER_UPDATING = ServerState.fromString("Updating");
3034

@@ -123,4 +127,8 @@ private void showProperties() {
123127
DefaultLoader.getUIHelper().openMySQLPropertyView(MySQLNode.this);
124128
}
125129

130+
@Override
131+
public Map<String, String> toProperties() {
132+
return Collections.singletonMap(TelemetryConstants.SUBSCRIPTIONID, this.subscriptionId);
133+
}
126134
}

Utils/azuretools-core/src/com/microsoft/azuretools/utils/AzureRegisterProviderNamespaces.java

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,36 +6,24 @@
66
package com.microsoft.azuretools.utils;
77

88
import com.microsoft.azure.management.Azure;
9-
import rx.Observable;
10-
import rx.schedulers.Schedulers;
9+
import org.apache.commons.lang3.StringUtils;
1110

12-
import java.util.concurrent.Callable;
11+
import java.util.Arrays;
1312

1413
public class AzureRegisterProviderNamespaces {
15-
public static void registerAzureNamespaces(Azure azureInstance) {
16-
String[] namespaces = new String[] {"Microsoft.Resources", "Microsoft.Network", "Microsoft.Compute",
17-
"Microsoft.KeyVault", "Microsoft.Storage", "Microsoft.Web", "Microsoft.Authorization", "Microsoft.HDInsight"};
18-
try {
19-
Observable.from(namespaces).flatMap(namespace -> {
20-
return Observable.fromCallable(new Callable<Object>() {
21-
@Override
22-
public Object call() throws Exception {
23-
azureInstance.providers().register(namespace);
24-
return null;
25-
}
26-
}).subscribeOn(Schedulers.io());
27-
}).toBlocking().subscribe();
28-
// azureInstance.providers().register("Microsoft.Resources");
29-
// azureInstance.providers().register("Microsoft.Network");
30-
// azureInstance.providers().register("Microsoft.Compute");
31-
// azureInstance.providers().register("Microsoft.KeyVault");
32-
// azureInstance.providers().register("Microsoft.Storage");
33-
// azureInstance.providers().register("Microsoft.Web");
34-
// azureInstance.providers().register("Microsoft.Authorization");
35-
// azureInstance.providers().register("Microsoft.HDInsight");
36-
} catch (Exception ignored) {
37-
// No need to handle this for now since this functionality will be eventually removed once the Azure SDK
38-
// something similar
14+
private static final String[] namespaces = new String[]{"Microsoft.Resources", "Microsoft.Network", "Microsoft.Compute", "Microsoft.KeyVault",
15+
"Microsoft.Storage", "Microsoft.Web", "Microsoft.Authorization", "Microsoft.HDInsight", "Microsoft.DBforMySQL"};
16+
17+
public static void registerAzureNamespaces(Azure azureInstance) {
18+
19+
try {
20+
Arrays.stream(namespaces).parallel()
21+
.map(azureInstance.providers()::getByName)
22+
.filter(provider -> !StringUtils.equalsIgnoreCase("Registered", provider.registrationState()))
23+
.forEach(provider -> azureInstance.providers().register(provider.namespace()));
24+
} catch (Exception ignored) {
25+
// No need to handle this for now since this functionality will be eventually removed once the Azure SDK
26+
// something similar
27+
}
3928
}
40-
}
4129
}

0 commit comments

Comments
 (0)