@@ -10,6 +10,7 @@ import kotlinx.coroutines.channels.Channel
10
10
import kotlinx.coroutines.channels.ClosedSendChannelException
11
11
import kotlinx.coroutines.flow.MutableStateFlow
12
12
import kotlinx.coroutines.flow.StateFlow
13
+ import kotlinx.coroutines.flow.update
13
14
import kotlinx.coroutines.launch
14
15
15
16
/* *
@@ -89,17 +90,17 @@ class CoderSettingsPage(context: CoderToolboxContext, triggerSshConfig: Channel<
89
90
override val actionButtons: StateFlow <List <RunnableActionDescription >> = MutableStateFlow (
90
91
listOf (
91
92
Action (context.i18n.ptrl(" Save" ), closesPage = true ) {
92
- context.settingsStore.updateBinarySource(binarySourceField.textState .value)
93
- context.settingsStore.updateBinaryDirectory(binaryDirectoryField.textState .value)
94
- context.settingsStore.updateDataDirectory(dataDirectoryField.textState .value)
93
+ context.settingsStore.updateBinarySource(binarySourceField.contentState .value)
94
+ context.settingsStore.updateBinaryDirectory(binaryDirectoryField.contentState .value)
95
+ context.settingsStore.updateDataDirectory(dataDirectoryField.contentState .value)
95
96
context.settingsStore.updateEnableDownloads(enableDownloadsField.checkedState.value)
96
97
context.settingsStore.updateSignatureFallbackStrategy(signatureFallbackStrategyField.checkedState.value)
97
98
context.settingsStore.updateBinaryDirectoryFallback(enableBinaryDirectoryFallbackField.checkedState.value)
98
- context.settingsStore.updateHeaderCommand(headerCommandField.textState .value)
99
- context.settingsStore.updateCertPath(tlsCertPathField.textState .value)
100
- context.settingsStore.updateKeyPath(tlsKeyPathField.textState .value)
101
- context.settingsStore.updateCAPath(tlsCAPathField.textState .value)
102
- context.settingsStore.updateAltHostname(tlsAlternateHostnameField.textState .value)
99
+ context.settingsStore.updateHeaderCommand(headerCommandField.contentState .value)
100
+ context.settingsStore.updateCertPath(tlsCertPathField.contentState .value)
101
+ context.settingsStore.updateKeyPath(tlsKeyPathField.contentState .value)
102
+ context.settingsStore.updateCAPath(tlsCAPathField.contentState .value)
103
+ context.settingsStore.updateAltHostname(tlsAlternateHostnameField.contentState .value)
103
104
context.settingsStore.updateDisableAutostart(disableAutostartField.checkedState.value)
104
105
val oldIsSshWildcardConfigEnabled = settings.isSshWildcardConfigEnabled
105
106
context.settingsStore.updateEnableSshWildcardConfig(enableSshWildCardConfig.checkedState.value)
@@ -113,10 +114,73 @@ class CoderSettingsPage(context: CoderToolboxContext, triggerSshConfig: Channel<
113
114
}
114
115
}
115
116
}
116
- context.settingsStore.updateSshLogDir(sshLogDirField.textState .value)
117
- context.settingsStore.updateNetworkInfoDir(networkInfoDirField.textState .value)
118
- context.settingsStore.updateSshConfigOptions(sshExtraArgs.textState .value)
117
+ context.settingsStore.updateSshLogDir(sshLogDirField.contentState .value)
118
+ context.settingsStore.updateNetworkInfoDir(networkInfoDirField.contentState .value)
119
+ context.settingsStore.updateSshConfigOptions(sshExtraArgs.contentState .value)
119
120
}
120
121
)
121
122
)
123
+
124
+ override fun beforeShow () {
125
+ // update the value of all fields
126
+ binarySourceField.contentState.update {
127
+ settings.binarySource ? : " "
128
+ }
129
+ binaryDirectoryField.contentState.update {
130
+ settings.binaryDirectory ? : " "
131
+ }
132
+ dataDirectoryField.contentState.update {
133
+ settings.dataDirectory ? : " "
134
+ }
135
+ enableDownloadsField.checkedState.update {
136
+ settings.enableDownloads
137
+ }
138
+ signatureFallbackStrategyField.checkedState.update {
139
+ settings.fallbackOnCoderForSignatures.isAllowed()
140
+ }
141
+
142
+ enableBinaryDirectoryFallbackField.checkedState.update {
143
+ settings.enableBinaryDirectoryFallback
144
+ }
145
+
146
+ headerCommandField.contentState.update {
147
+ settings.headerCommand ? : " "
148
+ }
149
+
150
+ tlsCertPathField.contentState.update {
151
+ settings.tls.certPath ? : " "
152
+ }
153
+
154
+ tlsKeyPathField.contentState.update {
155
+ settings.tls.keyPath ? : " "
156
+ }
157
+
158
+ tlsCAPathField.contentState.update {
159
+ settings.tls.caPath ? : " "
160
+ }
161
+
162
+ tlsAlternateHostnameField.contentState.update {
163
+ settings.tls.altHostname ? : " "
164
+ }
165
+
166
+ disableAutostartField.checkedState.update {
167
+ settings.disableAutostart
168
+ }
169
+
170
+ enableSshWildCardConfig.checkedState.update {
171
+ settings.isSshWildcardConfigEnabled
172
+ }
173
+
174
+ sshExtraArgs.contentState.update {
175
+ settings.sshConfigOptions ? : " "
176
+ }
177
+
178
+ sshLogDirField.contentState.update {
179
+ settings.sshLogDirectory ? : " "
180
+ }
181
+
182
+ networkInfoDirField.contentState.update {
183
+ settings.networkInfoDir
184
+ }
185
+ }
122
186
}
0 commit comments