use of org.ovirt.engine.ui.uicommonweb.models.EntityModel 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.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VolumeRebalanceStatusModel method showStatus.
public void showStatus(GlusterVolumeTaskStatusEntity rebalanceStatusEntity) {
List<GlusterVolumeTaskStatusForHost> rebalanceSessionsList = rebalanceStatusEntity.getHostwiseStatusDetails();
List<EntityModel<GlusterVolumeTaskStatusForHost>> sessionList = new ArrayList<>();
for (GlusterVolumeTaskStatusForHost hostDetail : rebalanceSessionsList) {
EntityModel<GlusterVolumeTaskStatusForHost> sessionModel = new EntityModel<>(hostDetail);
sessionList.add(sessionModel);
}
getStartTime().setEntity(rebalanceStatusEntity.getStartTime());
getStatusTime().setEntity(rebalanceStatusEntity.getStatusTime());
getRebalanceSessions().setItems(sessionList);
setStatusAvailable(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FINISHED);
if (rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FINISHED) {
refresh.cancel();
} else {
if (rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED || rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.FAILED) {
refresh.cancel();
if (rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED) {
getStopTime().setEntity(rebalanceStatusEntity.getStopTime());
}
}
}
setStopTimeVisible(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.ABORTED);
if (GlusterTaskType.REBALANCE == getEntity().getAsyncTask().getType()) {
getStopReblanceFromStatus().setIsExecutionAllowed(rebalanceStatusEntity.getStatusSummary().getStatus() == JobExecutionStatus.STARTED);
}
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VolumeBrickListModel method onShowBrickAdvancedDetails.
private void onShowBrickAdvancedDetails(GlusterVolumeEntity volumeEntity) {
final GlusterBrickEntity brickEntity = getSelectedItem();
final BrickAdvancedDetailsModel brickModel = new BrickAdvancedDetailsModel();
setWindow(brickModel);
brickModel.setTitle(ConstantsManager.getInstance().getConstants().advancedDetailsBrickTitle());
brickModel.setHelpTag(HelpTag.brick_advanced);
// $NON-NLS-1$
brickModel.setHashName("brick_advanced");
brickModel.startProgress();
AsyncDataProvider.getInstance().getGlusterVolumeBrickDetails(new AsyncQuery<QueryReturnValue>(returnValue -> {
brickModel.stopProgress();
if (returnValue == null || !returnValue.getSucceeded()) {
brickModel.setMessage(ConstantsManager.getInstance().getConstants().errorInFetchingBrickAdvancedDetails());
return;
}
GlusterVolumeAdvancedDetails advDetails = returnValue.getReturnValue();
brickModel.getBrick().setEntity(brickEntity.getQualifiedName());
if (advDetails != null && advDetails.getBrickDetails() != null && advDetails.getBrickDetails().size() == 1) {
BrickDetails brickDetails = advDetails.getBrickDetails().get(0);
brickModel.getBrickProperties().setProperties(brickDetails.getBrickProperties());
ArrayList<EntityModel<GlusterClientInfo>> clients = new ArrayList<>();
for (GlusterClientInfo client : brickDetails.getClients()) {
clients.add(new EntityModel<>(client));
}
brickModel.getClients().setItems(clients);
brickModel.getMemoryStatistics().updateMemoryStatistics(brickDetails.getMemoryStatus().getMallInfo());
ArrayList<EntityModel<Mempool>> memoryPools = new ArrayList<>();
for (Mempool mempool : brickDetails.getMemoryStatus().getMemPools()) {
memoryPools.add(new EntityModel<>(mempool));
}
brickModel.getMemoryPools().setItems(memoryPools);
}
}, true), volumeEntity.getClusterId(), volumeEntity.getId(), brickEntity.getId());
// $NON-NLS-1$
UICommand command = new UICommand("Cancel", this);
command.setTitle(ConstantsManager.getInstance().getConstants().close());
command.setIsCancel(true);
brickModel.getCommands().add(command);
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class VolumeBrickListModel method addBricks.
private void addBricks() {
final VolumeBrickModel volumeBrickModel = (VolumeBrickModel) getWindow();
final GlusterVolumeEntity volumeEntity = getEntity();
volumeBrickModel.getReplicaCount().setEntity(volumeEntity.getReplicaCount());
volumeBrickModel.getReplicaCount().setIsChangeable(true);
volumeBrickModel.getReplicaCount().setIsAvailable(volumeEntity.getVolumeType().isReplicatedType());
volumeBrickModel.getStripeCount().setEntity(volumeEntity.getStripeCount());
volumeBrickModel.getStripeCount().setIsChangeable(true);
volumeBrickModel.getStripeCount().setIsAvailable(volumeEntity.getVolumeType().isStripedType());
volumeBrickModel.setTitle(ConstantsManager.getInstance().getConstants().addBricksTitle());
volumeBrickModel.setHelpTag(HelpTag.add_bricks);
// $NON-NLS-1$
volumeBrickModel.setHashName("add_bricks");
volumeBrickModel.getVolumeType().setEntity(volumeEntity.getVolumeType());
AsyncDataProvider.getInstance().getClusterById(volumeBrickModel.asyncQuery(cluster -> {
volumeBrickModel.getForce().setIsAvailable(true);
volumeBrickModel.setIsBrickProvisioningSupported();
AsyncDataProvider.getInstance().getHostListByCluster(volumeBrickModel.asyncQuery(hostList -> {
Iterator<VDS> iterator = hostList.iterator();
while (iterator.hasNext()) {
if (iterator.next().getStatus() != VDSStatus.Up) {
iterator.remove();
}
}
volumeBrickModel.setHostList(hostList);
}), cluster.getName());
}), volumeEntity.getClusterId());
// TODO: fetch the mount points to display
volumeBrickModel.getBricks().setItems(new ArrayList<EntityModel<GlusterBrickEntity>>());
// $NON-NLS-1$
UICommand command = UICommand.createDefaultOkUiCommand("OnAddBricks", this);
volumeBrickModel.getCommands().add(command);
// $NON-NLS-1$
volumeBrickModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
}
use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.
the class GlusterClusterSnapshotConfigureOptionsPopupView method initEditors.
private void initEditors() {
clusterEditor = new ListModelListBoxEditor<>(new NameRenderer<Cluster>());
configsTable = new EntityModelCellTable<>(false, true);
configsTable.setSelectionModel(new NoSelectionModel());
configsTable.addColumn(new AbstractEntityModelTextColumn<GlusterVolumeSnapshotConfig>() {
@Override
public String getText(GlusterVolumeSnapshotConfig object) {
return object.getParamName();
}
}, constants.volumeSnapshotConfigName(), // $NON-NLS-1$
"200px");
Column<EntityModel<GlusterVolumeSnapshotConfig>, String> valueColumn = new Column<EntityModel<GlusterVolumeSnapshotConfig>, String>(new TextInputCell()) {
@Override
public String getValue(EntityModel<GlusterVolumeSnapshotConfig> object) {
return object.getEntity().getParamValue();
}
};
// $NON-NLS-1$
configsTable.addColumn(valueColumn, constants.volumeSnapshotConfigValue(), "100px");
valueColumn.setFieldUpdater((index, object, value) -> object.getEntity().setParamValue(value));
}
Aggregations