Search in sources :

Example 86 with ConfirmationModel

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

the class VolumeBrickListModel method stopRemoveBricks.

private void stopRemoveBricks() {
    if (getConfirmWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setConfirmWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksTitle());
    model.setMessage(ConstantsManager.getInstance().getConstants().stopRemoveBricksMessage());
    model.setHelpTag(HelpTag.volume_remove_bricks_stop);
    // $NON-NLS-1$
    model.setHashName("volume_remove_bricks_stop");
    GlusterVolumeEntity volumeEntity = getVolumeEntity();
    GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask();
    ArrayList<String> list = new ArrayList<>();
    for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
        if (brick.getAsyncTask() != null && volumeTask != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volumeTask.getTaskId()) && volumeTask.getStatus() == JobExecutionStatus.STARTED) {
            list.add(brick.getQualifiedName());
        }
    }
    model.setItems(list);
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnStopRemoveBricks", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = new UICommand("CancelConfirmation", this);
    cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close());
    cancelCommand.setIsCancel(true);
    model.getCommands().add(cancelCommand);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 87 with ConfirmationModel

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

the class VolumeBrickListModel method commitRemoveBricks.

private void commitRemoveBricks() {
    if (getConfirmWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setConfirmWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksTitle());
    model.setMessage(ConstantsManager.getInstance().getConstants().commitRemoveBricksMessage());
    model.setHelpTag(HelpTag.volume_remove_bricks_commit);
    // $NON-NLS-1$
    model.setHashName("volume_remove_bricks_commit");
    GlusterVolumeEntity volumeEntity = getVolumeEntity();
    GlusterAsyncTask volumeTask = volumeEntity.getAsyncTask();
    ArrayList<String> list = new ArrayList<>();
    for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
        if (brick.getAsyncTask() != null && volumeTask != null && brick.getAsyncTask().getTaskId() != null && brick.getAsyncTask().getTaskId().equals(volumeTask.getTaskId()) && volumeTask.getStatus() == JobExecutionStatus.FINISHED) {
            list.add(brick.getQualifiedName());
        }
    }
    model.setItems(list);
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnCommitRemoveBricks", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("CancelConfirmation", this);
    model.getCommands().add(cancelCommand);
}
Also used : GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 88 with ConfirmationModel

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

the class VolumeBrickListModel method showRemoveBricksStatus.

private void showRemoveBricksStatus() {
    final GlusterVolumeEntity volumeEntity = getVolumeEntity();
    final ArrayList<GlusterBrickEntity> bricks = new ArrayList<>();
    for (GlusterBrickEntity brick : volumeEntity.getBricks()) {
        if (brick.getAsyncTask() != null && brick.getAsyncTask().getTaskId() != null) {
            bricks.add(brick);
        }
    }
    final ConfirmationModel cModel = new ConfirmationModel();
    cModel.setHelpTag(HelpTag.volume_remove_bricks_status);
    // //$NON-NLS-1$
    cModel.setHashName("volume_remove_bricks_status");
    // $NON-NLS-1$
    UICommand removeBrickStatusOk = new UICommand("CancelConfirmation", VolumeBrickListModel.this);
    removeBrickStatusOk.setTitle(ConstantsManager.getInstance().getConstants().ok());
    removeBrickStatusOk.setIsCancel(true);
    cModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
    cModel.getCommands().add(removeBrickStatusOk);
    cModel.setTitle(ConstantsManager.getInstance().getConstants().removeBricksStatusTitle());
    setConfirmWindow(cModel);
    // $NON-NLS-1$
    final UICommand stopRemoveBrickFromStatus = new UICommand("StopRemoveBricksOnStatus", this);
    stopRemoveBrickFromStatus.setTitle(ConstantsManager.getInstance().getConstants().stopRemoveBricksButton());
    stopRemoveBrickFromStatus.setIsExecutionAllowed(false);
    // $NON-NLS-1$
    final UICommand commitRemoveBrickFromStatus = new UICommand("CommitRemoveBricksOnStatus", this);
    commitRemoveBrickFromStatus.setTitle(ConstantsManager.getInstance().getConstants().commitRemoveBricksButton());
    commitRemoveBrickFromStatus.setIsExecutionAllowed(false);
    // $NON-NLS-1$
    final UICommand retainBricksFromStatus = new UICommand("RetainBricksOnStatus", this);
    retainBricksFromStatus.setTitle(ConstantsManager.getInstance().getConstants().retainBricksButton());
    retainBricksFromStatus.setIsExecutionAllowed(false);
    // $NON-NLS-1$
    final UICommand cancelCommand = new UICommand("CancelRemoveBricksStatus", this);
    cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().close());
    cancelCommand.setIsCancel(true);
    AsyncDataProvider.getInstance().getGlusterRemoveBricksStatus(new AsyncQuery<>(returnValue -> {
        cModel.stopProgress();
        if (returnValue.getSucceeded() && returnValue.getReturnValue() != null) {
            cancelConfirmation();
            RemoveBrickStatusModel removeBrickStatusModel;
            GlusterVolumeTaskStatusEntity removeBrickStatusEntity = returnValue.getReturnValue();
            if (getWindow() == null) {
                removeBrickStatusModel = new RemoveBrickStatusModel(volumeEntity, bricks);
                removeBrickStatusModel.setTitle(ConstantsManager.getInstance().getConstants().removeBricksStatusTitle());
                removeBrickStatusModel.setHelpTag(HelpTag.volume_remove_bricks_status);
                // //$NON-NLS-1$
                removeBrickStatusModel.setHashName("volume_remove_bricks_status");
                setWindow(removeBrickStatusModel);
                removeBrickStatusModel.getVolume().setEntity(volumeEntity.getName());
                removeBrickStatusModel.getCluster().setEntity(volumeEntity.getClusterName());
                removeBrickStatusModel.addStopRemoveBricksCommand(stopRemoveBrickFromStatus);
                removeBrickStatusModel.addCommitRemoveBricksCommand(commitRemoveBrickFromStatus);
                removeBrickStatusModel.addRetainBricksCommand(retainBricksFromStatus);
                removeBrickStatusModel.getCommands().add(cancelCommand);
            } else {
                removeBrickStatusModel = (RemoveBrickStatusModel) getWindow();
            }
            removeBrickStatusModel.showStatus(removeBrickStatusEntity);
        } else {
            cModel.setMessage(ConstantsManager.getInstance().getMessages().removeBrickStatusFailed(volumeEntity.getName()));
        }
    }), volumeEntity.getClusterId(), volumeEntity.getId(), bricks);
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) GlusterVolumeReplaceBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterVolumeBricksActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeResetBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeResetBrickActionParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) 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) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity)

Example 89 with ConfirmationModel

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

the class GlusterVolumeSnapshotListModel method runAction.

private void runAction(ActionType action, ActionParametersBase param) {
    if (getConfirmWindow() == null) {
        return;
    }
    final ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    model.startProgress();
    Frontend.getInstance().runAction(action, param, result -> {
        model.stopProgress();
        setConfirmWindow(null);
    });
}
Also used : ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 90 with ConfirmationModel

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

the class GlusterVolumeSnapshotListModel method deleteSnapshot.

private void deleteSnapshot() {
    if (getSelectedItems() == null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    List<GlusterVolumeSnapshotEntity> snapshots = getSelectedItems();
    StringBuilder snapshotNames = new StringBuilder();
    for (GlusterVolumeSnapshotEntity snapshot : snapshots) {
        snapshotNames.append(snapshot.getSnapshotName());
        // $NON-NLS-1$
        snapshotNames.append("\n");
    }
    setConfirmWindow(model);
    model.setTitle(ConstantsManager.getInstance().getMessages().confirmRemoveSnapshot(getEntity().getName()));
    model.setHelpTag(HelpTag.volume_delete_snapshot_confirmation);
    // $NON-NLS-1$
    model.setHashName("volume_delete_snapshot_confirmation");
    model.setMessage(ConstantsManager.getInstance().getMessages().confirmVolumeSnapshotDeleteMessage(snapshotNames.toString()));
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("onDeleteSnapshot", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("cancelConfirmation", this);
    model.getCommands().add(cancelCommand);
}
Also used : GlusterVolumeSnapshotEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

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