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);
}
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());
}
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());
}
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);
}
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);
}
Aggregations