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 2022/03/26 20:53:53 UTC
[isis] branch ISIS-2957 updated: ISIS-2957 tooltip data formatted
This is an automated email from the ASF dual-hosted git repository.
joergrade pushed a commit to branch ISIS-2957
in repository https://gitbox.apache.org/repos/asf/isis.git
The following commit(s) were added to refs/heads/ISIS-2957 by this push:
new a843674 ISIS-2957 tooltip data formatted
a843674 is described below
commit a84367480a7ec4a44ad5e3e107bffbde42265d36
Author: Jörg Rade <jo...@kuehne-nagel.com>
AuthorDate: Sat Mar 26 21:53:33 2022 +0100
ISIS-2957 tooltip data formatted
---
.../isis/client/kroviz/ui/panel/EventBubbleChart.kt | 16 ++++++++--------
.../org/apache/isis/client/kroviz/utils/StringUtils.kt | 16 ++++++++++++++--
.../apache/isis/client/kroviz/util/StringUtilsTest.kt | 10 ++++++++++
3 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/panel/EventBubbleChart.kt b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/panel/EventBubbleChart.kt
index 911085f..3da4281 100644
--- a/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/panel/EventBubbleChart.kt
+++ b/incubator/clients/kroviz/src/main/kotlin/org/apache/isis/client/kroviz/ui/panel/EventBubbleChart.kt
@@ -29,6 +29,7 @@ import io.kvision.utils.obj
import org.apache.isis.client.kroviz.core.event.LogEntry
import org.apache.isis.client.kroviz.ui.core.SessionManager
import org.apache.isis.client.kroviz.ui.dialog.EventLogDetail
+import org.apache.isis.client.kroviz.utils.StringUtils
import kotlin.math.pow
@OptIn(ExperimentalJsExport::class)
@@ -83,7 +84,7 @@ class EventBubbleChart : SimplePanel() {
val error = obj {
text = "error"
fillStyle = TRANSPARENT
- strokeStyle = ERROR
+ strokeStyle = ERROR_COLOR
}
legendLabelList.add(error as LegendItem)
val size = obj {
@@ -148,8 +149,7 @@ class EventBubbleChart : SimplePanel() {
val borderColorList = mutableListOf<Color>()
model.log.forEach {
when {
- it.isError() -> borderColorList.add(ERROR)
- it.response.contains("httpStatusCode") -> borderColorList.add(ERROR)
+ it.isError() -> borderColorList.add(ERROR_COLOR)
else -> borderColorList.add(Color.name(Col.LIGHTGRAY))
}
}
@@ -162,13 +162,11 @@ class EventBubbleChart : SimplePanel() {
* 2. datasets are used inside datasets, data inside data
*/
fun buildDataSetsList(): List<DataSets> {
- console.log("[EBC.buildData]")
val dataSetsList = mutableListOf<DataSets>()
model.log.forEach {
val d = it.buildData()
dataSetsList.add(d)
}
- console.log(dataSetsList)
return dataSetsList
}
@@ -180,10 +178,12 @@ class EventBubbleChart : SimplePanel() {
}
private fun LogEntry.buildToolTip(index: Int): String {
- return this.title +
+ val size = StringUtils.format(this.responseLength)
+ val title = StringUtils.shortTitle(this.title)
+ return title +
"\nseq.no.: $index" +
"\nparallel runs: ${this.runningAtStart}" +
- "\nrsp.len.: ${this.responseLength}" +
+ "\nrsp.len.: $size" +
"\ntype: ${this.type}"
}
@@ -218,7 +218,7 @@ class EventBubbleChart : SimplePanel() {
companion object {
val TRANSPARENT = Color.rgba(0xFF, 0xFF, 0xFF, 0x00)
- val ERROR = Color.rgba(0xFF, 0x00, 0x00, 0xFF)
+ val ERROR_COLOR = Color.rgba(0xFF, 0x00, 0x00, 0xFF)
val LIGHT_BLUE = Color.rgba(0x4B, 0xAC, 0xC6, 0x80)
val DARK_BLUE = Color.rgba(0x4F, 0x81, 0xBD, 0x80)
val GREEN = Color.rgba(0x9B, 0xBB, 0x59, 0x80)
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 0606d95..8589845 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
@@ -133,7 +133,7 @@ object StringUtils {
args: Map<String, Argument?>?,
start: String,
sep: String,
- end: String
+ end: String,
): String {
return if (args.isNullOrEmpty()) "" else {
var answer = start
@@ -151,7 +151,7 @@ object StringUtils {
args: Map<String, Argument?>?,
start: String,
sep: String,
- end: String
+ end: String,
): String {
return if (args.isNullOrEmpty()) "" else {
var answer = start
@@ -241,4 +241,16 @@ object StringUtils {
return result
}
+ fun format(input: Int): String {
+ var output = ""
+ val str = input.toString()
+ str.reversed().forEachIndexed() { i, c ->
+ if (i > 0 && i % 3 == 0) {
+ output += "."
+ }
+ output += c
+ }
+ return output.reversed()
+ }
+
}
diff --git a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/util/StringUtilsTest.kt b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/util/StringUtilsTest.kt
index 3ce7a62..7482d0d 100644
--- a/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/util/StringUtilsTest.kt
+++ b/incubator/clients/kroviz/src/test/kotlin/org/apache/isis/client/kroviz/util/StringUtilsTest.kt
@@ -26,4 +26,14 @@ class StringUtilsTest {
assertEquals(expected, actual)
}
+ @Test
+ fun testFormat() {
+ // given
+ val int = 123456789
+ // when
+ val actual = StringUtils.format(int)
+ // then
+ val expected = "123.456.789"
+ assertEquals(expected, actual)
+ }
}