Call Graphs (autolabcli NG) - AutolabJS/autolabcli GitHub Wiki

Initialization

Used for initializing the autolabcli by providing credentials and authenticating.

PlantUML code for initialization
@startuml
Actor user
== Init ==
autonumber
user -> index : autolabjs init
index -> "controller:index" : start()

"controller:index" -> "controller:init" : onInit(args, options) note left caporal.js implicitly triggers onInit() end note

"controller:init" -> "output:init" : sendOutput("Welcome") "controller:init" -> "input:init" : getInput(options)

'We have two cases; input form cli and inp from inquirer

"input:init" -> "input:init" : areCredentialsValid(options)

alt valid credentials in options "input:init" -> "controller:init" : "{ username, password }" else "input:init" -> "inquirer" : prompt(questions) "input:init" //-- "inquirer" : answers "input:init" -> "controller:init" : answers end

"controller:init" -> "output:init" : sendOutput("Authentication") "controller:init" -> "model:init" : authenticate(credentials)

"model:init" -> "model:init" : fetchPrivateToken() "model:init" -> "request-promise" : post() "model:init" //-- "request-promise" : token

"model:init" -> "preference-manager" : setPreference(gitlab-credentials) "model:init" <- "controller:init" : status

"controller:init" -> "output:init" : sendOutput(status) @enduml

Evaluation

Used for evaluating a given lab on AutolabJS

PlantUML code for evaluation
@startuml
Actor user
== Eval ==
autonumber

user -> index : autolabjs eval index -> "controller:index" : start()

"controller:index" -> "controller:eval" : onEval(args, options) note left caporal.js implicitly triggers onEval() end note

"controller:eval" -> commandValidator : validateSession()

"controller:eval" -> "input:eval" : getInput(args, options)

alt valid evaluation in options "input:eval" -> preferenceManager : getPreference(GitlabPrefs) "input:eval" -> "controller:eval" : "{ lab, lang, hash, idNo }" else "input:eval" -> "inquirer" : prompt(questions) "input:eval" //-- "inquirer" : answers "input:eval" -> preferenceManager : getPreference(GitlabPrefs) "input:eval" -> "controller:eval" : "{answers, idNo}" end

"controller:eval" -> "output:eval" : sendOutput("Eval Started") "controller:eval" -> "model:eval" : evaluate(options, callback)

"model:Eval" -> preferenceManager : getPreference(CliPrefs)

"model:Eval" -> io : connect(AutolabJSHost) "model:Eval" <- io : socket activate socket socket ->] : emit("Submission", options) socket <--] : results

"socket"-> "controller:eval" : callback(results) deactivate socket "controller:eval" -> "output:eval" : sendOutput(results) @enduml

Preferences

Used for changing and viewing gitlab or cli preferences.

PlantUML code for preferences
@startuml
Actor user
== Prefs ==
autonumber

user -> index : autolabjs prefs index -> "controller:index" : start()

"controller:index" -> "controller:prefs" : onPrefs(args, options) note left caporal.js implicitly triggers onPrefs() end note

"controller:prefs" -> "input:prefs" : getInput(args, options)

alt changelang alt lang in options "controller:prefs" <- "input:prefs" : { lang } else "input:prefs" -> inquirer : prompt(questions) "input:prefs" <-- inquirer : answers "controller:prefs" <- "input:prefs" : { lang } end

else changeserver alt server in options "controller:prefs" <- "input:prefs" : { host, port, type } else "input:prefs" -> inquirer : prompt(questions) "input:prefs" <-- inquirer : answers "controller:prefs" <- "input:prefs" : { host, port, type } end

else show "controller:prefs" <- "input:prefs" : { "show_prefs" } end

"controller:prefs" -> "model:prefs" : storePrefs(changePrefEvent)

alt show prefs "model:prefs" -> preferenceManager : getPreference("cli-prefs") else "model:prefs" -> preferenceManager : setPreference(details)

end

"model:prefs" -> "controller:prefs" : changePrefEvent

"controller:prefs" -> "output:prefs" : sendOutput(changePrefEvent)

@enduml

Exit

Used for exiting/destroying the current session of autolabcli.

PlantUML code for exit
@startuml
Actor user
== Exit ==
autonumber

user -> index : autolabjs exit index -> "controller:index" : start()

"controller:index" -> "controller:exit" : onExit(args, options) note left caporal.js implicitly triggers onExit() end note

"controller:exit" -> commandValiator : validateSession()

alt invalid session commandValidator -> preferenceManager : deleteCredentials()

else valid session "controller:exit" -> "model:exit" : logout() "model:exit" -> preferenceManager : deleteCredentials() "controller:exit" -> "output:exit" : sendOutput("Logout Success") end @enduml

⚠️ **GitHub.com Fallback** ⚠️