Skip to content

Commit 6eaf1b6

Browse files
authored
Merge pull request #4848 from microsoft/release
Release
2 parents b70e93e + 4179bcc commit 6eaf1b6

File tree

11 files changed

+111
-78
lines changed

11 files changed

+111
-78
lines changed

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ All notable changes to "Azure Toolkit for IntelliJ IDEA" will be documented in t
6565
## 3.47.0
6666

6767
### Added
68-
- Add Azure MySQL support in Azure Toolkits
69-
- Manage Azure MySQL instance (create/start/stop/restart/configure/show properties)
70-
- Configure Azure MySQL to allow access it from azure services and local PC
71-
- Show sample of JDBC connection strings on MySQL
72-
- Open and connect to MySQL server by Intellij database tools
68+
- Add Azure Database for MySQL support in Azure Toolkits
69+
- Manage Azure Database for MySQL instance (create/start/stop/restart/configure/show properties)
70+
- Configure Azure Database for MySQL to allow access it from azure services and local PC
71+
- Show sample of JDBC connection strings on Azure Database for MySQL
72+
- Open and connect to Azure Database for MySQL server by Intellij database tools
7373
- Add Stacktrace filter in Spark console
7474
- Enable speed search in subscription table
7575
- Enable speed search in Azure explorer tree

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
<ul>
3030
<li>Add Azure MySQL support in Azure Toolkits
3131
<ul>
32-
<li>Manage Azure MySQL instance (create/start/stop/restart/configure/show properties)</li>
33-
<li>Configure Azure MySQL to allow access it from azure services and local PC</li>
34-
<li>Show sample of JDBC connection strings on MySQL</li>
35-
<li>Open and connect to MySQL server by Intellij database tools</li>
32+
<li>Manage Azure Database for MySQL instance (create/start/stop/restart/configure/show properties)</li>
33+
<li>Configure Azure Database for MySQL to allow access it from azure services and local PC</li>
34+
<li>Show sample of JDBC connection strings on Azure Database for MySQL</li>
35+
<li>Open and connect to Azure Database for MySQL server by Intellij database tools</li>
3636
</ul>
3737
</li>
3838
<li>Add Stacktrace filter in Spark console</li>

PluginsAndFeatures/azure-toolkit-for-intellij/resources/whatsnew/whatsnew.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
## 3.47.0
55

66
### Added
7-
- Add Azure MySQL support in Azure Toolkits
8-
- Manage Azure MySQL instance (create/start/stop/restart/configure/show properties)
9-
- Configure Azure MySQL to allow access it from azure services and local PC
10-
- Show sample of JDBC connection strings on MySQL
11-
- Open and connect to MySQL server by Intellij database tools
7+
<img src="https://user-images.githubusercontent.com/19339116/102885897-15b30d00-448f-11eb-9733-ecbf77ee9760.gif" width="840" height="525" />
8+
9+
- Add Azure Database for MySQL support in Azure Toolkits
10+
- Manage Azure Database for MySQL instance (create/start/stop/restart/configure/show properties)
11+
- Configure Azure Database for MySQL to allow access it from azure services and local PC
12+
- Show sample of JDBC connection strings on Azure Database for MySQL
13+
- Open and connect to Azure Database for MySQL server by Intellij database tools
1214
- Add Stacktrace filter in Spark console
1315
- Enable speed search in subscription table
1416
- Enable speed search in Azure explorer tree

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/common/handler/IntelliJAzureExceptionHandler.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
import com.intellij.openapi.actionSystem.AnActionEvent;
3030
import com.intellij.openapi.application.ApplicationManager;
3131
import com.intellij.openapi.application.ModalityState;
32+
import com.intellij.openapi.progress.ProgressIndicator;
33+
import com.intellij.openapi.progress.ProgressManager;
3234
import com.intellij.openapi.project.Project;
3335
import com.intellij.util.ui.UIUtil;
3436
import com.microsoft.azure.toolkit.intellij.common.AzureToolkitErrorDialog;
@@ -46,10 +48,8 @@
4648
import org.apache.commons.lang3.StringUtils;
4749

4850
import java.awt.*;
49-
import java.util.HashMap;
5051
import java.util.List;
51-
import java.util.ListIterator;
52-
import java.util.Map;
52+
import java.util.*;
5353
import java.util.stream.Collectors;
5454
import java.util.stream.Stream;
5555

@@ -70,8 +70,9 @@ public void handleException(Project object, Throwable throwable, boolean isBackG
7070

7171
@Override
7272
protected void onHandleException(final Throwable throwable, final @Nullable AzureExceptionAction[] actions) {
73-
// todo: detect foreground/background from call stack
74-
onHandleException(throwable, false, actions);
73+
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
74+
final boolean background = Objects.isNull(indicator) || !indicator.isModal();
75+
onHandleException(throwable, background, actions);
7576
}
7677

7778
@Override

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/mysql/creation/PasswordUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ private static AzureValidationInfo validatePassword(String password, String user
9292
// validate longest common subsequence between username and password.
9393
LongestCommonSubsequence algorithm = new LongestCommonSubsequence();
9494
int longestCommonSubsequenceLength = algorithm.apply(username, password);
95-
if (longestCommonSubsequenceLength >= LONGEST_COMMON_SUBSEQUENCE_BETWEEN_NAME_AND_PASSWORD) {
95+
int usernameLength = StringUtils.length(username);
96+
if ((usernameLength > 0 && longestCommonSubsequenceLength == usernameLength)
97+
|| longestCommonSubsequenceLength >= LONGEST_COMMON_SUBSEQUENCE_BETWEEN_NAME_AND_PASSWORD) {
9698
final AzureValidationInfo.AzureValidationInfoBuilder builder = AzureValidationInfo.builder();
9799
return builder.input(input).message("Your password cannot contain all or part of the login name." +
98100
" Part of a login name is defined as three or more consecutive alphanumeric characters.")

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/forms/CreateRedisCacheForm.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
import java.awt.event.MouseAdapter;
6262
import java.awt.event.MouseEvent;
6363
import java.io.IOException;
64+
import java.util.Arrays;
6465
import java.util.Comparator;
6566
import java.util.LinkedHashMap;
6667
import java.util.List;
@@ -87,6 +88,7 @@ public class CreateRedisCacheForm extends AzureDialogWrapper {
8788
private JTextField txtNewResGrp;
8889
private JRadioButton rdoUseExist;
8990
private JComboBox<String> cbUseExist;
91+
// TODO(qianjin) : use AzureComboBox
9092
private JComboBox<Location> cbLocations;
9193
private JComboBox<String> cbPricing;
9294
private JCheckBox chkNoSSL;
@@ -122,6 +124,11 @@ public class CreateRedisCacheForm extends AzureDialogWrapper {
122124
private static final String NEW_RES_GRP_ERROR_FORMAT = "The resource group: %s is already existed.";
123125
private static final String RES_GRP_NAME_RULE = "Resource group name can only allows up to 90 characters, include"
124126
+ " alphanumeric characters, periods, underscores, hyphens and parenthesis and cannot end in a period.";
127+
private static final List<String> SUPPORTED_REGIONS = Arrays.asList("centralus", "eastasia", "southeastasia", "eastus", "eastus2", "westus",
128+
"westus2", "northcentralus", "southcentralus", "westcentralus", "northeurope", "westeurope", "japaneast", "japanwest", "brazilsouth",
129+
"australiasoutheast", "australiaeast", "westindia", "southindia", "centralindia", "canadacentral", "canadaeast", "uksouth", "ukwest",
130+
"koreacentral", "koreasouth", "francecentral", "southafricanorth", "uaenorth", "australiacentral", "switzerlandnorth", "germanywestcentral",
131+
"norwayeast", "australiacentral2", "eastus2euap", "centraluseuap");
125132

126133
public CreateRedisCacheForm(Project project) throws IOException {
127134
super(project, true);
@@ -398,7 +405,8 @@ public void customize(JList list, Object o, int i, boolean b, boolean b1) {
398405
private void fillLocationsAndResourceGrps(SubscriptionDetail selectedSub) {
399406
List<Location> locations = AzureModel.getInstance().getSubscriptionToLocationMap().get(selectedSub);
400407
if (locations != null) {
401-
List<Location> sortedLocations = locations.stream().sorted(Comparator.comparing(Location::displayName)).collect(Collectors.toList());
408+
List<Location> sortedLocations = locations.stream().filter(e -> SUPPORTED_REGIONS.contains(e.name()))
409+
.sorted(Comparator.comparing(Location::displayName)).collect(Collectors.toList());
402410
cbLocations.setModel(new DefaultComboBoxModel(sortedLocations.toArray()));
403411
}
404412
List<ResourceGroup> groups = AzureModel.getInstance().getSubscriptionToResourceGroupMap().get(selectedSub);

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,8 @@ public FunctionModule(Node parent) {
5252
@Override
5353
@AzureOperation(value = "remove function app", type = AzureOperation.Type.ACTION)
5454
public void removeNode(String sid, String id, Node node) {
55-
try {
56-
functionModulePresenter.onDeleteFunctionApp(sid, id);
57-
removeDirectChildNode(node);
58-
} finally {
59-
functionModulePresenter.onModuleRefresh();
60-
}
55+
functionModulePresenter.onDeleteFunctionApp(sid, id);
56+
removeDirectChildNode(node);
6157
}
6258

6359
@Override

Utils/azuretools-core/src/com/microsoft/azure/toolkit/lib/common/handler/AzureExceptionHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@
2222
package com.microsoft.azure.toolkit.lib.common.handler;
2323

2424
import com.microsoft.azuretools.azurecommons.helpers.Nullable;
25+
import lombok.extern.java.Log;
2526
import org.apache.commons.lang3.exception.ExceptionUtils;
2627

2728
import java.io.InterruptedIOException;
29+
import java.util.logging.Level;
2830

31+
@Log
2932
public abstract class AzureExceptionHandler {
3033
private static AzureExceptionHandler handler;
3134

@@ -53,11 +56,13 @@ public static void onRxException(final Throwable e) {
5356
}
5457

5558
public void handleException(Throwable throwable, @Nullable AzureExceptionAction... action) {
59+
log.log(Level.WARNING, "caught an error in AzureExceptionHandler", throwable);
5660
onHandleException(throwable, action);
5761
}
5862

5963
public void handleException(Throwable throwable, boolean isBackGround, @Nullable AzureExceptionAction... action) {
60-
onHandleException(throwable, isBackGround, action);
64+
log.log(Level.WARNING, "caught an error in AzureExceptionHandler", throwable);
65+
this.onHandleException(throwable, isBackGround, action);
6166
}
6267

6368
protected abstract void onHandleException(Throwable throwable, @Nullable AzureExceptionAction[] action);

Utils/azuretools-core/src/com/microsoft/azure/toolkit/lib/common/operation/AzureOperationEnhancer.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@
2323
package com.microsoft.azure.toolkit.lib.common.operation;
2424

2525
import com.microsoft.azure.toolkit.lib.common.exception.AzureToolkitOperationException;
26+
import lombok.extern.java.Log;
2627
import org.apache.commons.collections4.CollectionUtils;
2728
import org.aspectj.lang.JoinPoint;
2829
import org.aspectj.lang.annotation.*;
2930
import org.aspectj.lang.reflect.MethodSignature;
3031

32+
import java.util.Objects;
33+
import java.util.logging.Level;
34+
3135
@Aspect
36+
@Log
3237
public final class AzureOperationEnhancer {
3338

3439
@Pointcut("execution(@AzureOperation * *..*.*(..))")
@@ -40,15 +45,19 @@ public void enterOperation(JoinPoint point) {
4045
final AzureOperationRef operation = toOperationRef(point);
4146
final AzureOperation.Type type = AzureOperationUtils.getAnnotation(operation).type();
4247
if (type == AzureOperation.Type.ACTION) {
43-
AzureOperationsContext.operations.get().clear();
48+
AzureOperationsContext.clear();
4449
}
4550
AzureOperationsContext.push(operation);
4651
}
4752

4853
@AfterReturning("operation()")
4954
public void exitOperation(JoinPoint point) {
50-
if (CollectionUtils.isNotEmpty(AzureOperationsContext.operations.get())) {
51-
AzureOperationsContext.pop();
55+
final AzureOperationRef operation = toOperationRef(point);
56+
if (CollectionUtils.isNotEmpty(AzureOperationsContext.getOperations())) {
57+
final AzureOperationRef popped = AzureOperationsContext.pop();
58+
if (!Objects.equals(popped, operation)) {
59+
log.log(Level.SEVERE, "!!!operation stack is wrongly managed!!!");
60+
}
5261
}
5362
}
5463

Utils/azuretools-core/src/com/microsoft/azure/toolkit/lib/common/operation/AzureOperationRef.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,26 @@
2323
package com.microsoft.azure.toolkit.lib.common.operation;
2424

2525
import lombok.Builder;
26-
import lombok.Data;
26+
import lombok.Getter;
27+
import lombok.Setter;
2728

2829
import java.lang.reflect.Method;
2930

30-
@Data
31+
@Getter
32+
@Setter
3133
@Builder
3234
public class AzureOperationRef {
3335
private Method method;
3436
private String[] paramNames;
3537
private Object[] paramValues;
3638
private Object instance;
39+
40+
@Override
41+
public boolean equals(final Object obj) {
42+
if (!(obj instanceof AzureOperationRef)) {
43+
return false;
44+
}
45+
final AzureOperationRef operation = (AzureOperationRef) obj;
46+
return operation.getMethod() == this.method || operation.getMethod().equals(this.method);
47+
}
3748
}

0 commit comments

Comments
 (0)