Skip to content

Commit b6fef70

Browse files
committed
update sql server property view file.
1 parent 655071c commit b6fef70

File tree

1 file changed

+11
-13
lines changed
  • PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/sqlserver/properties

1 file changed

+11
-13
lines changed

PluginsAndFeatures/azure-toolkit-for-intellij/src/com/microsoft/azure/toolkit/intellij/sqlserver/properties/SqlServerPropertyView.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,9 @@ private void onSaveButtonClicked(ActionEvent e) {
143143
SqlServerPropertyView.this.propertyActionPanel.getSaveButton().setText(actionName);
144144
SqlServerPropertyView.this.propertyActionPanel.getSaveButton().setEnabled(false);
145145
Runnable runnable = () -> {
146-
String subscriptionId = property.getSubscriptionId();
147146
// refresh property
148-
SqlServerEntity entity = property.getServer().entity();
149-
refreshProperty(subscriptionId, entity.getResourceGroup(), entity.getName());
147+
SqlServerEntity entity = this.property.getServer().entity();
148+
refreshProperty(entity.getSubscriptionId(), entity.getResourceGroup(), entity.getName());
150149
boolean allowAccessToAzureServices = connectionSecurity.getAllowAccessFromAzureServicesCheckBox().getModel().isSelected();
151150
boolean allowAccessToLocal = connectionSecurity.getAllowAccessFromLocalMachineCheckBox().getModel().isSelected();
152151
if (!originalAllowAccessToAzureServices.equals(allowAccessToAzureServices) || !originalAllowAccessToLocal.equals(allowAccessToLocal)) {
@@ -162,7 +161,7 @@ private void onSaveButtonClicked(ActionEvent e) {
162161
SqlServerPropertyView.this.propertyActionPanel.getSaveButton().setEnabled(changed);
163162
SqlServerPropertyView.this.propertyActionPanel.getDiscardButton().setEnabled(changed);
164163
final Map<String, String> properties = new HashMap<>();
165-
properties.put(TelemetryConstants.SUBSCRIPTIONID, subscriptionId);
164+
properties.put(TelemetryConstants.SUBSCRIPTIONID, entity.getSubscriptionId());
166165
properties.put("allowAccessToLocal", String.valueOf(allowAccessToLocal));
167166
properties.put("allowAccessToAzureServices", String.valueOf(allowAccessToAzureServices));
168167
EventUtil.logEvent(EventType.info, ActionConstants.parse(ActionConstants.MySQL.SAVE).getServiceName(),
@@ -181,9 +180,10 @@ private void onDiscardButtonClicked(ActionEvent e) {
181180
private void onDatabaseComboBoxChanged(ItemEvent e) {
182181
if (e.getStateChange() == ItemEvent.SELECTED && e.getItem() instanceof SqlDatabaseEntity) {
183182
final SqlDatabaseEntity database = (SqlDatabaseEntity) e.getItem();
184-
connectionStringsJDBC.getOutputTextArea().setText(getConnectionString(property.getServer().entity().getFullyQualifiedDomainName(),
183+
SqlServerEntity entity = this.property.getServer().entity();
184+
connectionStringsJDBC.getOutputTextArea().setText(getConnectionString(entity.getFullyQualifiedDomainName(),
185185
database.getName(), overview.getServerAdminLoginNameTextField().getText(), DBConnectionString.Type.JDBC));
186-
connectionStringsSpring.getOutputTextArea().setText(getConnectionString(property.getServer().entity().getFullyQualifiedDomainName(),
186+
connectionStringsSpring.getOutputTextArea().setText(getConnectionString(entity.getFullyQualifiedDomainName(),
187187
database.getName(), overview.getServerAdminLoginNameTextField().getText(), DBConnectionString.Type.SPRING));
188188
}
189189
}
@@ -223,23 +223,21 @@ public void onReadProperty(String sid, String resourceGroup, String name) {
223223
}
224224

225225
private void refreshProperty(String sid, String resourceGroup, String name) {
226-
SqlServerProperty newProperty = new SqlServerProperty();
227-
newProperty.setSubscriptionId(sid);
228226
// find server
229227
try {
230228
ISqlServer server = Azure.az(AzureSqlServer.class).sqlServer(sid, resourceGroup, name);
231-
newProperty.setServer(server);
229+
this.property.setServer(server);
232230
} catch (Exception ex) {
233231
String error = "find Azure Database for MySQL server information";
234232
String action = "confirm your network is available and your server actually exists.";
235233
throw new AzureToolkitRuntimeException(error, action);
236234
}
237-
if ("Ready".equals(newProperty.getServer().entity().getState())) {
235+
SqlServerEntity entity = property.getServer().entity();
236+
if ("Ready".equals(entity.getState())) {
238237
// find firewalls
239-
List<SqlFirewallRuleEntity> firewallRules = Azure.az(AzureSqlServer.class).sqlServer(newProperty.getServer().entity().getId()).firewallRules();
240-
newProperty.setFirewallRules(firewallRules);
238+
List<SqlFirewallRuleEntity> firewallRules = Azure.az(AzureSqlServer.class).sqlServer(entity.getId()).firewallRules();
239+
this.property.setFirewallRules(firewallRules);
241240
}
242-
this.property = newProperty;
243241
}
244242

245243
// @Override

0 commit comments

Comments
 (0)