Search in sources :

Example 81 with EntityModel

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);
}
Also used : GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) ListModel(org.ovirt.engine.ui.uicommonweb.models.ListModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList)

Example 82 with EntityModel

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);
    }
}
Also used : GlusterVolumeTaskStatusForHost(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusForHost) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ArrayList(java.util.ArrayList)

Example 83 with EntityModel

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);
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) GlusterVolumeReplaceBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) 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) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterVolumeBricksActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeResetBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeResetBrickActionParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) ArrayList(java.util.ArrayList) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool)

Example 84 with EntityModel

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));
}
Also used : GlusterTaskType(org.ovirt.engine.core.common.asynctasks.gluster.GlusterTaskType) GlusterVolumeTaskStatusEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeTaskStatusEntity) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) GlusterVolumeReplaceBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeReplaceBrickActionParameters) GlusterVolumeType(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeType) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) 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) GlusterBrickEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity) GetConfigurationValueParameters(org.ovirt.engine.core.common.queries.GetConfigurationValueParameters) Mempool(org.ovirt.engine.core.common.businessentities.gluster.Mempool) Map(java.util.Map) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) GlusterVolumeRemoveBricksParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeRemoveBricksParameters) VolumeListModel(org.ovirt.engine.ui.uicommonweb.models.volumes.VolumeListModel) EventArgs(org.ovirt.engine.ui.uicompat.EventArgs) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) GlusterClientInfo(org.ovirt.engine.core.common.businessentities.gluster.GlusterClientInfo) JobExecutionStatus(org.ovirt.engine.core.common.job.JobExecutionStatus) GlusterVolumeBricksActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeBricksActionParameters) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Iterator(java.util.Iterator) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfigValues(org.ovirt.engine.core.common.config.ConfigValues) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) GlusterVolumeAdvancedDetails(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeAdvancedDetails) List(java.util.List) VDSStatus(org.ovirt.engine.core.common.businessentities.VDSStatus) BrickDetails(org.ovirt.engine.core.common.businessentities.gluster.BrickDetails) GlusterAsyncTask(org.ovirt.engine.core.common.asynctasks.gluster.GlusterAsyncTask) GlusterVolumeResetBrickActionParameters(org.ovirt.engine.core.common.action.gluster.GlusterVolumeResetBrickActionParameters) VDS(org.ovirt.engine.core.common.businessentities.VDS) VDS(org.ovirt.engine.core.common.businessentities.VDS) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 85 with EntityModel

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));
}
Also used : GlusterVolumeSnapshotConfig(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeSnapshotConfig) AbstractEntityModelTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEntityModelTextColumn) Column(com.google.gwt.user.cellview.client.Column) NameRenderer(org.ovirt.engine.ui.common.widget.renderer.NameRenderer) NoSelectionModel(com.google.gwt.view.client.NoSelectionModel) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) TextInputCell(com.google.gwt.cell.client.TextInputCell)

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