Search in sources :

Example 1 with RemoveDiskModel

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

the class DiskListModel method remove.

private void remove() {
    if (getWindow() != null) {
        return;
    }
    RemoveDiskModel model = new RemoveDiskModel();
    setWindow(model);
    model.initialize(null, getSelectedItems(), this);
    model.getLatch().setIsAvailable(false);
}
Also used : RemoveDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel)

Example 2 with RemoveDiskModel

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

the class DiskListModel method onRemove.

private void onRemove() {
    RemoveDiskModel model = (RemoveDiskModel) getWindow();
    ArrayList<ActionParametersBase> parameterList = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        Disk disk = (Disk) item;
        ActionParametersBase parameters = new RemoveDiskParameters(disk.getId());
        parameterList.add(parameters);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveDisk, parameterList, result -> {
        DiskListModel localModel = (DiskListModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, this);
}
Also used : RemoveDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel) ArrayList(java.util.ArrayList) CinderDisk(org.ovirt.engine.core.common.businessentities.storage.CinderDisk) Disk(org.ovirt.engine.core.common.businessentities.storage.Disk) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Example 3 with RemoveDiskModel

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

the class StorageDiskListModel method remove.

private void remove() {
    if (getWindow() != null) {
        return;
    }
    RemoveDiskModel model = new RemoveDiskModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeDisksTitle());
    model.setHelpTag(HelpTag.remove_disk);
    // $NON-NLS-1$
    model.setHashName("remove_disk");
    model.getLatch().setIsAvailable(false);
    List<DiskModel> items = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        DiskImage disk = (DiskImage) item;
        DiskModel diskModel = new DiskModel();
        diskModel.setDisk(disk);
        items.add(diskModel);
    }
    model.setItems(items);
    // $NON-NLS-1$
    UICommand onRemoveCommand = UICommand.createDefaultOkUiCommand("OnRemove", this);
    model.getCommands().add(onRemoveCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(cancelCommand);
}
Also used : RemoveDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel) DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) RemoveDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 4 with RemoveDiskModel

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

the class StorageDiskListModel method onRemove.

private void onRemove() {
    RemoveDiskModel model = (RemoveDiskModel) getWindow();
    List<ActionParametersBase> paramerterList = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        DiskImage disk = (DiskImage) item;
        ActionParametersBase parameters = new RemoveDiskParameters(disk.getId(), getEntity().getId());
        paramerterList.add(parameters);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveDisk, paramerterList, result -> {
        StorageDiskListModel localModel = (StorageDiskListModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, this);
}
Also used : RemoveDiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel) ArrayList(java.util.ArrayList) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Aggregations

RemoveDiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.RemoveDiskModel)4 ArrayList (java.util.ArrayList)3 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 RemoveDiskParameters (org.ovirt.engine.core.common.action.RemoveDiskParameters)2 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)2 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)1 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 DiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel)1