@@ -188,11 +188,7 @@ private void onSelectFunctionSlot(final DeploymentSlotConfig value) {
188188 }
189189 toggleDeploymentSlot (chkSlot .isSelected ());
190190 if (chkSlot .isSelected ()) {
191- if (value .isNewCreate ()) {
192- appSettingsTable .clear ();
193- } else {
194- loadAppSettings (getResourceId (functionAppComboBox .getValue (), value ));
195- }
191+ loadAppSettings (getResourceId (Objects .requireNonNull (functionAppComboBox .getValue ()), value ), value .isNewCreate ());
196192 }
197193 }
198194
@@ -208,17 +204,17 @@ private void onSelectFunctionApp(final FunctionAppConfig value) {
208204 toggleDeploymentSlot (chkSlot .isSelected ());
209205 this .cbDeploymentSlot .setAppService (value .getResourceId ());
210206 if (!this .chkSlot .isSelected ()) {
211- loadAppSettings (getResourceId (value , null ));
207+ loadAppSettings (getResourceId (value , null ), StringUtils . isEmpty ( value . getResourceId ()) );
212208 }
213209 }
214210
215- private void loadAppSettings (@ Nullable final String resourceId ) {
211+ private void loadAppSettings (@ Nullable final String resourceId , final boolean isNewResource ) {
216212 if (StringUtils .equalsIgnoreCase (resourceId , this .appSettingsResourceId ) && MapUtils .isNotEmpty (this .appSettingsTable .getAppSettings ())) {
217213 return ;
218214 }
219215 this .appSettingsResourceId = resourceId ;
220216 this .appSettingsTable .loadAppSettings (() -> {
221- final AbstractAzResource <?, ?, ?> resource = StringUtils .isBlank (resourceId ) ? null : Azure .az ().getById (resourceId );
217+ final AbstractAzResource <?, ?, ?> resource = StringUtils .isBlank (resourceId ) || isNewResource ? null : Azure .az ().getById (resourceId );
222218 return resource instanceof AppServiceAppBase <?, ?, ?> ? ((AppServiceAppBase <?, ?, ?>) resource ).getAppSettings () : Collections .emptyMap ();
223219 });
224220 }
@@ -252,9 +248,9 @@ private void onSlotCheckBoxChanged() {
252248 final DeploymentSlotConfig slot = cbDeploymentSlot .getValue ();
253249 // reload app settings when switch slot configuration
254250 if (chkSlot .isSelected () && ObjectUtils .allNotNull (function , slot )) {
255- loadAppSettings (getResourceId (functionAppComboBox .getValue (), slot ));
251+ loadAppSettings (getResourceId (functionAppComboBox .getValue (), slot ), slot . isNewCreate () );
256252 } else if (!chkSlot .isSelected () && Objects .nonNull (function )) {
257- loadAppSettings (getResourceId (functionAppComboBox .getValue (), null ));
253+ loadAppSettings (getResourceId (functionAppComboBox .getValue (), null ), StringUtils . isEmpty ( function . getResourceId ()) );
258254 }
259255 }
260256
0 commit comments