Search in sources :

Example 11 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class VolumeListModel method onStopRebalance.

private void onStopRebalance() {
    ConfirmationModel model = (ConfirmationModel) getConfirmWindow();
    if (model.getProgress() != null) {
        return;
    }
    if (getSelectedItems() == null) {
        return;
    }
    model.startProgress();
    final GlusterVolumeEntity volumeEntity = getSelectedItem();
    GlusterVolumeRebalanceParameters param = new GlusterVolumeRebalanceParameters(volumeEntity.getId(), false, false);
    Frontend.getInstance().runAction(ActionType.StopRebalanceGlusterVolume, param, result -> {
        ConfirmationModel localModel = (ConfirmationModel) getConfirmWindow();
        localModel.stopProgress();
        setConfirmWindow(null);
        if (result.getReturnValue().getSucceeded()) {
            showRebalanceStatus();
        }
    });
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) GlusterVolumeRebalanceParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters)

Example 12 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class VolumeListModel method stop.

private void stop() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().confirmStopVolume());
    model.setHelpTag(HelpTag.volume_stop);
    // $NON-NLS-1$
    model.setHashName("volume_stop");
    model.setMessage(ConstantsManager.getInstance().getConstants().stopVolumeMessage());
    if (isMetaVolumeInList(getSelectedItems())) {
        model.setNote(ConstantsManager.getInstance().getConstants().stopMetaVolumeWarning());
    } else {
        model.setNote(ConstantsManager.getInstance().getConstants().stopVolumeWarning());
    }
    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("onStop", 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 13 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class VolumeListModel method startRebalance.

private void startRebalance() {
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Object item : getSelectedItems()) {
        GlusterVolumeEntity volume = (GlusterVolumeEntity) item;
        list.add(new GlusterVolumeRebalanceParameters(volume.getId(), false, false));
    }
    Frontend.getInstance().runMultipleAction(ActionType.StartRebalanceGlusterVolume, list, null, true, true);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) GlusterVolumeRebalanceParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters)

Example 14 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class MainVolumeView method initTable.

void initTable(VolumeListModel model) {
    getTable().enableColumnResizing();
    VolumeStatusColumn statusColumn = new VolumeStatusColumn(model.getStartCommand());
    statusColumn.setContextMenuTitle(constants.statusVolume());
    statusColumn.makeSortable(Comparator.comparingInt(g -> GlusterVolumeUtils.getVolumeStatus(g).ordinal()));
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.empty(), "30px");
    AbstractTextColumn<GlusterVolumeEntity> nameColumn = new AbstractLinkColumn<GlusterVolumeEntity>(new FieldUpdater<GlusterVolumeEntity, String>() {

        @Override
        public void update(int index, GlusterVolumeEntity volume, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), volume.getName());
            // The link was clicked, now fire an event to switch to details.
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.volumeGeneralSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(GlusterVolumeEntity object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameVolume(), "150px");
    AbstractTextColumn<GlusterVolumeEntity> clusterColumn = new AbstractTextColumn<GlusterVolumeEntity>() {

        @Override
        public String getValue(GlusterVolumeEntity object) {
            return object.getClusterName();
        }
    };
    clusterColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(clusterColumn, constants.clusterVolume(), "150px");
    AbstractTextColumn<GlusterVolumeEntity> volumeTypeColumn = new AbstractEnumColumn<GlusterVolumeEntity, GlusterVolumeType>() {

        @Override
        protected GlusterVolumeType getRawValue(GlusterVolumeEntity object) {
            return object.getVolumeType();
        }
    };
    volumeTypeColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(volumeTypeColumn, constants.volumeTypeVolume(), "150px");
    // $NON-NLS-1$
    getTable().addColumn(new VolumeBrickStatusColumn(), constants.bricksStatusVolume(), "150px");
    // $NON-NLS-1$
    getTable().addColumn(new VolumeInfoColumn(), constants.volumeInfoVolume(), "100px");
    MenuCell<GlusterTaskSupport> rebalanceMenuCell = getRebalanceActivityMenu();
    MenuCell<GlusterTaskSupport> removeBricksMenuCell = getRemoveBrickActivityMenu();
    List<HasCell<GlusterTaskSupport, ?>> list = new ArrayList<>();
    list.add(new VolumeActivityStatusColumn<>());
    list.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(new VolumeActivitySeperatorCell<GlusterTaskSupport>()) {

        @Override
        public GlusterTaskSupport getValue(GlusterTaskSupport object) {
            return object;
        }
    });
    list.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(rebalanceMenuCell) {

        @Override
        public GlusterTaskSupport getValue(GlusterTaskSupport object) {
            return object;
        }
    });
    list.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(removeBricksMenuCell) {

        @Override
        public GlusterTaskSupport getValue(GlusterTaskSupport object) {
            return object;
        }
    });
    List<HasCell<GlusterTaskSupport, ?>> compositeList = new ArrayList<>();
    compositeList.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(new VolumeTaskWaitingCell<>()) {

        @Override
        public GlusterTaskSupport getValue(GlusterTaskSupport object) {
            return object;
        }
    });
    compositeList.add(new Column<GlusterTaskSupport, GlusterTaskSupport>(new VolumeActivityCompositeCell<>(list)) {

        @Override
        public GlusterTaskSupport getValue(GlusterTaskSupport object) {
            return object;
        }
    });
    Column<GlusterVolumeEntity, GlusterVolumeEntity> capacityColumn = new Column<GlusterVolumeEntity, GlusterVolumeEntity>(new VolumeCapacityCell()) {

        @Override
        public GlusterVolumeEntity getValue(GlusterVolumeEntity object) {
            return object;
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(capacityColumn, constants.volumeCapacity(), "100px");
    getTable().addColumn(new VolumeActivityColumn<GlusterVolumeEntity>(new VolumeActivityCompositeCell<GlusterTaskSupport>(compositeList)), constants.activitiesOnVolume(), // $NON-NLS-1$
    "100px");
    AbstractTextColumn<GlusterVolumeEntity> snapshotCountColumn = new AbstractTextColumn<GlusterVolumeEntity>() {

        @Override
        public String getValue(GlusterVolumeEntity object) {
            return object.getSnapshotsCount().toString();
        }
    };
    snapshotCountColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(snapshotCountColumn, constants.noOfSnapshotsLabel(), "100px");
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) GlusterTaskSupport(org.ovirt.engine.core.common.businessentities.gluster.GlusterTaskSupport) MenuCell(org.ovirt.engine.ui.webadmin.widget.table.cell.MenuCell) AssetProvider(org.ovirt.engine.ui.webadmin.gin.AssetProvider) Inject(com.google.inject.Inject) HashMap(java.util.HashMap) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) GWT(com.google.gwt.core.client.GWT) ArrayList(java.util.ArrayList) MainVolumePresenter(org.ovirt.engine.ui.webadmin.section.main.presenter.MainVolumePresenter) ApplicationConstants(org.ovirt.engine.ui.webadmin.ApplicationConstants) Map(java.util.Map) FragmentParams(org.ovirt.engine.ui.common.presenter.FragmentParams) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) VolumeTaskWaitingCell(org.ovirt.engine.ui.webadmin.widget.table.cell.VolumeTaskWaitingCell) HasCell(com.google.gwt.cell.client.HasCell) GlusterVolumeUtils(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils) WebAdminButtonDefinition(org.ovirt.engine.ui.webadmin.widget.action.WebAdminButtonDefinition) VolumeInfoColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeInfoColumn) ElementIdHandler(org.ovirt.engine.ui.common.idhandler.ElementIdHandler) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) VolumeActivitySeperatorCell(org.ovirt.engine.ui.webadmin.widget.table.cell.VolumeActivitySeperatorCell) VolumeBrickStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeBrickStatusColumn) VolumeStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeStatusColumn) VolumeActivityColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeActivityColumn) VolumeCapacityCell(org.ovirt.engine.ui.webadmin.widget.table.cell.VolumeCapacityCell) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) MainModelProvider(org.ovirt.engine.ui.common.uicommon.model.MainModelProvider) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) VolumeActivityCompositeCell(org.ovirt.engine.ui.webadmin.widget.table.cell.VolumeActivityCompositeCell) VolumeActivityStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeActivityStatusColumn) List(java.util.List) FieldUpdater(com.google.gwt.cell.client.FieldUpdater) Column(com.google.gwt.user.cellview.client.Column) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) Comparator(java.util.Comparator) GlusterTaskSupport(org.ovirt.engine.core.common.businessentities.gluster.GlusterTaskSupport) VolumeInfoColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeInfoColumn) VolumeTaskWaitingCell(org.ovirt.engine.ui.webadmin.widget.table.cell.VolumeTaskWaitingCell) HasCell(com.google.gwt.cell.client.HasCell) ArrayList(java.util.ArrayList) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) VolumeInfoColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeInfoColumn) VolumeBrickStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeBrickStatusColumn) VolumeStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeStatusColumn) VolumeActivityColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeActivityColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) VolumeActivityStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeActivityStatusColumn) Column(com.google.gwt.user.cellview.client.Column) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) VolumeCapacityCell(org.ovirt.engine.ui.webadmin.widget.table.cell.VolumeCapacityCell) VolumeActivityCompositeCell(org.ovirt.engine.ui.webadmin.widget.table.cell.VolumeActivityCompositeCell) VolumeBrickStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeBrickStatusColumn) VolumeStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VolumeStatusColumn) VolumeActivitySeperatorCell(org.ovirt.engine.ui.webadmin.widget.table.cell.VolumeActivitySeperatorCell) HashMap(java.util.HashMap) Map(java.util.Map)

Example 15 with GlusterVolumeEntity

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity in project ovirt-engine by oVirt.

the class GlusterVolumeGeoRepCreateSessionPopupView method initEditors.

private void initEditors() {
    showEligibleVolumes = new EntityModelCheckBoxEditor(Align.RIGHT);
    startSessionEditor = new EntityModelCheckBoxEditor(Align.RIGHT);
    slaveClusterEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<String>() {

        @Override
        public String getReplacementStringNullSafe(String data) {
            return data;
        }

        @Override
        public String getDisplayStringNullSafe(String data) {
            return templates.typeAheadNameDescription(data == null ? constants.empty() : data, constants.empty()).asString();
        }
    });
    slaveHostIpEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<Pair<String, Guid>>() {

        @Override
        public String getReplacementStringNullSafe(Pair<String, Guid> data) {
            return data.getFirst();
        }

        @Override
        public String getDisplayStringNullSafe(Pair<String, Guid> data) {
            return templates.typeAheadNameDescription(data == null ? constants.empty() : data.getFirst(), constants.empty()).asString();
        }
    });
    slaveVolumeEditor = new ListModelTypeAheadListBoxEditor<>(new ListModelTypeAheadListBoxEditor.NullSafeSuggestBoxRenderer<GlusterVolumeEntity>() {

        @Override
        public String getReplacementStringNullSafe(GlusterVolumeEntity data) {
            return data.getName();
        }

        @Override
        public String getDisplayStringNullSafe(GlusterVolumeEntity data) {
            return templates.typeAheadNameDescription(data.getName() == null ? constants.empty() : data.getName(), data.getClusterName() == null ? constants.empty() : data.getClusterName()).asString();
        }
    });
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) EntityModelCheckBoxEditor(org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor) Guid(org.ovirt.engine.core.compat.Guid) Pair(org.ovirt.engine.core.common.utils.Pair)

Aggregations

GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)220 ArrayList (java.util.ArrayList)57 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)49 Test (org.junit.Test)47 Guid (org.ovirt.engine.core.compat.Guid)30 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)30 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)26 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)20 VDS (org.ovirt.engine.core.common.businessentities.VDS)19 HashMap (java.util.HashMap)16 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)16 List (java.util.List)15 Map (java.util.Map)15 ValidationResult (org.ovirt.engine.core.bll.ValidationResult)15 ActionType (org.ovirt.engine.core.common.action.ActionType)13 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)13 GlusterVolumeSnapshotEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotEntity)13 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)13 GlusterVolumeRemoveBricksParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters)12 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)12