Skip to content

Commit

Permalink
print more info after deploying (#2515)
Browse files Browse the repository at this point in the history
* print more info after deploying

* fix
  • Loading branch information
RuoyuWang-MS authored Dec 10, 2024
1 parent 366edef commit 2691b3d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,7 @@ public com.azure.resourcemanager.appcontainers.models.ContainerApp createResourc
.orElse(null);

AzureMessager.getMessager().success(AzureString.format("Azure Container App({0}) is successfully created.", this.getName()), browse, updateImage);

final Action<String> learnMore = Optional.ofNullable(AzureActionManager.getInstance().getAction(Action.OPEN_URL).withLabel("Learn More"))
.map(action -> action.bind("https://aka.ms/azuretools-aca-stack"))
.orElse(null);

final Action<String> openPortal = Optional.ofNullable(AzureActionManager.getInstance().getAction(Action.OPEN_URL).withLabel("Open Portal"))
.map(action -> action.bind(this.getPortalUrl()))
.orElse(null);
AzureMessager.getMessager().info("Azure container apps offers an automatic memory fitting experience for Java developers. To take advantage of this Java-optimized feature, please set your development stack to `Java` in the portal.", learnMore, openPortal);
printSuccessMessages();
return result;
}

Expand Down Expand Up @@ -206,12 +198,31 @@ public com.azure.resourcemanager.appcontainers.models.ContainerApp updateResourc
.map(action -> action.bind(this))
.orElse(null);
messager.success(AzureString.format("Container App({0}) is successfully updated.", getName()), browse);
printSuccessMessages();
if (isImageModified) {
AzureTaskManager.getInstance().runOnPooledThread(() -> this.getRevisionModule().refresh());
}
return result;
}

private void printSuccessMessages() {
final Action<String> learnMore = Optional.ofNullable(AzureActionManager.getInstance().getAction(Action.OPEN_URL).withLabel("Learn More"))
.map(action -> action.bind("https://aka.ms/azuretools-aca-stack"))
.orElse(null);
final Action<String> openPortal = Optional.ofNullable(AzureActionManager.getInstance().getAction(Action.OPEN_URL).withLabel("Open Portal"))
.map(action -> action.bind(this.getPortalUrl()))
.orElse(null);
final Action<String> openApp = Optional.ofNullable(this.getIngressFqdn())
.filter(fqdn -> !StringUtils.isEmpty(fqdn))
.flatMap(fqdn -> Optional.ofNullable(AzureActionManager.getInstance()
.getAction(Action.OPEN_URL)
.withLabel("Open Application"))
.map(action -> action.bind(String.format("https://%s", fqdn))))
.orElse(null);

AzureMessager.getMessager().info("To take advantage of the Java-optimized feature, please set your development stack to `Java` in the portal.", learnMore, openPortal, openApp);
}

@Nonnull
private com.azure.resourcemanager.appcontainers.models.ContainerApp.Update updateImage(@Nonnull com.azure.resourcemanager.appcontainers.models.ContainerApp origin) {
final ImageConfig config = Objects.requireNonNull(this.getConfig().getImageConfig(), "image config is null.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private ContainerAppDraft.Config toContainerAppDraftConfig() {
}

@Override
@AzureOperation(name = "internal/containerapps.create_update_app.app", params = {"config.getAppName()"})
@AzureOperation(name = "internal/containerapps.create_update_app.app", params = {"this.config.getAppName()"})
public ContainerApp doExecute() throws Exception {
for (final AzureTask<?> t : this.subTasks) {
t.getBody().call();
Expand Down

0 comments on commit 2691b3d

Please sign in to comment.