Skip to content

Commit

Permalink
Make refresh api redirect to overview
Browse files Browse the repository at this point in the history
  • Loading branch information
xrchz committed Nov 13, 2017
1 parent 063e6dc commit 900054a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ TODO: Add interface to stop jobs. Rethink job categorisation.

TODO: Use SSE to refresh the html interface dynamically

TODO: Make the refresh API redirect back to the overview page

TODO: Make server stop jobs that have been running too long
This could be done as part of the refresh action.

Expand Down
1 change: 0 additions & 1 deletion apiLib.sml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ datatype api = Waiting | Refresh
| Append of id * line (* not including newline *)
| Stop of id | Abort of id

val refresh_response = "refreshed\n"
val claim_response = "claimed\n"
val append_response = "appended\n"
val stop_response = "stopped\n"
Expand Down
7 changes: 5 additions & 2 deletions server.sml
Original file line number Diff line number Diff line change
Expand Up @@ -165,16 +165,19 @@ fun get_api () =
local
fun id_list ids = String.concatWith " " (List.map Int.toString ids)
in
fun dispatch api =
fun dispatch Refresh =
((refresh (); TextIO.output(TextIO.stdOut,String.concat["Location:",base_url,"\n\n"]))
handle e => cgi_die [exnMessage e])
| dispatch api =
text_response (
case api of
Waiting => id_list (waiting())
| Refresh => (refresh (); refresh_response)
| Job id => file_to_string (job id)
| Claim(id,name) => (claim id name; claim_response)
| Append(id,line) => (append id line; append_response)
| Stop id => (stop id; stop_response)
| Abort id => (abort id; abort_response)
| Refresh => raise(Fail"impossible")
) handle e => cgi_die [exnMessage e]
end

Expand Down

0 comments on commit 900054a

Please sign in to comment.