Search in sources :

Example 1 with DetachGlusterHostsModel

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

the class ClusterGeneralModel method onDetachNewGlusterHosts.

public void onDetachNewGlusterHosts() {
    if (getWindow() == null) {
        return;
    }
    final DetachGlusterHostsModel hostsModel = (DetachGlusterHostsModel) getWindow();
    if (!hostsModel.validate()) {
        return;
    }
    boolean force = hostsModel.getForce().getEntity();
    ArrayList<ActionParametersBase> parametersList = new ArrayList<>();
    for (Object model : hostsModel.getHosts().getSelectedItems()) {
        String host = (String) ((EntityModel) model).getEntity();
        parametersList.add(new RemoveGlusterServerParameters(getEntity().getId(), host, force));
    }
    Frontend.getInstance().runMultipleAction(ActionType.RemoveGlusterServer, parametersList);
    cancel();
}
Also used : ArrayList(java.util.ArrayList) DetachGlusterHostsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel) RemoveGlusterServerParameters(org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters) ActionParametersBase(org.ovirt.engine.core.common.action.ActionParametersBase)

Example 2 with DetachGlusterHostsModel

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

Aggregations

ArrayList (java.util.ArrayList)2 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)2 RemoveGlusterServerParameters (org.ovirt.engine.core.common.action.gluster.RemoveGlusterServerParameters)2 DetachGlusterHostsModel (org.ovirt.engine.ui.uicommonweb.models.gluster.DetachGlusterHostsModel)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 GlusterServiceParameters (org.ovirt.engine.core.common.action.gluster.GlusterServiceParameters)1 AddVdsActionParameters (org.ovirt.engine.core.common.action.hostdeploy.AddVdsActionParameters)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 MigrateOnErrorOptions (org.ovirt.engine.core.common.businessentities.MigrateOnErrorOptions)1 VDS (org.ovirt.engine.core.common.businessentities.VDS)1 GlusterServerService (org.ovirt.engine.core.common.businessentities.gluster.GlusterServerService)1 GlusterServiceStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterServiceStatus)1 GlusterStatus (org.ovirt.engine.core.common.businessentities.gluster.GlusterStatus)1 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)1 ServiceType (org.ovirt.engine.core.common.businessentities.gluster.ServiceType)1