Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to session ID clearance #148

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/jsMain/kotlin/reactredux/containers/OptionsPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import react.Props
import react.invoke
import react.redux.rConnect
import reactredux.slices.ValidationContextSlice
import reactredux.slices.ValidationSessionSlice
import reactredux.store.AppState
import redux.RAction
import redux.WrapperAction
Expand All @@ -26,7 +27,9 @@ private interface OptionsPageDispatchProps : Props {
var updateCliContext: (CliContext) -> Unit
var updateSelectedIgPackageInfo: (Set<PackageInfo>) -> Unit
var updateAddedExtensionUrl: (Set<String>) -> Unit
var setSessionId: (String) -> Unit
var updateAddedProfiles: (Set<String>) -> Unit

}

val optionsPage: ComponentClass<Props> =
Expand All @@ -48,6 +51,7 @@ val optionsPage: ComponentClass<Props> =
updateAddedExtensionUrl = {
dispatch(ValidationContextSlice.UpdateAddedExtensionUrl(it))
}
setSessionId = { id: String -> dispatch(ValidationSessionSlice.SetSessionId(id)) }
updateAddedProfiles = {
dispatch(ValidationContextSlice.UpdateAddedProfile(it))
}
Expand Down
4 changes: 2 additions & 2 deletions src/jsMain/kotlin/reactredux/slices/LocalizationSlice.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ object LocalizationSlice {
fun reducer(state: State = State(), action: RAction): State {
return when (action) {
is SetPolyglot -> {
println("setting new polyglot instance\nexisting -> ${state.polyglotInstance.t("heading_validate")}")
println("setting new polyglot instance\nnew -> ${action.polyglotInstance.t("heading_validate")}")
println("setting new polyglot instance\nexisting -> ${state.polyglotInstance.t("validate_heading")}")
println("setting new polyglot instance\nnew -> ${action.polyglotInstance.t("validate_heading")}")
state.copy(polyglotInstance = action.polyglotInstance)
}
is SetLanguage -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class LanguageSelect(props : LanguageSelectProps) : RComponent<LanguageSelectPro
attrs {
label = ReactNode("Language")
onChange = { event, _ ->
var selectedLanguage = getSelectedLanguage(event.target.value)
val selectedLanguage = getSelectedLanguage(event.target.value)
if (selectedLanguage != null) {
props.setLanguage(selectedLanguage)
props.fetchPolyglot(selectedLanguage.getLanguageCode());
Expand Down
40 changes: 29 additions & 11 deletions src/jsMain/kotlin/ui/components/options/OptionsPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ external interface OptionsPageProps : Props {
var addedProfiles: Set<String>
var updateAddedProfiles: (Set<String>) -> Unit
var polyglot: Polyglot
var setSessionId: (String) -> Unit
}

class OptionsPageState : State {
Expand Down Expand Up @@ -63,6 +64,18 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
}
}

private fun updateCliContext(cliContext: CliContext) {
props.updateCliContext(cliContext)
props.setSessionId("");
console.log("Ungabunga")
}

private fun updateAddedExtensions(newAddedExtensionSet: MutableSet<String>) {
props.updateAddedExtensionUrl(newAddedExtensionSet)
props.setSessionId("");
console.log("Ungabunga 2")
}

override fun RBuilder.render() {
styledDiv {
css {
Expand All @@ -81,7 +94,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
selected = props.cliContext.isDoNative()
hasDescription = true
onChange = {
props.updateCliContext(props.cliContext.setDoNative(it))
updateCliContext(props.cliContext.setDoNative(it))
}
}
styledDiv {
Expand All @@ -95,7 +108,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
selected = props.cliContext.isHintAboutNonMustSupport()
hasDescription = true
onChange = {
props.updateCliContext(props.cliContext.setHintAboutNonMustSupport(it))
updateCliContext(props.cliContext.setHintAboutNonMustSupport(it))
}
}
styledDiv {
Expand All @@ -109,7 +122,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
selected = props.cliContext.isAssumeValidRestReferences()
hasDescription = true
onChange = {
props.updateCliContext(props.cliContext.setAssumeValidRestReferences(it))
updateCliContext(props.cliContext.setAssumeValidRestReferences(it))
}
}
styledDiv {
Expand All @@ -123,7 +136,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
selected = props.cliContext.isNoExtensibleBindingMessages()
hasDescription = true
onChange = {
props.updateCliContext(props.cliContext.setNoExtensibleBindingMessages(it))
updateCliContext(props.cliContext.setNoExtensibleBindingMessages(it))
}
}
styledDiv {
Expand All @@ -138,7 +151,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
hasDescription = true
onChange = {
props.cliContext.setShowTimes(it)
props.updateCliContext(props.cliContext)
updateCliContext(props.cliContext)
}
}
styledDiv {
Expand All @@ -153,7 +166,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
hasDescription = true
onChange = {
props.cliContext.setAllowExampleUrls(it)
props.updateCliContext(props.cliContext)
updateCliContext(props.cliContext)
}
}
}
Expand All @@ -179,6 +192,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
else -> it.copy(second = false)
}
}
updateCliContext(props.cliContext)
}
}
}
Expand Down Expand Up @@ -208,6 +222,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
selectedIgSet.minus(igPackageInfo).toMutableSet()
}
props.updateSelectedIgPackageInfo(newSelectedIgSet)
props.setSessionId("")
}
onFilterStringChange = { partialIgName ->
mainScope.launch {
Expand Down Expand Up @@ -239,6 +254,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
addedProfiles.plus(profile).toMutableSet()
}
props.updateAddedProfiles(newProfiles)
props.setSessionId("")
}
}
}
Expand All @@ -260,15 +276,15 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
} else {
addedExtensionSet.plus(extensionUrl).toMutableSet()
}
props.updateAddedExtensionUrl(newAddedExtensionSet)
updateAddedExtensions(newAddedExtensionSet)
}
onUpdateAnyExtension = {anySelected ->
val newSet = if (anySelected) {
addedExtensionSet.plus("any").toMutableSet()
} else {
addedExtensionSet.minus("any").toMutableSet()
}
props.updateAddedExtensionUrl(newSet)
updateAddedExtensions(newSet)
}
}
}
Expand All @@ -294,8 +310,8 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
version -> it.copy(second = true)
else -> it.copy(second = false)
}

}
updateCliContext(props.cliContext)
}
}
}
Expand All @@ -315,7 +331,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
GlobalScope.async {
val txServerOutcome = async { checkTxServer(url) }
if (txServerOutcome.await()) {
props.updateCliContext(props.cliContext.setTxServer(url))
updateCliContext(props.cliContext.setTxServer(url))
true
} else {
false
Expand All @@ -330,6 +346,8 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
}
}



private fun getPackageNames(packageInfo : List<PackageInfo>) : MutableList<Pair<String, Boolean>> {
return packageInfo.map { Pair(it.id!!, false)}.toMutableList()
}
Expand All @@ -340,7 +358,7 @@ class OptionsPage : RComponent<OptionsPageProps, OptionsPageState>() {
withTimeout(TERMINOLOGY_CHECK_TIME_LIMIT) {
val response = validateTxServer(txUrl)
if (response.validTxServer) {
props.updateCliContext(props.cliContext.setTxServer(response.url))
updateCliContext(props.cliContext.setTxServer(response.url))
validTxServer = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import utils.isJson
import utils.isXml

//TODO make this an intelligent value
private const val VALIDATION_TIME_LIMIT = 45000L
private const val VALIDATION_TIME_LIMIT = 60000L

external interface ManualEntryTabProps : Props {
var cliContext: CliContext
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package controller.validation

import org.hl7.fhir.validation.cli.services.ValidationService

private const val MIN_FREE_MEMORY = 2500000000
private const val MIN_FREE_MEMORY = 250000000

class ValidationServiceFactoryImpl : ValidationServiceFactory {

Expand Down