-{"models":{"138a81fa1f16435":{"_id":"138a81fa1f16435","_name":"RuntimeAdmin","_inherit":["RuntimeComponent"],"_core":true,"start":{},"stop":{}},"135c71078810af2":{"_id":"135c71078810af2","_name":"RuntimeChannel","_inherit":["RuntimeComponent"],"sync":{},"loadSystem":{"params":[{"name":"system","type":"object"}]},"createSchema":{"params":[{"name":"id","type":"string"},{"name":"schema","type":"object"}]},"updateSchema":{"params":[{"name":"id","type":"string"},{"name":"schema","type":"object"}]},"deleteSchema":{"params":[{"name":"id","type":"string"}]},"createModel":{"params":[{"name":"id","type":"string"},{"name":"model","type":"object"}]},"updateModel":{"params":[{"name":"id","type":"string"},{"name":"model","type":"object"}]},"deleteModel":{"params":[{"name":"id","type":"string"}]},"createType":{"params":[{"name":"id","type":"string"},{"name":"type","type":"object"}]},"updateType":{"params":[{"name":"id","type":"string"},{"name":"type","type":"object"}]},"deleteType":{"params":[{"name":"id","type":"string"}]},"createComponent":{"params":[{"name":"collection","type":"string"},{"name":"component","type":"object"}]},"updateComponent":{"params":[{"name":"id","type":"string"},{"name":"collection","type":"string"},{"name":"component","type":"object"}]},"deleteComponent":{"params":[{"name":"id","type":"string"},{"name":"collection","type":"string"}]},"createBehavior":{"params":[{"name":"behavior","type":"object"}]},"updateBehavior":{"params":[{"name":"id","type":"string"},{"name":"behavior","type":"object"}]},"deleteBehavior":{"params":[{"name":"id","type":"string"}]}}},"schemas":{"10374180581a41f":{"_id":"10374180581a41f","_name":"RuntimeAdmin","_inherit":["RuntimeComponent"],"_core":true,"start":"method","stop":"method"},"104ad1f48518376":{"_id":"104ad1f48518376","_name":"RuntimeChannel","sync":"event","loadSystem":"event","createSchema":"event","updateSchema":"event","deleteSchema":"event","createModel":"event","updateModel":"event","deleteModel":"event","createType":"event","updateType":"event","deleteType":"event","createComponent":"event","updateComponent":"event","deleteComponent":"event","createBehavior":"event","updateBehavior":"event","deleteBehavior":"event"}},"types":{},"behaviors":{"1c00c107e01c9b3":{"_id":"1c00c107e01c9b3","component":"RuntimeAdmin","state":"start","action":"function start() {\n var RuntimeChannel = null,\n runtimeChannel = null;\n \n if (!this.require('channel-admin')) {\n RuntimeChannel = this.require('RuntimeChannel');\n runtimeChannel = new RuntimeChannel({\n '_id': 'channel-admin',\n '_core': true\n });\n \n runtimeChannel.on('send', function send(message) {\n localStorage.setItem('system-designer-message', JSON.stringify(message));\n });\n \n // schema change events\n runtimeChannel.on('createSchema', function createSchema(id, schema) {\n this.require('metamodel').schema(schema);\n this.require('metamodel').create();\n }, true);\n \n runtimeChannel.on('updateSchema', function updateSchema(id, schema) {\n this.require('metamodel').type(schema);\n this.require('metamodel').create();\n }, true);\n \n runtimeChannel.on('deleteSchema', function deleteSchema(id) {\n $db.Runtime.remove({'_id': id});\n this.require('metamodel').create();\n }, true);\n \n // model change events\n runtimeChannel.on('createModel', function createModel(id, model) {\n this.require('metamodel').schema(model);\n this.require('metamodel').create();\n }, true);\n \n runtimeChannel.on('updateModel', function updateModel(id, model) {\n this.require('metamodel').type(model);\n this.require('metamodel').create();\n }, true);\n \n runtimeChannel.on('deleteModel', function deleteModel(id) {\n $db['Runtime'].remove({'_id': id});\n this.require('metamodel').create();\n $component.removeFromMemory(id);\n }, true);\n \n // type change events\n runtimeChannel.on('createType', function createType(id, type) {\n this.require('metamodel').type(type);\n this.require('metamodel').create();\n }, true);\n \n runtimeChannel.on('updateType', function updateType(id, type) {\n this.require('metamodel').type(type);\n this.require('metamodel').create();\n }, true);\n \n runtimeChannel.on('deleteType', function deleteType(id) {\n $db.RuntimeType.remove({'_id': id});\n this.require('metamodel').create();\n }, true);\n \n // component change events\n runtimeChannel.on('createComponent', function createComponent(model, component) {\n $db[model].insert(component);\n }, true);\n \n runtimeChannel.on('updateComponent', function updateComponent(id, collection, component) {\n $db[collection].update({'_id': id}, component);\n }, true);\n \n runtimeChannel.on('deleteComponent', function deleteComponent(id, collection) {\n $db[collection].remove({'_id': id});\n }, true);\n \n // behavior change events\n runtimeChannel.on('createBehavior', function createBehavior(component) {\n $db.RuntimeBehavior.insert(component);\n }, true);\n runtimeChannel.on('updateBehavior', function updateBehavior(id, behavior) {\n this.require(id).action(behavior.action);\n });\n runtimeChannel.on('deleteBehavior', function deleteBehavior(id) {\n $db.RuntimeBehavior.remove({'_id': id}); \n }, true);\n \n // System Designer event\n runtimeChannel.on('sync', function sync() {\n this.loadSystem(JSON.parse(this.require('db').system()));\n });\n\n window.addEventListener('storage', function (e) {\n if (e.key === 'system-designer-message') {\n $db.RuntimeMessage.insert(JSON.parse(e.newValue));\n }\n });\n \n this.require('logger').info('admin is started');\n } else {\n this.require('logger').info('admin is already started');\n }\n}","useCoreAPI":true,"core":true},"1d7151dd2d1558f":{"_id":"1d7151dd2d1558f","component":"RuntimeAdmin","state":"stop","action":"function stop() {\n}","useCoreAPI":true,"core":true}},"components":{"RuntimeAdmin":{"admin":{"_id":"admin","_core":true}}},"name":"system-admin","version":"0.4.0","description":"Runtime Component administration ","_id":"18ed81de331252c","master":false,"subsystem":false}
0 commit comments