Skip to content

Commit 3a7b562

Browse files
committed
Refresh service manager while refresh app service node
1 parent 04a4210 commit 3a7b562

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public FunctionAppNode(@Nonnull AzureRefreshableNode parent, @Nonnull IFunctionA
4444

4545
@Override
4646
protected void refreshItems() {
47+
super.refreshItems();
4748
this.renderSubModules();
4849
}
4950

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
@@ -45,7 +45,7 @@ public void removeNode(String sid, String id, Node node) {
4545
@AzureOperation(name = "function.reload_all", type = AzureOperation.Type.ACTION)
4646
protected void refreshItems() {
4747
Azure.az(AzureAppService.class).functionApps(true)
48-
.stream().map(functionApp -> new FunctionAppNode(FunctionModule.this, functionApp))
48+
.stream().parallel().map(functionApp -> new FunctionAppNode(FunctionModule.this, functionApp))
4949
.forEach(this::addChildNode);
5050
}
5151

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public void run() {
8181
@Override
8282
public void renderChildren(@NotNull final List<IWebApp> resourceExes) {
8383
resourceExes.stream()
84+
.parallel()
8485
.filter(webApp -> StringUtils.isNotEmpty(webApp.id()))
8586
.map(webApp -> new WebAppNode(this, webApp))
8687
.forEach(this::addChildNode);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public IWebApp getWebappManager() {
5959
@Override
6060
@AzureOperation(name = "webapp.refresh", type = AzureOperation.Type.ACTION)
6161
protected void refreshItems() {
62+
super.refreshItems();
6263
this.renderSubModules();
6364
}
6465

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

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
import com.azure.resourcemanager.resources.fluentcore.arm.ResourceId;
99
import com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem;
10-
import com.microsoft.azure.toolkit.lib.appservice.service.IAppService;
10+
import com.microsoft.azure.toolkit.lib.appservice.service.IAppService;\
1111
import com.microsoft.azuretools.telemetry.AppInsightsConstants;
1212
import com.microsoft.azuretools.telemetry.TelemetryProperties;
13+
import com.microsoft.tooling.msservices.components.DefaultLoader;
14+
import com.microsoft.tooling.msservices.serviceexplorer.AzureIconSymbol;
1315
import com.microsoft.tooling.msservices.serviceexplorer.AzureRefreshableNode;
1416
import com.microsoft.tooling.msservices.serviceexplorer.NodeAction;
1517
import com.microsoft.tooling.msservices.serviceexplorer.RefreshableNode;
@@ -38,7 +40,7 @@ public WebAppBaseNode(final AzureRefreshableNode parent, final String label, fin
3840
this.appService = appService;
3941
this.subscriptionId = ResourceId.fromString(appService.id()).subscriptionId();
4042

41-
renderNode(WebAppBaseState.fromString(appService.state()));
43+
DefaultLoader.getIdeHelper().executeOnPooledThread(() -> refreshItems());
4244
}
4345

4446
protected String getAppServiceIconPath(final WebAppBaseState state) {
@@ -47,6 +49,13 @@ protected String getAppServiceIconPath(final WebAppBaseState state) {
4749
+ label + (state == WebAppBaseState.RUNNING ? ICON_RUNNING_POSTFIX : ICON_STOPPED_POSTFIX);
4850
}
4951

52+
@Override
53+
protected void refreshItems() {
54+
renderNode(WebAppBaseState.UPDATING);
55+
appService.refresh();
56+
renderNode(WebAppBaseState.fromString(appService.state()));
57+
}
58+
5059
@Override
5160
public List<NodeAction> getNodeActions() {
5261
boolean running = this.state == WebAppBaseState.RUNNING;
@@ -58,12 +67,15 @@ public List<NodeAction> getNodeActions() {
5867
}
5968

6069
public void renderNode(@Nonnull WebAppBaseState state) {
70+
this.state = state;
6171
switch (state) {
6272
case RUNNING:
6373
case STOPPED:
64-
this.state = state;
6574
this.setIconPath(getAppServiceIconPath(state));
6675
break;
76+
case UPDATING:
77+
this.setIconPath(AzureIconSymbol.Common.REFRESH.getPath());
78+
break;
6779
default:
6880
break;
6981
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ protected void onNodeClick(NodeActionEvent e) {
9595
@Override
9696
@AzureOperation(name = "webapp|deployment.refresh", params = {"this.slot.name()", "this.webApp.name()"}, type = AzureOperation.Type.ACTION)
9797
protected void refreshItems() {
98+
super.refreshItems();
9899
if (slot.exists()) {
99100
this.renderNode(WebAppBaseState.fromString(slot.state()));
100101
} else {

0 commit comments

Comments
 (0)