diff options
| author | Shireesh Anjal <shireesh@gluster.com> | 2011-05-09 15:20:04 +0530 |
|---|---|---|
| committer | Shireesh Anjal <shireesh@gluster.com> | 2011-05-09 15:20:04 +0530 |
| commit | c0db2695f0979b400ebea561bccd72a8cd9aee75 (patch) | |
| tree | 99c23854decf242866fcf0c132e05548ec50aaca /src/com.gluster.storage.management.gui | |
| parent | 2668c28ff8a4bb678304e73b156c34dc889aea8b (diff) | |
Story #42 - Volume logs download
Diffstat (limited to 'src/com.gluster.storage.management.gui')
| -rw-r--r-- | src/com.gluster.storage.management.gui/plugin.xml | 16 | ||||
| -rw-r--r-- | src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DownloadVolumeLogsAction.java | 70 |
2 files changed, 86 insertions, 0 deletions
diff --git a/src/com.gluster.storage.management.gui/plugin.xml b/src/com.gluster.storage.management.gui/plugin.xml index b208fc24..6c6983a3 100644 --- a/src/com.gluster.storage.management.gui/plugin.xml +++ b/src/com.gluster.storage.management.gui/plugin.xml @@ -526,6 +526,22 @@ </action> <action allowLabelUpdate="false" + class="com.gluster.storage.management.gui.actions.DownloadVolumeLogsAction" + definitionId="com.gluster.storage.management.gui.commands.DownloadVolumeLogs" + icon="icons/logs.png" + id="com.gluster.storage.management.gui.actions.DownloadVolumeLogsAction" + label="Download &Logs" + menubarPath="com.gluster.storage.management.gui.menu.volume/volume" + mode="FORCE_TEXT" + pulldown="false" + retarget="false" + state="false" + style="push" + toolbarPath="Normal" + tooltip="Download all logs of the volume"> + </action> + <action + allowLabelUpdate="false" class="com.gluster.storage.management.gui.actions.ResetVolumeOptionsAction" definitionId="com.gluster.storage.management.gui.commands.ResetVolumeOptions" icon="icons/reset-options.png" diff --git a/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DownloadVolumeLogsAction.java b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DownloadVolumeLogsAction.java new file mode 100644 index 00000000..d8547644 --- /dev/null +++ b/src/com.gluster.storage.management.gui/src/com/gluster/storage/management/gui/actions/DownloadVolumeLogsAction.java @@ -0,0 +1,70 @@ +/******************************************************************************* + * Copyright (c) 2011 Gluster, Inc. <http://www.gluster.com> + * This file is part of Gluster Management Console. + * + * Gluster Management Console is free software; you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Gluster Management Console is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License + * for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * <http://www.gnu.org/licenses/>. + *******************************************************************************/ +package com.gluster.storage.management.gui.actions; + +import java.io.File; + +import org.eclipse.jface.action.IAction; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.FileDialog; + +import com.gluster.storage.management.client.GlusterDataModelManager; +import com.gluster.storage.management.client.VolumesClient; +import com.gluster.storage.management.core.model.Volume; + +/** + * + */ +public class DownloadVolumeLogsAction extends AbstractActionDelegate { + + /* (non-Javadoc) + * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose() + */ + @Override + public void dispose() { + // TODO Auto-generated method stub + + } + + /* (non-Javadoc) + * @see com.gluster.storage.management.gui.actions.AbstractActionDelegate#performAction(org.eclipse.jface.action.IAction) + */ + @Override + protected void performAction(IAction action) { + final Volume volume = (Volume)selectedEntity; + final VolumesClient client = new VolumesClient(GlusterDataModelManager.getInstance().getSecurityToken()); + Display.getDefault().asyncExec(new Runnable() { + + @Override + public void run() { + FileDialog dialog = new FileDialog(getShell(), SWT.SAVE); + dialog.setFilterNames(new String[] {"GZipped Tar"}); + dialog.setFilterExtensions(new String[] {"*.tar.gz"}); + dialog.open(); + + try { + client.downloadLogs(volume.getName(), dialog.getFilterPath() + File.separator + dialog.getFileName()); + } catch(Exception e) { + showErrorDialog("Download Volume Logs [" + volume.getName() + "]", e.getMessage()); + } + } + }); + } +} |
