diff --git a/static/js/globals/Tools.js b/static/js/globals/Tools.js index 9b3f4343..9a6fbe1b 100644 --- a/static/js/globals/Tools.js +++ b/static/js/globals/Tools.js @@ -590,7 +590,6 @@ function createJSFilesLibrary() { scriptLibrary.push("static/js2db/lib/jquery.layout.js"); scriptLibrary.push("static/js2db/dbModel/View.js"); - scriptLibrary.push("static/js2db/dbModel/Toolbar.js"); scriptLibrary.push("static/js2db/dbModel/locator/PortRightLocator.js"); scriptLibrary.push("static/js2db/dbModel/locator/PortLeftLocator.js"); scriptLibrary.push("static/js2db/dbModel/shape/DBTable.js"); diff --git a/static/js/rai/controller/RaccordementController.js b/static/js/rai/controller/RaccordementController.js index f6fb6b75..2b19c789 100644 --- a/static/js/rai/controller/RaccordementController.js +++ b/static/js/rai/controller/RaccordementController.js @@ -13,7 +13,7 @@ Ext.define('RAI.controller.RaccordementController', { extend: 'Ext.app.Controller', stores: ['ElementsDonneeRightGrid', 'ElementsDonneeLeftGrid', 'Raccordements'], - views: ['raccordement.MainWindow','raccordement.GridPanel','raccordement.ListRaccordement'], + views: ['raccordement.MainWindow', 'raccordement.GridPanel', 'raccordement.ListRaccordement'], refs: [{ ref: 'mainWindow', @@ -31,7 +31,7 @@ Ext.define('RAI.controller.RaccordementController', { }); }, - getReadRaccordementOperation: function() { + getReadRaccordementOperation: function() { var operation = new Ext.data.Operation({ action: 'read', params: { @@ -40,7 +40,7 @@ Ext.define('RAI.controller.RaccordementController', { }); return operation; }, - + syncListRaccordement: function(listRaccordement) { var controller = this; @@ -60,14 +60,14 @@ Ext.define('RAI.controller.RaccordementController', { grid.getStore().loadData(model.attributes); }, - removeMask: function(gridPanel) { + removeMask: function(gridPanel) { gridPanel.getComponent('gridLeft').setLoading(false); gridPanel.getComponent('gridRight').setLoading(false); }, - + openModeleRaccordement: function(win) { - var controller = this; - var model = win.getActiveModel(); + var model, controller = this; + model = win.getActiveModel(); params = { modelID: model @@ -89,8 +89,8 @@ Ext.define('RAI.controller.RaccordementController', { } }; failureFunction = function(response) { - controller.removeMask(controller.getMainWindow().down('panel')); - console.log('Error on openModeleRaccordement method'); + controller.removeMask(controller.getMainWindow().down('panel')); + Ext.Msg.alert('Error', 'Error on openModeleRaccordement method'); }; this.createAjaxRequest('rai/getModeleRaccordement/', "GET", params, null, successFunction, failureFunction); }, @@ -107,17 +107,17 @@ Ext.define('RAI.controller.RaccordementController', { }, raccorderElements: function(button, e, eOpts) { - var controller = this; - var listRaccordement = controller.getMainWindow().getComponent('listRaccordementGrid'); - var gridPanel = controller.getMainWindow().down('panel'); + var listRaccordement, gridPanel, leftSelection, rightSelection, raccordementsJSON, shouldSyncStore, i, j, controller = this; + listRaccordement = controller.getMainWindow().getComponent('listRaccordementGrid'); + gridPanel = controller.getMainWindow().down('panel'); - var leftSelection = gridPanel.getComponent('gridLeft').getSelectionModel().getSelection(); - var rightSelection = gridPanel.getComponent('gridRight').getSelectionModel().getSelection(); + leftSelection = gridPanel.getComponent('gridLeft').getSelectionModel().getSelection(); + rightSelection = gridPanel.getComponent('gridRight').getSelectionModel().getSelection(); - var raccordementsJSON = []; - var shouldSyncStore = false; - for (var i = 0; i < leftSelection.length; i++) { - for (var j = 0; j < rightSelection.length; j++) { + raccordementsJSON = []; + shouldSyncStore = false; + for (i = 0; i < leftSelection.length; i++) { + for (j = 0; j < rightSelection.length; j++) { var attribute = controller.createRaccordementAttribute(listRaccordement.getModelRaccordement(), controller.getMainWindow().getActiveModel(), leftSelection[i].data, rightSelection[j].data); var recordIndex = listRaccordement.getStore().findBy(function(record, id) { if (record.get('modelName') === listRaccordement.getModelRaccordement() && record.get('sourceName') === attribute.data.sourceName && record.get('targetName') === attribute.data.targetName) { @@ -138,7 +138,7 @@ Ext.define('RAI.controller.RaccordementController', { } if (shouldSyncStore) { - controller.syncListRaccordement(listRaccordement); + controller.syncListRaccordement(listRaccordement); } }, diff --git a/static/js/rai/model/ElementDonnee.js b/static/js/rai/model/ElementDonnee.js index 015a7ac5..ef6b2a70 100644 --- a/static/js/rai/model/ElementDonnee.js +++ b/static/js/rai/model/ElementDonnee.js @@ -3,5 +3,5 @@ */ Ext.define('RAI.model.ElementDonnee', { extend: 'Ext.data.Model', - fields: ['id','attributeName', 'entityId', 'entityName'] + fields: ['id', 'attributeName', 'entityId', 'entityName'] }); \ No newline at end of file diff --git a/static/js/rai/store/ElementsDonneeLeftGrid.js b/static/js/rai/store/ElementsDonneeLeftGrid.js index 2128ce01..8f2f0241 100644 --- a/static/js/rai/store/ElementsDonneeLeftGrid.js +++ b/static/js/rai/store/ElementsDonneeLeftGrid.js @@ -5,12 +5,8 @@ Ext.define('RAI.store.ElementsDonneeLeftGrid', { extend: 'Ext.data.Store', - requires: [ - 'RAI.model.ElementDonnee', - 'Ext.data.proxy.Memory', - 'Ext.data.reader.Json' - ], - + requires: ['RAI.model.ElementDonnee', 'Ext.data.proxy.Memory', 'Ext.data.reader.Json'], + sorters: ['attributeName', 'entityName'], groupField: 'entityName', constructor: function(cfg) { diff --git a/static/js/rai/store/ElementsDonneeRightGrid.js b/static/js/rai/store/ElementsDonneeRightGrid.js index d5b0e5f5..1ba31e44 100644 --- a/static/js/rai/store/ElementsDonneeRightGrid.js +++ b/static/js/rai/store/ElementsDonneeRightGrid.js @@ -5,12 +5,8 @@ Ext.define('RAI.store.ElementsDonneeRightGrid', { extend: 'Ext.data.Store', - requires: [ - 'RAI.model.ElementDonnee', - 'Ext.data.proxy.Memory', - 'Ext.data.reader.Json' - ], - + requires: ['RAI.model.ElementDonnee', 'Ext.data.proxy.Memory', 'Ext.data.reader.Json'], + sorters: ['attributeName', 'entityName'], groupField: 'entityName', constructor: function(cfg) { diff --git a/static/js/rai/store/Raccordements.js b/static/js/rai/store/Raccordements.js index 34d09609..dd4d3ea1 100644 --- a/static/js/rai/store/Raccordements.js +++ b/static/js/rai/store/Raccordements.js @@ -25,7 +25,7 @@ Ext.define('RAI.store.Raccordements', { }, reader: { type: 'json', - root: 'raccordements', + root: 'raccordements', successProperty: 'success' }, pageParam: false, diff --git a/static/js/rai/view/raccordement/GridPanel.js b/static/js/rai/view/raccordement/GridPanel.js index 2f85cddc..6bb7454d 100644 --- a/static/js/rai/view/raccordement/GridPanel.js +++ b/static/js/rai/view/raccordement/GridPanel.js @@ -24,10 +24,12 @@ Ext.define('RAI.view.raccordement.GridPanel', { itemId: 'gridLeft', iconCls: 'icon-grid', frame: true, - features: [Ext.create('Ext.grid.feature.Grouping',{ - groupHeaderTpl: 'Entity: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})' - })], - selModel: Ext.create('Ext.selection.CheckboxModel', {injectCheckbox: 'last'}), + features: [Ext.create('Ext.grid.feature.Grouping', { + groupHeaderTpl: 'Entity: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})' + })], + selModel: Ext.create('Ext.selection.CheckboxModel', { + injectCheckbox: 'last' + }), columns: [{ text: 'Attribute', flex: 1, @@ -38,9 +40,9 @@ Ext.define('RAI.view.raccordement.GridPanel', { dataIndex: 'entityName' }], listeners: { - afterrender: function() { - this.setLoading(true); - } + afterrender: function() { + this.setLoading(true); + } } }, { xtype: 'gridpanel', @@ -48,10 +50,12 @@ Ext.define('RAI.view.raccordement.GridPanel', { itemId: 'gridRight', iconCls: 'icon-grid', frame: true, - features: [Ext.create('Ext.grid.feature.Grouping',{ - groupHeaderTpl: 'Entity: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})' - })], - selModel: Ext.create('Ext.selection.CheckboxModel', {injectCheckbox: 'last'}), + features: [Ext.create('Ext.grid.feature.Grouping', { + groupHeaderTpl: 'Entity: {name} ({rows.length} Item{[values.rows.length > 1 ? "s" : ""]})' + })], + selModel: Ext.create('Ext.selection.CheckboxModel', { + injectCheckbox: 'last' + }), columns: [{ text: 'Attribute', flex: 1, @@ -62,9 +66,9 @@ Ext.define('RAI.view.raccordement.GridPanel', { dataIndex: 'entityName' }], listeners: { - afterrender: function() { - this.setLoading(true); - } + afterrender: function() { + this.setLoading(true); + } } }], fbar: [{ diff --git a/static/js/rai/view/raccordement/ListRaccordement.js b/static/js/rai/view/raccordement/ListRaccordement.js index bf32ce92..08351801 100644 --- a/static/js/rai/view/raccordement/ListRaccordement.js +++ b/static/js/rai/view/raccordement/ListRaccordement.js @@ -10,7 +10,7 @@ Ext.define('RAI.view.raccordement.ListRaccordement', { store: 'Raccordements', title: 'Raccordement', modelRaccordement: null, - + columns: [{ text: 'Element raccordant', flex: 1, @@ -28,7 +28,7 @@ Ext.define('RAI.view.raccordement.ListRaccordement', { initComponent: function() { this.dockedItems = [{ xtype: 'toolbar', - items: ['->',{ + items: ['->', { iconCls: 'x-tool-rowDel', text: _SM.__language.Text_Delete_Button, action: 'delete' diff --git a/static/js/rai/view/raccordement/MainWindow.js b/static/js/rai/view/raccordement/MainWindow.js index 416f0394..17b71f02 100644 --- a/static/js/rai/view/raccordement/MainWindow.js +++ b/static/js/rai/view/raccordement/MainWindow.js @@ -4,8 +4,8 @@ Ext.define('RAI.view.raccordement.MainWindow', { extend: 'Ext.window.Window', alias: 'widget.raccordementMainWindow', - itemId: 'raccordementMainWindow', - + itemId: 'raccordementMainWindow', + layout: { type: 'vbox', align: 'stretch' @@ -15,33 +15,32 @@ Ext.define('RAI.view.raccordement.MainWindow', { modal: true, height: 600, width: 800, - + initComponent: function() { var me = this; Ext.applyIf(me, { - items: [ - { + items: [{ xtype: 'raccordementGridPanel', flex: 1 }, { xtype: 'listRaccordementGrid', - selModel: Ext.create('Ext.selection.CheckboxModel', {injectCheckbox: 'last'}), + selModel: Ext.create('Ext.selection.CheckboxModel', { + injectCheckbox: 'last' + }), flex: 1 }] }); - - me.addEvents( - 'openModeleRaccordement' - ); - me.on('beforeshow', function(){ - this.fireEvent('openModeleRaccordement', me); - }); + + me.addEvents('openModeleRaccordement'); + me.on('beforeshow', function() { + this.fireEvent('openModeleRaccordement', me); + }); me.callParent(arguments); }, - + getActiveModel: function() { - return this.selectedModel[0]; + return this.selectedModel[0]; } }); diff --git a/static/testing/app-test.js b/static/testing/app-test.js index 957796d7..f616c7a1 100644 --- a/static/testing/app-test.js +++ b/static/testing/app-test.js @@ -1,5 +1,5 @@ Ext.Loader.setConfig({enabled: true}); -// Ext.Loader.setPath('Name', 'static/path/to/Name'); + Ext.Loader.setPath('ProtoUL', 'static/js'); Ext.require('Ext.app.Application'); @@ -12,10 +12,7 @@ Ext.onReady(function() { name: 'ProtoUL', appfolder: 'static/js', paths: { - 'ProtoUL.view.diagram': 'static/js/view/diagram/', - 'ProtoUL': 'static/js/', - 'ProtoUL.model': 'static/js/model/', - 'ProtoUL.store': 'static/js/store/' + 'ProtoUL': 'static/js/' }, models: [ @@ -44,7 +41,6 @@ Ext.onReady(function() { 'DiagramMenuController' ], launch: function() { - //include the tests in the test.html head jasmine.getEnv().addReporter(new jasmine.HtmlReporter()); jasmine.getEnv().execute(); } diff --git a/static/testing/tests/DiagramEditorTest.js b/static/testing/tests/DiagramEditorTest.js index 626fe3f1..2849c4d3 100644 --- a/static/testing/tests/DiagramEditorTest.js +++ b/static/testing/tests/DiagramEditorTest.js @@ -24,7 +24,7 @@ describe('ProtoUL.store.Diagrams', function() { it('calls out to the proper listDiagrams url', function() { store.load(); var request = jasmine.Ajax.requests.mostRecent(); - expect(request.url).toMatch('protoLib/listDiagrams/'); + expect(request.url).toMatch('protoDiagram/listDiagrams/'); }); it('New item should be added to store', function() { @@ -55,12 +55,12 @@ describe('ProtoUL.controller.DiagramController', function() { controller.init(); }); - it("test createPort", function () { - spyOn(controller, 'createPort'); + it("test createEntityAttribute", function () { + spyOn(controller, 'createEntityAttribute'); - var port = controller.createPort("draw2d_InputPort","default"); + var port = controller.createEntityAttribute('attribute', 'id', 'pk', 'fk', 'string'); - expect(controller.createPort).toHaveBeenCalled(); - expect(controller.createPort).toHaveBeenCalledWith("draw2d_InputPort","default"); + expect(controller.createEntityAttribute).toHaveBeenCalled(); + expect(controller.createEntityAttribute).toHaveBeenCalledWith('attribute', 'id', 'pk', 'fk', 'string'); }); });