Skip to content
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# 0.0.30

## PiMonitor Client SDK Core

- [[BF142]](https://github.com/picortex/bitframe/issues/142) Refactor SignUpService to just use one method for signing up

## Bitframe

- [[BF143]](https://github.com/picortex/bitframe/issues/143) Response is not properly returning the cause of an error

## Bitframe Server

- [[BF144]](https://github.com/picortex/bitframe/issues/144) Fix Cross Origin Resource Sharing Issue

# 0.0.29

## PiMonitor Client SDK Core
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import bitframe.authentication.spaces.Space
import bitframe.response.response.decodeResponseFromString
import bitframe.service.MiniService
import bitframe.service.config.KtorClientConfiguration
import bitframe.service.utils.JsonContent
import io.ktor.client.features.*
import io.ktor.client.request.*
import io.ktor.client.statement.*
import io.ktor.content.*
import io.ktor.http.*
import kotlinx.serialization.json.Json
Expand All @@ -21,13 +24,12 @@ class SignInServiceKtor @JvmOverloads constructor(
private val scope = config.scope
override fun signIn(credentials: SignInCredentials): Later<LoginConundrum> = scope.later {
validate(credentials)
val json = http.post<String>(path) {
body = TextContent(
text = Json.encodeToString(SignInCredentials.serializer(), credentials),
contentType = ContentType.Application.Json
)
val resp = try {
http.post(path) { body = JsonContent(credentials) }
} catch (exp: ClientRequestException) {
exp.response
}
Json.decodeResponseFromString(LoginConundrum.serializer(), json).response()
Json.decodeResponseFromString(LoginConundrum.serializer(), resp.readText()).response()
}

override fun resolve(space: Space): Later<Session.SignedIn> = scope.later {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ import kotlin.jvm.JvmOverloads
data class Error(
val message: String,
val type: String,
val cause: String
val cause: String,
val stackTrace: String = ""
) {

@JvmOverloads
constructor(error: Throwable, message: String? = null) : this(
message = message ?: error.message ?: "Unknown",
type = error::class.simpleName ?: "Unknown",
cause = (if (message == null) error.cause?.message else error.message) ?: "Unknown"
cause = (if (message == null) error.cause?.message else error.message) ?: "Unknown",
stackTrace = error.stackTraceToString()
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import bitframe.server.http.HttpRequest
import bitframe.server.modules.Module
import bitframe.server.modules.authentication.AuthenticationModule
import io.ktor.application.*
import io.ktor.features.*
import io.ktor.http.*
import io.ktor.http.content.*
import io.ktor.request.*
Expand All @@ -23,6 +24,19 @@ class Application(
@JvmOverloads
fun start(port: Int = 8080) = embeddedServer(CIO, port) {
println("Serving files from ${client.absolutePath}")
install(CORS) {
method(HttpMethod.Options)
method(HttpMethod.Get)
method(HttpMethod.Post)
method(HttpMethod.Put)
method(HttpMethod.Delete)
method(HttpMethod.Patch)
header(HttpHeaders.AccessControlAllowHeaders)
header(HttpHeaders.ContentType)
header(HttpHeaders.AccessControlAllowOrigin)
anyHost()
allowCredentials = true
}
routing {
static("/") {
staticRootFolder = client.absoluteFile
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ object vers {
}

object bitframe {
val current = "0.0.29"
val previous = "0.0.28"
val current = "0.0.30"
val previous = "0.0.29"
}

object asoft {
Expand Down
2 changes: 0 additions & 2 deletions pi-monitor/pi-monitor-client/browser/react/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ val jvmTest by tasks.getting(Test::class) {
)
if (System.getenv("TEST_MODE") == "CI") {
dependsOn(":pi-monitor-server:createDockerfile")
// val bin = System.getenv("CHROME_BIN") ?: "/usr/local/share/chrome_driver"
// props["selenide.browserBinary"] = "/usr/bin/google-chrome"
}
systemProperties(props)
testLogging {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@ private val BusinessContainer = fc<BusinessContainerProps> { props ->
is BusinessesState.Businesses -> styledDiv {
FlexBox {
css { justifyContent = JustifyContent.flexEnd }
ContainedButton("Create") {}
ContainedButton("Create") { viewModel.post(BusinessesIntent.ShowBusinessForm) }
}
if (state.data.isEmpty()) EmptyBusiness()
else BusinessList(state.data)
}
is BusinessesState.BusinessForm -> styledDiv {
+"Creating form, just wait and see"
}
is BusinessesState.Success -> SuccessBox(state.message)
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package pimonitor.evaluation.business

import pimonitor.Monitor
import pimonitor.monitored.MonitoredBusiness
import react.RBuilder
import reakt.*

internal fun RBuilder.BusinessList(
data: List<Monitor.Business>
data: List<MonitoredBusiness>
) = ReactTable(
data,
columns = listOf(
Column("name") { it.name },
Column("email") { it.email.value },
Column("contact") { it.name },
Column("email") { it.contacts.first().email.value },
Column("contact") { it.contacts.first().name },
RenderColumn("actions") {
Grid(cols = "1fr 1fr") {
ContainedButton("View") {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,18 @@ import kotlinext.js.jso
import kotlinx.browser.document
import kotlinx.extensions.By
import kotlinx.extensions.get
import logging.ConsoleAppender
import logging.Logging
import org.w3c.dom.HTMLDivElement
import pimonitor.authentication.signup.SignUp
import pimonitor.authentication.signup.legacy.SignUpLegacy
import pimonitor.evaluation.business.BusinessContainer
import reakt.setContent

fun main() = document.get<HTMLDivElement>(By.id("root")).setContent {
val client = client(jso {
appId = "test-client"
simulationTime = 3000
// url = "http://localhost:8080"
simulationTime = 1500
})
val version: String by konfig()
Logging.init(ConsoleAppender())
Bitframe(
client = client,
routeRenderers = mapOf(
Expand Down
Loading