use of com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem in project azure-tools-for-java by Microsoft.
the class AppServiceCreateDialog method collectData.
private void collectData() {
model.setCreatingNew(true);
model.setWebAppName(textAppName.getText().trim());
int index = comboSubscription.getSelectionIndex();
model.setSubscriptionId(index < 0 ? null : binderSubscriptionDetails.get(index).getId());
// Resource Group
boolean isCreatingNewResGrp = btnResourceGroupCreateNew.getSelection();
model.setCreatingResGrp(isCreatingNewResGrp);
if (isCreatingNewResGrp) {
model.setResourceGroup(textResourceGroupName.getText().trim());
} else {
index = comboResourceGroup.getSelectionIndex();
model.setResourceGroup(index < 0 ? null : binderResourceGroup.get(index).getName());
}
// App Service Plan
boolean isCreatingAppServicePlan = btnAppServiceCreateNew.getSelection();
model.setCreatingAppServicePlan(isCreatingAppServicePlan);
if (isCreatingAppServicePlan) {
model.setAppServicePlanName(textAppSevicePlanName.getText().trim());
index = comboAppServicePlanLocation.getSelectionIndex();
model.setRegion(index < 0 ? null : binderAppServicePlanLocation.get(index).getName());
model.setPricing(Optional.ofNullable(getSelectedPricingTier()).map(PricingTier::toString).orElse(APPSETTINGS_TOOLTIP));
} else {
index = comboAppServicePlan.getSelectionIndex();
model.setAppServicePlanId(index < 0 ? null : binderAppServicePlan.get(index).id());
}
// Runtime
final OperatingSystem os = getSelectedOS();
final Runtime runtime = os == OperatingSystem.LINUX ? getSelectedRuntimeStack() : Runtime.getRuntime(OperatingSystem.WINDOWS, getSelectedWebcontainer(), getSelectedJavaVersion());
model.saveRuntime(runtime);
}
use of com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem in project azure-tools-for-java by Microsoft.
the class AppServiceCreateDialog method fillAppServicePlans.
protected void fillAppServicePlans() {
Subscription selectedSubscription = getSelectedSubscription();
if (selectedSubscription == null) {
return;
}
OperatingSystem os = getSelectedOS();
setComboRefreshingStatus(comboAppServicePlan, true);
Mono.fromCallable(() -> {
return Azure.az(AzureAppService.class).appServicePlans(selectedSubscription.getId(), false).stream().filter(asp -> asp.entity().getOperatingSystem() == null || asp.entity().getOperatingSystem() == os).collect(Collectors.toList());
}).subscribeOn(Schedulers.boundedElastic()).subscribe(appServicePlans -> {
appServicePlans.sort(Comparator.comparing(IAppServicePlan::name));
DefaultLoader.getIdeHelper().invokeLater(() -> {
setComboRefreshingStatus(comboAppServicePlan, false);
binderAppServicePlan = new ArrayList<>();
for (IAppServicePlan asp : appServicePlans) {
binderAppServicePlan.add(asp);
comboAppServicePlan.add(asp.name());
}
if (comboAppServicePlan.getItemCount() > 0) {
comboAppServicePlan.select(0);
}
String aspName = CommonUtils.getPreference(CommonUtils.ASP_NAME);
CommonUtils.selectComboIndex(comboAppServicePlan, aspName);
fillAppServicePlansDetails();
});
});
}
use of com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem in project azure-tools-for-java by Microsoft.
the class AppServiceInfoAdvancedPanel method onRuntimeChanged.
private void onRuntimeChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
final Runtime runtime = (Runtime) e.getItem();
final OperatingSystem operatingSystem = Objects.isNull(runtime) ? null : runtime.getOperatingSystem();
this.selectorServicePlan.setOperatingSystem(operatingSystem);
}
}
use of com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem in project azure-tools-for-java by Microsoft.
the class FunctionAppConfigFormPanelAdvance method createUIComponents.
private void createUIComponents() {
// TODO: place custom component creation code here
appServiceConfigPanelAdvanced = new AppServiceInfoAdvancedPanel<>(project, () -> FunctionAppConfig.builder().build());
appServiceConfigPanelAdvanced.setValidRuntime(Runtime.FUNCTION_APP_RUNTIME);
appServiceConfigPanelAdvanced.setValidPricingTier(new ArrayList<>(PricingTier.FUNCTION_PRICING), PricingTier.CONSUMPTION);
// Function does not support file deployment
appServiceConfigPanelAdvanced.setDeploymentVisible(false);
insightsConfig = ApplicationInsightsConfig.builder().newCreate(true).name(appServiceConfigPanelAdvanced.getTextName().getValue()).build();
appServiceMonitorPanel = new AppServiceMonitorPanel(project);
appServiceMonitorPanel.setWebServerLogVisible(false);
appServiceMonitorPanel.setData(MonitorConfig.builder().applicationInsightsConfig(insightsConfig).build());
appServiceConfigPanelAdvanced.getSelectorSubscription().addActionListener(event -> appServiceMonitorPanel.getApplicationInsightsComboBox().setSubscription(appServiceConfigPanelAdvanced.getSelectorSubscription().getValue()));
appServiceConfigPanelAdvanced.getSelectorRuntime().addActionListener(event -> {
final OperatingSystem operatingSystem = Optional.ofNullable(appServiceConfigPanelAdvanced.getSelectorRuntime().getValue()).map(Runtime::getOperatingSystem).orElse(null);
appServiceMonitorPanel.setApplicationLogVisible(operatingSystem == OperatingSystem.WINDOWS);
});
}
use of com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem in project azure-tools-for-java by Microsoft.
the class WebAppBasePropertyView method showProperty.
@Override
public void showProperty(WebAppProperty webAppProperty) {
txtResourceGroup.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_RESOURCE_GRP) == null ? TXT_NA : (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_RESOURCE_GRP));
txtStatus.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_STATUS) == null ? TXT_NA : (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_STATUS));
txtLocation.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_LOCATION) == null ? TXT_NA : (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_LOCATION));
txtSubscription.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_SUB_ID) == null ? TXT_NA : (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_SUB_ID));
txtAppServicePlan.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_PLAN) == null ? TXT_NA : (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_PLAN));
Object url = webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_URL);
if (url == null) {
lnkUrl.setHyperlinkText(TXT_NA);
} else {
lnkUrl.setHyperlinkText("http://" + url);
lnkUrl.setHyperlinkTarget("http://" + url);
}
txtPricingTier.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_PRICING) == null ? TXT_NA : (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_PRICING));
Object os = webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_OPERATING_SYS);
if (os != null && os instanceof OperatingSystem) {
switch((OperatingSystem) os) {
case WINDOWS:
case LINUX:
txtJavaVersion.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_JAVA_VERSION) == null ? TXT_NA : (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_JAVA_VERSION));
txtContainer.setText(webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_JAVA_CONTAINER) == null ? TXT_NA : (String) webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_JAVA_CONTAINER));
txtJavaVersion.setVisible(true);
txtContainer.setVisible(true);
lblJavaVersion.setVisible(true);
lblContainer.setVisible(true);
break;
case DOCKER:
txtJavaVersion.setVisible(false);
txtContainer.setVisible(false);
lblJavaVersion.setVisible(false);
lblContainer.setVisible(false);
break;
default:
break;
}
}
tableModel.getDataVector().removeAllElements();
cachedAppSettings.clear();
tblAppSetting.getEmptyText().setText(TABLE_EMPTY_MESSAGE);
Object appSettingsObj = webAppProperty.getValue(WebAppPropertyViewPresenter.KEY_APP_SETTING);
if (appSettingsObj != null && appSettingsObj instanceof Map) {
Map<String, String> appSettings = (Map<String, String>) appSettingsObj;
for (String key : appSettings.keySet()) {
tableModel.addRow(new String[] { key, appSettings.get(key) });
cachedAppSettings.put(key, appSettings.get(key));
}
}
updateMapStatus(editedAppSettings, cachedAppSettings);
pnlOverview.revalidate();
pnlAppSettings.revalidate();
}
Aggregations