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");
}
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()));
}
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);
}
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);
}
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();
}
}
Aggregations