Search in sources :

Example 36 with UICommand

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

the class VmListModel method editConsole.

private void editConsole() {
    if (getWindow() != null || getSelectedItem() == null) {
        return;
    }
    final VmConsoles activeVmConsoles = consolesFactory.getVmConsolesForVm(getSelectedItem());
    final ConsolePopupModel model = new ConsolePopupModel();
    model.setVmConsoles(activeVmConsoles);
    model.setHelpTag(HelpTag.editConsole);
    // $NON-NLS-1$
    model.setHashName("editConsole");
    setWindow(model);
    // $NON-NLS-1$
    final UICommand saveCommand = UICommand.createDefaultOkUiCommand("OnEditConsoleSave", this);
    model.getCommands().add(saveCommand);
    // $NON-NLS-1$
    final UICommand cancelCommand = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(cancelCommand);
}
Also used : ConsolePopupModel(org.ovirt.engine.ui.uicommonweb.models.ConsolePopupModel) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) VmConsoles(org.ovirt.engine.ui.uicommonweb.models.VmConsoles)

Example 37 with UICommand

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

the class VmSnapshotListModel method cloneTemplate.

private void cloneTemplate() {
    Snapshot snapshot = getSelectedItem();
    if (snapshot == null) {
        return;
    }
    if (getWindow() != null) {
        return;
    }
    final UnitVmModel model = new UnitVmModel(createNewTemplateBehavior(), this);
    setWindow(model);
    model.startProgress();
    AsyncDataProvider.getInstance().getVmConfigurationBySnapshot(new AsyncQuery<>(vm -> {
        NewTemplateVmModelBehavior behavior = (NewTemplateVmModelBehavior) model.getBehavior();
        behavior.setVm(vm);
        model.setTitle(ConstantsManager.getInstance().getConstants().newTemplateTitle());
        model.setHelpTag(HelpTag.clone_template_from_snapshot);
        // $NON-NLS-1$
        model.setHashName("clone_template_from_snapshot");
        model.setIsNew(true);
        model.setCustomPropertiesKeysList(AsyncDataProvider.getInstance().getCustomPropertiesList());
        model.initialize();
        model.getVmType().setSelectedItem(vm.getVmType());
        model.getIsHighlyAvailable().setEntity(vm.getStaticData().isAutoStartup());
        model.getCommands().add(// $NON-NLS-1$
        new UICommand("OnNewTemplate", VmSnapshotListModel.this).setTitle(ConstantsManager.getInstance().getConstants().ok()).setIsDefault(true));
        // $NON-NLS-1$
        model.getCommands().add(UICommand.createCancelUiCommand("Cancel", VmSnapshotListModel.this));
        model.stopProgress();
    }), snapshot.getId());
}
Also used : CommonUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.CommonUnitToVmBaseBuilder) UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) QueryType(org.ovirt.engine.core.common.queries.QueryType) UnitToAddVmTemplateParametersBuilder(org.ovirt.engine.ui.uicommonweb.builders.template.UnitToAddVmTemplateParametersBuilder) FullUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.FullUnitToVmBaseBuilder) RemoveSnapshotParameters(org.ovirt.engine.core.common.action.RemoveSnapshotParameters) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SnapshotActionEnum(org.ovirt.engine.core.common.businessentities.SnapshotActionEnum) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) RestoreAllSnapshotsParameters(org.ovirt.engine.core.common.action.RestoreAllSnapshotsParameters) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) AddVmFromSnapshotParameters(org.ovirt.engine.core.common.action.AddVmFromSnapshotParameters) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) VmBaseToVmBaseForTemplateCompositeBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.template.VmBaseToVmBaseForTemplateCompositeBaseBuilder) DateTimeFormat(com.google.gwt.i18n.client.DateTimeFormat) Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) ActionUtils(org.ovirt.engine.core.common.ActionUtils) SnapshotStatus(org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotStatus) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) Linq(org.ovirt.engine.ui.uicommonweb.Linq) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Set(java.util.Set) TryBackToAllSnapshotsOfVmParameters(org.ovirt.engine.core.common.action.TryBackToAllSnapshotsOfVmParameters) StringHelper(org.ovirt.engine.core.compat.StringHelper) Collectors(java.util.stream.Collectors) SnapshotType(org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) AddVmTemplateFromSnapshotParameters(org.ovirt.engine.core.common.action.AddVmTemplateFromSnapshotParameters) Comparator(java.util.Comparator) Collections(java.util.Collections) VMStatus(org.ovirt.engine.core.common.businessentities.VMStatus) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) VmSpecificUnitToVmBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.VmSpecificUnitToVmBuilder) Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 38 with UICommand

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

the class VmSnapshotListModel method cloneVM.

private void cloneVM() {
    Snapshot snapshot = getSelectedItem();
    if (snapshot == null) {
        return;
    }
    if (getWindow() != null) {
        return;
    }
    VM selectedVm = getEntity();
    UnitVmModel model = new UnitVmModel(new CloneVmFromSnapshotModelBehavior(), this);
    model.getVmType().setSelectedItem(selectedVm.getVmType());
    // $NON-NLS-1$
    model.setIsAdvancedModeLocalStorageKey("wa_snapshot_dialog");
    setWindow(model);
    model.startProgress();
    AsyncDataProvider.getInstance().getVmConfigurationBySnapshot(new AsyncQuery<>(vm -> {
        UnitVmModel unitVmModel = (UnitVmModel) getWindow();
        CloneVmFromSnapshotModelBehavior behavior = (CloneVmFromSnapshotModelBehavior) unitVmModel.getBehavior();
        behavior.setVm(vm);
        unitVmModel.setTitle(ConstantsManager.getInstance().getConstants().cloneVmFromSnapshotTitle());
        unitVmModel.setHelpTag(HelpTag.clone_vm_from_snapshot);
        // $NON-NLS-1$
        unitVmModel.setHashName("clone_vm_from_snapshot");
        unitVmModel.setCustomPropertiesKeysList(AsyncDataProvider.getInstance().getCustomPropertiesList());
        unitVmModel.initialize();
        VmBasedWidgetSwitchModeCommand switchModeCommand = new VmBasedWidgetSwitchModeCommand();
        switchModeCommand.init(unitVmModel);
        unitVmModel.getCommands().add(switchModeCommand);
        // $NON-NLS-1$
        UICommand tempVar = UICommand.createDefaultOkUiCommand("OnCloneVM", VmSnapshotListModel.this);
        unitVmModel.getCommands().add(tempVar);
        // $NON-NLS-1$
        UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", VmSnapshotListModel.this);
        unitVmModel.getCommands().add(tempVar2);
        stopProgress();
    }), snapshot.getId());
}
Also used : CommonUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.CommonUnitToVmBaseBuilder) UnitToGraphicsDeviceParamsBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.UnitToGraphicsDeviceParamsBuilder) QueryType(org.ovirt.engine.core.common.queries.QueryType) UnitToAddVmTemplateParametersBuilder(org.ovirt.engine.ui.uicommonweb.builders.template.UnitToAddVmTemplateParametersBuilder) FullUnitToVmBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.FullUnitToVmBaseBuilder) RemoveSnapshotParameters(org.ovirt.engine.core.common.action.RemoveSnapshotParameters) Guid(org.ovirt.engine.core.compat.Guid) HelpTag(org.ovirt.engine.ui.uicommonweb.help.HelpTag) SnapshotActionEnum(org.ovirt.engine.core.common.businessentities.SnapshotActionEnum) HashMap(java.util.HashMap) ActionReturnValue(org.ovirt.engine.core.common.action.ActionReturnValue) RestoreAllSnapshotsParameters(org.ovirt.engine.core.common.action.RestoreAllSnapshotsParameters) SearchableListModel(org.ovirt.engine.ui.uicommonweb.models.SearchableListModel) DiskImage(org.ovirt.engine.core.common.businessentities.storage.DiskImage) IdQueryParameters(org.ovirt.engine.core.common.queries.IdQueryParameters) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel) ArrayList(java.util.ArrayList) AddVmFromSnapshotParameters(org.ovirt.engine.core.common.action.AddVmFromSnapshotParameters) EntityModel(org.ovirt.engine.ui.uicommonweb.models.EntityModel) ActionType(org.ovirt.engine.core.common.action.ActionType) Frontend(org.ovirt.engine.ui.frontend.Frontend) VmBaseToVmBaseForTemplateCompositeBaseBuilder(org.ovirt.engine.ui.uicommonweb.builders.template.VmBaseToVmBaseForTemplateCompositeBaseBuilder) DateTimeFormat(com.google.gwt.i18n.client.DateTimeFormat) Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) ConstantsManager(org.ovirt.engine.ui.uicompat.ConstantsManager) AsyncDataProvider(org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider) Model(org.ovirt.engine.ui.uicommonweb.models.Model) ActionUtils(org.ovirt.engine.core.common.ActionUtils) SnapshotStatus(org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotStatus) DiskStorageType(org.ovirt.engine.core.common.businessentities.storage.DiskStorageType) Linq(org.ovirt.engine.ui.uicommonweb.Linq) BuilderExecutor(org.ovirt.engine.ui.uicommonweb.builders.BuilderExecutor) Collection(java.util.Collection) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) Set(java.util.Set) TryBackToAllSnapshotsOfVmParameters(org.ovirt.engine.core.common.action.TryBackToAllSnapshotsOfVmParameters) StringHelper(org.ovirt.engine.core.compat.StringHelper) Collectors(java.util.stream.Collectors) SnapshotType(org.ovirt.engine.core.common.businessentities.Snapshot.SnapshotType) List(java.util.List) VM(org.ovirt.engine.core.common.businessentities.VM) AddVmTemplateFromSnapshotParameters(org.ovirt.engine.core.common.action.AddVmTemplateFromSnapshotParameters) Comparator(java.util.Comparator) Collections(java.util.Collections) VMStatus(org.ovirt.engine.core.common.businessentities.VMStatus) PropertyChangedEventArgs(org.ovirt.engine.ui.uicompat.PropertyChangedEventArgs) VmSpecificUnitToVmBuilder(org.ovirt.engine.ui.uicommonweb.builders.vm.VmSpecificUnitToVmBuilder) Snapshot(org.ovirt.engine.core.common.businessentities.Snapshot) VM(org.ovirt.engine.core.common.businessentities.VM) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Example 39 with UICommand

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

the class VolumeListModel method removeVolume.

private void removeVolume() {
    if (getWindow() != null) {
        return;
    }
    ConfirmationModel model = new ConfirmationModel();
    setWindow(model);
    model.setTitle(ConstantsManager.getInstance().getConstants().removeVolumesTitle());
    model.setHelpTag(HelpTag.remove_volume);
    // $NON-NLS-1$
    model.setHashName("remove_volume");
    if (isMetaVolumeInList(getSelectedItems())) {
        model.setNote(ConstantsManager.getInstance().getConstants().removeMetaVolumeWarning());
    } else {
        model.setNote(ConstantsManager.getInstance().getConstants().removeVolumesWarning());
    }
    if (getSelectedItems() == null) {
        return;
    }
    ArrayList<String> list = new ArrayList<>();
    for (GlusterVolumeEntity item : getSelectedItems()) {
        list.add(item.getName());
    }
    model.setItems(list);
    // $NON-NLS-1$
    UICommand tempVar = UICommand.createDefaultOkUiCommand("OnRemove", this);
    model.getCommands().add(tempVar);
    // $NON-NLS-1$
    UICommand tempVar2 = UICommand.createCancelUiCommand("Cancel", this);
    model.getCommands().add(tempVar2);
}
Also used : GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) ArrayList(java.util.ArrayList) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand) ConfirmationModel(org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)

Example 40 with UICommand

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

the class VolumeListModel method showVolumeProfiling.

private void showVolumeProfiling() {
    if (getSelectedItem() == null || getWindow() != null) {
        return;
    }
    GlusterVolumeEntity selectedVolume = getSelectedItem();
    VolumeProfileStatisticsModel profileStatsModel = new VolumeProfileStatisticsModel(selectedVolume.getClusterId(), selectedVolume.getId(), selectedVolume.getName());
    setWindow(profileStatsModel);
    setHelpTag(HelpTag.volume_profile_statistics);
    // $NON-NLS-1$
    setHashName("volume_profile_statistics");
    // $NON-NLS-1$
    profileStatsModel.startProgress(ConstantsManager.getInstance().getConstants().fetchingDataMessage());
    // $NON-NLS-1$
    UICommand closeProfilingStats = new UICommand("closeProfileStats", VolumeListModel.this);
    closeProfilingStats.setTitle(ConstantsManager.getInstance().getConstants().close());
    closeProfilingStats.setIsCancel(true);
    profileStatsModel.getCommands().add(closeProfilingStats);
    if (selectedVolume.isNfsEnabled()) {
        profileStatsModel.queryBackend(true);
    }
    profileStatsModel.queryBackend(false);
}
Also used : VolumeProfileStatisticsModel(org.ovirt.engine.ui.uicommonweb.models.gluster.VolumeProfileStatisticsModel) GlusterVolumeEntity(org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity) UICommand(org.ovirt.engine.ui.uicommonweb.UICommand)

Aggregations

UICommand (org.ovirt.engine.ui.uicommonweb.UICommand)257 ConfirmationModel (org.ovirt.engine.ui.uicommonweb.models.ConfirmationModel)134 ArrayList (java.util.ArrayList)105 List (java.util.List)49 AsyncDataProvider (org.ovirt.engine.ui.uicommonweb.dataprovider.AsyncDataProvider)49 HelpTag (org.ovirt.engine.ui.uicommonweb.help.HelpTag)49 ConstantsManager (org.ovirt.engine.ui.uicompat.ConstantsManager)48 ActionType (org.ovirt.engine.core.common.action.ActionType)47 Frontend (org.ovirt.engine.ui.frontend.Frontend)47 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)44 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)41 ActionParametersBase (org.ovirt.engine.core.common.action.ActionParametersBase)36 Guid (org.ovirt.engine.core.compat.Guid)36 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)33 QueryType (org.ovirt.engine.core.common.queries.QueryType)33 VDS (org.ovirt.engine.core.common.businessentities.VDS)30 GlusterVolumeEntity (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity)29 Linq (org.ovirt.engine.ui.uicommonweb.Linq)28 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)26 ApplicationMode (org.ovirt.engine.core.common.mode.ApplicationMode)24