Search in sources :

Example 61 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class ClusterGeneralModel method detachNewGlusterHosts.

public void detachNewGlusterHosts() {
    if (getWindow() != null) {
        return;
    }
    final DetachGlusterHostsModel hostsModel = new DetachGlusterHostsModel();
    setWindow(hostsModel);
    hostsModel.setTitle(ConstantsManager.getInstance().getConstants().detachGlusterHostsTitle());
    hostsModel.setHelpTag(HelpTag.detach_gluster_hosts);
    // $NON-NLS-1$
    hostsModel.setHashName("detach_gluster_hosts");
    // $NON-NLS-1$
    UICommand command = UICommand.createOkUiCommand("OnDetachGlusterHosts", this);
    hostsModel.getCommands().add(command);
    hostsModel.getHosts().setItems(new ArrayList<EntityModel<String>>());
    // $NON-NLS-1$
    hostsModel.getCommands().add(UICommand.createCancelUiCommand("Cancel", this));
    hostsModel.startProgress();
    AsyncDataProvider.getInstance().getGlusterHostsNewlyAdded(new AsyncQuery<>(hostMap -> {
        if (hostMap == null || hostMap.isEmpty()) {
            hostsModel.setMessage(ConstantsManager.getInstance().getConstants().emptyNewGlusterHosts());
        } else {
            ArrayList<EntityModel<String>> hostList = new ArrayList<>();
            for (String host : hostMap.keySet()) {
                hostList.add(new EntityModel<>(host));
            }
            hostsModel.getHosts().setItems(hostList);
        }
        hostsModel.stopProgress();
    }), getEntity().getId(), true);
}
Also used : QueryType(org.ovirt.engine.core.common.queries.QueryType) Guid(org.ovirt.engine.core.compat.Guid) ServiceType(org.ovirt.engine.core.common.businessentities.gluster.ServiceType) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HostDetailModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostDetailModel) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) RemoveGlusterServerParameters(org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterServiceParameters(org.ovirt.engine.core.common.action.gluster.GlusterServiceParameters) MultipleHostsModel(org.ovirt.engine.ui.uicommonweb.models.hosts.MultipleHostsModel) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) DetachGlusterHostsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) Objects(java.util.Objects) GlusterStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus) List(java.util.List) MigrateOnErrorOptions(org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterServerService(org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService) AddVdsActionParameters(org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters) GlusterServiceStatus(org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList) DetachGlusterHostsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 62 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class HostMaintenanceConfirmationPopupView method edit.

@Override
public void edit(HostMaintenanceConfirmationModel object) {
    driver.edit(object);
    // Bind "Latch.IsAvailable"
    object.getLatch().getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("IsAvailable".equals(args.propertyName)) {
            // $NON-NLS-1$
            EntityModel entity = (EntityModel) sender;
            if (entity.getIsAvailable()) {
                latch.setVisible(true);
            }
        }
    });
    if (object.getForceLabel() != null) {
        force.setLabel(object.getForceLabel());
    }
    force.asCheckBox().setValue(object.getForce().getEntity());
    // Bind "Force.Label"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("ForceLabel".equals(args.propertyName)) {
            // $NON-NLS-1$
            ConfirmationModel entity = (ConfirmationModel) sender;
            force.setLabel(entity.getForceLabel());
        }
    });
    setNote(object.getNote());
    // Bind "Note"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("Note".equals(args.propertyName)) {
            // $NON-NLS-1$
            ConfirmationModel entity = (ConfirmationModel) sender;
            setNote(entity.getNote());
        }
    });
    // Bind "ReasonVisible"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("ReasonVisible".equals(args.propertyName)) {
            // $NON-NLS-1$
            updateReasonVisibility((HostMaintenanceConfirmationModel) sender);
        }
    });
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) HostMaintenanceConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.HostMaintenanceConfirmationModel)

Example 63 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class RemoveConfirmationPopupView method edit.

@Override
public void edit(ConfirmationModel object) {
    driver.edit(object);
    // Bind "Latch.IsAvailable"
    object.getLatch().getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("IsAvailable".equals(args.propertyName)) {
            // $NON-NLS-1$
            EntityModel<?> entity = (EntityModel<?>) sender;
            if (entity.getIsAvailable()) {
                latch.setVisible(true);
            }
        }
    });
    if (object.getForceLabel() != null) {
        force.setLabel(object.getForceLabel());
    }
    force.asCheckBox().setValue(object.getForce().getEntity());
    // Bind "Force.Label"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("ForceLabel".equals(args.propertyName)) {
            // $NON-NLS-1$
            ConfirmationModel entity = (ConfirmationModel) sender;
            force.setLabel(entity.getForceLabel());
        }
    });
    setNote(object.getNote());
    // Bind "Note"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("Note".equals(args.propertyName)) {
            // $NON-NLS-1$
            ConfirmationModel entity = (ConfirmationModel) sender;
            setNote(entity.getNote());
        }
    });
    // Bind "ReasonVisible"
    object.getPropertyChangedEvent().addListener((ev, sender, args) -> {
        if ("ReasonVisible".equals(args.propertyName)) {
            // $NON-NLS-1$
            updateReasonVisibility((ConfirmationModel) sender);
        }
    });
}
Also used : EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 64 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel in project ovirt-engine by oVirt.

the class VmListModel method onRemove.

private void onRemove() {
    final ConfirmationModel model = (ConfirmationModel) getWindow();
    if (model.getProgress() != null) {
        return;
    }
    final ArrayList<ActionParametersBase> list = new ArrayList<>();
    for (Entry<Guid, EntityModel> entry : vmsRemoveMap.entrySet()) {
        list.add(new RemoveVmParameters(entry.getKey(), false, (Boolean) entry.getValue().getEntity()));
    }
    model.startProgress();
    Frontend.getInstance().runMultipleAction(ActionType.RemoveVm, list, result -> {
        ConfirmationModel localModel = (ConfirmationModel) result.getState();
        localModel.stopProgress();
        cancel();
    }, model);
}
Also used : RemoveVmParameters(org.ovirt.engine.core.common.action.RemoveVmParameters) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) Guid(org.ovirt.engine.core.compat.Guid) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 65 with EntityModel

use of org.ovirt.engine.ui.uicommonweb.models.EntityModel 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)

Aggregations

EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)105 ArrayList (java.util.ArrayList)56 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)27 List (java.util.List)26 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)23 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)22 ListModel (org.ovirt.engine.ui.uicommonweb.models.ListModel)22 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)22 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)20 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)19 ActionType (org.ovirt.engine.core.common.action.ActionType)18 Frontend (org.ovirt.engine.ui.frontend.Frontend)18 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)17 Guid (org.ovirt.engine.core.compat.Guid)17 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 QueryType (org.ovirt.engine.core.common.queries.QueryType)16 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)13 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)13 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)13