Search in sources :

Example 1 with ErrataCounts

use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.

the class GetErrataCountsForHostQueryTest method availableHostErrata.

@Test
public void availableHostErrata() {
    setupToReportErrata(expectedErrata());
    getQuery().executeQueryCommand();
    ErrataCounts counts = getQuery().getQueryReturnValue().getReturnValue();
    assertEquals(5, counts.getCountByType(ErrataType.BUGFIX));
    assertEquals(4, counts.getCountByType(ErrataType.ENHANCEMENT));
    assertEquals(2, counts.getCountByType(ErrataType.SECURITY));
    assertEquals(0, counts.getCountByTypeAndSeverity(ErrataType.SECURITY, ErrataSeverity.MODERATE));
}
Also used : ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts) Test(org.junit.Test)

Example 2 with ErrataCounts

use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.

the class SubTabVirtualMachineErrataPresenter method onBind.

@Override
protected void onBind() {
    super.onBind();
    getView().getTotalSecurity().setCommand(errataCountModel.getShowSecurityCommand());
    getView().getTotalBugFix().setCommand(errataCountModel.getShowBugsCommand());
    getView().getTotalEnhancement().setCommand(errataCountModel.getShowEnhancementsCommand());
    registerHandler(getView().getTotalSecurity().addClickHandler(event -> getView().getTotalSecurity().getCommand().execute()));
    registerHandler(getView().getTotalBugFix().addClickHandler(event -> getView().getTotalBugFix().getCommand().execute()));
    registerHandler(getView().getTotalEnhancement().addClickHandler(event -> getView().getTotalEnhancement().getCommand().execute()));
    // Handle the counts changing -> simple view update.
    // 
    errataCountModel.addErrataCountsChangeListener((ev, sender, args) -> {
        // bus published message that the counts changed. update view.
        ErrataCounts counts = errataCountModel.getErrataCounts();
        getView().showCounts(counts);
    });
    // Handle the count model getting a query error -> simple view update.
    // 
    errataCountModel.addPropertyChangeListener((ev, sender, args) -> {
        if ("Message".equals(args.propertyName)) {
            // bus published message that an error occurred communicating with Katello. Show the alert panel.
            if (errataCountModel.getMessage() != null && !errataCountModel.getMessage().isEmpty()) {
                getView().showErrorMessage(SafeHtmlUtils.fromString(errataCountModel.getMessage()));
            } else {
                getView().clearErrorMessage();
            }
        } else if (PropertyChangedEventArgs.PROGRESS.equals(args.propertyName)) {
            if (errataCountModel.getProgress() != null) {
                getView().showProgress();
            }
        }
    });
}
Also used : AbstractUiCommandButton(org.ovirt.engine.ui.common.widget.AbstractUiCommandButton) ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts) VmListModel(org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel) EventBus(com.google.gwt.event.shared.EventBus) ProxyCodeSplit(com.gwtplatform.mvp.client.annotations.ProxyCodeSplit) NameToken(com.gwtplatform.mvp.client.annotations.NameToken) Inject(com.google.inject.Inject) TabContentProxyPlace(com.gwtplatform.mvp.client.proxy.TabContentProxyPlace) AbstractSubTabPresenter(org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter) DetailTabDataIndex(org.ovirt.engine.ui.webadmin.section.main.presenter.tab.DetailTabDataIndex) VM(org.ovirt.engine.core.common.businessentities.VM) VmErrataCountModel(org.ovirt.engine.ui.uicommonweb.models.VmErrataCountModel) DetailTabModelProvider(org.ovirt.engine.ui.common.uicommon.model.DetailTabModelProvider) TabInfo(com.gwtplatform.mvp.client.annotations.TabInfo) PlaceManager(com.gwtplatform.mvp.client.proxy.PlaceManager) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) TabData(com.gwtplatform.mvp.client.TabData) ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts)

Example 3 with ErrataCounts

use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.

the class SubTabHostErrataPresenter method initializeHandlers.

@Override
public void initializeHandlers() {
    super.initializeHandlers();
    registerHandler(getView().getTotalSecurity().addClickHandler(event -> getView().getTotalSecurity().getCommand().execute()));
    registerHandler(getView().getTotalBugFix().addClickHandler(event -> getView().getTotalBugFix().getCommand().execute()));
    registerHandler(getView().getTotalEnhancement().addClickHandler(event -> getView().getTotalEnhancement().getCommand().execute()));
    // Handle the counts changing -> simple view update.
    // 
    errataCountModel.addErrataCountsChangeListener((ev, sender, args) -> {
        // bus published message that the counts changed. update view.
        ErrataCounts counts = errataCountModel.getErrataCounts();
        getView().showCounts(counts);
    });
    // Handle the count model getting a query error -> simple view update.
    // 
    errataCountModel.addPropertyChangeListener((ev, sender, args) -> {
        if ("Message".equals(args.propertyName)) {
            // $NON-NLS-1$
            if (errataCountModel.getMessage() != null && !errataCountModel.getMessage().isEmpty()) {
                // bus published message that an error occurred communicating with Katello. Show the alert panel.
                getView().showErrorMessage(SafeHtmlUtils.fromString(errataCountModel.getMessage()));
            }
        } else if (PropertyChangedEventArgs.PROGRESS.equals(args.propertyName)) {
            if (errataCountModel.getProgress() != null) {
                getView().showProgress();
            }
        }
    });
}
Also used : AbstractUiCommandButton(org.ovirt.engine.ui.common.widget.AbstractUiCommandButton) ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts) EventBus(com.google.gwt.event.shared.EventBus) ProxyCodeSplit(com.gwtplatform.mvp.client.annotations.ProxyCodeSplit) NameToken(com.gwtplatform.mvp.client.annotations.NameToken) Inject(com.google.inject.Inject) TabContentProxyPlace(com.gwtplatform.mvp.client.proxy.TabContentProxyPlace) AbstractSubTabPresenter(org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter) DetailTabDataIndex(org.ovirt.engine.ui.webadmin.section.main.presenter.tab.DetailTabDataIndex) DetailTabModelProvider(org.ovirt.engine.ui.common.uicommon.model.DetailTabModelProvider) HostErrataCountModel(org.ovirt.engine.ui.uicommonweb.models.HostErrataCountModel) TabInfo(com.gwtplatform.mvp.client.annotations.TabInfo) PlaceManager(com.gwtplatform.mvp.client.proxy.PlaceManager) HostListModel(org.ovirt.engine.ui.uicommonweb.models.hosts.HostListModel) WebAdminApplicationPlaces(org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces) SafeHtml(com.google.gwt.safehtml.shared.SafeHtml) VDS(org.ovirt.engine.core.common.businessentities.VDS) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) SafeHtmlUtils(com.google.gwt.safehtml.shared.SafeHtmlUtils) TabData(com.gwtplatform.mvp.client.TabData) ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts)

Example 4 with ErrataCounts

use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.

the class KatelloProvider method mapErrataCounts.

private ErrataCounts mapErrataCounts(ErrataWrapper wrapper) {
    ErrataCounts errataCounts = new ErrataCounts();
    errataCounts.setTotalErrata(wrapper.getTotalCount());
    errataCounts.setSubTotalErrata(wrapper.getSubTotalCount());
    return errataCounts;
}
Also used : ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts)

Example 5 with ErrataCounts

use of org.ovirt.engine.core.common.businessentities.ErrataCounts in project ovirt-engine by oVirt.

the class AbstractErrataCountModel method runQuery.

public void runQuery(Guid guid) {
    // $NON-NLS-1$
    startProgress("getCount");
    AsyncQuery<QueryReturnValue> asyncQuery = new AsyncQuery<>(returnValue -> {
        stopProgress();
        ErrataCounts resultEntity = returnValue.getReturnValue();
        // Set message to null to make sure the actual setMessage creates an event.
        setMessage(null);
        if (resultEntity != null && returnValue.getSucceeded()) {
            setErrataCounts(resultEntity);
        } else {
            setMessage(// $NON-NLS-1$
            constants.katelloProblemRetrievingErrata() + " " + returnValue.getExceptionMessage());
        }
    });
    asyncQuery.setHandleFailure(true);
    Frontend.getInstance().runQuery(getQueryType(), new GetErrataCountsParameters(guid), asyncQuery);
}
Also used : QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) ErrataCounts(org.ovirt.engine.core.common.businessentities.ErrataCounts) GetErrataCountsParameters(org.ovirt.engine.core.common.queries.GetErrataCountsParameters)

Aggregations

ErrataCounts (org.ovirt.engine.core.common.businessentities.ErrataCounts)7 EventBus (com.google.gwt.event.shared.EventBus)2 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)2 SafeHtmlUtils (com.google.gwt.safehtml.shared.SafeHtmlUtils)2 Inject (com.google.inject.Inject)2 TabData (com.gwtplatform.mvp.client.TabData)2 NameToken (com.gwtplatform.mvp.client.annotations.NameToken)2 ProxyCodeSplit (com.gwtplatform.mvp.client.annotations.ProxyCodeSplit)2 TabInfo (com.gwtplatform.mvp.client.annotations.TabInfo)2 PlaceManager (com.gwtplatform.mvp.client.proxy.PlaceManager)2 TabContentProxyPlace (com.gwtplatform.mvp.client.proxy.TabContentProxyPlace)2 Test (org.junit.Test)2 AbstractSubTabPresenter (org.ovirt.engine.ui.common.presenter.AbstractSubTabPresenter)2 DetailTabModelProvider (org.ovirt.engine.ui.common.uicommon.model.DetailTabModelProvider)2 AbstractUiCommandButton (org.ovirt.engine.ui.common.widget.AbstractUiCommandButton)2 WebAdminApplicationPlaces (org.ovirt.engine.ui.uicommonweb.place.WebAdminApplicationPlaces)2 PropertyChangedEventArgs (org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs)2 DetailTabDataIndex (org.ovirt.engine.ui.webadmin.section.main.presenter.tab.DetailTabDataIndex)2 ErrataData (org.ovirt.engine.core.common.businessentities.ErrataData)1 ErrataType (org.ovirt.engine.core.common.businessentities.Erratum.ErrataType)1