Skip to content

Commit 173fdd7

Browse files
authored
Fix function refresh and list app service plan issues (#4582)
* Fix new function will trigger webapp refresh events * Bump azure version and fix app service list issues * Fix checkstyle
1 parent f3b1ecd commit 173fdd7

File tree

12 files changed

+26
-27
lines changed

12 files changed

+26
-27
lines changed

PluginsAndFeatures/AddLibrary/AppInsights/com.microsoft.applicationinsights.ui/src/main/java/com/microsoft/applicationinsights/ui/config/messages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ depLocation=dependencies/
1414
excp=Exception in getClasspathEntries
1515
azureSDKcontainerID=com.microsoft.azuretools.SDK_CONTAINER
1616
sdkID=com.microsoft.azuretools.sdk
17-
sdkJar=dependencies/azure-1.35.1.jar
17+
sdkJar=dependencies/azure-1.36.2.jar
1818
jstDep=org.eclipse.jst.component.dependency
1919
aiCheckBoxTxt=Enable telemetry with Application Insights
2020
webxmlPath=WebContent/WEB-INF/web.xml

PluginsAndFeatures/AddLibrary/AzureLibraries/com.microsoft.azuretools.wasdkjava.ui/src/main/java/com/microsoft/azuretools/wasdkjava/ui/classpath/messages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ lblVersion=Version :
77
libNotAvail=Library is not available.
88
notFound=Not found
99
sdkID=com.microsoft.azuretools.sdk
10-
sdkJar=dependencies/azure-1.35.1.jar
10+
sdkJar=dependencies/azure-1.36.2.jar
1111
title=Microsoft Azure Libraries for Java
1212
verNotAvail=The selected version is not available.
1313
version1=Microsoft Azure Libraries for Java, version %s.%s.%s

PluginsAndFeatures/azure-toolkit-for-eclipse/com.microsoft.azuretools.core/src/com/microsoft/azuretools/core/utils/messages.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ err=Error
5656
prefFileName=WAEclipsePlugin
5757
bundleName=org.eclipse.core.runtime
5858
sdkLibBundleName=com.microsoftopentechnologies.windowsazure.tools.sdk
59-
sdkLibBaseJar=dependencies/azure-1.35.1.jar
59+
sdkLibBaseJar=dependencies/azure-1.36.2.jar
6060
SDKLocErrMsg=Error occurred while retrieving path of Azure libraries
6161
resCLExWkspRfrsh=Exception while refresh of workspace.
6262
cmhLblStrgAcc=Storage Accounts

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/functions/deploy/ui/creation/FunctionCreationDialog.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
import com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent;
3434
import com.microsoft.azure.management.appservice.FunctionApp;
3535
import com.microsoft.azure.management.appservice.OperatingSystem;
36-
import com.microsoft.azuretools.authmanage.AuthMethodManager;
3736
import com.microsoft.azuretools.telemetry.AppInsightsClient;
3837
import com.microsoft.azuretools.telemetrywrapper.EventType;
3938
import com.microsoft.azuretools.telemetrywrapper.EventUtil;
@@ -275,14 +274,12 @@ public void run(ProgressIndicator progressIndicator) {
275274
EventUtil.logEvent(EventType.info, operation, properties);
276275
bindingApplicationInsights(functionConfiguration);
277276
final CreateFunctionHandler createFunctionHandler = new CreateFunctionHandler(functionConfiguration);
278-
createFunctionHandler.execute();
279-
result = AuthMethodManager.getInstance().getAzureClient(functionConfiguration.getSubscription()).appServices().functionApps()
280-
.getByResourceGroup(functionConfiguration.getResourceGroup(), functionConfiguration.getAppName());
277+
result = createFunctionHandler.execute();
281278
ApplicationManager.getApplication().invokeLater(() -> {
282279
sendTelemetry(true, null);
283280
if (AzureUIRefreshCore.listeners != null) {
284281
AzureUIRefreshCore.execute(new AzureUIRefreshEvent(AzureUIRefreshEvent.EventType.REFRESH,
285-
null));
282+
result));
286283
}
287284
});
288285
DefaultLoader.getIdeHelper().invokeLater(() -> FunctionCreationDialog.super.doOKAction());

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/functions/library/function/CreateFunctionHandler.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ public CreateFunctionHandler(IAppServiceContext ctx) {
7979
this.ctx = ctx;
8080
}
8181

82-
public void execute() throws IOException, AzureExecutionException {
82+
public FunctionApp execute() throws IOException, AzureExecutionException {
8383
final FunctionApp app = getFunctionApp();
8484
if (app == null) {
85-
createFunctionApp();
85+
return createFunctionApp();
8686
} else {
8787
throw new AzureExecutionException(String.format(TARGET_FUNCTION_APP_ALREADY_EXISTS, ctx.getAppName()));
8888
}
@@ -91,13 +91,14 @@ public void execute() throws IOException, AzureExecutionException {
9191

9292
// region Create or update Azure Functions
9393

94-
private void createFunctionApp() throws IOException, AzureExecutionException {
94+
private FunctionApp createFunctionApp() throws IOException, AzureExecutionException {
9595
Log.prompt(FUNCTION_APP_CREATE_START);
9696
final FunctionRuntimeHandler runtimeHandler = getFunctionRuntimeHandler();
9797
final WithCreate withCreate = runtimeHandler.defineAppWithRuntime();
9898
configureAppSettings(withCreate::withAppSettings, getAppSettingsWithDefaultValue());
99-
withCreate.create();
99+
FunctionApp result = withCreate.create();
100100
Log.prompt(String.format(FUNCTION_APP_CREATED, ctx.getAppName()));
101+
return result;
101102
}
102103

103104
private void configureAppSettings(final Consumer<Map> withAppSettings, final Map appSettings) {

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/intellij/runner/webapp/webappconfig/slimui/creation/WebAppCreationDialog.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ public void fillResourceGroup(@NotNull List<ResourceGroup> resourceGroups) {
208208

209209
@Override
210210
public void fillAppServicePlan(@NotNull List<AppServicePlan> appServicePlans) {
211+
updateConfiguration();
211212
cbExistAppServicePlan.removeAllItems();
212213
appServicePlans.stream()
213214
.filter(item -> Comparing.equal(item.operatingSystem(), webAppConfiguration.getOS()))

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

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

3030
public class PluginHelper {
3131

32-
private static final String AZURE_ARTIFACT = "azure-1.35.1.jar";
32+
private static final String AZURE_ARTIFACT = "azure-1.36.2.jar";
3333

3434
/**
3535
* @return resource filename in plugin's directory

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,6 @@ public void run() {
106106
}
107107

108108
private static boolean isFunctionModuleEvent(Object eventObject) {
109-
return eventObject == null || FunctionModule.class.getName().equals(eventObject);
109+
return eventObject != null && eventObject instanceof FunctionApp;
110110
}
111111
}

Utils/azuretools-core/src/com/microsoft/azuretools/core/mvp/model/function/AzureFunctionMvpModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public List<AppServicePlan> listAppServicePlanBySubscriptionIdAndResourceGroupNa
107107
* List app service plan by subscription id.
108108
*/
109109
public List<AppServicePlan> listAppServicePlanBySubscriptionId(String sid) throws IOException {
110-
return AuthMethodManager.getInstance().getAzureClient(sid).appServices().appServicePlans().list();
110+
return AuthMethodManager.getInstance().getAzureClient(sid).appServices().appServicePlans().list(true);
111111
}
112112

113113
/**

Utils/azuretools-core/src/com/microsoft/azuretools/core/mvp/model/webapp/AzureWebAppMvpModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ public List<AppServicePlan> listAppServicePlanBySubscriptionIdAndResourceGroupNa
478478
* List app service plan by subscription id.
479479
*/
480480
public List<AppServicePlan> listAppServicePlanBySubscriptionId(String sid) throws IOException {
481-
return AuthMethodManager.getInstance().getAzureClient(sid).appServices().appServicePlans().list();
481+
return AuthMethodManager.getInstance().getAzureClient(sid).appServices().appServicePlans().list(true);
482482
}
483483

484484
/**

0 commit comments

Comments
 (0)