You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by jo...@apache.org on 2021/12/08 07:55:11 UTC

[isis] branch master updated: ISIS-2348 EventComparison: pin implemented, pretty xml compared

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d5315cd  ISIS-2348 EventComparison: pin implemented, pretty xml compared
     new 2dd3ae8  Merge remote-tracking branch 'origin/master'
d5315cd is described below

commit d5315cd9858beba22cb8d219aa9bcdc79b6b3b77
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Wed Dec 8 08:54:41 2021 +0100

    ISIS-2348 EventComparison: pin implemented, pretty xml compared
---
 .../isis/client/kroviz/core/event/LogEntryComparison.kt |  7 +++++++
 .../isis/client/kroviz/ui/dialog/EventCompareDialog.kt  | 17 ++++++++++++++++-
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntryComparison.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntryComparison.kt
index d8825f1..19c714a 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntryComparison.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntryComparison.kt
@@ -21,6 +21,7 @@ package org.apache.isis.client.kroviz.core.event
 import io.kvision.html.ButtonStyle
 import kotlinx.serialization.Serializable
 import org.apache.isis.client.kroviz.ui.core.Constants
+import org.apache.isis.client.kroviz.utils.XmlHelper
 
 enum class ChangeType(val id: String, val iconName: String, val style: ButtonStyle) {
     ADDED("ADDED", "fas fa-plus", ButtonStyle.INFO),
@@ -50,9 +51,15 @@ data class LogEntryComparison(val title: String, val expected: LogEntry?, val ac
             expectedResponse = expected?.response
             if (expected != null) {
                 expectedBaseUrl = extractBaseUrl(expected)
+                if (expected.subType == Constants.subTypeXml) {
+                    expectedResponse = XmlHelper.format(expectedResponse!!)
+                }
             }
             if (actual != null) {
                 actualBaseUrl = extractBaseUrl(actual)
+                if (actual.subType == Constants.subTypeXml) {
+                    actualResponse = XmlHelper.format(actualResponse!!)
+                }
             }
         }
     }
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/EventCompareDialog.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/EventCompareDialog.kt
index 8a64691..9547c12 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/EventCompareDialog.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/EventCompareDialog.kt
@@ -19,13 +19,18 @@
 package org.apache.isis.client.kroviz.ui.dialog
 
 import io.kvision.core.CssSize
+import io.kvision.core.FlexDirection
 import io.kvision.core.UNIT
+import io.kvision.html.table
 import io.kvision.panel.VPanel
+import io.kvision.tabulator.tabulator
 import org.apache.isis.client.kroviz.core.event.LogEntryComparison
 import org.apache.isis.client.kroviz.ui.core.RoDialog
+import org.apache.isis.client.kroviz.ui.core.UiManager
 import org.apache.isis.client.kroviz.ui.panel.EventComparisonTable
 
 class EventCompareDialog(val data: List<LogEntryComparison>) : Command() {
+    private val title = "Event Comparison"
     private var table: EventComparisonTable
 
     private val panel = VPanel(spacing = 3) {
@@ -34,7 +39,7 @@ class EventCompareDialog(val data: List<LogEntryComparison>) : Command() {
 
     init {
         dialog = RoDialog(
-            caption = "Event Comparison",
+            caption = title,
             items = mutableListOf(),
             command = this,
             defaultAction = "Pin",
@@ -49,4 +54,14 @@ class EventCompareDialog(val data: List<LogEntryComparison>) : Command() {
         dialog.formPanel!!.add(panel)
     }
 
+    override fun execute(action: String?) {
+        pin()
+    }
+
+    private fun pin() {
+        table.tabulator.removeCssClass("tabulator-in-dialog")
+        UiManager.add(title, panel)
+        dialog.close()
+    }
+
 }