Search in sources :

Example 26 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VmListModel method onPowerAction.

private void onPowerAction(ActionType actionType, PowerActionParametersFactory<?> parametersFactory) {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        VM vm = (VM) item;
        list.add(parametersFactory.createActionParameters(vm));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(actionType, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : VM(org.ovirt.engine.core.common.businessentities.VM) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 27 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeListModel method removeVolume.

private void removeVolume() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeVolumesTitle());
    model.setHelpTag(HelpTag.remove_volume);
    // $NON-NLS-1$
    model.setHashName("remove_volume");
    if (isMetaVolumeInList(getSelectedItems())) {
        model.setNote(ConstantsManager.getInstance().getConstants().removeMetaVolumeWarning());
    } else {
        model.setNote(ConstantsManager.getInstance().getConstants().removeVolumesWarning());
    }
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<String> list = new ArrayList<>();
    for (GlusterVolumeEntity item : getSelectedItems()) {
        list.add(item.getName());
    }
    model.setItems(list);
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 28 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeListModel method onRemoveVolume.

private void onRemoveVolume() {
    if (getWindow() == null) {
        return;
    }
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
        list.add(new GlusterVolumeActionParameters(volume.getId(), false));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.DeleteGlusterVolume, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)

Example 29 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeListModel method onStop.

public void onStop() {
    if (getWindow() == null) {
        return;
    }
    ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
        list.add(new GlusterVolumeActionParameters(volume.getId(), false));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.StopGlusterVolume, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)

Example 30 with ConfirmationModel

use of org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel in project ovirt-engine by oVirt.

the class VolumeListModel method showRebalanceStatus.

private void showRebalanceStatus() {
    if (getSelectedItem() == null) {
        return;
    }
    final ConfirmationModel cModel = new ConfirmationModel();
    final GlusterVolumeEntity volumeEntity = getSelectedItem();
    setConfirmWindow(cModel);
    cModel.setTitle(ConstantsManager.getInstance().getConstants().rebalanceStatusTitle());
    // $NON-NLS-1$
    cModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
    cModel.setHelpTag(HelpTag.volume_rebalance_status);
    // $NON-NLS-1$
    cModel.setHashName("volume_rebalance_status");
    // $NON-NLS-1$
    final UICommand rebalanceStatusOk = new UICommand("closeConfirmationWindow", VolumeListModel.this);
    rebalanceStatusOk.setTitle(ConstantsManager.getInstance().getConstants().ok());
    rebalanceStatusOk.setIsCancel(true);
    cModel.getCommands().add(rebalanceStatusOk);
    AsyncDataProvider.getInstance().getGlusterRebalanceStatus(new AsyncQuery<>(returnValue -> {
        cModel.stopProgress();
        GlusterVolumeTaskStatusEntity rebalanceStatusEntity = returnValue.getReturnValue();
        if ((rebalanceStatusEntity == null) || !returnValue.getSucceeded()) {
            cModel.setMessage(ConstantsManager.getInstance().getMessages().rebalanceStatusFailed(volumeEntity.getName()));
        } else {
            setConfirmWindow(null);
            if (getWindow() == null) {
                VolumeRebalanceStatusModel rebalanceStatusModel = new VolumeRebalanceStatusModel(volumeEntity);
                rebalanceStatusModel.setTitle(ConstantsManager.getInstance().getConstants().volumeRebalanceStatusTitle());
                setWindow(rebalanceStatusModel);
                rebalanceStatusModel.setHelpTag(HelpTag.volume_rebalance_status);
                // $NON-NLS-1$
                rebalanceStatusModel.setHashName("volume_rebalance_status");
                rebalanceStatusModel.getVolume().setEntity(volumeEntity.getName());
                rebalanceStatusModel.getCluster().setEntity(volumeEntity.getClusterName());
                // $NON-NLS-1$
                UICommand stopRebalanceFromStatus = new UICommand("stop_rebalance_from_status", VolumeListModel.this);
                stopRebalanceFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRebalance());
                rebalanceStatusModel.getCommands().add(stopRebalanceFromStatus);
                rebalanceStatusModel.setStopReblanceFromStatus(stopRebalanceFromStatus);
                // $NON-NLS-1$
                UICommand cancelRebalance = new UICommand("CancelRebalanceStatus", VolumeListModel.this);
                cancelRebalance.setTitle(ConstantsManager.getInstance().getConstants().close());
                cancelRebalance.setIsCancel(true);
                rebalanceStatusModel.getCommands().add(cancelRebalance);
                rebalanceStatusModel.showStatus(rebalanceStatusEntity);
            } else {
                VolumeRebalanceStatusModel statusModel = (VolumeRebalanceStatusModel) getWindow();
                statusModel.getCommands().get(0).setIsExecutionAllowed(false);
                statusModel.showStatus(rebalanceStatusEntity);
            }
        }
    }), volumeEntity.getClusterId(), volumeEntity.getId());
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) VolumeBrickListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel) VolumeRebalanceStatusModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterVolumeUtils(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterClusterSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) List(java.util.List) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) VolumeGeneralModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel) VolumeGeoRepListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel) GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) GlusterVolumeSnapshotListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) VolumeEventListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel) VolumeParameterListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel) VolumeProfileStatisticsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel) VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) GlusterVolumeRebalanceParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) UpdateGlusterVolumeSnapshotConfigParameters(org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters) VolumeStatus(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus) VolumeRebalanceStatusModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)

Aggregations

ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)184 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)112 ArrayList (java.util.ArrayList)105 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)54 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)23 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)22 List (java.util.List)21 ActionType (org.ovirt.engine.core.common.action.ActionType)20 Frontend (org.ovirt.engine.ui.frontend.Frontend)20 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)20 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)20 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)20 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)18 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)17 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)17 QueryType (org.ovirt.engine.core.common.queries.QueryType)17 Guid (org.ovirt.engine.core.compat.Guid)17 Model (org.ovirt.engine.ui.uicommonweb.models.Model)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)14