Skip to content

Commit 6ac508c

Browse files
authored
Merge pull request #5015 from microsoft/mysql/notification
Add notification for mysql link to module action
2 parents 8ceb146 + 3be0cd5 commit 6ac508c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/link/LinkMySQLToModuleDialog.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
import com.microsoft.azure.toolkit.intellij.link.mysql.JdbcUrl;
1515
import com.microsoft.azure.toolkit.intellij.link.mysql.MySQLResourceConfig;
1616
import com.microsoft.azure.toolkit.intellij.link.po.MySQLResourcePO;
17+
import com.microsoft.azure.toolkit.intellij.mysql.action.LinkMySQLAction;
1718
import com.microsoft.azure.toolkit.lib.common.form.AzureForm;
19+
import com.microsoft.azure.toolkit.lib.common.operation.AzureOperationBundle;
20+
import com.microsoft.azure.toolkit.lib.common.operation.IAzureOperationTitle;
1821
import com.microsoft.azure.toolkit.lib.common.task.AzureTask;
1922
import com.microsoft.azure.toolkit.lib.common.task.AzureTaskManager;
2023
import com.microsoft.azure.toolkit.lib.link.AzureLinkService;
@@ -30,7 +33,7 @@
3033
public class LinkMySQLToModuleDialog extends AzureDialog<LinkConfig<MySQLResourceConfig, ModuleResourceConfig>> {
3134

3235
private static final String PROMPT_TITLE = "Azure Explorer";
33-
private static final String[] PROMPT_OPTIONS = new String[] {"Yes", "No"};
36+
private static final String[] PROMPT_OPTIONS = new String[]{"Yes", "No"};
3437
private static final String PROMPT_MESSAGE = "This resource already existed in your local environment. Do you want to override it?";
3538
private JPanel rootPanel;
3639
private BasicLinkMySQLPanel basicPanel;
@@ -87,8 +90,8 @@ private void doLink(LinkConfig<MySQLResourceConfig, ModuleResourceConfig> linkCo
8790
boolean storageResource = true;
8891
if (Objects.nonNull(existedResourcePO)) {
8992
if (!StringUtils.equals(resourceConfig.getUrl(), existedResourcePO.getUrl()) ||
90-
!StringUtils.equals(resourceConfig.getUsername(), existedResourcePO.getUsername()) ||
91-
resourceConfig.getPasswordConfig().getPasswordSaveType() != existedResourcePO.getPasswordSave()) {
93+
!StringUtils.equals(resourceConfig.getUsername(), existedResourcePO.getUsername()) ||
94+
resourceConfig.getPasswordConfig().getPasswordSaveType() != existedResourcePO.getPasswordSave()) {
9295
storageResource = DefaultLoader.getUIHelper().showConfirmation(PROMPT_MESSAGE, PROMPT_TITLE, PROMPT_OPTIONS, null);
9396
}
9497
}
@@ -98,9 +101,12 @@ private void doLink(LinkConfig<MySQLResourceConfig, ModuleResourceConfig> linkCo
98101
final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
99102
indicator.setIndeterminate(true);
100103
AzureLinkService.getInstance().link(project, linkConfig, finalStorageResource);
104+
final String message = String.format("The connection between database %s and project %s has been successfully created.",
105+
resourceConfig.getDatabase().name(), project.getName());
106+
DefaultLoader.getUIHelper().showInfoNotification(LinkMySQLAction.ACTION_NAME, message);
101107
};
102-
String progressMessage = "Connecting Azure Database for MySQL with Module...";
103-
final AzureTask task = new AzureTask(null, progressMessage, false, runnable);
108+
final IAzureOperationTitle title = AzureOperationBundle.title("azure-mysql.azure-mysql-link-to-module");
109+
final AzureTask task = new AzureTask(null, title, false, runnable);
104110
AzureTaskManager.getInstance().runInBackground(task);
105111
}
106112

0 commit comments

Comments
 (0)