Skip to content

Commit 0d336db

Browse files
authored
Merge pull request #6124 from microsoft/hanli-fix-validation
Fix validation issue for intellij
2 parents 9a03d6e + 3853a13 commit 0d336db

File tree

8 files changed

+18
-10
lines changed

8 files changed

+18
-10
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-vm/src/main/java/com/microsoft/azure/toolkit/intellij/vm/creation/component/VirtualNetworkDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class VirtualNetworkDialog extends AzureDialog<DraftNetwork> implements A
2727
private static final String NETWORK_NAME_RULES = "The name must begin with a letter or number, end with a letter, number or underscore, " +
2828
"and may contain only letters, numbers, underscores, periods, or hyphens.";
2929
private static final String NETWORK_NAME_PATTERN = "[a-zA-Z0-9][a-zA-Z0-9_\\.-]{0,62}[a-zA-Z0-9_]";
30-
private static final String SUBNET_NAME_PATTERN = "[a-zA-Z0-9][a-zA-Z0-9_\\.-]{0,78}[a-zA-Z0-9_]";
30+
private static final String SUBNET_NAME_PATTERN = "[a-zA-Z0-9]([a-zA-Z0-9_\\.-]{0,78}[a-zA-Z0-9_])?";
3131

3232
private JPanel contentPane;
3333
private AzureTextInput txtName;

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-vm/src/main/java/com/microsoft/azure/toolkit/intellij/vm/creation/component/ip/PublicIpAddressCreationDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
public class PublicIpAddressCreationDialog extends AzureDialog<DraftPublicIpAddress>
2929
implements AzureForm<DraftPublicIpAddress> {
30-
private static final String IP_NAME_PATTERN = "[a-zA-Z0-9][a-zA-Z0-9_\\.-]{0,78}[a-zA-Z0-9_]";
30+
private static final String IP_NAME_PATTERN = "[a-zA-Z0-9]([a-zA-Z0-9_\\.-]{0,78}[a-zA-Z0-9_])?";
3131

3232
private Subscription subscription;
3333
private ResourceGroup resourceGroup;

PluginsAndFeatures/azure-toolkit-for-intellij/src/main/java/com/microsoft/azure/toolkit/intellij/webapp/WebAppBasePropertyView.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ public void showProperty(WebAppProperty webAppProperty) {
311311
if (url == null) {
312312
lnkUrl.setHyperlinkText(TXT_NA);
313313
} else {
314-
lnkUrl.setHyperlinkText("http://" + url);
315-
lnkUrl.setHyperlinkTarget("http://" + url);
314+
lnkUrl.setHyperlinkText("https://" + url);
315+
lnkUrl.setHyperlinkTarget("https://" + url);
316316
}
317317
txtPricingTier.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_PRICING) == null ? TXT_NA
318318
: (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_PRICING));

PluginsAndFeatures/azure-toolkit-for-intellij/src/main/java/com/microsoft/azure/toolkit/intellij/webapp/docker/webapponlinux/WebAppOnLinuxDeployState.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public IAppService executeSteps(@NotNull RunProcessHandler processHandler, @NotN
9393
processHandler.setText(String.format("Creating new WebApp ... [%s]", deployModel.getWebAppName()));
9494
final IWebApp app = AzureWebAppMvpModel.getInstance().createAzureWebAppWithPrivateRegistryImage(deployModel);
9595
if (app != null && app.name() != null) {
96-
processHandler.setText(String.format("URL: http://%s.azurewebsites.net/", app.name()));
96+
processHandler.setText(String.format("URL: https://%s.azurewebsites.net/", app.name()));
9797
updateConfigurationDataModel(app);
9898

9999
AzureUIRefreshCore.execute(new AzureUIRefreshEvent(AzureUIRefreshEvent.EventType.REFRESH, null));
@@ -105,7 +105,7 @@ public IAppService executeSteps(@NotNull RunProcessHandler processHandler, @NotN
105105
deployModel.getWebAppName()));
106106
final IWebApp app = AzureWebAppMvpModel.getInstance().updateWebAppOnDocker(deployModel.getWebAppId(), acrInfo);
107107
if (app != null && app.name() != null) {
108-
processHandler.setText(String.format("URL: http://%s.azurewebsites.net/", app.name()));
108+
processHandler.setText(String.format("URL: https://%s.azurewebsites.net/", app.name()));
109109
}
110110
return app;
111111
}

PluginsAndFeatures/azure-toolkit-for-intellij/src/main/java/com/microsoft/intellij/util/ValidationUtils.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,14 @@ public static void validateAppServiceName(String subscriptionId, String appServi
5858
if (StringUtils.isEmpty(subscriptionId)) {
5959
throw new IllegalArgumentException(message("appService.subscription.validate.empty"));
6060
}
61+
if (StringUtils.isEmpty(appServiceName)) {
62+
throw new IllegalArgumentException(message("appService.name.validate.empty"));
63+
}
64+
if (appServiceName.length() < 2 || appServiceName.length() > 60) {
65+
throw new IllegalArgumentException(message("appService.name.validate.length"));
66+
}
6167
if (!isValidAppServiceName(appServiceName)) {
62-
throw new IllegalArgumentException(message("appService.subscription.validate.invalidName"));
68+
throw new IllegalArgumentException(message("appService.name.validate.invalidName"));
6369
}
6470
final CheckNameAvailabilityResultEntity result = Azure.az(AzureAppService.class).checkNameAvailability(subscriptionId, appServiceName);
6571
if (!result.isAvailable()) {

PluginsAndFeatures/azure-toolkit-for-intellij/src/main/resources/com/microsoft/intellij/ui/messages/messages.properties

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,9 @@ appService.deploy.hint.succeed=Deploy succeed
13671367
appService.deploy.hint.failed=Deploy failed!
13681368
appService.runProcess.hint.processTerminated=The process has been terminated
13691369
appService.subscription.validate.empty=Subscription can not be null
1370-
appService.subscription.validate.invalidName=App service names only allow alphanumeric characters and hyphens, cannot start or end in a hyphen, and must be less than 60 chars.
1370+
appService.name.validate.empty=App service names can not be null
1371+
appService.name.validate.length=App service names be at least 2 characters, and be fewer than 60 characters
1372+
appService.name.validate.invalidName=App service names only allow alphanumeric characters and hyphens, cannot start or end in a hyphen, and must be less than 60 chars.
13711373
appService.logStreaming.hint.connect=Connecting to log stream...
13721374
appService.logStreaming.hint.notStart=Streaming log is not started.
13731375
appService.logStreaming.hint.disconnected=Disconnected from log-streaming service.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ private void openInPortal() {
146146

147147
@AzureOperation(name = "webapp.open_browser", params = {"this.webApp.name()"}, type = AzureOperation.Type.ACTION)
148148
private void openInBrowser() {
149-
DefaultLoader.getUIHelper().openInBrowser("http://" + this.webApp.hostName());
149+
DefaultLoader.getUIHelper().openInBrowser("https://" + this.webApp.hostName());
150150
}
151151

152152
@AzureOperation(name = "webapp.show_properties", params = {"this.webApp.name()"}, type = AzureOperation.Type.ACTION)

Utils/azure-explorer-common/src/com/microsoft/tooling/msservices/serviceexplorer/azure/webapp/deploymentslot/DeploymentSlotNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ private void openInPortal() {
134134

135135
@AzureOperation(name = "webapp|deployment.open_browser", params = {"this.slot.name()", "this.webApp.name()"}, type = AzureOperation.Type.ACTION)
136136
private void openInBrowser() {
137-
DefaultLoader.getUIHelper().openInBrowser("http://" + slot.hostName());
137+
DefaultLoader.getUIHelper().openInBrowser("https://" + slot.hostName());
138138
}
139139

140140
@AzureOperation(name = "webapp|deployment.show_properties", params = {"this.slot.name()", "this.webApp.name()"}, type = AzureOperation.Type.ACTION)

0 commit comments

Comments
 (0)