1414import com .microsoft .azure .toolkit .intellij .link .mysql .JdbcUrl ;
1515import com .microsoft .azure .toolkit .intellij .link .mysql .MySQLResourceConfig ;
1616import com .microsoft .azure .toolkit .intellij .link .po .MySQLResourcePO ;
17+ import com .microsoft .azure .toolkit .intellij .mysql .action .LinkMySQLAction ;
1718import 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 ;
1821import com .microsoft .azure .toolkit .lib .common .task .AzureTask ;
1922import com .microsoft .azure .toolkit .lib .common .task .AzureTaskManager ;
2023import com .microsoft .azure .toolkit .lib .link .AzureLinkService ;
3033public 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