use of org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel in project ovirt-engine by oVirt.
the class VolumeListModel method newVolume.
private void newVolume() {
if (getWindow() != null) {
return;
}
VolumeModel volumeModel = new VolumeModel();
volumeModel.setHelpTag(HelpTag.new_volume);
// $NON-NLS-1$
volumeModel.setHashName("new_volume");
volumeModel.setTitle(ConstantsManager.getInstance().getConstants().newVolumeTitle());
setWindow(volumeModel);
AsyncDataProvider.getInstance().getDataCenterByClusterServiceList(new AsyncQuery<>(dataCenters -> {
VolumeModel innerVolumeModel = (VolumeModel) getWindow();
final UIConstants constants = ConstantsManager.getInstance().getConstants();
innerVolumeModel.getDataCenter().setItems(dataCenters);
innerVolumeModel.getDataCenter().setSelectedItem(Linq.firstOrNull(dataCenters));
// $NON-NLS-1$
UICommand command = UICommand.createDefaultOkUiCommand("onCreateVolume", VolumeListModel.this);
innerVolumeModel.getCommands().add(command);
// $NON-NLS-1$
innerVolumeModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", VolumeListModel.this));
}), false, true);
}
use of org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel 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.ui.uicommonweb.models.gluster.VolumeModel in project ovirt-engine by oVirt.
the class VolumeListModel method postOnCreateVolume.
public void postOnCreateVolume(ActionReturnValue returnValue, GlusterVolumeEntity volume) {
VolumeModel model = (VolumeModel) getWindow();
model.stopProgress();
if (returnValue != null && returnValue.getSucceeded()) {
cancel();
if (model.getOptimizeForVirtStore().getEntity()) {
volume.setId((Guid) returnValue.getActionReturnValue());
optimizeVolumesForVirtStore(Arrays.asList(volume));
}
}
}
use of org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel in project ovirt-engine by oVirt.
the class VolumePopupView method edit.
@Override
public void edit(final VolumeModel object) {
driver.edit(object);
addBricksButton.setCommand(object.getAddBricksCommand());
object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
VolumeModel model = (VolumeModel) sender;
if ("Bricks".equals(args.propertyName)) {
// $NON-NLS-1$
bricksCountEditor.setText(ConstantsManager.getInstance().getMessages().noOfBricksSelected(model.getBricks().getSelectedItems() == null ? 0 : model.getBricks().getSelectedItems().size()));
}
});
object.getOptimizeForVirtStore().getEntityChangedEvent().addListener((ev, sender, args) -> virtStoreOptimiseWarning.setVisible(object.getOptimizeForVirtStore().getEntity() && object.getReplicaCount().getEntity() != 3));
object.getReplicaCount().getEntityChangedEvent().addListener((ev, sender, args) -> virtStoreOptimiseWarning.setVisible(object.getOptimizeForVirtStore().getEntity() && object.getReplicaCount().getEntity() != 3));
}
Aggregations