O.G.A.S. Русский

Methods of the workshop and the pulpit

What the window of the workshop takes from the platform and what it calls it with, the methods of the function ui and of the function of the pulpit canvas: the document of the pulpit, the surface for the window, pictures, looks, pieces.

Introduction

The document is a part of the contract Exchange with the kernel: the sources of the data of the workshop, the methods of the window program and the description of the pulpit. How it is shown to the person — The workshop. The refusal codes — Error codes.

1 The data of the workshop

The functions do not describe drawing: the workshop draws its views itself, and takes its data with ordinary requests to the functions (The workshop, section 8).

Table 1 — The data of the workshop

What the workshop shows Where it takes it from
the graph of a process process.open, process.list, process.kinds, process.node.template, process.node.candidates, process.validate, process.inspect; the event process.changed — the list of processes is read anew, whoever made, imported or saved a process
a program, its events and runs process.program.list, process.objects, process.variable.list, process.ask.list, process.show.get, process.runs.list, process.snapshot; the events program.changed, run.changed, node.changed, variable.changed, show.changed, ask.opened, ask.closed
the pulpit canvas.snapshot (slots and revision), canvas.get when editing; no pulpit yet — the command canvas.ensure makes an empty one
settings settings.schema, settings.get; the section «State» — core.status
modules module.list; the tab «Check» — the answer of module.test
the memory of a module node in the panel of the node module.state.list; «Clear the memory» — the command module.state.clear
the journal and problems observe.logs.query, observe.problems.list (the fields of a problem — File formats, section 13)

An action of the person is an ordinary command to the owner (process.run.start, process.event.fire, canvas.save, settings.set, module.install …); the list of commands is in the contract of the owner. At introduction a function names its surfaces in the field surfaces — this is needed to see the make-up of the platform; the kernel does not parse the meaning of these names.

2 The window

The window of the workshop is a Windows program; it connects to the function ui at the address 127.0.0.1 (the port and the session token come on the command line of the start, The workshop, section 2). How messages are passed and what the wrapper looks like — Exchange with the kernel, sections 2, 3. The id of a request of the window is window-<number>.

Table 2 — The window

Method Who answers Parameters Result
ui.window.hello the function ui, the first message of a connection token { "status": "ready" }
ui.window.font the function ui — { "format": "truetype" \| "opentype" \| "woff" \| "woff2", "data": base64 } — the file ui.font.file, if ui.font.source = file; up to 2,500,000 bytes
ui.window.defaults the function ui — { "values": { key: default } } — the defaults of all ui.* by the schema of the function ui; the window draws with them until the function of settings answers with values
ui.window.layout.get the function ui — the document ogas.layout/1 from config/layout.json; before the first write — { "format", "host": null, "windows": [], "panels": {} } (File formats, 7.1)
ui.window.layout.set the function ui layout: { host, windows, panels }; without panels an empty set is written {}; a layout that does not agree with File formats, 7.1, — document_invalid naming the field
ui.window.library.get the function ui — the document ogas.library/1 from config/library.json; before the first write — { "format", "bars": [{ "id": "programs", "name": "", "programs": [] }], "hidden": { "programs": [], "modules": [] } } (File formats, 7.3)
ui.window.library.set the function ui library: { bars, hidden, views } {}; a library that does not agree with File formats, 7.3, — document_invalid naming the field
ui.window.face the function ui — { "process_id": id \| null } — the process whose face a start asked to show, or null; the name is given once: a window opened anew shows what it is asked to then
ui.window.path function ui path — a path of Windows { path } — the same file as Linux sees it (wslpath -u); where WSL does not reach — the refusal ui_window_path_unknown
ui.window.launch function ui — { target, arguments, icon } — what a shortcut of Windows runs to start the platform: the starter ogas-start.exe (the window program puts it on the disk of Windows), which hands to wsl.exe with no console the words with the distribution and the folder of the installation, the picture — the window program; a shortcut of a program adds program --process <id>
methods of functions (process.*, settings.*, i18n.* …) the owner of the method through the kernel as at the owner as at the owner
core.status, core.health, core.space, core.event.subscribe, core.shutdown the kernel through the function ui as in Exchange with the kernel, section 5 as in Exchange with the kernel, section 5

The other core.* and function.handshake are closed to the window — method_not_allowed. A wrong token or a first message other than ui.window.hello — ui_window_unauthorized and the connection closed. The events of the kernel the function ui passes to the window as the notification event in the same event wrapper (Exchange with the kernel, section 7). Neither the function ui nor the window program sets a term of its own for an answer: both only pass the call on, and how long to wait the page decides (The make-up of the platform, 3.7.1). The page waits as long as the owner of the method needs and sets no term of its own: a term of the window would break off long work of the owner — checking a module, installing an environment. A call without an answer does not hang: it ends with the refusal function_lost when the owner disconnected or did not pass the health check, and ui_window_disconnected when the link of the window with the platform broke.

The face of a program is opened by a start (The workshop, 6.6). The name of the program is carried by the function ui:

At its start the window asks ui.window.face and, having got a name, shows the face at once, before the process is read; then it opens the process and switches its program on with a command to the owner (process.program.on). An already open window learns of a request from the event ui.face.asked.

3 The pulpit

The owner of workspace.json is the function canvas. The document of the pulpit is ogas.workspace/3, the graph of the interface: containers and elements (File formats, section 7). The meaning of shared objects is the graph's: they are set by the nodes and variables of process.json (The program: graph and runs, section 16). An empty pulpit is allowed: objects are not laid out by themselves. A refusal for the form of the document is canvas_invalid, the message names the element or container and the field.