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/10/20 16:09:35 UTC
[isis] 03/05: ISIS-2348 Replay User Events (2/n): dead code removed,
duplicate handling with xml layout fixed, event log table height corrected,
doc improved
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 784bdb5d079b6d5968fc57523bb6f4f60189872d
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Tue Oct 19 16:14:05 2021 +0200
ISIS-2348 Replay User Events (2/n): dead code removed, duplicate handling with xml layout fixed, event log table height corrected, doc improved
---
.../modules/kroviz/pages/DevelopmentGuide.adoc | 16 +++---
.../kroviz/partials/design/uml-renderer.adoc | 20 ++++----
.../isis/client/kroviz/core/event/EventStore.kt | 14 ++---
.../isis/client/kroviz/core/event/ReplayCommand.kt | 60 +++++++++-------------
.../isis/client/kroviz/core/event/ResourceProxy.kt | 3 +-
.../isis/client/kroviz/handler/BaseHandler.kt | 3 --
.../apache/isis/client/kroviz/ui/core/Constants.kt | 2 +-
.../isis/client/kroviz/ui/panel/EventLogTable.kt | 1 -
8 files changed, 49 insertions(+), 70 deletions(-)
diff --git a/incubator/clients/kroviz/adoc/modules/kroviz/pages/DevelopmentGuide.adoc b/incubator/clients/kroviz/adoc/modules/kroviz/pages/DevelopmentGuide.adoc
index 73ca46e..a197afa 100644
--- a/incubator/clients/kroviz/adoc/modules/kroviz/pages/DevelopmentGuide.adoc
+++ b/incubator/clients/kroviz/adoc/modules/kroviz/pages/DevelopmentGuide.adoc
@@ -263,18 +263,14 @@ include::partial$design/dev-mindmap.adoc[]
* JSON structures can be visualized via kroki (cf. History -> Details)
* Layout: for FLEX see https://css-tricks.com/snippets/css/a-guide-to-flexbox/
-[source,bash]
-----
-npm install -g json-to-plantuml
-----
+=== The Browser as Client Runtime Environment
-=== Visualize JS dependencies
+Google Chrome is used as browser. It has a very feature rich debugger (<CTRL>-<SHIFT>-I) which can even be connected to IntelliJ's debugger (Settings -> Preferences -> Extension -> Link handling). For a nice introduction to Chrome, see: https://www.google.com/googlebooks/chrome/.
-[source,bash]
-----
-npm -g install dependo
-dependo -f amd ./build/js/kroviz.js > dependo.html
-----
+All current browsers implement some security features in order to counteract Cross-Site-Resource-Forgery (XSRF). CORS (Cross-Origin-Resource-Sharing) is beeing devised to allow access to resources from a different host-port under certain circumstances. It is said to be bypassable via https://www.npmjs.com/package/node-iframe, cf. https://stackoverflow.com/questions/33143776/ajax-request-refused-to-set-unsafe-header/66782595#66782595
+
+=== Visualize JS dependencies
+E.g. via https://npmgraph.js.org/
=== Measure Test Coverage
diff --git a/incubator/clients/kroviz/adoc/modules/kroviz/partials/design/uml-renderer.adoc b/incubator/clients/kroviz/adoc/modules/kroviz/partials/design/uml-renderer.adoc
index 822c7a8..d5374be 100644
--- a/incubator/clients/kroviz/adoc/modules/kroviz/partials/design/uml-renderer.adoc
+++ b/incubator/clients/kroviz/adoc/modules/kroviz/partials/design/uml-renderer.adoc
@@ -8,7 +8,7 @@
abstract class Renderer {
iconName:String
title:String
- view:RoView
+ view:RvzView
protocol:Protocol
}
Renderer -right-> Protocol
@@ -18,19 +18,19 @@ abstract class Protocol {
}
Renderer <|-down- ObjectRdr
-Renderer <|-down- ListRdr
-ListRdr <|-down- GeoLocationRdr
-ListRdr <|-down- EventRdr
+Renderer <|-down- CollectionRdr
+CollectionRdr <|-down- GeoLocationRdr
+CollectionRdr <|-down- EventRdr
-abstract class RoView {
+abstract class RvzView {
}
-RoView <|-down- ObjectVw
-RoView <|-down- ListVw
-ListVw <|-down- GeoLocationVw
-ListVw <|-down- TimeLineView
+RvzView <|-down- ObjectV
+RvzView <|-down- CollectionV
+CollectionV <|-down- GeoLocationV
+CollectionV <|-down- TimeLineV
-Renderer -left-> RoView
+Renderer -left-> RvzView
class Exposer {
delegate:TransferObject
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/EventStore.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/EventStore.kt
index 686911c..e9b9f3e 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/EventStore.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/EventStore.kt
@@ -121,18 +121,18 @@ object EventStore {
/**
* Answers the first matching entry.
*/
- fun findBy(reSpec: ResourceSpecification): LogEntry? {
- return if (reSpec.isRedundant()) {
- findEquivalent(reSpec)
+ fun findBy(rs: ResourceSpecification): LogEntry? {
+ return if (rs.isRedundant()) {
+ findEquivalent(rs)
} else {
- findExact(reSpec)
+ findExact(rs)
}
}
- fun findBy(reSpec: ResourceSpecification, body: String): LogEntry? {
+ fun findBy(rs: ResourceSpecification, body: String): LogEntry? {
return log.firstOrNull() {
- it.url == reSpec.url
- && it.subType == reSpec.subType
+ it.url == rs.url
+ && it.subType == rs.subType
&& it.request == body
}
}
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 9ae653e..4d09ac8 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
@@ -18,14 +18,10 @@
*/
package org.apache.isis.client.kroviz.core.event
-import io.kvision.utils.createInstance
-import kotlinx.coroutines.GlobalScope
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.launch
import org.apache.isis.client.kroviz.core.aggregator.AggregatorWithLayout
-import org.apache.isis.client.kroviz.core.aggregator.BaseAggregator
import org.apache.isis.client.kroviz.main
import org.apache.isis.client.kroviz.to.Link
+import org.apache.isis.client.kroviz.to.Relation
import org.apache.isis.client.kroviz.to.Represention
class ReplayCommand {
@@ -33,41 +29,42 @@ class ReplayCommand {
fun execute() {
val events = copyEvents(EventStore.log)
EventStore.reset()
- main()
+ main() // re-creates the UI, but keeps the UiManager(singleton/object) and the session
- console.log("[ReplayCommand.execute]")
- console.log(events)
- console.log(events.size)
+ val userActions = filterUserActions(events)
+ replay(userActions)
+ }
+
+ private fun replay(userActions: List<LogEntry>) {
+ console.log("[ReplayCommand.replay]")
+ userActions.forEach {
+ val link = Link(href = it.url)
+ console.log(link)
+ ResourceProxy().fetch(link, null, it.subType)
+ }
+ }
+
+ private fun filterUserActions(events: List<LogEntry>): List<LogEntry> {
+ console.log("[ReplayCommand.filterUserActions]")
val userActions = events.filter {
(it.type == Represention.HOMEPAGE.type) ||
it.type == Represention.OBJECT_ACTION.type ||
- it.type == Represention.OBJECT.type ||
+ it.type == Relation.OBJECT_LAYOUT.type ||
it.hasDisplayModel()
}
console.log(userActions)
console.log(userActions.size)
-
- userActions.forEach {
- val link = Link(href = it.url)
- var aggregator: BaseAggregator? = null
- if (it.nOfAggregators > 0) {
- val clazz = it.getAggregator()::class
- aggregator = clazz.createInstance<BaseAggregator>()
- }
- //eventually put a thinkTime here
- wait(1000)
- console.log(link)
- console.log(aggregator)
- ResourceProxy().fetch(link, aggregator, it.subType)
- }
-
+ return userActions
}
private fun copyEvents(inputList: List<LogEntry>): List<LogEntry> {
+ console.log("[ReplayCommand.copyEvents]")
val outputList = mutableListOf<LogEntry>()
inputList.forEach {
outputList.add(copyEvent(it))
}
+ console.log(outputList)
+ console.log(outputList.size)
return outputList
}
@@ -83,18 +80,9 @@ class ReplayCommand {
return output
}
- fun wait(milliseconds: Long) {
- GlobalScope.launch {
- delay(milliseconds)
- }
- }
-
private fun LogEntry.hasDisplayModel(): Boolean {
- if (this.nOfAggregators > 0) {
- val aggregator = this.getAggregator()
- return (aggregator is AggregatorWithLayout)
- }
- return false
+ return (this.nOfAggregators > 0) &&
+ (this.getAggregator() is AggregatorWithLayout)
}
}
\ No newline at end of file
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/ResourceProxy.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/ResourceProxy.kt
index ad596a0..c3ad519 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/ResourceProxy.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/core/event/ResourceProxy.kt
@@ -57,7 +57,7 @@ class ResourceProxy {
subType: String = Constants.subTypeJson,
isRest: Boolean = true,
referrer: String = "") {
- val rs = ResourceSpecification(link.href, referrerUrl = referrer)
+ val rs = ResourceSpecification(link.href, subType = subType, referrerUrl = referrer)
val isCached = when (val le = EventStore.findBy(rs)) {
null -> false
else -> le.isCached(rs, link.method)
@@ -93,7 +93,6 @@ class ResourceProxy {
EventStore.updateStatus(le)
}
-
fun invokeKroki(pumlCode: String, aggregator: SvgDispatcher) {
RoXmlHttpRequest(aggregator).invokeKroki(pumlCode)
}
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/handler/BaseHandler.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/handler/BaseHandler.kt
index 77c6b51..578ff72 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/handler/BaseHandler.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/handler/BaseHandler.kt
@@ -77,9 +77,6 @@ abstract class BaseHandler {
open fun update() {
logEntry.getAggregator().update(logEntry, Constants.subTypeJson)
- logEntry.aggregators.forEach {
-// console.log(it)
- }
}
}
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/core/Constants.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/core/Constants.kt
index b708db5..b15121e 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/core/Constants.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/core/Constants.kt
@@ -25,7 +25,7 @@ object Constants {
const val svgMimeType = "image/svg+xml"
const val pngMimeType = "image/png"
const val xmlMimeType = "application/xml"
- const val calcHeight = "calc(100vh - 88px)"
+ const val calcHeight = "calc(100vh - 113px)"
const val actionSeparator = "\n"
const val subTypeJson = "json"
const val subTypeXml = "xml"
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 db3505b..7ad8cbf 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
@@ -77,7 +77,6 @@ class EventLogTable(val model: List<LogEntry>) : VPanel() {
field = "response",
headerFilter = Editor.INPUT,
width = "200",
-// tooltip = { (data) -> data.response }
),
ColumnDefinition("resp.len", field = "responseLength", width = "100", hozAlign = Align.RIGHT, download = false),
ColumnDefinition("cacheHits", field = "cacheHits", width = "100", hozAlign = Align.RIGHT, download = false),