Skip to content

Commit 30bea01

Browse files
committed
- update admin system
1 parent 4241879 commit 30bea01

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

build/system/system.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ var system = {
12091209
"_id": "1c00c107e01c9b3",
12101210
"component": "RuntimeAdmin",
12111211
"state": "start",
1212-
"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 this.require('admin').designerWindow().postMessage(JSON.stringify(message), '*');\n }, false, true);\n\n // schema change events\n channel.on('$designerCreateSchema', function $designerCreateSchema(id, schema) {\n this.require('logger').level('warn');\n this.require('metamodel').schema(schema);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$editorUpdateSchema', function $editorUpdateSchema(id, schema) {\n this.require('logger').level('warn');\n this.require('metamodel').schema(schema);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$designerDeleteSchema', function $designerDeleteSchema(id) {\n this.require('logger').level('warn');\n var search = $db.RuntimeSchema.find({ '_id': id }),\n modelName = '',\n modelId = '';\n\n if (search.length) {\n modelName = search[0]._name;\n $db.RuntimeSchema.remove({ '_id': id });\n\n search = $db.RuntimeModel.find({ '_name': modelName });\n if (search.length) {\n modelId = search[0]._id;\n $db.RuntimeModel.remove({ '_id': modelId });\n $component.removeFromMemory(modelName);\n }\n\n search = $db.RuntimeGeneratedModel.find({ '_name': modelName });\n if (search.length) {\n modelId = search[0]._id;\n $db.RuntimeGeneratedModel.remove({ '_id': modelId });\n $component.removeFromMemory(modelName);\n }\n this.require('metamodel').create();\n }\n this.require('logger').level('debug');\n }, true, true);\n\n // model change events\n channel.on('$designerCreateModel', function $designerCreateModel(id, model) {\n this.require('logger').level('warn');\n this.require('metamodel').model(model);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$editorUpdateModel', function $editorUpdateModel(id, model) {\n this.require('logger').level('warn');\n this.require('metamodel').model(model);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$designerUpdateModel', function $designerUpdateModel(id, model) {\n this.require('logger').level('warn');\n this.require('metamodel').model(model);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$designerDeleteModel', function $designerDeleteModel(id) {\n this.require('logger').level('warn');\n var search = $db.RuntimeModel.find({ '_id': id }),\n modelName = '',\n modelId = '';\n\n if (search.length) {\n modelName = search[0]._name;\n $db.RuntimeModel.remove({ '_id': id });\n $component.removeFromMemory(modelName);\n }\n\n search = $db.RuntimeGeneratedModel.find({ '_name': modelName });\n if (search.length) {\n modelId = search[0]._id;\n $db.RuntimeGeneratedModel.remove({ '_id': modelId });\n $component.removeFromMemory(modelName);\n }\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n // type change events\n channel.on('$designerCreateType', function $designerCreateType(id, type) {\n this.require('logger').level('warn');\n this.require('metamodel').type(type);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$editorUpdateType', function $editorUpdateType(id, type) {\n this.require('logger').level('warn');\n this.require('metamodel').type(type);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n\n }, true, true);\n\n channel.on('$editorDeleteType', function $editorDeleteType(id) {\n this.require('logger').level('warn');\n $db.RuntimeType.remove({ 'name': id });\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$designerDeleteType', function $designerDeleteType(id) {\n this.require('logger').level('warn');\n $db.RuntimeType.remove({ 'name': id });\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n // component change events\n channel.on('$designerCreateComponent', function $designerCreateComponent(model, component) {\n $db[model].insert(component);\n }, true, true);\n\n channel.on('$editorUpdateComponent', function $editorUpdateComponent(id, collection, component) {\n $db[collection].update({ '_id': id }, component, { 'upsert': true });\n }, true, true);\n\n channel.on('$designerUpdateComponent', function $editorUpdateComponent(id, collection, component) {\n $db[collection].update({ '_id': id }, component, { 'upsert': true });\n }, true, true);\n\n channel.on('$editorDeleteComponent', function $editorDeleteComponent(id, collection) {\n $db[collection].remove({ '_id': id });\n }, true, true);\n\n channel.on('$designerDeleteComponent', function $designerDeleteComponent(id, collection) {\n $db[collection].remove({ '_id': id });\n }, true, true);\n\n // behavior change events\n channel.on('$designerCreateBehavior', function createBehavior(component) {\n $db.RuntimeBehavior.insert(component);\n }, true, true);\n\n channel.on('$editorUpdateBehavior', function $editorUpdateBehavior(id, behavior) {\n if (this.require(id)) {\n this.require(id).action(behavior.action);\n if (behavior.state === 'main') {\n this.require(behavior.component).main();\n }\n }\n }, true, true);\n\n channel.on('$designerUpdateBehavior', function $designerUpdateBehavior(id, behavior) {\n if (this.require(id)) {\n this.require(id).action(behavior.action);\n if (behavior.state === 'main') {\n this.require(behavior.component).main();\n }\n }\n }, true, true);\n\n channel.on('$editorDeleteBehavior', function $editorDeleteBehavior(id) {\n $db.RuntimeBehavior.remove({ '_id': id });\n }, true, true);\n\n channel.on('$designerDeleteBehavior', function $editorDeleteBehavior(id) {\n $db.RuntimeBehavior.remove({ '_id': id });\n }, true, true);\n\n // System Designer event\n runtimeChannel.on('$designerSync', function sync() {\n var designerWindow = this.require('admin').designerWindow(),\n system = null;\n\n this.require('admin').designerWindow(null);\n system = JSON.parse(this.require('db').system());\n designerWindow = this.require('admin').designerWindow(designerWindow);\n\n this.$appLoadSystem(system);\n }, false, true);\n\n window.addEventListener('message', function (event) {\n var data = null;\n try {\n data = JSON.parse(event.data);\n if (data &&\n typeof data.event !== 'undefined' &&\n typeof data.from !== 'undefined' &&\n typeof data.data !== 'undefined') {\n this.designerWindow(event.source);\n $db.RuntimeMessage.insert(data);\n }\n } catch (e) {\n }\n }.bind(this), false);\n\n this.require('logger').info('admin is started');\n } else {\n this.require('logger').info('admin is already started');\n }\n}",
1212+
"action": "function start() {\n var RuntimeChannel = null,\n channel = null;\n\n if (!this.require('channel-admin')) {\n RuntimeChannel = this.require('RuntimeChannel');\n channel = new RuntimeChannel({\n '_id': 'channel-admin',\n '_core': true\n });\n\n channel.on('send', function send(message) {\n this.require('admin').designerWindow().postMessage(JSON.stringify(message), '*');\n }, false, true);\n\n // schema change events\n channel.on('$designerCreateSchema', function $designerCreateSchema(id, schema) {\n this.require('logger').level('warn');\n this.require('metamodel').schema(schema);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$editorUpdateSchema', function $editorUpdateSchema(id, schema) {\n this.require('logger').level('warn');\n this.require('metamodel').schema(schema);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$designerDeleteSchema', function $designerDeleteSchema(id) {\n this.require('logger').level('warn');\n var search = $db.RuntimeSchema.find({ '_id': id }),\n modelName = '',\n modelId = '';\n\n if (search.length) {\n modelName = search[0]._name;\n $db.RuntimeSchema.remove({ '_id': id });\n\n search = $db.RuntimeModel.find({ '_name': modelName });\n if (search.length) {\n modelId = search[0]._id;\n $db.RuntimeModel.remove({ '_id': modelId });\n $component.removeFromMemory(modelName);\n }\n\n search = $db.RuntimeGeneratedModel.find({ '_name': modelName });\n if (search.length) {\n modelId = search[0]._id;\n $db.RuntimeGeneratedModel.remove({ '_id': modelId });\n $component.removeFromMemory(modelName);\n }\n this.require('metamodel').create();\n }\n this.require('logger').level('debug');\n }, true, true);\n\n // model change events\n channel.on('$designerCreateModel', function $designerCreateModel(id, model) {\n this.require('logger').level('warn');\n this.require('metamodel').model(model);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$editorUpdateModel', function $editorUpdateModel(id, model) {\n this.require('logger').level('warn');\n this.require('metamodel').model(model);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$designerUpdateModel', function $designerUpdateModel(id, model) {\n this.require('logger').level('warn');\n this.require('metamodel').model(model);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$designerDeleteModel', function $designerDeleteModel(id) {\n this.require('logger').level('warn');\n var search = $db.RuntimeModel.find({ '_id': id }),\n modelName = '',\n modelId = '';\n\n if (search.length) {\n modelName = search[0]._name;\n $db.RuntimeModel.remove({ '_id': id });\n $component.removeFromMemory(modelName);\n }\n\n search = $db.RuntimeGeneratedModel.find({ '_name': modelName });\n if (search.length) {\n modelId = search[0]._id;\n $db.RuntimeGeneratedModel.remove({ '_id': modelId });\n $component.removeFromMemory(modelName);\n }\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n // type change events\n channel.on('$designerCreateType', function $designerCreateType(id, type) {\n this.require('logger').level('warn');\n this.require('metamodel').type(type);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$editorUpdateType', function $editorUpdateType(id, type) {\n this.require('logger').level('warn');\n this.require('metamodel').type(type);\n this.require('metamodel').create();\n this.require('logger').level('debug');\n\n }, true, true);\n\n channel.on('$editorDeleteType', function $editorDeleteType(id) {\n this.require('logger').level('warn');\n $db.RuntimeType.remove({ 'name': id });\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n channel.on('$designerDeleteType', function $designerDeleteType(id) {\n this.require('logger').level('warn');\n $db.RuntimeType.remove({ 'name': id });\n this.require('metamodel').create();\n this.require('logger').level('debug');\n }, true, true);\n\n // component change events\n channel.on('$designerCreateComponent', function $designerCreateComponent(model, component) {\n $db[model].insert(component);\n }, true, true);\n\n channel.on('$editorUpdateComponent', function $editorUpdateComponent(id, collection, component) {\n $db[collection].update({ '_id': id }, component, { 'upsert': true });\n }, true, true);\n\n channel.on('$designerUpdateComponent', function $editorUpdateComponent(id, collection, component) {\n $db[collection].update({ '_id': id }, component, { 'upsert': true });\n }, true, true);\n\n channel.on('$editorDeleteComponent', function $editorDeleteComponent(id, collection) {\n $db[collection].remove({ '_id': id });\n }, true, true);\n\n channel.on('$designerDeleteComponent', function $designerDeleteComponent(id, collection) {\n $db[collection].remove({ '_id': id });\n }, true, true);\n\n // behavior change events\n channel.on('$designerCreateBehavior', function createBehavior(component) {\n $db.RuntimeBehavior.insert(component);\n }, true, true);\n\n channel.on('$editorUpdateBehavior', function $editorUpdateBehavior(id, behavior) {\n if (this.require(id)) {\n this.require(id).action(behavior.action);\n if (behavior.state === 'main') {\n this.require(behavior.component).main();\n }\n }\n }, true, true);\n\n channel.on('$designerUpdateBehavior', function $designerUpdateBehavior(id, behavior) {\n if (this.require(id)) {\n this.require(id).action(behavior.action);\n if (behavior.state === 'main') {\n this.require(behavior.component).main();\n }\n }\n }, true, true);\n\n channel.on('$editorDeleteBehavior', function $editorDeleteBehavior(id) {\n $db.RuntimeBehavior.remove({ '_id': id });\n }, true, true);\n\n channel.on('$designerDeleteBehavior', function $editorDeleteBehavior(id) {\n $db.RuntimeBehavior.remove({ '_id': id });\n }, true, true);\n\n // System Designer event\n channel.on('$designerSync', function sync() {\n var designerWindow = this.require('admin').designerWindow(),\n system = null;\n\n this.require('admin').designerWindow(null);\n system = JSON.parse(this.require('db').system());\n designerWindow = this.require('admin').designerWindow(designerWindow);\n\n this.$appLoadSystem(system);\n }, false, true);\n\n window.addEventListener('message', function (event) {\n var data = null;\n try {\n data = JSON.parse(event.data);\n if (data &&\n typeof data.event !== 'undefined' &&\n typeof data.from !== 'undefined' &&\n typeof data.data !== 'undefined') {\n this.designerWindow(event.source);\n $db.RuntimeMessage.insert(data);\n }\n } catch (e) {\n }\n }.bind(this), false);\n\n this.require('logger').info('admin is started');\n } else {\n this.require('logger').info('admin is already started');\n }\n}",
12131213
"useCoreAPI": true,
12141214
"core": true
12151215
},
@@ -1513,7 +1513,7 @@ var system = {
15131513
"version": "1.7.0",
15141514
"description": "Runtime",
15151515
"_id": "e89c617b6b15d24",
1516-
"master": true,
1516+
"master": false,
15171517
"subsystem": false
15181518
};
15191519

0 commit comments

Comments
 (0)