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