Search in sources :

Example 1 with StorageSyncSchedule

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

the class StorageDRListModel method onSave.

private void onSave() {
    final StorageDRModel model = (StorageDRModel) getWindow();
    if (!model.validate()) {
        return;
    }
    StorageDomain storageDomain = getEntity();
    final StorageSyncSchedule syncSchedule = new StorageSyncSchedule();
    syncSchedule.setFrequency(model.getFrequency().getSelectedItem());
    syncSchedule.setHour(model.getHour().getSelectedItem());
    syncSchedule.setMins(model.getMins().getSelectedItem());
    Guid georepId = model.getGeoRepSession().getSelectedItem() != null ? model.getGeoRepSession().getSelectedItem().getId() : null;
    StorageSyncScheduleParameters parameter = new StorageSyncScheduleParameters(syncSchedule, storageDomain.getId(), georepId);
    model.startProgress();
    Frontend.getInstance().runAction(ActionType.ScheduleGlusterStorageSync, parameter, result -> {
        StorageDRListModel localModel = (StorageDRListModel) result.getState();
        model.stopProgress();
        localModel.postSaveAction(result.getReturnValue());
    }, this);
}
Also used : StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) Guid(org.ovirt.engine.core.compat.Guid) StorageSyncScheduleParameters(org.ovirt.engine.core.common.action.StorageSyncScheduleParameters)

Example 2 with StorageSyncSchedule

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

the class SubTabStorageDRView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    AbstractTextColumn<StorageDomainDR> sessionColumn = new AbstractTextColumn<StorageDomainDR>() {

        @Override
        public String getValue(StorageDomainDR storageDomainDR) {
            GlusterGeoRepSession session = getDetailModel().getGeoRepSessionsMap().get(storageDomainDR.getGeoRepSessionId());
            if (session == null) {
                return storageDomainDR.getGeoRepSessionId().toString();
            } else {
                return messages.geoRepRemoteSessionName(session.getSlaveHostName(), session.getSlaveVolumeName());
            }
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(sessionColumn, constants.geoRepSlaveVolume(), "300px");
    AbstractTextColumn<StorageDomainDR> scheduleColumn = new AbstractTextColumn<StorageDomainDR>() {

        @Override
        public String getValue(StorageDomainDR storageDomainDR) {
            StorageSyncSchedule schedule = new StorageSyncSchedule(storageDomainDR.getScheduleCronExpression());
            return schedule.toString();
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(scheduleColumn, constants.scheduleLabel(), "300px");
}
Also used : StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)

Example 3 with StorageSyncSchedule

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

the class StorageDRListModel method editDR.

private void editDR() {
    if (getWindow() != null) {
        return;
    }
    final StorageDomain storageDomain = getEntity();
    if (storageDomain == null) {
        return;
    }
    final StorageDomainDR selectedDR = getSelectedItem();
    StorageSyncSchedule schedule = new StorageSyncSchedule(selectedDR.getScheduleCronExpression());
    final StorageDRModel model = new StorageDRModel();
    model.setHelpTag(HelpTag.new_storage_dr);
    model.setTitle(ConstantsManager.getInstance().getConstants().edit());
    // $NON-NLS-1$
    model.setHashName("edit_dr");
    model.getStorageDomain().setEntity(storageDomain);
    setWindow(model);
    model.startProgress();
    model.getFrequency().setSelectedItem(schedule.getFrequency());
    model.getHour().setSelectedItem(schedule.getHour());
    model.getMins().setSelectedItem(schedule.getMins());
    AsyncDataProvider.getInstance().getGlusterGeoRepSessionsForStorageDomain(new AsyncQuery<>(geoRepSessions -> {
        model.getGeoRepSession().setItems(geoRepSessions);
        model.getGeoRepSession().setSelectedItem(Linq.firstOrNull(geoRepSessions, new Linq.IdPredicate<>(selectedDR.getGeoRepSessionId())));
        model.stopProgress();
    }), storageDomain.getId());
    // $NON-NLS-1$
    UICommand okCommand = UICommand.createDefaultOkUiCommand("OnSave", this);
    model.getCommands().add(okCommand);
    // $NON-NLS-1$
    UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(cancelCommand);
}
Also used : GlusterGeoRepSession(org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession) QueryType(org.ovirt.engine.core.common.queries.QueryType) QueryReturnValue(org.ovirt.engine.core.common.queries.QueryReturnValue) Linq(org.ovirt.engine.ui.uicommonweb.Linq) Guid(org.ovirt.engine.core.compat.Guid) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) ArrayList(java.util.ArrayList) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) List(java.util.List) Map(java.util.Map) StorageSyncScheduleParameters(org.ovirt.engine.core.common.action.StorageSyncScheduleParameters) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) StorageSyncSchedule(org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule) StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageDomainDR(org.ovirt.engine.core.common.businessentities.StorageDomainDR) Linq(org.ovirt.engine.ui.uicommonweb.Linq) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

StorageSyncSchedule (org.ovirt.engine.core.common.businessentities.gluster.StorageSyncSchedule)3 StorageSyncScheduleParameters (org.ovirt.engine.core.common.action.StorageSyncScheduleParameters)2 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)2 StorageDomainDR (org.ovirt.engine.core.common.businessentities.StorageDomainDR)2 GlusterGeoRepSession (org.ovirt.engine.core.common.businessentities.gluster.GlusterGeoRepSession)2 Guid (org.ovirt.engine.core.compat.Guid)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)1 ActionType (org.ovirt.engine.core.common.action.ActionType)1 IdQueryParameters (org.ovirt.engine.core.common.queries.IdQueryParameters)1 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)1 QueryType (org.ovirt.engine.core.common.queries.QueryType)1 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)1 Frontend (org.ovirt.engine.ui.frontend.Frontend)1 Linq (org.ovirt.engine.ui.uicommonweb.Linq)1 UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)1 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)1