-
Notifications
You must be signed in to change notification settings - Fork 10
Events Doc
Sribalaji M edited this page May 1, 2018
·
3 revisions
We are following an event-based approach for communication of controller with input, output and the model
The general body of an event is as follows-
{
name: 'event_name',
details: {
datail1: 'datail1_value',
detail2: 'detail2_value',
...
}
}
- The controller of init first sends an event to the output for welcome message -
initOutput.sendOutput({
name: 'welcome'
});
- Then the controller gets input from init/input and send another event to the output to indicate that the authentication process has started.
initOutput.sendOutput({
name: 'authentication_started'
});
- The model, after fetching the private token from the gitlab server, sends it to the controller along with the status of the task.
| status code | status detail |
-------------------------------
| 200 | success |
| 401 | unauthorized |
| 4 | no connection |
- After getting the status from the model, the controller send an event to the the output to indicate that the authentication has ended along with the status from the model.
initOutput.sendOutput({
name: 'authentication_ended',
details: {
...status
}
});
The above code uses the spread operator of ES6.
- The controller of exit sends an event to the output when the model has successfully logged out -
initOutput.sendOutput({
name: 'logout_success'
});
- The prefs input returns an event according to the arguments to the prefs command.
{ name: 'server_changed', details: { host, port, type: 'ms', }, }
{ name: 'server_changed', details: { host, type: 'gitlab', }, }
- In case the input provided to change the server is invalid, appropriate events are returned.
{ name: 'invalid_host', }
{ name: 'invalid_port', }
- When the input is to to show the stored prefs, the returned event is -
{ name: 'show_prefs', }
-
The controller of eval sends an event to the output to show that the evaluation has started after it receives the input from evalInput -
{ name: 'eval_started', }
-
The eval controller then passes the input to the model along with a callback function. The model calls this callback function with one of the below events when it receives a response from the server. The controller forwards this event to the eval output.
{ name: 'invalid', }
{ name: 'submission_pending', }
{ name: 'scores', details: { ...dataFromServer } }
- Autolabcli v1.0.0 Docs
- Submission Workflow
- Architecture
- Refactoring Advice
- Feature Development
- Autolabcli Tests
- Events Doc
- Sequence Diagrams
- Testing in Javascript
- Libraries
- Debug Techniques
- Arrow Functions
- Autolabcli v0.1.1 Docs
- References