Search in sources :

Example 1 with ChangeQuotaModel

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

the class TemplateDiskListModel method changeQuota.

private void changeQuota() {
    ArrayList<DiskImage> disks = (ArrayList<DiskImage>) getSelectedItems();
    if (disks == null || getWindow() != null) {
        return;
    }
    ChangeQuotaModel model = new ChangeQuotaModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().assignQuotaForDisk());
    model.setHelpTag(HelpTag.change_quota_disks);
    // $NON-NLS-1$
    model.setHashName("change_quota_disks");
    model.startProgress();
    model.init(disks);
    // $NON-NLS-1$
    model.getCommands().add(UICommand.createDefaultOkUiCommand("onChangeQuota", this));
    // $NON-NLS-1$
    model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
Also used : ArrayList(java.util.ArrayList) ChangeQuotaModel(org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 2 with ChangeQuotaModel

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

the class DiskListModel method changeQuota.

private void changeQuota() {
    ArrayList<DiskImage> disks = (ArrayList<DiskImage>) asImages(getSelectedItems());
    if (disks == null || getWindow() != null) {
        return;
    }
    ChangeQuotaModel model = new ChangeQuotaModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().assignQuotaForDisk());
    model.setHelpTag(HelpTag.change_quota_disks);
    // $NON-NLS-1$
    model.setHashName("change_quota_disks");
    model.startProgress();
    model.init(disks);
    // $NON-NLS-1$
    UICommand command = UICommand.createDefaultOkUiCommand("onChangeQuota", this);
    model.getCommands().add(command);
    // $NON-NLS-1$
    model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
Also used : ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ChangeQuotaModel(org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Example 3 with ChangeQuotaModel

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

the class TemplateDiskListModel method onChangeQuota.

private void onChangeQuota() {
    ChangeQuotaModel model = (ChangeQuotaModel) getWindow();
    ArrayList<ActionParametersBase> paramerterList = new ArrayList<>();
    for (Object item : model.getItems()) {
        ChangeQuotaItemModel itemModel = (ChangeQuotaItemModel) item;
        DiskImage disk = itemModel.getEntity();
        ActionParametersBase parameters = new ChangeQuotaParameters(itemModel.getQuota().getSelectedItem().getId(), disk.getId(), itemModel.getStorageDomainId(), disk.getStoragePoolId());
        paramerterList.add(parameters);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.ChangeQuotaForDisk, paramerterList, result -> cancel(), this);
}
Also used : ChangeQuotaParameters(org.ovirt.engine.core.common.action.ChangeQuotaParameters) ArrayList(java.util.ArrayList) ChangeQuotaModel(org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaModel) ChangeQuotaItemModel(org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaItemModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 4 with ChangeQuotaModel

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

the class DiskListModel method onChangeQuota.

private void onChangeQuota() {
    ChangeQuotaModel model = (ChangeQuotaModel) getWindow();
    ArrayList<ActionParametersBase> paramerterList = new ArrayList<>();
    for (ChangeQuotaItemModel item : model.getItems()) {
        DiskImage disk = item.getEntity();
        ActionParametersBase parameters = new ChangeQuotaParameters(item.getQuota().getSelectedItem().getId(), disk.getId(), item.getStorageDomainId(), disk.getStoragePoolId());
        paramerterList.add(parameters);
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.ChangeQuotaForDisk, paramerterList, result -> {
        DiskListModel localModel = (DiskListModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, this);
}
Also used : ChangeQuotaParameters(org.ovirt.engine.core.common.action.ChangeQuotaParameters) ArrayList(java.util.ArrayList) ChangeQuotaModel(org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaModel) ChangeQuotaItemModel(org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaItemModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 5 with ChangeQuotaModel

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

the class VmDiskListModel method changeQuota.

private void changeQuota() {
    ArrayList<DiskImage> disks = (ArrayList) getSelectedItems();
    if (disks == null || getWindow() != null) {
        return;
    }
    ChangeQuotaModel model = new ChangeQuotaModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().assignQuotaForDisk());
    model.setHelpTag(HelpTag.change_quota_disks);
    // $NON-NLS-1$
    model.setHashName("change_quota_disks");
    model.startProgress();
    model.init(disks);
    // $NON-NLS-1$
    model.getCommands().add(UICommand.createDefaultOkUiCommand("onChangeQuota", this));
    // $NON-NLS-1$
    model.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
Also used : ArrayList(java.util.ArrayList) ChangeQuotaModel(org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage)

Aggregations

ArrayList (java.util.ArrayList)6 DiskImage (org.ovirt.engine.core.common.businessentities.storage.DiskImage)6 ChangeQuotaModel (org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaModel)6 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)3 ChangeQuotaParameters (org.ovirt.engine.core.common.action.ChangeQuotaParameters)3 ChangeQuotaItemModel (org.ovirt.engine.ui.uicommonweb.models.quota.ChangeQuotaItemModel)3 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1