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

IJMP-1320: fixed both IJMP-1318 and IJMP-1320. #160

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ class ConnectionConfig : ConnectionConfigBase {
if (name != other.name) return false
if (url != other.url) return false
if (isAllowSelfSigned != other.isAllowSelfSigned) return false
if (zVersion != other.zVersion) return false
if (zoweConfigPath != other.zoweConfigPath) return false
if (owner != other.owner) return false
// TODO: uncomment next 2 lines when the task https://jira.ibagroup.eu/browse/IJMP-1412 will be completed.
// if (zVersion != other.zVersion) return false
// if (owner != other.owner) return false

return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class ZOSMFConnectionConfigurable : BoundSearchableConfigurable("z/OSMF Connecti
}
}

private val zoweConfigStates = mutableListOf<ConnectionDialogState>()
private val zoweConfigStates = hashMapOf<String, ConnectionDialogState>()

/** Dialog to edit existing connection. Triggers the dialog and, after the changes, tests the connection and adds the changes */
private fun editConnection() {
Expand All @@ -114,8 +114,8 @@ class ZOSMFConnectionConfigurable : BoundSearchableConfigurable("z/OSMF Connecti
val state = showAndTestConnection(connectionsTableModel!![idx].apply {
mode = DialogMode.UPDATE
})
if (state?.zoweConfigPath != null) {
zoweConfigStates.add(state)
state?.zoweConfigPath?.let {
zoweConfigStates[it] = state
}
if (state != null) {
connectionsTableModel?.set(idx, state)
Expand Down Expand Up @@ -275,7 +275,11 @@ class ZOSMFConnectionConfigurable : BoundSearchableConfigurable("z/OSMF Connecti
val wasModified = isModified
applySandbox<Credentials>()
applySandbox<ConnectionConfig>()
zoweConfigStates.distinct().forEach { updateZoweConfigIfNeeded(it) }
zoweConfigStates.values.forEach {
if (isModified) {
updateZoweConfigIfNeeded(it)
}
}
if (wasModified) {
panel?.updateUI()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import org.zowe.kotlinsdk.zowe.config.ZoweConfig
import org.zowe.kotlinsdk.zowe.config.parseConfigJson
import java.nio.file.Path
import java.util.*
import kotlin.streams.toList
import java.util.stream.Collectors

val ZOWE_PROJECT_PREFIX = "zowe-"

Expand Down Expand Up @@ -82,7 +82,7 @@ class ZoweConfigServiceImpl(override val myProject: Project) : ZoweConfigService
private fun findExistingConnection(): ConnectionConfig? {
val zoweConnectionList = configCrudable.find<ConnectionConfig> {
it.name == zoweConnectionName
}.toList()
}.collect(Collectors.toList())
return if (zoweConnectionList.isEmpty()) null else zoweConnectionList[0]
}

Expand Down Expand Up @@ -177,6 +177,7 @@ class ZoweConfigServiceImpl(override val myProject: Project) : ZoweConfigService
fun ZoweConfig.toConnectionConfig(zVersion: ZVersion = ZVersion.ZOS_2_1): ConnectionConfig =
toConnectionConfig(getOrCreateUuid(), zVersion)


/**
* @see ZoweConfigService.getZoweConfigState
*/
Expand All @@ -202,3 +203,4 @@ class ZoweConfigServiceImpl(override val myProject: Project) : ZoweConfigService
}

}

Loading