From f02f719cf28dea27923ad04dd7c1c50ea49933ff Mon Sep 17 00:00:00 2001 From: Dhandapani Date: Wed, 17 Aug 2011 16:09:00 +0530 Subject: conflict fixes --- .../plugin.properties | 3 +- .../plugin.xml | 11 +----- .../management/console/ConsoleConstants.java | 26 +++++++++++++++ .../console/dialogs/CreateVolumePage1.java | 1 - .../console/dialogs/CreateVolumeWizard.java | 14 ++++++-- .../management/console/utils/GUIHelper.java | 5 ++- .../console/views/GlusterViewsManager.java | 9 +++-- .../management/console/views/TerminalView.java | 26 --------------- .../console/views/VolumeSummaryView.java | 39 +++++++++++++++++----- 9 files changed, 78 insertions(+), 56 deletions(-) create mode 100644 src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/ConsoleConstants.java delete mode 100644 src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/TerminalView.java (limited to 'src/com.gluster.storage.management.console') diff --git a/src/com.gluster.storage.management.console/plugin.properties b/src/com.gluster.storage.management.console/plugin.properties index 6a93e73d..4ef7da70 100644 --- a/src/com.gluster.storage.management.console/plugin.properties +++ b/src/com.gluster.storage.management.console/plugin.properties @@ -3,4 +3,5 @@ Version: 1.0.0\n\n\ Copyright (c) 2011 Gluster, Inc.\n\ Visit http://www.gluster.com/\n\n\ This product includes software developed by the\n\ -Eclipse Foundation http://eclipse.org/ \ No newline at end of file +Eclipse Foundation http://eclipse.org/\n\ +RichClientGUI http://www.richclientgui.com/ \ No newline at end of file diff --git a/src/com.gluster.storage.management.console/plugin.xml b/src/com.gluster.storage.management.console/plugin.xml index 675b7e52..9cadd537 100644 --- a/src/com.gluster.storage.management.console/plugin.xml +++ b/src/com.gluster.storage.management.console/plugin.xml @@ -175,15 +175,6 @@ name="Tasks" restorable="true"> - - @@ -1419,7 +1410,7 @@ + * 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 + * . + *******************************************************************************/ +package com.gluster.storage.management.console; + +/** + * + */ +public class ConsoleConstants { + public static final String TERMINAL_VIEW_ID = "org.eclipse.tm.terminal.view.TerminalView"; +} diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumePage1.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumePage1.java index 8fa27087..d7d98d24 100644 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumePage1.java +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumePage1.java @@ -362,7 +362,6 @@ public class CreateVolumePage1 extends WizardPage { } addVolumeBricks(); - return volume; } diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java index bfb29ee1..498723d9 100644 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/dialogs/CreateVolumeWizard.java @@ -28,6 +28,7 @@ import com.gluster.storage.management.console.utils.GlusterLogger; import com.gluster.storage.management.core.constants.CoreConstants; import com.gluster.storage.management.core.model.Volume; import com.gluster.storage.management.core.model.Volume.VOLUME_STATUS; +import com.gluster.storage.management.core.model.Volume.VOLUME_TYPE; public class CreateVolumeWizard extends Wizard { private static final String title = "Gluster Management Console - Create Volume"; @@ -51,8 +52,17 @@ public class CreateVolumeWizard extends Wizard { try { volumesClient.createVolume(newVolume); + + // Set proper volume type before assign to model + VOLUME_TYPE volumetype = newVolume.getVolumeType(); + if (volumetype == VOLUME_TYPE.REPLICATE && newVolume.getBricks().size() > newVolume.getReplicaCount()) { + newVolume.setVolumeType(VOLUME_TYPE.DISTRIBUTED_REPLICATE); + } else if (volumetype == VOLUME_TYPE.STRIPE && newVolume.getBricks().size() > newVolume.getStripeCount()) { + newVolume.setVolumeType(VOLUME_TYPE.DISTRIBUTED_STRIPE); + } + handleSuccess(newVolume, volumesClient); - } catch(Exception e) { + } catch (Exception e) { String errMsg = e.getMessage(); // the error could be in to post-volume-create processing. check if this is the case. if (volumesClient.volumeExists(newVolume.getName())) { @@ -62,7 +72,7 @@ public class CreateVolumeWizard extends Wizard { return false; } } - + return true; } diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/utils/GUIHelper.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/utils/GUIHelper.java index 841d5a9d..f46f9ddf 100644 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/utils/GUIHelper.java +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/utils/GUIHelper.java @@ -80,11 +80,11 @@ import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.progress.IProgressConstants; import com.gluster.storage.management.console.Application; +import com.gluster.storage.management.console.ConsoleConstants; import com.gluster.storage.management.console.GlusterDataModelManager; import com.gluster.storage.management.console.IImageKeys; import com.gluster.storage.management.console.views.NavigationView; import com.gluster.storage.management.console.views.TasksView; -import com.gluster.storage.management.console.views.TerminalView; import com.gluster.storage.management.core.exceptions.GlusterRuntimeException; import com.gluster.storage.management.core.model.Disk; import com.gluster.storage.management.core.utils.JavaUtil; @@ -460,8 +460,7 @@ public class GUIHelper { } public void showTerminalView() { - //showView("org.eclipse.tm.terminal.view.TerminalView"); - showView(TerminalView.ID); + showView(ConsoleConstants.TERMINAL_VIEW_ID); } public void showProgressView() { diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterViewsManager.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterViewsManager.java index 928bc7fc..05c30626 100644 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterViewsManager.java +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/GlusterViewsManager.java @@ -24,6 +24,7 @@ import org.eclipse.ui.IViewReference; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; +import com.gluster.storage.management.console.ConsoleConstants; import com.gluster.storage.management.core.model.Cluster; import com.gluster.storage.management.core.model.Entity; import com.gluster.storage.management.core.model.EntityGroup; @@ -44,6 +45,7 @@ public class GlusterViewsManager implements ViewsManager { /* (non-Javadoc) * @see com.gluster.storage.management.console.views.ViewsManager#updateViews(com.gluster.storage.management.core.model.Entity) */ + @SuppressWarnings("rawtypes") @Override public void updateViews(Entity entity) { closeAllViews(); @@ -65,13 +67,11 @@ public class GlusterViewsManager implements ViewsManager { } } - /** - * - */ private void closeAllViews() { IViewReference[] viewReferences = page.getViewReferences(); for (final IViewReference viewReference : viewReferences) { - if (!(viewReference.getId().equals(NavigationView.ID) || viewReference.getId().equals(TerminalView.ID))) { + if (!(viewReference.getId().equals(NavigationView.ID) || viewReference.getId().equals( + ConsoleConstants.TERMINAL_VIEW_ID))) { page.hideView(viewReference); } } @@ -80,7 +80,6 @@ public class GlusterViewsManager implements ViewsManager { private void showViewsForCluster(Cluster cluster) throws PartInitException { page.showView(ClusterSummaryView.ID); page.showView(TasksView.ID, null, IWorkbenchPage.VIEW_CREATE); - //page.showView("org.eclipse.tm.terminal.view.TerminalView", null, IWorkbenchPage.VIEW_CREATE); } private void showViewsForVolume(Volume volume) throws PartInitException { diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/TerminalView.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/TerminalView.java deleted file mode 100644 index d99ac513..00000000 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/TerminalView.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Gluster, Inc. - * 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 - * . - *******************************************************************************/ -package com.gluster.storage.management.console.views; - -/** - * - */ -public class TerminalView extends org.eclipse.tm.internal.terminal.view.TerminalView { - public static final String ID = TerminalView.class.getName(); -} diff --git a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumeSummaryView.java b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumeSummaryView.java index 5de35000..dfd0c669 100644 --- a/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumeSummaryView.java +++ b/src/com.gluster.storage.management.console/src/com/gluster/storage/management/console/views/VolumeSummaryView.java @@ -3,6 +3,7 @@ package com.gluster.storage.management.console.views; import java.net.MalformedURLException; import java.net.URL; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.eclipse.jface.dialogs.MessageDialog; @@ -403,8 +404,6 @@ public class VolumeSummaryView extends ViewPart { guiHelper.setStatusMessage("Setting Cifs Configuration..."); parent.update(); - final String cifsUsers = cifsUsersText.getText().trim(); - // To check if no changes in the users list if (!isvalidCifsUser()) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Cifs Configuration", @@ -419,6 +418,7 @@ public class VolumeSummaryView extends ViewPart { public void run() { VolumesClient vc = new VolumesClient(); Volume newVolume = new Volume(); + String cifsUsers = cifsUsersText.getText().trim(); try { vc.setCifsConfig(volume.getName(), cifsCheckbox.getSelection(), cifsUsers); enableCifsUsersControls(false); @@ -665,7 +665,7 @@ public class VolumeSummaryView extends ViewPart { || volume.getVolumeType() == VOLUME_TYPE.DISTRIBUTED_REPLICATE) { replicaCount = (double) volume.getReplicaCount(); } - totalDiskSpace.setText("" + NumberUtil.formatNumber((getTotalDiskSpace() / 1024) / replicaCount)); + totalDiskSpace.setText("" + NumberUtil.formatNumber(getTotalDiskSpace() / 1024)); } private double getDiskSize(String serverName, String deviceName) { @@ -692,16 +692,39 @@ public class VolumeSummaryView extends ViewPart { } private double getTotalDiskSpace() { + List diskSizes = getVolumeDiskSizes(); + VOLUME_TYPE volumeType = volume.getVolumeType(); double diskSize = 0d; + if (volumeType == VOLUME_TYPE.DISTRIBUTE || volumeType == VOLUME_TYPE.STRIPE + || volumeType == VOLUME_TYPE.DISTRIBUTED_STRIPE) { + for (Double size : diskSizes) { + diskSize += size; + } + } else { // Replicate or distributed replicate + int replicaCount = volume.getReplicaCount(); + if (replicaCount == 0) { + replicaCount = Volume.DEFAULT_REPLICA_COUNT; + } + int startIndex = 0; + for (int i = 0; i < (diskSizes.size() / replicaCount); i++) { + startIndex = i * replicaCount; + diskSize += Collections.min(diskSizes.subList(startIndex, startIndex + replicaCount)); + } + } + return diskSize; + } + + private List getVolumeDiskSizes() { + List diskSizes = new ArrayList(); Device device; for (Brick brick : volume.getBricks()) { device = modelManager.getDeviceForBrickDir(brick); - if (device != null) { // In case of off line server, device becomes null - diskSize += getDiskSize(brick.getServerName(), device.getName()); - } + diskSizes.add( (device == null) ? 0d : getDiskSize(brick.getServerName(), device.getName()) ); } - return diskSize; + return diskSizes; } + + private void createDiskSpaceField(Composite section) { Label diskSpaceLabel = toolkit.createLabel(section, "Total Disk Space (GB): ", SWT.NONE); @@ -713,7 +736,7 @@ public class VolumeSummaryView extends ViewPart { replicaCount = (double) Volume.DEFAULT_REPLICA_COUNT; } totalDiskSpace = toolkit.createLabel(section, - "" + NumberUtil.formatNumber((getTotalDiskSpace() / 1024) / replicaCount), SWT.NONE); + "" + NumberUtil.formatNumber(getTotalDiskSpace() / 1024), SWT.NONE); toolkit.createLabel(section, "", SWT.NONE); // dummy } -- cgit From 9c44a91cc45290e8cbb91dfa9f449d442f145ef7 Mon Sep 17 00:00:00 2001 From: Dhandapani Date: Wed, 17 Aug 2011 16:03:44 +0530 Subject: Missing disabled icons added --- .../icons/tango/32x32/add-brick-disabled.png | Bin 0 -> 2063 bytes .../icons/tango/32x32/remove-server-disabled.png | Bin 0 -> 1907 bytes .../icons/tango/32x32/remove-volume-disabled.png | Bin 0 -> 1644 bytes .../icons/tango/32x32/reset-volume-option-disabled.png | Bin 0 -> 2273 bytes .../icons/tango/32x32/volume-rebalance-disabled.png | Bin 0 -> 1927 bytes src/com.gluster.storage.management.console/plugin.xml | 7 +++++++ 6 files changed, 7 insertions(+) create mode 100644 src/com.gluster.storage.management.console/icons/tango/32x32/add-brick-disabled.png create mode 100644 src/com.gluster.storage.management.console/icons/tango/32x32/remove-server-disabled.png create mode 100644 src/com.gluster.storage.management.console/icons/tango/32x32/remove-volume-disabled.png create mode 100644 src/com.gluster.storage.management.console/icons/tango/32x32/reset-volume-option-disabled.png create mode 100644 src/com.gluster.storage.management.console/icons/tango/32x32/volume-rebalance-disabled.png (limited to 'src/com.gluster.storage.management.console') diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/add-brick-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/add-brick-disabled.png new file mode 100644 index 00000000..925c8b44 Binary files /dev/null and b/src/com.gluster.storage.management.console/icons/tango/32x32/add-brick-disabled.png differ diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/remove-server-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/remove-server-disabled.png new file mode 100644 index 00000000..3f31d216 Binary files /dev/null and b/src/com.gluster.storage.management.console/icons/tango/32x32/remove-server-disabled.png differ diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/remove-volume-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/remove-volume-disabled.png new file mode 100644 index 00000000..5eb09cfd Binary files /dev/null and b/src/com.gluster.storage.management.console/icons/tango/32x32/remove-volume-disabled.png differ diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/reset-volume-option-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/reset-volume-option-disabled.png new file mode 100644 index 00000000..c4c955f5 Binary files /dev/null and b/src/com.gluster.storage.management.console/icons/tango/32x32/reset-volume-option-disabled.png differ diff --git a/src/com.gluster.storage.management.console/icons/tango/32x32/volume-rebalance-disabled.png b/src/com.gluster.storage.management.console/icons/tango/32x32/volume-rebalance-disabled.png new file mode 100644 index 00000000..35d49af7 Binary files /dev/null and b/src/com.gluster.storage.management.console/icons/tango/32x32/volume-rebalance-disabled.png differ diff --git a/src/com.gluster.storage.management.console/plugin.xml b/src/com.gluster.storage.management.console/plugin.xml index 9cadd537..6fb95258 100644 --- a/src/com.gluster.storage.management.console/plugin.xml +++ b/src/com.gluster.storage.management.console/plugin.xml @@ -427,6 +427,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.DeleteVolumeAction" definitionId="com.gluster.storage.management.console.commands.DeleteVolume" + disabledIcon="icons/tango/32x32/remove-volume-disabled.png" icon="icons/tango/32x32/remove-volume.png" id="com.gluster.storage.management.console.actions.DeleteVolumeAction" label="&Delete Volume(s)" @@ -538,6 +539,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.DeleteVolumeAction" definitionId="com.gluster.storage.management.console.commands.DeleteVolume" + disabledIcon="icons/tango/32x32/remove-volume-disabled.png" icon="icons/tango/32x32/remove-volume.png" id="com.gluster.storage.management.console.actions.DeleteVolumeAction" label="&Delete Volume" @@ -568,6 +570,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.ResetVolumeOptionsAction" definitionId="com.gluster.storage.management.console.commands.ResetVolumeOptions" + disabledIcon="icons/tango/32x32/reset-volume-option-disabled.png" icon="icons/tango/32x32/reset-volume-option.png" id="com.gluster.storage.management.console.actions.ResetVolumeOptionsAction" label="Reset &Options" @@ -583,6 +586,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.RebalanceVolumeAction" definitionId="com.gluster.storage.management.console.commands.RebalanceVolume" + disabledIcon="icons/tango/32x32/volume-rebalance-disabled.png" icon="icons/tango/32x32/volume-rebalance.png" id="com.gluster.storage.management.console.actions.RebalanceVolumeAction" label="&Rebalance Volume" @@ -646,6 +650,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.AddBrickAction" definitionId="com.gluster.storage.management.console.commands.AddDisk" + disabledIcon="icons/tango/32x32/add-brick-disabled.png" icon="icons/tango/32x32/add-brick.png" id="com.gluster.storage.management.console.actions.AddDiskAction" label="&Add Brick" @@ -705,6 +710,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.RemoveServerAction" definitionId="com.gluster.storage.management.console.commands.RemoveServer" + disabledIcon="icons/tango/32x32/remove-server-disabled.png" icon="icons/tango/32x32/remove-server.png" id="com.gluster.storage.management.console.actions.RemoveServerAction" label="&Remove Server(s)" @@ -763,6 +769,7 @@ allowLabelUpdate="false" class="com.gluster.storage.management.console.actions.RemoveServerAction" definitionId="com.gluster.storage.management.console.commands.RemoveServer" + disabledIcon="icons/tango/32x32/remove-server-disabled.png" icon="icons/tango/32x32/remove-server.png" id="com.gluster.storage.management.console.actions.RemoveServerAction" label="&Remove Server(s)" -- cgit