Skip to content

Commit a4d843c

Browse files
authored
Improve the validation implemetation (#2939)
1 parent 00c828a commit a4d843c

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.webapp/src/com/microsoft/azuretools/webapp/ui/AppServiceCreateDialog.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,13 +1093,13 @@ protected void okPressed() {
10931093
properties.put("runtime",
10941094
model.getOS() == OperatingSystem.LINUX ? "Linux-" + model.getLinuxRuntime().toString()
10951095
: "windows-" + model.getWebContainer());
1096+
if (!validated()) {
1097+
return;
1098+
}
10961099
try {
10971100
ProgressDialog.get(this.getShell(), CREATE_APP_SERVICE_PROGRESS_TITLE).run(true, true,
10981101
(monitor) -> {
10991102
monitor.beginTask(VALIDATING_FORM_FIELDS, IProgressMonitor.UNKNOWN);
1100-
if (!validated()) {
1101-
return;
1102-
}
11031103
monitor.setTaskName(CREATING_APP_SERVICE);
11041104
if (monitor.isCanceled()) {
11051105
AzureModel.getInstance().setResourceGroupToWebAppMap(null);
@@ -1171,18 +1171,12 @@ protected boolean validated() {
11711171
return false;
11721172
}
11731173
// App service plan name must be unique in each subscription
1174-
List<ResourceGroup> rgl = AzureMvpModel.getInstance()
1175-
.getResourceGroupsBySubscriptionId(model.getSubscriptionId());
1176-
for (ResourceGroup rg : rgl) {
1177-
List<AppServicePlan> aspl = AzureWebAppMvpModel.getInstance()
1178-
.listAppServicePlanBySubscriptionIdAndResourceGroupName(model.getSubscriptionId(),
1179-
rg.name());
1180-
for (AppServicePlan asp : aspl) {
1181-
if (asp != null
1182-
&& asp.name().toLowerCase().equals(model.getAppServicePlanName().toLowerCase())) {
1183-
setError(dec_textAppSevicePlanName, APP_SERVICE_PLAN_NAME_MUST_UNUQUE);
1184-
return false;
1185-
}
1174+
List<AppServicePlan> appServicePlans = getAppservicePlanBySID(model.getSubscriptionId());
1175+
for (AppServicePlan asp : appServicePlans) {
1176+
if (asp != null
1177+
&& asp.name().toLowerCase().equals(model.getAppServicePlanName().toLowerCase())) {
1178+
setError(dec_textAppSevicePlanName, APP_SERVICE_PLAN_NAME_MUST_UNUQUE);
1179+
return false;
11861180
}
11871181
}
11881182
}

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.webapp/src/com/microsoft/azuretools/webapp/ui/WebAppDeployDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,7 @@ private WebAppBase getRealWebApp(WebAppDetails webAppDetails, Object parent, IPr
10471047
String deploymentName) {
10481048
if (isDeployToSlot) {
10491049
if (isCreateNewSlot) {
1050-
String message = "Create Deployment Slot...";
1050+
String message = "Creating Deployment Slot...";
10511051
monitor.setTaskName(message);
10521052
AzureDeploymentProgressNotification.notifyProgress(parent, deploymentName, "", 30, message);
10531053
return createDeploymentSlot(webAppDetails);

0 commit comments

Comments
 (0)