@@ -124,27 +124,33 @@ module private Update =
124
124
125
125
open State
126
126
127
- let private validateInputState ( state : InputState ) =
128
- match state.SeqMode with
129
- | Some Single ->
130
- match state.SingleSequence with
131
- | " " -> false , " No data provided"
132
- | _ ->
133
- match state.HasValidFasta with
134
- | false -> false , " Fasta is invalid"
135
- | _ -> true , " Start computation"
136
- | Some Fasta ->
137
- match state.FastaFileData with
138
- | " " -> false , " No data provided"
139
- | x when x.Split([| '>' |], System.StringSplitOptions.RemoveEmptyEntries) .Length > 1000 ->
140
- false , " Too many sequences (>1000)."
141
- | _ ->
142
- match state.HasValidFasta with
143
- | false -> false , " Fasta is invalid"
144
- | _ -> true , " Start computation"
145
- | None ->
146
- false , " No data provided"
147
-
127
+ let private validateInputState ( versions : State.Versions ) ( state : InputState ) =
128
+ let validateInput () =
129
+ match state.SeqMode with
130
+ | Some Single ->
131
+ match state.SingleSequence with
132
+ | " " -> false , " No data provided"
133
+ | _ ->
134
+ match state.HasValidFasta with
135
+ | false -> false , " Fasta is invalid"
136
+ | _ -> true , " Start computation"
137
+ | Some Fasta ->
138
+ match state.FastaFileData with
139
+ | " " -> false , " No data provided"
140
+ | x when x.Split([| '>' |], System.StringSplitOptions.RemoveEmptyEntries) .Length > 1000 ->
141
+ false , " Too many sequences (>1000)."
142
+ | _ ->
143
+ match state.HasValidFasta with
144
+ | false -> false , " Fasta is invalid"
145
+ | _ -> true , " Start computation"
146
+ | None ->
147
+ false , " No data provided"
148
+ match versions with
149
+ | noServerConnection when versions.UI = " " ->
150
+ false , " No connection to server"
151
+ | noApiConnection when versions.Api = " " ->
152
+ false , " No connection to predictor service"
153
+ | _ -> validateInput()
148
154
module private UploadHandler =
149
155
open Fable.Core .JsInterop
150
156
@@ -327,10 +333,10 @@ let private startPredictionRight (hasJobRunning:bool) (isValidState:bool) (butto
327
333
open Update
328
334
329
335
[<ReactComponent>]
330
- let View ( hasJobRunning : bool ) ( dispatch : Msg -> unit ) =
336
+ let View ( versions : State.Versions ) ( hasJobRunning : bool ) ( dispatch : Msg -> unit ) =
331
337
let state , setState = React.useElmish( init, update, [||])
332
338
333
- let isValidState , buttonMsg = validateInputState state
339
+ let isValidState , buttonMsg = validateInputState versions state
334
340
335
341
div [ Style [ FlexGrow 1 ; Display DisplayOptions.Flex; FlexDirection " column" ]] [
336
342
Columns.columns [ Columns.CustomClass " ProcessDecision" ; Columns.Props [ Style [ FlexGrow 1 ]]] [
0 commit comments