Commit aa23703fa77801e9986e0006799dea280e292cc7

Authored by Benjamin Renard
1 parent 698494ac

Fix TT operation with shared TT (#9497)

js/app/models/AmdaTimeObject.js
... ... @@ -12,12 +12,17 @@
12 12  
13 13  
14 14 Ext.define('amdaModel.TTobject', {
15   - extend: 'amdaModel.AmdaObject',
  15 + extend: 'amdaModel.AmdaObject',
  16 +
  17 + fields : [
  18 + {name: 'nodeType', type: 'string'}
  19 + ],
16 20  
17 21 getJsonValues : function () {
18 22 var values = new Object();
19 23 values.timeTableName = this.get('name');
20 24 values.id = this.get('id');
  25 + values.nodeType = this.get('nodeType');
21 26 return values;
22 27 }
23 28 });
... ...
js/app/models/TimeTableNode.js
... ... @@ -135,7 +135,7 @@ Ext.define('amdaModel.TimeTableNode', {
135 135 var me = this;
136 136 myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt_op.id, true, function (module) {
137 137 module.createWindow();
138   - module.getUiContent().addTT(me.get('text'), me.get('id'));
  138 + module.getUiContent().addTT(me.get('text'), me.get('id'), me.get('nodeType'));
139 139 });
140 140 },
141 141  
... ...
js/app/views/TimeTableOperationUI.js
... ... @@ -17,13 +17,13 @@ Ext.define('amdaUI.TimeTableOperationUI', {
17 17 this.callParent(arguments);
18 18 },
19 19  
20   - addTT : function(newTTName,newTTid) {
  20 + addTT : function(newTTName,newTTid,nodeType) {
21 21 // search for an existing record in store with this unique name
22 22 var existingIndex = this.TTGrid.store.findExact( 'name', newTTName);
23 23 // if no corresponding TT found
24 24 if (existingIndex == -1){
25 25 // adding the time table to the TTGrid of TT download
26   - var r = Ext.create('amdaModel.TTobject', { id: newTTid, name: newTTName });
  26 + var r = Ext.create('amdaModel.TTobject', { id: newTTid, name: newTTName, nodeType: nodeType});
27 27 this.TTGrid.store.insert(this.TTGrid.store.getCount(),r);
28 28 }
29 29 },
... ... @@ -125,7 +125,7 @@ Ext.define('amdaUI.TimeTableOperationUI', {
125 125 var timeTableOperationModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt_op.id);
126 126 if (!timeTableOperationModule)
127 127 return false;
128   - timeTableOperationModule.getUiContent().addTT(data.records[0].get('text'),data.records[0].get('id'));
  128 + timeTableOperationModule.getUiContent().addTT(data.records[0].get('text'),data.records[0].get('id'), data.records[0].get('nodeType'));
129 129 return true;
130 130 }
131 131 });
... ... @@ -173,7 +173,7 @@ Ext.define('amdaUI.TimeTableOperationUI', {
173 173 var ttids = [];
174 174 var name= "";
175 175 Ext.each(tts, function(tt, index) {
176   - ttids[index] = tt.data.id;
  176 + ttids[index] = {'id': tt.data.id, 'nodeType' : tt.data.nodeType};
177 177 name = name + tt.data.name + " ";
178 178 });
179 179 // Time table's name and history field
... ... @@ -235,7 +235,7 @@ Ext.define('amdaUI.TimeTableOperationUI', {
235 235 var tts = this.TTGrid.getStore().data.items;
236 236 var ttids = [];
237 237 Ext.each(tts, function(tt, index) {
238   - ttids[index] = tt.data.id;
  238 + ttids[index] = {'id': tt.data.id, 'nodeType': tt.data.nodeType};
239 239 });
240 240 // Time table's name and history field
241 241 var newTabName = tts[0].data.name + "_I_" + tts[1].data.name;
... ...