Search in sources :

Example 1 with VolumeModel

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);
}
Also used : SearchType(org.ovirt.engine.core.common.interfaces.SearchType) Arrays(java.util.Arrays) SearchObjects(org.ovirt.engine.core.searchbackend.SearchObjects) Inject(com.google.inject.Inject) ApplicationMode(org.ovirt.engine.core.common.mode.ApplicationMode) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) GlusterVolumeActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters) TransportType(org.ovirt.engine.core.common.businessentities.gluster.TransportType) HasEntity(org.ovirt.engine.ui.uicommonweb.models.HasEntity) VolumeBrickListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeBrickListModel) VolumeRebalanceStatusModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeRebalanceStatusModel) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterVolumeUtils(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) SearchParameters(org.ovirt.engine.core.common.queries.SearchParameters) VolumeSnapshotOptionModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeSnapshotOptionModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterClusterSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterClusterSnapshotConfigModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) List(java.util.List) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) VolumeGeneralModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeneralModel) VolumeGeoRepListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeGeoRepListModel) GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) QueryType(org.ovirt.engine.core.common.queries.QueryType) PermissionListModel(org.ovirt.engine.ui.uicommonweb.models.configure.PermissionListModel) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) GlusterVolumeSnapshotListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotListModel) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) Frontend(org.ovirt.engine.ui.frontend.Frontend) GlusterVolumeSnapshotConfigModel(org.ovirt.engine.ui.uicommonweb.models.gluster.GlusterVolumeSnapshotConfigModel) GlusterVolumeOptionEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeOptionEntity) CreateGlusterVolumeParameters(org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters) Linq(org.ovirt.engine.ui.uicommonweb.Linq) SearchStringMapping(org.ovirt.engine.ui.uicommonweb.models.SearchStringMapping) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) VolumeEventListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeEventListModel) VolumeParameterListModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeParameterListModel) VolumeProfileStatisticsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel) VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel) ListWithSimpleDetailsModel(org.ovirt.engine.ui.uicommonweb.models.ListWithSimpleDetailsModel) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants) GlusterVolumeOptionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters) GlusterVolumeRebalanceParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) UpdateGlusterVolumeSnapshotConfigParameters(org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters) VolumeStatus(org.ovirt.engine.ui.frontend.utils.GlusterVolumeUtils.VolumeStatus) VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) UIConstants(org.ovirt.engine.ui.uicompat.UIConstants)

Example 2 with VolumeModel

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);
}
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 3 with VolumeModel

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));
        }
    }
}
Also used : VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel)

Example 4 with VolumeModel

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));
}
Also used : VolumeModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel)

Aggregations

VolumeModel (org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeModel)4 ArrayList (java.util.ArrayList)2 CreateGlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.CreateGlusterVolumeParameters)2 GlusterBrickEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity)2 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)2 GlusterVolumeType (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType)2 Guid (org.ovirt.engine.core.compat.Guid)2 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)2 Inject (com.google.inject.Inject)1 Arrays (java.util.Arrays)1 List (java.util.List)1 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 GlusterVolumeActionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeActionParameters)1 GlusterVolumeOptionParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeOptionParameters)1 GlusterVolumeParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeParameters)1 GlusterVolumeRebalanceParameters (org.ovirt.engine.core.common.action.gluster.GlusterVolumeRebalanceParameters)1 UpdateGlusterVolumeSnapshotConfigParameters (org.ovirt.engine.core.common.action.gluster.UpdateGlusterVolumeSnapshotConfigParameters)1 GlusterAsyncTask (org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask)1