Search in sources :

Example 1 with AzureArtifact

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.

the class WebAppSlimSettingPanel method resetFromConfig.

@Override
protected void resetFromConfig(@NotNull WebAppConfiguration configuration) {
    if (!StringUtils.isAllEmpty(configuration.getWebAppName(), configuration.getWebAppId())) {
        final WebAppComboBoxModel configModel = new WebAppComboBoxModel(configuration.getModel());
        comboBoxWebApp.setConfigModel(configModel);
    }
    if (configuration.getAzureArtifactType() != null) {
        final AzureArtifact artifact = AzureArtifactManager.getInstance(this.project).getAzureArtifactById(configuration.getAzureArtifactType(), configuration.getArtifactIdentifier());
        comboBoxArtifact.setArtifact(artifact);
    }
    if (configuration.getWebAppId() != null && configuration.isDeployToSlot()) {
        toggleSlotPanel(true);
        chkDeployToSlot.setSelected(true);
        final boolean useNewDeploymentSlot = StringUtils.equals(configuration.getSlotName(), Constants.CREATE_NEW_SLOT);
        rbtNewSlot.setSelected(useNewDeploymentSlot);
        rbtExistingSlot.setSelected(!useNewDeploymentSlot);
        toggleSlotType(!useNewDeploymentSlot);
        txtNewSlotName.setText(configuration.getNewSlotName());
        cbxSlotName.addItem(useNewDeploymentSlot ? configuration.getNewSlotName() : configuration.getSlotName());
        cbxSlotConfigurationSource.addItem(configuration.getNewSlotConfigurationSource());
    } else {
        toggleSlotPanel(false);
        chkDeployToSlot.setSelected(false);
    }
    final DateFormat df = new SimpleDateFormat("yyMMddHHmmss");
    final String defaultSlotName = StringUtils.isEmpty(configuration.getNewSlotName()) ? String.format(DEFAULT_SLOT_NAME, df.format(new Date())) : configuration.getNewSlotName();
    txtNewSlotName.setText(defaultSlotName);
    chkToRoot.setSelected(configuration.isDeployToRoot());
    chkOpenBrowser.setSelected(configuration.isOpenBrowserAfterDeployment());
    slotDecorator.setOn(configuration.isSlotPanelVisible());
}
Also used : WebAppComboBoxModel(com.microsoft.azure.toolkit.intellij.webapp.WebAppComboBoxModel) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date)

Example 2 with AzureArtifact

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.

the class SpringCloudDeploymentConfigurationPanel method onArtifactChanged.

private void onArtifactChanged(final ItemEvent e) {
    final DataContext context = DataManager.getInstance().getDataContext(getContentPanel());
    final ConfigurationSettingsEditorWrapper editor = ConfigurationSettingsEditorWrapper.CONFIGURATION_EDITOR_KEY.getData(context);
    final AzureArtifact artifact = (AzureArtifact) e.getItem();
    if (Objects.nonNull(editor) && Objects.nonNull(artifact)) {
        if (e.getStateChange() == ItemEvent.DESELECTED) {
            BeforeRunTaskUtils.removeBeforeRunTask(editor, artifact);
        }
        if (e.getStateChange() == ItemEvent.SELECTED) {
            BeforeRunTaskUtils.addBeforeRunTask(editor, artifact, this.configuration);
        }
    }
}
Also used : DataContext(com.intellij.openapi.actionSystem.DataContext) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) ConfigurationSettingsEditorWrapper(com.intellij.execution.impl.ConfigurationSettingsEditorWrapper)

Example 3 with AzureArtifact

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.

the class AppServiceInfoBasicPanel method getData.

@SneakyThrows
@Override
public T getData() {
    final String name = this.textName.getValue();
    final Runtime platform = this.selectorRuntime.getValue();
    final AzureArtifact artifact = this.selectorApplication.getValue();
    final T result = (T) (this.config == null ? initConfig() : this.config).toBuilder().build();
    result.setName(name);
    result.setRuntime(platform);
    if (Objects.nonNull(artifact)) {
        final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
        final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
        result.setApplication(Paths.get(path));
    }
    this.config = result;
    return result;
}
Also used : Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) SneakyThrows(lombok.SneakyThrows)

Example 4 with AzureArtifact

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.

the class AppServiceInfoAdvancedPanel method getData.

@Override
public T getData() {
    final Subscription subscription = this.selectorSubscription.getValue();
    final ResourceGroup resourceGroup = this.selectorGroup.getValue();
    final String name = this.textName.getValue();
    final Runtime runtime = this.selectorRuntime.getValue();
    final Region region = this.selectorRegion.getValue();
    final AppServicePlanEntity servicePlan = this.selectorServicePlan.getValue();
    final AzureArtifact artifact = this.selectorApplication.getValue();
    final T config = supplier.get();
    config.setSubscription(subscription);
    config.setResourceGroup(resourceGroup);
    config.setName(name);
    config.setRuntime(runtime);
    config.setRegion(region);
    config.setServicePlan(servicePlan);
    if (Objects.nonNull(artifact)) {
        final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
        final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
        config.setApplication(Paths.get(path));
    }
    return config;
}
Also used : Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) AppServicePlanEntity(com.microsoft.azure.toolkit.lib.appservice.entity.AppServicePlanEntity) Region(com.microsoft.azure.toolkit.lib.common.model.Region) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) ResourceGroup(com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)

Example 5 with AzureArtifact

use of com.microsoft.azure.toolkit.intellij.common.AzureArtifact in project azure-tools-for-java by Microsoft.

the class SpringCloudDeploymentConfigurationPanel method getData.

public SpringCloudAppConfig getData(SpringCloudAppConfig appConfig) {
    final SpringCloudDeploymentConfig deploymentConfig = appConfig.getDeployment();
    appConfig.setSubscriptionId(this.selectorSubscription.getValue().getId());
    appConfig.setClusterName(this.selectorCluster.getValue().name());
    appConfig.setAppName(this.selectorApp.getValue().name());
    final AzureArtifact artifact = this.selectorArtifact.getValue();
    deploymentConfig.setArtifact(new WrappedAzureArtifact(this.selectorArtifact.getValue(), this.project));
    return appConfig;
}
Also used : AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) SpringCloudDeploymentConfig(com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig)

Aggregations

AzureArtifact (com.microsoft.azure.toolkit.intellij.common.AzureArtifact)5 AzureArtifactManager (com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager)2 Runtime (com.microsoft.azure.toolkit.lib.appservice.model.Runtime)2 ConfigurationSettingsEditorWrapper (com.intellij.execution.impl.ConfigurationSettingsEditorWrapper)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 WebAppComboBoxModel (com.microsoft.azure.toolkit.intellij.webapp.WebAppComboBoxModel)1 AppServicePlanEntity (com.microsoft.azure.toolkit.lib.appservice.entity.AppServicePlanEntity)1 Region (com.microsoft.azure.toolkit.lib.common.model.Region)1 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)1 Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)1 SpringCloudDeploymentConfig (com.microsoft.azure.toolkit.lib.springcloud.config.SpringCloudDeploymentConfig)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 SneakyThrows (lombok.SneakyThrows)1