Dashboard import should use name from xml file if not provided by user fixes #999
authorEriks Jenkevics <eriks@netxms.org>
Thu, 18 Aug 2016 14:12:20 +0000 (17:12 +0300)
committerEriks Jenkevics <eriks@netxms.org>
Thu, 18 Aug 2016 14:12:20 +0000 (17:12 +0300)
ChangeLog
src/java/netxms-eclipse/Dashboard/src/org/netxms/ui/eclipse/dashboard/dialogs/ImportDashboardDialog.java
webui/webapp/Dashboard/src/org/netxms/ui/eclipse/dashboard/dialogs/ImportDashboardDialog.java

index 447e283..abfb1b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,7 +16,7 @@
 - Management console
        - New editors for Agent Config Policy and Log Parser Policy. 
        - DCI summary tables with empty menu path not shown in object context menu
-- Fixed issues: #92, #906, #959, #1006, #1051, #1096, #1159, #1187, #1191, #1230, #1237, #1254, #1263
+- Fixed issues: #92, #906, #959, #999, #1006, #1051, #1096, #1159, #1187, #1191, #1230, #1237, #1254, #1263
 
 
 *
index 7fc5175..0fac103 100644 (file)
@@ -38,6 +38,7 @@ import org.netxms.ui.eclipse.widgets.LabeledText;
 public class ImportDashboardDialog extends Dialog
 {
        private String objectName;
+       private int index;
        private File importFile;
        private LabeledText textName;
        private LocalFileSelector importFileSelector;
@@ -104,12 +105,15 @@ public class ImportDashboardDialog extends Dialog
        protected void okPressed()
        {
                objectName = textName.getText().trim();
+               importFile = importFileSelector.getFile();
                if (objectName.isEmpty())
                {
-                       MessageDialogHelper.openWarning(getShell(), Messages.get().ImportDashboardDialog_Warning, Messages.get().ImportDashboardDialog_WarningValidName);
-                       return;
+                  objectName = importFile.getName();
+                  index = objectName.indexOf(".xml");
+                  objectName = objectName.substring(0, index);
+                  super.okPressed();
                }
-               importFile = importFileSelector.getFile();
+               
                if (importFile == null)
                {
                        MessageDialogHelper.openWarning(getShell(), Messages.get().ImportDashboardDialog_Warning, Messages.get().ImportDashboardDialog_WarningSelectFile);
index 7fc5175..0fac103 100644 (file)
@@ -38,6 +38,7 @@ import org.netxms.ui.eclipse.widgets.LabeledText;
 public class ImportDashboardDialog extends Dialog
 {
        private String objectName;
+       private int index;
        private File importFile;
        private LabeledText textName;
        private LocalFileSelector importFileSelector;
@@ -104,12 +105,15 @@ public class ImportDashboardDialog extends Dialog
        protected void okPressed()
        {
                objectName = textName.getText().trim();
+               importFile = importFileSelector.getFile();
                if (objectName.isEmpty())
                {
-                       MessageDialogHelper.openWarning(getShell(), Messages.get().ImportDashboardDialog_Warning, Messages.get().ImportDashboardDialog_WarningValidName);
-                       return;
+                  objectName = importFile.getName();
+                  index = objectName.indexOf(".xml");
+                  objectName = objectName.substring(0, index);
+                  super.okPressed();
                }
-               importFile = importFileSelector.getFile();
+               
                if (importFile == null)
                {
                        MessageDialogHelper.openWarning(getShell(), Messages.get().ImportDashboardDialog_Warning, Messages.get().ImportDashboardDialog_WarningSelectFile);