-
Notifications
You must be signed in to change notification settings - Fork 6
Developer Guide
app.js and include
controllers/models/views/resources
testing
production mode
step by step + explanation ...
PlatformContext is a globally available object. As for v0.3 it contains references to
- UserContext and UserContextController
- TangoRestApi -- REST API model
- Tango hosts collection
- Devices collection
Custom widgets may bind (see webix docs) to tangos hosts or/and devices.
UserContext contains data relevant to a user of TangoWebapp. As for v0.3 UserContext contains the following information:
- user name
- rest url -- REST API entry point URL aka http://localhost:10001
- tango hosts -- a number of tango hosts entered by the user via tango hosts widget
- device filters -- a number of device filters entered by the user via device filters widget
Use ext field. For instance, attrs_monitor_view
By default TangoWebapp comes with an embedded in-memory server side storage for the UserContext. This means that all the data will be lost if app is restarted. However it is very easy to implement a permanent storage.
Such storage can be a dedicated service that follows very simple API:
GET url?id=user_name returns base64 encoded stringified JSON UserContext instance
POST url?id=user_name&data=data, where data is a base64 encoded stringified JSON value of the UserContext instance to overwrite the stored data or null to delete the data
Once such storage has been deployed you need to refer to it. For this set url field of the TangoRemoteStorage model:
TangoRemoteStorage.url = http://my-host/my-storageThe later script can be placed in an arbitrary resource file:
..
|-resources
|-custom_storage.js
and then applied in the app.js file:
//apps/tango_webapp.js
include.resources('custom_storage')...
models
controllers
views
- Go to index.html and download webix library:

- Once downloaded go to project structure (File->Project Structure); choose Global Libraries and attach webix_debug to a module with your application:

- create new file in
resources/tango_webappe.g.resources/tango_webapp/device_tree.js - add newly created file to
resources/tango_webapp/setup.js:
MVC.Object.extend(TangoWebapp.ui, {
_webix_files: [
"dashboard",
"devices_tree" //<--------
]
});
//... - start prototyping your component:
/** @module DevicesTree*/
(function(){
//it is better to assign protoUI to a variable to ease navigation in project structure tab, see below
/**
* @type {webix.protoUI}
*/
var devices_tree = webix.protoUI({...})
})();With protoUIs assigned to variables Structure tab gives an easy way to navigate between protoUIs:

- Create application's ui after platform_context.create i.e. in application's main controller do:
//controllers/tango_webapp/main_controller.js
"tango_webapp.initialize subscribe": function (event) {
// event.data contains fully properly initialized PlatformContext model
var platform_context = event.data;
webix.ui({
view: 'devices_tree', // custom webix component created above
context: platform_context
} ,0, 'content')
}- In your component define __ui