Search in sources :

Example 11 with IWebApp

use of com.microsoft.azure.toolkit.lib.appservice.service.IWebApp in project azure-tools-for-java by Microsoft.

the class WebAppDeployDialog method validated.

private boolean validated() {
    setErrorMessage(null);
    int selectedRow = table.getSelectionIndex();
    Button okButton = getButton(IDialogConstants.OK_ID);
    if (selectedRow < 0) {
        okButton.setEnabled(false);
        return false;
    }
    String appServiceName = table.getItems()[selectedRow].getText(0);
    IWebApp wad = webAppDetailsMap.get(appServiceName);
    if (wad != null && Objects.equals(wad.getRuntime().getJavaVersion(), JavaVersion.OFF)) {
        setErrorMessage("Select java based App Service");
        okButton.setEnabled(false);
        return false;
    }
    okButton.setEnabled(true);
    return true;
}
Also used : Button(org.eclipse.swt.widgets.Button) Point(org.eclipse.swt.graphics.Point) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Example 12 with IWebApp

use of com.microsoft.azure.toolkit.lib.appservice.service.IWebApp in project azure-tools-for-java by Microsoft.

the class WebAppDeployDialog method showFtpCreadentialsWindow.

private void showFtpCreadentialsWindow() {
    int selectedRow = table.getSelectionIndex();
    if (selectedRow < 0) {
        return;
    }
    String appServiceName = table.getItems()[selectedRow].getText(0);
    IWebApp webApp = webAppDetailsMap.get(appServiceName);
    FtpCredentialsWindow w = new FtpCredentialsWindow(getShell(), webApp);
    w.open();
}
Also used : Point(org.eclipse.swt.graphics.Point) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Example 13 with IWebApp

use of com.microsoft.azure.toolkit.lib.appservice.service.IWebApp in project azure-tools-for-java by Microsoft.

the class WebAppDeployDialog method doFillTable.

private void doFillTable(boolean forceRefresh) {
    try {
        webAppDetailsMap.clear();
        table.removeAll();
        TableItem refreshingItem = new TableItem(table, SWT.NULL);
        refreshingItem.setText(REFRESHING);
        Mono.fromCallable(() -> {
            return Azure.az(AzureAppService.class).webapps(forceRefresh).stream().filter(webApp -> !webApp.getRuntime().isDocker() && !Objects.equals(webApp.getRuntime().getJavaVersion(), JavaVersion.OFF)).sorted((o1, o2) -> o1.name().compareTo(o2.name())).collect(Collectors.toList());
        }).subscribeOn(Schedulers.boundedElastic()).subscribe(webAppDetailsList -> {
            DefaultLoader.getIdeHelper().invokeLater(() -> {
                table.removeAll();
                for (IWebApp webApp : webAppDetailsList) {
                    TableItem item = new TableItem(table, SWT.NULL);
                    item.setText(new String[] { webApp.name(), webApp.getRuntime().getWebContainer().getValue(), webApp.getRuntime().getJavaVersion().getValue(), webApp.resourceGroup() });
                    webAppDetailsMap.put(webApp.name(), webApp);
                }
                fillUserSettings();
            });
        });
    } catch (Exception e) {
        LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "updateAndFillTable@AppServiceCreateDialog", e));
    }
}
Also used : HttpURLConnection(java.net.HttpURLConnection) Azure(com.microsoft.azure.toolkit.lib.Azure) DefaultToolTip(org.eclipse.jface.window.DefaultToolTip) IDialogConstants(org.eclipse.jface.dialogs.IDialogConstants) FocusEvent(org.eclipse.swt.events.FocusEvent) Point(org.eclipse.swt.graphics.Point) CommonUtils(com.microsoft.azuretools.webapp.util.CommonUtils) PluginUtil(com.microsoft.azuretools.core.utils.PluginUtil) Composite(org.eclipse.swt.widgets.Composite) Map(java.util.Map) REFRESH_METADATA(com.microsoft.azuretools.telemetry.TelemetryConstants.REFRESH_METADATA) MessageDialog(org.eclipse.jface.dialogs.MessageDialog) IWebAppDeploymentSlot(com.microsoft.azure.toolkit.lib.appservice.service.IWebAppDeploymentSlot) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Text(org.eclipse.swt.widgets.Text) ILog(org.eclipse.core.runtime.ILog) PlatformUI(org.eclipse.ui.PlatformUI) Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) UpdateProgressIndicator(com.microsoft.azuretools.core.utils.UpdateProgressIndicator) ErrorType(com.microsoft.azuretools.telemetrywrapper.ErrorType) Status(org.eclipse.core.runtime.Status) JavaVersion(com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion) CountDownLatch(java.util.concurrent.CountDownLatch) Window(org.eclipse.jface.window.Window) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) SWT(org.eclipse.swt.SWT) EventUtil(com.microsoft.azuretools.telemetrywrapper.EventUtil) SimpleDateFormat(java.text.SimpleDateFormat) CREATE_WEBAPP_SLOT(com.microsoft.azuretools.telemetry.TelemetryConstants.CREATE_WEBAPP_SLOT) IProject(org.eclipse.core.resources.IProject) IDataModel(org.eclipse.wst.common.frameworks.datamodel.IDataModel) ErrorWindow(com.microsoft.azuretools.core.ui.ErrorWindow) DefaultLoader(com.microsoft.tooling.msservices.components.DefaultLoader) WebComponentExportDataModelProvider(org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentExportDataModelProvider) GridData(org.eclipse.swt.layout.GridData) RowData(org.eclipse.swt.layout.RowData) Link(org.eclipse.swt.widgets.Link) IWebAppBase(com.microsoft.azure.toolkit.lib.appservice.service.IWebAppBase) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) TableItem(org.eclipse.swt.widgets.TableItem) Shell(org.eclipse.swt.widgets.Shell) DELETE_WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.DELETE_WEBAPP) IOException(java.io.IOException) Mono(reactor.core.publisher.Mono) DataModelFactory(org.eclipse.wst.common.frameworks.datamodel.DataModelFactory) File(java.io.File) ProgressDialog(com.microsoft.azuretools.core.utils.ProgressDialog) ScrolledComposite(org.eclipse.swt.custom.ScrolledComposite) GridLayout(org.eclipse.swt.layout.GridLayout) Activator(com.microsoft.azuretools.webapp.Activator) URL(java.net.URL) Date(java.util.Date) DEPLOY_WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.DEPLOY_WEBAPP) TableColumn(org.eclipse.swt.widgets.TableColumn) MavenUtils(com.microsoft.azuretools.core.utils.MavenUtils) IncrementalProjectBuilder(org.eclipse.core.resources.IncrementalProjectBuilder) IStatus(org.eclipse.core.runtime.IStatus) WebContainer(com.microsoft.azure.toolkit.lib.appservice.model.WebContainer) AzureWebAppMvpModel(com.microsoft.azuretools.core.mvp.model.webapp.AzureWebAppMvpModel) Button(org.eclipse.swt.widgets.Button) Operation(com.microsoft.azuretools.telemetrywrapper.Operation) UUID(java.util.UUID) Display(org.eclipse.swt.widgets.Display) Collectors(java.util.stream.Collectors) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) Objects(java.util.Objects) List(java.util.List) AzureDeploymentProgressNotification(com.microsoft.azuretools.core.ui.views.AzureDeploymentProgressNotification) Optional(java.util.Optional) Label(org.eclipse.swt.widgets.Label) WEBAPP(com.microsoft.azuretools.telemetry.TelemetryConstants.WEBAPP) ControlDecoration(org.eclipse.jface.fieldassist.ControlDecoration) OPEN_CREATEWEBAPP_DIALOG(com.microsoft.azuretools.telemetry.TelemetryConstants.OPEN_CREATEWEBAPP_DIALOG) Image(org.eclipse.swt.graphics.Image) HashMap(java.util.HashMap) Table(org.eclipse.swt.widgets.Table) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp) FocusListener(org.eclipse.swt.events.FocusListener) IAppServicePlan(com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan) Schedulers(reactor.core.scheduler.Schedulers) FillLayout(org.eclipse.swt.layout.FillLayout) AzureAppService(com.microsoft.azure.toolkit.lib.appservice.AzureAppService) Combo(org.eclipse.swt.widgets.Combo) Job(org.eclipse.core.runtime.jobs.Job) IJ2EEComponentExportDataModelProperties(org.eclipse.jst.j2ee.datamodel.properties.IJ2EEComponentExportDataModelProperties) Group(org.eclipse.swt.widgets.Group) StringUtils(com.microsoft.azuretools.adauth.StringUtils) RowLayout(org.eclipse.swt.layout.RowLayout) EventType(com.microsoft.azuretools.telemetrywrapper.EventType) AccessibilityUtils(com.microsoft.azuretools.core.utils.AccessibilityUtils) TelemetryConstants(com.microsoft.azuretools.telemetry.TelemetryConstants) AppServiceBaseEntity(com.microsoft.azure.toolkit.lib.appservice.entity.AppServiceBaseEntity) AppInsightsClient(com.microsoft.azuretools.telemetry.AppInsightsClient) TelemetryManager(com.microsoft.azuretools.telemetrywrapper.TelemetryManager) SelectionEvent(org.eclipse.swt.events.SelectionEvent) FocusAdapter(org.eclipse.swt.events.FocusAdapter) WebAppSettingModel(com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel) Control(org.eclipse.swt.widgets.Control) Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) AzureAppService(com.microsoft.azure.toolkit.lib.appservice.AzureAppService) TableItem(org.eclipse.swt.widgets.TableItem) IOException(java.io.IOException) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Example 14 with IWebApp

use of com.microsoft.azure.toolkit.lib.appservice.service.IWebApp in project azure-tools-for-java by Microsoft.

the class WebAppModule method createListener.

private void createListener() {
    String id = "WebAppModule";
    AzureUIRefreshListener listener = new AzureUIRefreshListener() {

        @Override
        public void run() {
            if (event.opsType == AzureUIRefreshEvent.EventType.SIGNIN || event.opsType == AzureUIRefreshEvent.EventType.SIGNOUT) {
                removeAllChildNodes();
            } else if (event.object instanceof IWebApp && (event.opsType == AzureUIRefreshEvent.EventType.UPDATE || event.opsType == AzureUIRefreshEvent.EventType.REMOVE)) {
                if (hasChildNodes()) {
                    load(true);
                }
            } else if (event.object instanceof IWebApp && event.opsType == AzureUIRefreshEvent.EventType.REFRESH) {
                load(true);
            }
        }
    };
    AzureUIRefreshCore.addListener(id, listener);
}
Also used : AzureUIRefreshListener(com.microsoft.azuretools.utils.AzureUIRefreshListener) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Example 15 with IWebApp

use of com.microsoft.azure.toolkit.lib.appservice.service.IWebApp in project azure-tools-for-java by Microsoft.

the class WebAppPropertyViewPresenter method updateAppSettings.

@Override
protected void updateAppSettings(@NotNull final String sid, @NotNull final String webAppId, @Nullable final String name, final Map toUpdate, final Set toRemove) {
    final IWebApp webApp = getWebAppBase(sid, webAppId, name);
    final IAppServiceUpdater appServiceUpdater = webApp.update();
    appServiceUpdater.withAppSettings(toUpdate);
    toRemove.forEach(key -> appServiceUpdater.withoutAppSettings((String) key));
    appServiceUpdater.commit();
}
Also used : IAppServiceUpdater(com.microsoft.azure.toolkit.lib.appservice.service.IAppServiceUpdater) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Aggregations

IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)24 Point (org.eclipse.swt.graphics.Point)8 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)5 Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)5 PrivateRegistryImageSetting (com.microsoft.azuretools.core.mvp.model.webapp.PrivateRegistryImageSetting)5 IWebAppDeploymentSlot (com.microsoft.azure.toolkit.lib.appservice.service.IWebAppDeploymentSlot)4 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)4 IOException (java.io.IOException)4 AzureAppService (com.microsoft.azure.toolkit.lib.appservice.AzureAppService)3 PricingTier (com.microsoft.azure.toolkit.lib.appservice.model.PricingTier)3 Region (com.microsoft.azure.toolkit.lib.common.model.Region)3 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)3 Operation (com.microsoft.azuretools.telemetrywrapper.Operation)3 FileNotFoundException (java.io.FileNotFoundException)3 ISecureStore (com.microsoft.azure.toolkit.ide.common.store.ISecureStore)2 WebAppSettingModel (com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel)2 AzureUIRefreshEvent (com.microsoft.azuretools.utils.AzureUIRefreshEvent)2 DefaultDockerClient (com.spotify.docker.client.DefaultDockerClient)2 DockerClient (com.spotify.docker.client.DockerClient)2 Path (java.nio.file.Path)2