Search in sources :

Example 1 with GlusterVolumeType

use of org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType 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 2 with GlusterVolumeType

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

the class AddBrickPopupView method edit.

@Override
public void edit(final VolumeBrickModel object) {
    bricksTable.asEditor().edit(object.getBricks());
    driver.edit(object);
    addBrickButton.setCommand(object.getAddBrickCommand());
    removeBricksButton.setCommand(object.getRemoveBricksCommand());
    removeAllBricksButton.setCommand(object.getRemoveAllBricksCommand());
    moveBricksUpButton.setCommand(object.getMoveBricksUpCommand());
    moveBricksDownButton.setCommand(object.getMoveBricksDownCommand());
    GlusterVolumeType volumeType = object.getVolumeType().getEntity();
    if (volumeType == GlusterVolumeType.DISTRIBUTED_REPLICATE) {
        info.setVisible(true);
        info.setText(constants.distributedReplicateVolumeBrickInfoLabel());
    } else if (volumeType == GlusterVolumeType.DISTRIBUTED_STRIPE) {
        info.setVisible(true);
        info.setText(constants.distributedStripeVolumeBrickInfoLabel());
    } else {
        info.setVisible(false);
        info.setText(null);
    }
    forceWarning.setVisible(object.getForce().getEntity());
    object.getForce().getEntityChangedEvent().addListener((ev, sender, args) -> forceWarning.setVisible(object.getForce().getEntity()));
}
Also used : GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)

Example 3 with GlusterVolumeType

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

the class VolumeListModel method onCreateVolume.

private void onCreateVolume() {
    VolumeModel volumeModel = (VolumeModel) getWindow();
    if (!volumeModel.validate()) {
        return;
    }
    Guid clusterId = volumeModel.getCluster().getSelectedItem().getId();
    final GlusterVolumeEntity volume = new GlusterVolumeEntity();
    volume.setClusterId(clusterId);
    volume.setName(volumeModel.getName().getEntity());
    GlusterVolumeType type = volumeModel.getTypeList().getSelectedItem();
    if (type.isStripedType()) {
        volume.setStripeCount(volumeModel.getStripeCountValue());
    }
    if (type.isReplicatedType()) {
        volume.setReplicaCount(volumeModel.getReplicaCountValue());
        volume.setIsArbiter(volumeModel.getArbiterVolume().getEntity());
    }
    volume.setVolumeType(type);
    if (volumeModel.getTcpTransportType().getEntity()) {
        volume.getTransportTypes().add(TransportType.TCP);
    }
    if (volumeModel.getRdmaTransportType().getEntity()) {
        volume.getTransportTypes().add(TransportType.RDMA);
    }
    ArrayList<GlusterBrickEntity> brickList = new ArrayList<>();
    for (Object model : volumeModel.getBricks().getItems()) {
        brickList.add((GlusterBrickEntity) ((EntityModel) model).getEntity());
    }
    volume.setBricks(brickList);
    if (volumeModel.getNfs_accecssProtocol().getEntity()) {
        volume.enableNFS();
    } else {
        volume.disableNFS();
    }
    if (volumeModel.getCifs_accecssProtocol().getEntity()) {
        volume.enableCifs();
    } else {
        volume.disableCifs();
    }
    volume.setAccessControlList(volumeModel.getAllowAccess().getEntity());
    volumeModel.startProgress();
    CreateGlusterVolumeParameters parameter = new CreateGlusterVolumeParameters(volume, volumeModel.isForceAddBricks());
    Frontend.getInstance().runAction(ActionType.CreateGlusterVolume, parameter, result -> {
        VolumeListModel localModel = (VolumeListModel) result.getState();
        localModel.postOnCreateVolume(result.getReturnValue(), volume);
    }, this);
}
Also used : GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters) Guid(org.ovirt.engine.core.compat.Guid)

Example 4 with GlusterVolumeType

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

the class VolumeModel method onAddBricksInternal.

private void onAddBricksInternal() {
    VolumeBrickModel volumeBrickModel = (VolumeBrickModel) getWindow();
    cancelConfirmation();
    if (!volumeBrickModel.validate()) {
        return;
    }
    GlusterVolumeType selectedVolumeType = getTypeList().getSelectedItem();
    if (selectedVolumeType.isReplicatedType()) {
        getReplicaCount().setEntity(volumeBrickModel.getReplicaCount().getEntity());
    }
    if (selectedVolumeType.isStripedType()) {
        getStripeCount().setEntity(volumeBrickModel.getStripeCount().getEntity());
    }
    ArrayList<EntityModel<GlusterBrickEntity>> brickList = new ArrayList<>();
    brickList.addAll(volumeBrickModel.getBricks().getItems());
    volumeBrickModel.getBricks().setItems(null);
    ListModel<EntityModel<GlusterBrickEntity>> brickListModel = new ListModel<>();
    brickListModel.setItems(brickList);
    brickListModel.setSelectedItems(brickList);
    setBricks(brickListModel);
    setForceAddBricks(volumeBrickModel.getForce().getEntity());
    setWindow(null);
}
Also used : GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList)

Example 5 with GlusterVolumeType

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

the class VolumeModel method onAddBricks.

private void onAddBricks() {
    VolumeBrickModel volumeBrickModel = (VolumeBrickModel) getWindow();
    if (!volumeBrickModel.validate()) {
        return;
    }
    GlusterVolumeType volumeType = getTypeList().getSelectedItem();
    if (!volumeBrickModel.validateBrickCount(volumeType, true)) {
        String validationMsg = volumeBrickModel.getValidationFailedMsg(getTypeList().getSelectedItem(), true);
        if (validationMsg != null) {
            volumeBrickModel.setMessage(validationMsg);
        }
        return;
    }
    if (!validateArbiterVolume()) {
        volumeBrickModel.setMessage(ConstantsManager.getInstance().getConstants().arbiterVolumeShouldBeReplica3());
        return;
    }
    if ((volumeType == GlusterVolumeType.REPLICATE || volumeType == GlusterVolumeType.DISTRIBUTED_REPLICATE) && !volumeBrickModel.validateReplicateBricks()) {
        ConfirmationModel confirmModel = new ConfirmationModel();
        setConfirmWindow(confirmModel);
        confirmModel.setTitle(ConstantsManager.getInstance().getConstants().addBricksReplicateConfirmationTitle());
        confirmModel.setHelpTag(HelpTag.add_bricks_confirmation);
        // $NON-NLS-1$
        confirmModel.setHashName("add_bricks_confirmation");
        confirmModel.setMessage(ConstantsManager.getInstance().getConstants().addBricksToReplicateVolumeFromSameServerMsg());
        // $NON-NLS-1$
        UICommand okCommand = new UICommand("OnAddBricksInternal", this);
        okCommand.setTitle(ConstantsManager.getInstance().getConstants().yes());
        okCommand.setIsDefault(true);
        getConfirmWindow().getCommands().add(okCommand);
        // $NON-NLS-1$
        UICommand cancelCommand = new UICommand("CancelConfirmation", this);
        cancelCommand.setTitle(ConstantsManager.getInstance().getConstants().no());
        cancelCommand.setIsCancel(true);
        getConfirmWindow().getCommands().add(cancelCommand);
    } else {
        onAddBricksInternal();
    }
}
Also used : GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Aggregations

GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)5 ArrayList (java.util.ArrayList)3 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 VolumeListModel (org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel)2 FieldUpdater (com.google.gwt.cell.client.FieldUpdater)1 HasCell (com.google.gwt.cell.client.HasCell)1 GWT (com.google.gwt.core.client.GWT)1 Column (com.google.gwt.user.cellview.client.Column)1 Inject (com.google.inject.Inject)1 Comparator (java.util.Comparator)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 CreateGlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)1 GlusterTaskType (org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType)1 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)1 GlusterTaskSupport (org.ovirt.engine.core.common.businessentities.gluster.GlusterTaskSupport)1 Guid (org.ovirt.engine.core.compat.Guid)1