Skip to content

Commit fd96627

Browse files
Merge pull request #6287 from microsoft/endgame-december
Endgame december for 2021.3
2 parents 865d52d + cea0fd7 commit fd96627

File tree

4 files changed

+21
-13
lines changed

4 files changed

+21
-13
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice/src/main/java/com/microsoft/azure/toolkit/intellij/legacy/function/runner/component/table/AppSettingsDialogPresenter.java

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
import com.microsoft.azure.toolkit.lib.Azure;
99
import com.microsoft.azure.toolkit.lib.appservice.AzureAppService;
1010
import com.microsoft.azure.toolkit.lib.appservice.service.impl.FunctionApp;
11+
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
1112
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
1213
import com.microsoft.azuretools.core.mvp.ui.base.MvpPresenter;
1314
import rx.Observable;
1415

1516
import java.nio.file.Path;
17+
import java.util.Map;
1618

1719
public class AppSettingsDialogPresenter<V extends ImportAppSettingsView> extends MvpPresenter<V> {
1820
public void onLoadFunctionApps() {
@@ -40,16 +42,17 @@ public void onLoadFunctionAppSettings(FunctionApp functionApp) {
4042
}
4143

4244
public void onLoadLocalSettings(Path localSettingsJsonPath) {
43-
Observable.fromCallable(() -> {
45+
final AzureTaskManager tm = AzureTaskManager.getInstance();
46+
tm.runOnPooledThread(() -> {
4447
getMvpView().beforeFillAppSettings();
45-
return AppSettingsTableUtils.getAppSettingsFromLocalSettingsJson(localSettingsJsonPath.toFile());
46-
}).subscribeOn(getSchedulerProvider().io())
47-
.subscribe(appSettings -> AzureTaskManager.getInstance().runLater(() -> {
48-
if (isViewDetached()) {
49-
return;
50-
}
51-
getMvpView().fillFunctionAppSettings(appSettings);
52-
}));
48+
final Map<String, String> settings = AppSettingsTableUtils.getAppSettingsFromLocalSettingsJson(localSettingsJsonPath.toFile());
49+
tm.runLater(() -> {
50+
if (isViewDetached()) {
51+
return;
52+
}
53+
getMvpView().fillFunctionAppSettings(settings);
54+
}, AzureTask.Modality.ANY);
55+
});
5356
}
5457

5558
private void errorHandler(Throwable e) {

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-appservice/src/main/java/com/microsoft/azure/toolkit/intellij/legacy/function/runner/component/table/AppSettingsTableUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.io.IOException;
4040
import java.util.HashMap;
4141
import java.util.Map;
42+
import java.util.Optional;
4243

4344
import static com.microsoft.azure.toolkit.intellij.common.AzureBundle.message;
4445

@@ -114,11 +115,11 @@ public void windowClosed(WindowEvent windowEvent) {
114115
@Override
115116
public void actionPerformed(AnActionEvent anActionEvent) {
116117
try {
117-
FileSaverDescriptor fileDescriptor = new FileSaverDescriptor(message("function.appSettings.export.description"), "");
118+
final FileSaverDescriptor fileDescriptor = new FileSaverDescriptor(message("function.appSettings.export.description"), "");
118119
final FileSaverDialog dialog = FileChooserFactory.getInstance().createSaveFileDialog(fileDescriptor, (Project) null);
119120
final VirtualFile userHome = LocalFileSystem.getInstance().findFileByPath(System.getProperty("user.home"));
120121
final VirtualFileWrapper fileWrapper = dialog.save(userHome, LOCAL_SETTINGS_JSON);
121-
final File file = fileWrapper.getFile();
122+
final File file = Optional.ofNullable(fileWrapper).map(VirtualFileWrapper::getFile).orElse(null);
122123
if (file != null) {
123124
AppSettingsTableUtils.exportLocalSettingsJsonFile(file, appSettingsTable.getAppSettings());
124125
AzureMessager.getMessager().info(message("function.appSettings.export.succeed.title"), message("function.appSettings.export.succeed.message"));

PluginsAndFeatures/azure-toolkit-for-intellij/azure-intellij-plugin-springcloud/src/main/java/com/microsoft/azure/toolkit/intellij/springcloud/component/SpringCloudAppConfigPanel.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,12 @@ public synchronized void updateForm(@Nonnull SpringCloudApp app) {
121121
AzureTaskManager.getInstance().runLater(() -> {
122122
if (testUrl != null) {
123123
this.txtTestEndpoint.setHyperlinkText(testUrl.length() > 60 ? testUrl.substring(0, 60) + "..." : testUrl);
124+
this.txtTestEndpoint.setHyperlinkTarget(testUrl.endsWith("/") ? testUrl.substring(0, testUrl.length() - 1) : testUrl);
124125
} else {
125126
this.txtTestEndpoint.setVisible(false);
126127
this.lblTestEndpoint.setVisible(false);
128+
this.txtTestEndpoint.setHyperlinkTarget(null);
127129
}
128-
this.txtTestEndpoint.setHyperlinkTarget(testUrl);
129130
this.txtStorage.setText(Objects.nonNull(disk) ? disk.toString() : "---");
130131
this.txtEndpoint.setHyperlinkTarget(url);
131132
this.txtEndpoint.setEnabled(Objects.nonNull(url));

Utils/azure-toolkit-ide-libs/azure-toolkit-ide-springcloud-lib/src/main/java/com/microsoft/azure/toolkit/ide/springcloud/SpringCloudActionsContributor.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ public void registerActions(AzureActionManager am) {
3636
.enabled(s -> s instanceof SpringCloudApp && ((SpringCloudApp) s).entity().isPublic());
3737
am.registerAction(OPEN_PUBLIC_URL, new Action<>(openPublicUrl, openPublicUrlView));
3838

39-
final Consumer<SpringCloudApp> openTestUrl = s -> am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle(s.testUrl());
39+
final Consumer<SpringCloudApp> openTestUrl = s -> {
40+
final String testUrl = s.testUrl();
41+
am.getAction(ResourceCommonActionsContributor.OPEN_URL).handle(testUrl.endsWith("/") ? testUrl.substring(0, testUrl.length() - 1) : testUrl);
42+
};
4043
final ActionView.Builder openTestUrlView = new ActionView.Builder("Access Test Endpoint", "/icons/action/browser.svg")
4144
.title(s -> Optional.ofNullable(s).map(r -> title("springcloud.open_test_url.app", ((SpringCloudApp) r).name())).orElse(null))
4245
.enabled(s -> s instanceof SpringCloudApp);

0 commit comments

Comments
 (0)