Search in sources :

Example 21 with DiskModel

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

the class TemplateStorageListModel method remove.

private void remove() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeTemplateDisksTitle());
    model.setHelpTag(HelpTag.remove_template_disks);
    // $NON-NLS-1$
    model.setHashName("remove_template_disks");
    List<? extends Object> disks = getSelectedItems() != null ? getSelectedItems() : new ArrayList<DiskModel>();
    List<String> items = new ArrayList<>();
    for (Object o : disks) {
        DiskModel diskModel = (DiskModel) o;
        items.add(ConstantsManager.getInstance().getMessages().templateDiskDescription(diskModel.getDisk().getDiskAlias(), diskModel.getStorageDomain().getSelectedItem().getStorageName()));
    }
    model.setItems(items);
    // $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 : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 22 with DiskModel

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

the class TemplateStorageListModel method onRemove.

private void onRemove() {
    ConfirmationModel model = (ConfirmationModel) getWindow();
    List<ActionParametersBase> parameters = new ArrayList<>();
    List<? extends Object> disks = getSelectedItems() != null ? getSelectedItems() : new ArrayList<DiskModel>();
    for (Object o : disks) {
        DiskModel diskModel = (DiskModel) o;
        RemoveDiskParameters params = new RemoveDiskParameters(diskModel.getDisk().getId(), diskModel.getStorageDomain().getSelectedItem().getId());
        parameters.add(params);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveDisk, parameters, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
    cancel();
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) ArrayList(java.util.ArrayList) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) RemoveDiskParameters(org.ovirt.engine.core.common.action.RemoveDiskParameters)

Example 23 with DiskModel

use of org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel 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 24 with DiskModel

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

the class StoragesTree method getEntityId.

protected Object getEntityId(Object entity) {
    DiskModel diskModel = (DiskModel) entity;
    StorageDomain storageDomain = diskModel.getStorageDomain().getSelectedItem();
    return ((DiskImage) diskModel.getDisk()).getImageId().toString() + storageDomain.getId().toString();
}
Also used : DiskModel(org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

DiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.DiskModel)24 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)13 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)9 ArrayList (java.util.ArrayList)8 DiskProfile (org.ovirt.engine.core.common.businessentities.profiles.DiskProfile)4 Guid (org.ovirt.engine.core.compat.Guid)4 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)4 Disk (org.ovirt.engine.core.common.businessentities.storage.Disk)3 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)3 AttachDiskModel (org.ovirt.engine.ui.uicommonweb.models.vms.AttachDiskModel)3 I18NNameValidation (org.ovirt.engine.ui.uicommonweb.validation.I18NNameValidation)3 NotEmptyValidation (org.ovirt.engine.ui.uicommonweb.validation.NotEmptyValidation)3 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 CinderDisk (org.ovirt.engine.core.common.businessentities.storage.CinderDisk)2 LunDisk (org.ovirt.engine.core.common.businessentities.storage.LunDisk)2 VolumeFormat (org.ovirt.engine.core.common.businessentities.storage.VolumeFormat)2 VolumeType (org.ovirt.engine.core.common.businessentities.storage.VolumeType)2 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)2