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/11/10 07:39:01 UTC
[isis] 03/06: ISIS-2348 css etc. set for Dialogs,
kvision version upgrade, Replay* refactored
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
commit df5836ced66edbf412f91d3eca0895b768756b12
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Tue Nov 2 18:59:35 2021 +0100
ISIS-2348 css etc. set for Dialogs, kvision version upgrade, Replay* refactored
---
incubator/clients/kroviz/gradle.properties | 2 +-
.../isis/client/kroviz/core/event/LogEntry.kt | 3 +-
.../isis/client/kroviz/core/event/ReplayCommand.kt | 7 +--
.../apache/isis/client/kroviz/ui/core/RoDialog.kt | 43 ++++++++++---------
.../isis/client/kroviz/ui/dialog/LoginPrompt.kt | 2 +-
.../client/kroviz/ui/dialog/ReplayDiffDialog.kt | 50 ++++++++++++++++++----
.../isis/client/kroviz/ui/panel/EventLogTable.kt | 18 ++------
.../apache/isis/client/kroviz/utils/IconManager.kt | 3 +-
.../apache/isis/client/kroviz/utils/StringUtils.kt | 13 ++++++
.../kroviz/src/main/resources/css/kroviz.css | 21 +++++++--
10 files changed, 107 insertions(+), 55 deletions(-)
diff --git a/incubator/clients/kroviz/gradle.properties b/incubator/clients/kroviz/gradle.properties
index 716e43f..c035209 100644
--- a/incubator/clients/kroviz/gradle.properties
+++ b/incubator/clients/kroviz/gradle.properties
@@ -21,7 +21,7 @@ javaVersion=1.8
systemProp.kotlinVersion=1.5.31
serializationVersion=1.3.0
#Dependencies
-systemProp.kvisionVersion=5.4.0
+systemProp.kvisionVersion=5.4.3
coroutinesVersion=1.5.2
kotlin.mpp.stability.nowarn=true
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntry.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntry.kt
index 0aca7f4..ed2350d 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntry.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/LogEntry.kt
@@ -46,7 +46,8 @@ enum class EventState(val id: String, val iconName: String, val style: ButtonSty
DUPLICATE("DUPLICATE", "fas fa-copy", ButtonStyle.OUTLINESUCCESS),
CLOSED("CLOSED", "fas fa-eye-slash", ButtonStyle.OUTLINEINFO),
RELOAD("RELOAD", "fas fa-retweet", ButtonStyle.OUTLINEWARNING),
- MISSING("MISSING", "fas fa-bug", ButtonStyle.OUTLINEDANGER)
+ MISSING("MISSING", "fas fa-bug", ButtonStyle.OUTLINEDANGER),
+ DIFF("DIFF", "fas fa-bell", ButtonStyle.DANGER),
// IMPROVE multiple aspects intermangled: req/resp, view, as well as cache
// encapsulate access with managers?
}
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/ReplayCommand.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/ReplayCommand.kt
index bad2953..c6d3297 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/ReplayCommand.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/ReplayCommand.kt
@@ -29,7 +29,6 @@ import org.apache.isis.client.kroviz.to.Represention
import org.apache.isis.client.kroviz.to.TObject
import org.apache.isis.client.kroviz.ui.core.UiManager
import org.apache.isis.client.kroviz.ui.dialog.ReplayDiffDialog
-import org.apache.isis.client.kroviz.ui.panel.EventLogTable
val AppScope = CoroutineScope(window.asCoroutineDispatcher())
@@ -45,11 +44,7 @@ class ReplayCommand {
replay(uiEvents)
val actualEvents: MutableList<LogEntry> = eventStore.log
- val expectedTable = EventLogTable(expectedEvents)
- val actualTable = EventLogTable(actualEvents)
- val rdd = ReplayDiffDialog()
- rdd.expectedPanel.add(expectedTable)
- rdd.actualPanel.add(actualTable)
+ val rdd = ReplayDiffDialog(expectedEvents, actualEvents)
rdd.dialog.open()
}
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/core/RoDialog.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/core/RoDialog.kt
index ec579c1..6286239 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/core/RoDialog.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/core/RoDialog.kt
@@ -18,16 +18,12 @@
*/
package org.apache.isis.client.kroviz.ui.core
-import io.kvision.core.CssSize
-import io.kvision.core.JustifyContent
-import io.kvision.core.UNIT
-import io.kvision.core.Widget
+import io.kvision.core.*
import io.kvision.form.FormPanel
import io.kvision.html.Button
import io.kvision.html.ButtonStyle
import io.kvision.panel.HPanel
import io.kvision.panel.vPanel
-import io.kvision.utils.perc
import org.apache.isis.client.kroviz.to.ValueType
import org.apache.isis.client.kroviz.ui.dialog.Command
import org.apache.isis.client.kroviz.ui.dialog.DiagramDialog
@@ -97,28 +93,35 @@ class RoDialog(
contentWidth = CssSize(widthPerc, UNIT.perc)
contentHeight = CssSize(heightPerc, UNIT.perc)
- vPanel(justify = JustifyContent.SPACEBETWEEN) {
- height = 100.perc
- formPanel = FormPanelFactory(items).panel
+ vPanel() {
+ height = CssSize(heightPerc, UNIT.vh)
+ this.addCssClass("dialog")
- add(formPanel!!, grow = 2)
+ formPanel = FormPanelFactory(items).panel
+ formPanel!!.addCssClass("dialog-content")
+ add(formPanel!!)
- val buttonBar = HPanel(spacing = 10)
+ val buttonBar = buildButtonBar(customButtons)
buttonBar.addCssClass("button-bar")
- buttonBar.add(okButton)
- customButtons.forEach {
- val b = createButton(it)
- buttonBar.add(b)
- }
- buttonBar.add(cancelButton)
- if (items.isNotEmpty() && hasScalableContent()) {
- buttonBar.add(scaleUpButton)
- buttonBar.add(scaleDownButton)
- }
add(buttonBar)
}
}
+ private fun buildButtonBar(customButtons: List<FormItem>): HPanel {
+ val buttonBar = HPanel(spacing = 10)
+ buttonBar.add(okButton)
+ customButtons.forEach {
+ val b = createButton(it)
+ buttonBar.add(b)
+ }
+ buttonBar.add(cancelButton)
+ if (items.isNotEmpty() && hasScalableContent()) {
+ buttonBar.add(scaleUpButton)
+ buttonBar.add(scaleDownButton)
+ }
+ return buttonBar
+ }
+
private fun execute() {
command.execute()
close()
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/LoginPrompt.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/LoginPrompt.kt
index a20e8b6..e11e5a7 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/LoginPrompt.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/LoginPrompt.kt
@@ -44,7 +44,7 @@ class LoginPrompt : Command() {
formItems.add(FormItem("Url", ValueType.TEXT, url))
formItems.add(FormItem("User", ValueType.TEXT, username))
formItems.add(FormItem("Password", ValueType.PASSWORD, password))
- form = RoDialog(caption = "Connect", items = formItems, command = this)
+ form = RoDialog(caption = "Connect", items = formItems, command = this, heightPerc = 27)
val at = UiManager.position!!
form.open(at)
}
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/ReplayDiffDialog.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/ReplayDiffDialog.kt
index ce9e7bc..9f04df5 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/ReplayDiffDialog.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/dialog/ReplayDiffDialog.kt
@@ -20,36 +20,70 @@
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.panel.Direction
import io.kvision.panel.SplitPanel
import io.kvision.panel.VPanel
-import org.apache.isis.client.kroviz.ui.core.FormItem
+import org.apache.isis.client.kroviz.core.event.EventState
+import org.apache.isis.client.kroviz.core.event.LogEntry
+import org.apache.isis.client.kroviz.core.event.ResourceSpecification
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.EventLogTable
-class ReplayDiffDialog : Command() {
+class ReplayDiffDialog(
+ private val expectedEvents: List<LogEntry>,
+ actualEvents: List<LogEntry>
+) : Command() {
var dialog: RoDialog
- val expectedPanel = VPanel(spacing = 3) {
+ private val expectedPanel = VPanel(spacing = 3) {
width = CssSize(20, UNIT.perc)
}
- val actualPanel = VPanel(spacing = 3) {
+ private val actualPanel = VPanel(spacing = 3) {
width = CssSize(80, UNIT.perc)
}
init {
dialog = RoDialog(
- caption = "Replay Diff",
- items = mutableListOf<FormItem>(),
+ caption = "Replay Events: Expected vs. Actual",
+ items = mutableListOf(),
command = this,
- defaultAction = "",
+ defaultAction = "Compare",
widthPerc = 60,
- customButtons = mutableListOf<FormItem>()
+ heightPerc = 70,
+ customButtons = mutableListOf()
)
+ val expectedTable = EventLogTable(expectedEvents)
+ expectedTable.tabulator.addCssClass("tabulator-in-dialog")
+ val actualTable = EventLogTable(actualEvents)
+ actualTable.tabulator.addCssClass("tabulator-in-dialog")
+ expectedPanel.add(expectedTable)
+ actualPanel.add(actualTable)
+
val splitPanel = SplitPanel(direction = Direction.VERTICAL)
+ splitPanel.addCssClass("dialog-content")
+ splitPanel.flexDirection = FlexDirection.ROW
splitPanel.add(expectedPanel)
splitPanel.add(actualPanel)
dialog.formPanel!!.add(splitPanel)
}
+ override fun execute(action: String?) {
+ // iterate over expected and set each status to DIFF, where responses don't match
+ expectedEvents.forEach { xp ->
+ val rs = ResourceSpecification(xp.url, xp.subType)
+ val actual = UiManager.getEventStore().findBy(rs)
+ if (actual != null) {
+ val isSame = actual.response == xp.response
+ if (!isSame) {
+ xp.state = EventState.DIFF
+ }
+ } else {
+ xp.state = EventState.DIFF
+ }
+ }
+ }
+
}
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/panel/EventLogTable.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/panel/EventLogTable.kt
index 7ad8cbf..d5ce222 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/panel/EventLogTable.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/panel/EventLogTable.kt
@@ -24,6 +24,7 @@ import io.kvision.html.ButtonStyle
import io.kvision.panel.VPanel
import io.kvision.panel.hPanel
import io.kvision.tabulator.*
+import io.kvision.utils.auto
import io.kvision.utils.obj
import io.kvision.utils.px
import org.apache.isis.client.kroviz.core.event.LogEntry
@@ -101,30 +102,19 @@ class EventLogTable(val model: List<LogEntry>) : VPanel() {
private fun buildObjectButton(data: LogEntry): Button {
val b = Button(
- text = shorten(data.title),
+ text = StringUtils.shorten(data.title),
icon = data.state.iconName,
style = ButtonStyle.LINK)
b.onClick {
kotlinx.browser.window.open(data.title) //IMPROVE should be URL
}
val tto = TooltipOptions(title = data.title)
- b.enableTooltip(tto)
+ // tabulator tooltip is buggy: often the tooltip doesn't go away and the color is not settable
+ //b.enableTooltip(tto)
if (data.obj is TObject) b.setDragDropData(Constants.stdMimeType, data.url)
return b
}
- private fun shorten(url: String): String {
- var result = url
- val signature = Constants.restInfix
- if (url.contains(signature)) {
- // strip off protocol, host, port
- val protocolHostPort = UiManager.getUrl()
- result = result.replace(protocolHostPort + signature, "")
- result = StringUtils.removeHexCode(result)
- }
- return result
- }
-
private fun buildActionButton(data: LogEntry): Button {
val b = Button(
text = "",
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/IconManager.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/IconManager.kt
index 6058f67..af0b929 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/IconManager.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/IconManager.kt
@@ -37,6 +37,7 @@ object IconManager {
"Burger" to "bars",
"Chart" to "magic",
"Close" to "times",
+ "Compare" to "balance-scale",
"Configuration" to "wrench",
"Connect" to "plug",
"Console" to "terminal",
@@ -52,7 +53,7 @@ object IconManager {
"Edit" to "pencil",
"Error Handling" to "bug",
"Error" to "bug",
- "Event" to "road",
+ "Event" to "history",
"Experimental" to "flask",
"Export" to "file-export",
"Facet" to "gem",
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/StringUtils.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/StringUtils.kt
index 99e63a7..b52d456 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/StringUtils.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/utils/StringUtils.kt
@@ -22,6 +22,7 @@ import org.apache.isis.client.kroviz.to.Argument
import org.apache.isis.client.kroviz.to.Link
import org.apache.isis.client.kroviz.to.TObject
import org.apache.isis.client.kroviz.ui.core.Constants
+import org.apache.isis.client.kroviz.ui.core.UiManager
object StringUtils {
@@ -221,4 +222,16 @@ object StringUtils {
.toString() + pad
}
+ fun shorten(url: String): String {
+ var result = url
+ val signature = Constants.restInfix
+ if (url.contains(signature)) {
+ // strip off protocol, host, port
+ val protocolHostPort = UiManager.getUrl()
+ result = result.replace(protocolHostPort + signature, "")
+ result = StringUtils.removeHexCode(result)
+ }
+ return result
+ }
+
}
diff --git a/incubator/clients/kroviz/src/main/resources/css/kroviz.css b/incubator/clients/kroviz/src/main/resources/css/kroviz.css
index 7f6c23e..ee20ceb 100644
--- a/incubator/clients/kroviz/src/main/resources/css/kroviz.css
+++ b/incubator/clients/kroviz/src/main/resources/css/kroviz.css
@@ -121,11 +121,26 @@ textarea {
}
.button-bar {
- display: flex;
- align-self: baseline !important;
margin-top: 10px;
margin-left: 10px;
- margin-bottom: 12px;
+ margin-bottom: 10px;
+ position:absolute;
+ bottom:0;
+}
+
+.tabulator-in-dialog {
+ max-height: calc(70vh - 60px);
+}
+
+.dialog-content {
+ display: flex;
+ flex-direction: column;
+ overflow-y: auto;
+}
+
+.dialog {
+ display: flex;
+ height: 100vh;
}
@font-face {