This is an automated email from the ASF dual-hosted git repository.

hansva pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hop.git


The following commit(s) were added to refs/heads/master by this push:
     new 22d718a69b Configurable log level of the message in Abort action
     new 5a22bb3f81 Merge pull request #1487 from shlxue/plugin
22d718a69b is described below

commit 22d718a69bcec081a3888b3a036fbc4c9bd289fb
Author: Shl Xue <[email protected]>
AuthorDate: Sat May 14 01:57:05 2022 +0800

    Configurable log level of the message in Abort action
---
 .../hop/workflow/actions/abort/ActionAbort.java    | 21 +++++++++++++---
 .../workflow/actions/abort/ActionAbortDialog.java  | 28 ++++++++++++++++++----
 .../abort/messages/messages_en_US.properties       |  4 ++++
 .../abort/messages/messages_zh_CN.properties       |  3 +++
 .../abort/WorkflowActionAbortLoadSaveTest.java     | 10 ++++----
 5 files changed, 55 insertions(+), 11 deletions(-)

diff --git 
a/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbort.java
 
b/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbort.java
index 8b1d75b69d..98c12ccba3 100644
--- 
a/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbort.java
+++ 
b/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbort.java
@@ -46,6 +46,9 @@ public class ActionAbort extends ActionBase implements 
Cloneable, IAction {
   @HopMetadataProperty(key = "message")
   private String messageAbort;
 
+  @HopMetadataProperty(key = "always_log_rows")
+  private boolean alwaysLogRows;
+
   public ActionAbort(String name, String description) {
     super(name, description);
     messageAbort = null;
@@ -58,6 +61,7 @@ public class ActionAbort extends ActionBase implements 
Cloneable, IAction {
   public ActionAbort(ActionAbort other) {
     this(other.getName(), other.getDescription());
     this.messageAbort = other.messageAbort;
+    this.alwaysLogRows = other.alwaysLogRows;
   }
 
   @Override
@@ -81,9 +85,12 @@ public class ActionAbort extends ActionBase implements 
Cloneable, IAction {
         msg = BaseMessages.getString(PKG, 
"ActionAbort.Meta.CheckResult.Label");
       }
 
-      result.setNrErrors(1);
-      result.setResult(false);
-      logError(msg);
+      if (isAlwaysLogRows()) {
+        logMinimal(BaseMessages.getString(PKG, "ActionAbort.Log.Wrote.Row", 
nr, msg));
+      } else {
+        result.setNrErrors(1);
+        result.setResult(false);
+      }
     } catch (Exception e) {
       result.setNrErrors(1);
       result.setResult(false);
@@ -132,6 +139,14 @@ public class ActionAbort extends ActionBase implements 
Cloneable, IAction {
     return messageAbort;
   }
 
+  public boolean isAlwaysLogRows() {
+    return alwaysLogRows;
+  }
+
+  public void setAlwaysLogRows(boolean alwaysLogRows) {
+    this.alwaysLogRows = alwaysLogRows;
+  }
+
   @Override
   public void check(
       List<ICheckResult> remarks,
diff --git 
a/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbortDialog.java
 
b/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbortDialog.java
index 4efe011cc4..cda3e4aefe 100644
--- 
a/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbortDialog.java
+++ 
b/plugins/actions/abort/src/main/java/org/apache/hop/workflow/actions/abort/ActionAbortDialog.java
@@ -33,11 +33,11 @@ import org.apache.hop.workflow.action.IActionDialog;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.ModifyEvent;
 import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.*;
 import org.eclipse.swt.widgets.*;
 
+
 /** This dialog allows you to edit a Action Abort object. */
 public class ActionAbortDialog extends ActionDialog implements IActionDialog {
   private static final Class<?> PKG = ActionAbortDialog.class; // For 
Translator
@@ -52,6 +52,8 @@ public class ActionAbortDialog extends ActionDialog 
implements IActionDialog {
 
   private TextVar wMessageAbort;
 
+  private Button wAlwaysLogRows;
+
   public ActionAbortDialog(
       Shell parent, IAction action, WorkflowMeta workflowMeta, IVariables 
variables) {
     super(parent, workflowMeta, variables);
@@ -75,6 +77,7 @@ public class ActionAbortDialog extends ActionDialog 
implements IActionDialog {
     FormLayout formLayout = new FormLayout();
     formLayout.marginWidth = Const.FORM_MARGIN;
     formLayout.marginHeight = Const.FORM_MARGIN;
+    formLayout.spacing = Const.FORM_MARGIN;
 
     shell.setLayout(formLayout);
     shell.setText(BaseMessages.getString(PKG, "ActionAbortDialog.Title"));
@@ -121,6 +124,21 @@ public class ActionAbortDialog extends ActionDialog 
implements IActionDialog {
     fdMessageAbort.right = new FormAttachment(100, 0);
     wMessageAbort.setLayoutData(fdMessageAbort);
 
+    SelectionListener slMod = SelectionListener.widgetSelectedAdapter(event -> 
action.setChanged());
+    // Always log rows
+    wAlwaysLogRows = new Button(shell, SWT.CHECK);
+    wAlwaysLogRows.setSelection(true);
+    props.setLook(wAlwaysLogRows);
+    wAlwaysLogRows.setText(BaseMessages.getString(PKG, 
"ActionAbortDialog.AlwaysLogRows.Label"));
+    wAlwaysLogRows.setToolTipText(
+        BaseMessages.getString(PKG, 
"ActionAbortDialog.AlwaysLogRows.Tooltip"));
+    wAlwaysLogRows.addSelectionListener(slMod);
+    FormData fdAlwaysLogRows = new FormData();
+    fdAlwaysLogRows.left = new FormAttachment(middle, 0);
+    fdAlwaysLogRows.top = new FormAttachment(wMessageAbort, margin);
+    fdAlwaysLogRows.right = new FormAttachment(100, 0);
+    wAlwaysLogRows.setLayoutData(fdAlwaysLogRows);
+
     Button wOk = new Button(shell, SWT.PUSH);
     wOk.setText(BaseMessages.getString(PKG, "System.Button.OK"));
     wOk.addListener(SWT.Selection, (Event e) -> ok());
@@ -128,7 +146,7 @@ public class ActionAbortDialog extends ActionDialog 
implements IActionDialog {
     wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
     wCancel.addListener(SWT.Selection, (Event e) -> cancel());
     BaseTransformDialog.positionBottomButtons(
-        shell, new Button[] {wOk, wCancel}, margin, wMessageAbort);
+        shell, new Button[] {wOk, wCancel}, margin, 0, wAlwaysLogRows);
 
     getData();
 
@@ -151,6 +169,7 @@ public class ActionAbortDialog extends ActionDialog 
implements IActionDialog {
     if (action.getMessageAbort() != null) {
       wMessageAbort.setText(action.getMessageAbort());
     }
+    wAlwaysLogRows.setSelection(action.isAlwaysLogRows());
 
     wName.selectAll();
     wName.setFocus();
@@ -172,6 +191,7 @@ public class ActionAbortDialog extends ActionDialog 
implements IActionDialog {
     }
     action.setName(wName.getText());
     action.setMessageAbort(wMessageAbort.getText());
+    action.setAlwaysLogRows(wAlwaysLogRows.getSelection());
     dispose();
   }
 }
diff --git 
a/plugins/actions/abort/src/main/resources/org/apache/hop/workflow/actions/abort/messages/messages_en_US.properties
 
b/plugins/actions/abort/src/main/resources/org/apache/hop/workflow/actions/abort/messages/messages_en_US.properties
index 71dd676191..01cef2876f 100644
--- 
a/plugins/actions/abort/src/main/resources/org/apache/hop/workflow/actions/abort/messages/messages_en_US.properties
+++ 
b/plugins/actions/abort/src/main/resources/org/apache/hop/workflow/actions/abort/messages/messages_en_US.properties
@@ -18,6 +18,7 @@
 #
 #
 ActionAbort.Description=Abort the workflow
+ActionAbort.Log.Wrote.Row=Seen row nr {0} \: {1}
 ActionAbort.Meta.CheckResult.CouldNotExecute=Couldn't execute abort action\:
 ActionAbort.Meta.CheckResult.Label=Aborting workflow.
 ActionAbort.Name=Abort workflow
@@ -26,4 +27,7 @@ ActionAbortDialog.ActionName.Label=Action name
 ActionAbortDialog.Label=Abort workflow
 ActionAbortDialog.MessageAbort.Label=Message\:
 ActionAbortDialog.MessageAbort.Tooltip=Message to display in the log
+ActionAbortDialog.AlwaysLogRows.Label=Always log rows
+ActionAbortDialog.AlwaysLogRows.Tooltip=Always log rows even if below current 
log level
+ActionAbortDialog.MessageLogLevels.Label=Log level of the message:
 ActionAbortDialog.Title=Abort workflow
\ No newline at end of file
diff --git 
a/plugins/actions/abort/src/main/resources/org/apache/hop/workflow/actions/abort/messages/messages_zh_CN.properties
 
b/plugins/actions/abort/src/main/resources/org/apache/hop/workflow/actions/abort/messages/messages_zh_CN.properties
index 66079ab312..451ca889da 100644
--- 
a/plugins/actions/abort/src/main/resources/org/apache/hop/workflow/actions/abort/messages/messages_zh_CN.properties
+++ 
b/plugins/actions/abort/src/main/resources/org/apache/hop/workflow/actions/abort/messages/messages_zh_CN.properties
@@ -17,11 +17,14 @@
 #
 #
 ActionAbort.Description=\u7EC8\u6B62\u4EFB\u52A1
+ActionAbort.Log.Wrote.Row=\u89C1\u7B2C {0} \u884C\: {1}
 
ActionAbort.Meta.CheckResult.CouldNotExecute=\u4E0D\u80FD\u6267\u884C\u7EC8\u6B62
 Action\:
 ActionAbort.Meta.CheckResult.Label=\u7EC8\u6B62 Action.
 ActionAbort.Name=\u7EC8\u6B62\u4F5C\u4E1A
 ActionAbort.keyword=abort
 ActionAbortDialog.ActionName.Label=Action \u540D\u79F0:
+ActionAbortDialog.AlwaysLogRows.Label=\u603B\u662F\u8BB0\u5F55\u6570\u636E\u884C
+ActionAbortDialog.AlwaysLogRows.Tooltip=\u5373\u4F7F\u4F4E\u4E8E\u5F53\u524D\u65E5\u5FD7\u7EA7\u522B\u4E5F\u59CB\u7EC8\u8BB0\u5F55\u884C
 ActionAbortDialog.Label=\u7EC8\u6B62\u4F5C\u4E1A
 ActionAbortDialog.MessageAbort.Label=\u6D88\u606F\:
 
ActionAbortDialog.MessageAbort.Tooltip=\u65E5\u5FD7\u4E2D\u663E\u793A\u7684\u6D88\u606F
diff --git 
a/plugins/actions/abort/src/test/java/org/apache/hop/workflow/actions/abort/WorkflowActionAbortLoadSaveTest.java
 
b/plugins/actions/abort/src/test/java/org/apache/hop/workflow/actions/abort/WorkflowActionAbortLoadSaveTest.java
index b4b6cfc4b3..01977fc9c8 100644
--- 
a/plugins/actions/abort/src/test/java/org/apache/hop/workflow/actions/abort/WorkflowActionAbortLoadSaveTest.java
+++ 
b/plugins/actions/abort/src/test/java/org/apache/hop/workflow/actions/abort/WorkflowActionAbortLoadSaveTest.java
@@ -20,7 +20,7 @@ import org.apache.hop.junit.rules.RestoreHopEngineEnvironment;
 import 
org.apache.hop.workflow.action.loadsave.WorkflowActionLoadSaveTestSupport;
 import org.junit.ClassRule;
 
-import java.util.Collections;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -35,16 +35,18 @@ public class WorkflowActionAbortLoadSaveTest
 
   @Override
   protected List<String> listAttributes() {
-    return Collections.singletonList("messageAbort");
+    return Arrays.asList("messageAbort", "alwaysLogRows");
   }
 
   @Override
   protected Map<String, String> createGettersMap() {
-    return Collections.singletonMap("messageAbort", "getMessageAbort");
+    return toMap(
+        "messageAbort", "getMessageAbort",
+        "alwaysLogRows", "isAlwaysLogRows");
   }
 
   @Override
   protected Map<String, String> createSettersMap() {
-    return Collections.singletonMap("messageAbort", "setMessageAbort");
+    return toMap("messageAbort", "setMessageAbort", "alwaysLogRows", 
"setAlwaysLogRows");
   }
 }

Reply via email to