Daniel@0
|
1 "use strict";
|
Daniel@0
|
2
|
Daniel@0
|
3 App.module("RepresentationModule", function(RepresentationModule, App, Backbone, Marionette, $, _, Logger) {
|
Daniel@0
|
4
|
Daniel@0
|
5 RepresentationModule.addInitializer(function(options){
|
Daniel@0
|
6
|
Daniel@0
|
7 RepresentationModule.registerMaster({
|
Daniel@0
|
8 id: "entity.collection.pair",
|
Daniel@0
|
9 inherit: "entity._pair",
|
Daniel@0
|
10
|
Daniel@0
|
11
|
Daniel@0
|
12 // =================================================================
|
Daniel@0
|
13 // config grid header
|
Daniel@0
|
14
|
Daniel@0
|
15 _generateHeaderLabel1: function(entityHeaderView) {
|
Daniel@0
|
16 return _.str.sprintf("collection comparison (%s)", this.getConfigParameterValueOrDefaultValue(entityHeaderView.options.config, "comparisonMode"));
|
Daniel@0
|
17 },
|
Daniel@0
|
18
|
Daniel@0
|
19
|
Daniel@0
|
20 _generateHeaderLabel2: function(viewHeader) {
|
Daniel@0
|
21 var configOnTheLeft = viewHeader.dynamicDerivedConfigData.attributes.collectionConfigOnTheLeft;
|
Daniel@0
|
22 var configOnTheRight = viewHeader.dynamicDerivedConfigData.attributes.collectionConfigOnTheRight;
|
Daniel@0
|
23
|
Daniel@0
|
24 var labelParts = [];
|
Daniel@0
|
25
|
Daniel@0
|
26 if (configOnTheLeft) {
|
Daniel@0
|
27 labelParts.push(this._generateCollectionConfigTitle(configOnTheLeft));
|
Daniel@0
|
28 } else {
|
Daniel@0
|
29 labelParts.push("×");
|
Daniel@0
|
30 }
|
Daniel@0
|
31
|
Daniel@0
|
32 labelParts.push(" ↔ ");
|
Daniel@0
|
33
|
Daniel@0
|
34 if (configOnTheRight) {
|
Daniel@0
|
35 labelParts.push(this._generateCollectionConfigTitle(configOnTheRight));
|
Daniel@0
|
36 } else {
|
Daniel@0
|
37 labelParts.push("×");
|
Daniel@0
|
38 }
|
Daniel@0
|
39
|
Daniel@0
|
40 return labelParts.join("");
|
Daniel@0
|
41 },
|
Daniel@0
|
42
|
Daniel@0
|
43
|
Daniel@0
|
44 // =================================================================
|
Daniel@0
|
45 // dynamic derived config data
|
Daniel@0
|
46
|
Daniel@0
|
47 __optionsOfDynamicDerivedConfigData: {
|
Daniel@0
|
48 attributesToExcludeFromHash: ["collectionConfigOnTheLeft", "collectionConfigOnTheRight"],
|
Daniel@0
|
49 customHashSuffixGenerator: function (attributes) {
|
Daniel@0
|
50 return (attributes.collectionConfigOnTheLeft ? attributes.collectionConfigOnTheLeft. getClientId() : "x")
|
Daniel@0
|
51 + (attributes.collectionConfigOnTheRight ? attributes.collectionConfigOnTheRight.getClientId() : "x");
|
Daniel@0
|
52 // return (attributes.collectionConfigOnTheLeft ? attributes.collectionConfigOnTheLeft. getHashForParameters() : "x")
|
Daniel@0
|
53 // + (attributes.collectionConfigOnTheRight ? attributes.collectionConfigOnTheRight.getHashForParameters() : "x");
|
Daniel@0
|
54 }
|
Daniel@0
|
55 },
|
Daniel@0
|
56
|
Daniel@0
|
57
|
Daniel@0
|
58 __updateMethodOfDynamicDerivedConfigData: function (force) {
|
Daniel@0
|
59 this._doUpdate(force);
|
Daniel@0
|
60 if (this.attributes.collectionConfigOnTheLeft && this.attributes.dynamicDefinitionForCollectionOnTheLeft) {
|
Daniel@0
|
61 return;
|
Daniel@0
|
62 }
|
Daniel@0
|
63 if (this.attributes.collectionConfigOnTheRight && this.attributes.dynamicDefinitionForCollectionOnTheRight) {
|
Daniel@0
|
64 return;
|
Daniel@0
|
65 }
|
Daniel@0
|
66 var _this = this;
|
Daniel@0
|
67 var interval = setInterval(function() {
|
Daniel@0
|
68 _this._doUpdate(force);
|
Daniel@0
|
69 if (_this.attributes.collectionConfigOnTheLeft && !_this.attributes.dynamicDefinitionForCollectionOnTheLeft) {
|
Daniel@0
|
70 return;
|
Daniel@0
|
71 }
|
Daniel@0
|
72 if (_this.attributes.collectionConfigOnTheRight && !_this.attributes.dynamicDefinitionForCollectionOnTheRight) {
|
Daniel@0
|
73 return;
|
Daniel@0
|
74 }
|
Daniel@0
|
75 clearInterval(interval);
|
Daniel@0
|
76 }, 50);
|
Daniel@0
|
77 },
|
Daniel@0
|
78
|
Daniel@0
|
79 __doUpdateMethodOfDynamicDerivedConfigData: function (force) {
|
Daniel@0
|
80 var entityConfig = this.options.entityConfig;
|
Daniel@0
|
81 var configGrid = this.options.configGrid;
|
Daniel@0
|
82
|
Daniel@0
|
83 // do nothing with orphans (configs just before they are deleted)
|
Daniel@0
|
84 if (!entityConfig.getDimension()) {
|
Daniel@0
|
85 return;
|
Daniel@0
|
86 }
|
Daniel@0
|
87
|
Daniel@0
|
88 // find the nearest collections on the left and on the right
|
Daniel@0
|
89 var newCollectionConfigOnTheLeft = entityConfig;
|
Daniel@0
|
90 var newCollectionConfigOnTheRight = entityConfig;
|
Daniel@0
|
91
|
Daniel@0
|
92 do {
|
Daniel@0
|
93 newCollectionConfigOnTheLeft = configGrid.getPrevEntityNeighbour(newCollectionConfigOnTheLeft);
|
Daniel@0
|
94 } while (newCollectionConfigOnTheLeft && newCollectionConfigOnTheLeft.getParameterValue("kind") == "pair");
|
Daniel@0
|
95
|
Daniel@0
|
96 do {
|
Daniel@0
|
97 newCollectionConfigOnTheRight = configGrid.getNextEntityNeighbour(newCollectionConfigOnTheRight);
|
Daniel@0
|
98 } while (newCollectionConfigOnTheRight && newCollectionConfigOnTheRight.getParameterValue("kind") == "pair");
|
Daniel@0
|
99
|
Daniel@0
|
100 var newDynamicDerivedConfigDataOnTheLeft = App.dynamicDerivedConfigDataProvider.get(newCollectionConfigOnTheLeft);
|
Daniel@0
|
101 var newDynamicDerivedConfigDataOnTheRight = App.dynamicDerivedConfigDataProvider.get(newCollectionConfigOnTheRight);
|
Daniel@0
|
102
|
Daniel@0
|
103 var newDynamicDefinitionForCollectionOnTheLeft = newDynamicDerivedConfigDataOnTheLeft ? newDynamicDerivedConfigDataOnTheLeft .attributes.dynamicDefinitionForCollection : null;
|
Daniel@0
|
104 var newDynamicDefinitionForCollectionOnTheRight = newDynamicDerivedConfigDataOnTheRight ? newDynamicDerivedConfigDataOnTheRight.attributes.dynamicDefinitionForCollection : null;
|
Daniel@0
|
105
|
Daniel@0
|
106 var attributesToSet = {};
|
Daniel@0
|
107
|
Daniel@0
|
108 var arrayOfShortcuts = [
|
Daniel@0
|
109 [newCollectionConfigOnTheLeft, "collectionConfigOnTheLeft", "change:parameters", this.triggerChange],
|
Daniel@0
|
110 [newCollectionConfigOnTheRight, "collectionConfigOnTheRight", "change:parameters", this.triggerChange],
|
Daniel@0
|
111 [newDynamicDefinitionForCollectionOnTheLeft, "dynamicDefinitionForCollectionOnTheLeft", "change", this.triggerChange],
|
Daniel@0
|
112 [newDynamicDefinitionForCollectionOnTheRight, "dynamicDefinitionForCollectionOnTheRight", "change", this.triggerChange],
|
Daniel@0
|
113 ];
|
Daniel@0
|
114
|
Daniel@0
|
115 for (var i = arrayOfShortcuts.length - 1; i >= 0; --i) {
|
Daniel@0
|
116 var shortcuts = arrayOfShortcuts[i];
|
Daniel@0
|
117 var oldAttributeValue = this.attributes[shortcuts[1]];
|
Daniel@0
|
118 var newAttributeValue = shortcuts[0];
|
Daniel@0
|
119 if (newAttributeValue != oldAttributeValue) {
|
Daniel@0
|
120 attributesToSet[shortcuts[1]] = newAttributeValue;
|
Daniel@0
|
121 if (oldAttributeValue) {
|
Daniel@0
|
122 this.stopListening(oldAttributeValue, shortcuts[2]);
|
Daniel@0
|
123 }
|
Daniel@0
|
124 if (newAttributeValue) {
|
Daniel@0
|
125 this.listenTo(newAttributeValue, shortcuts[2], shortcuts[3]);
|
Daniel@0
|
126 }
|
Daniel@0
|
127 }
|
Daniel@0
|
128 }
|
Daniel@0
|
129 this.set(attributesToSet);
|
Daniel@0
|
130 },
|
Daniel@0
|
131
|
Daniel@0
|
132
|
Daniel@0
|
133 __triggerChangeMethodOfDynamicDerivedConfigData: function() {
|
Daniel@0
|
134 this.dropCachedHash();
|
Daniel@0
|
135 this.trigger("change");
|
Daniel@0
|
136 },
|
Daniel@0
|
137
|
Daniel@0
|
138
|
Daniel@0
|
139 generateDynamicDerivedConfigData: function(entityConfig, configGrid) {
|
Daniel@0
|
140 var optionsOfThisDynamicDerivedConfigData = _.clone(this.__optionsOfDynamicDerivedConfigData);
|
Daniel@0
|
141 optionsOfThisDynamicDerivedConfigData.entityConfig = entityConfig;
|
Daniel@0
|
142 optionsOfThisDynamicDerivedConfigData.configGrid = configGrid;
|
Daniel@0
|
143
|
Daniel@0
|
144 var dynamicDerivedConfigData = new RepresentationModule.DynamicDerivedConfigData({
|
Daniel@0
|
145 collectionConfigOnTheLeft: null,
|
Daniel@0
|
146 collectionConfigOnTheRight: null,
|
Daniel@0
|
147 dynamicDefinitionForCollectionOnTheLeft: null,
|
Daniel@0
|
148 dynamicDefinitionForCollectionOnTheRight: null
|
Daniel@0
|
149 }, optionsOfThisDynamicDerivedConfigData);
|
Daniel@0
|
150
|
Daniel@0
|
151 dynamicDerivedConfigData.update = this.__updateMethodOfDynamicDerivedConfigData;
|
Daniel@0
|
152 dynamicDerivedConfigData._doUpdate = this.__doUpdateMethodOfDynamicDerivedConfigData;
|
Daniel@0
|
153 dynamicDerivedConfigData.triggerChange = this.__triggerChangeMethodOfDynamicDerivedConfigData;
|
Daniel@0
|
154
|
Daniel@0
|
155 dynamicDerivedConfigData.listenTo(configGrid, "change_layout", dynamicDerivedConfigData.update);
|
Daniel@0
|
156 dynamicDerivedConfigData.update();
|
Daniel@0
|
157
|
Daniel@0
|
158 return dynamicDerivedConfigData;
|
Daniel@0
|
159 },
|
Daniel@0
|
160
|
Daniel@0
|
161
|
Daniel@0
|
162 // =================================================================
|
Daniel@0
|
163 // dynamic derived vis instance data
|
Daniel@0
|
164
|
Daniel@0
|
165
|
Daniel@0
|
166 // -----------------------------------------------------------------
|
Daniel@0
|
167 // dynamic derived vis instance data - base
|
Daniel@0
|
168
|
Daniel@0
|
169 __optionsOfDynamicDerivedVisInstanceDataForBase: {
|
Daniel@0
|
170 attributesToExcludeFromHash: ["apiResponseOnTheLeft", "apiResponseOnTheRight"],
|
Daniel@0
|
171 customHashSuffixGenerator: function (attributes) {
|
Daniel@0
|
172 if (attributes.apiResponseOnTheLeft) {
|
Daniel@0
|
173 return JSON.stringify(attributes.apiResponseOnTheLeft.errors);
|
Daniel@0
|
174 } else {
|
Daniel@0
|
175 return typeof attributes.apiResponseOnTheLeft;
|
Daniel@0
|
176 }
|
Daniel@0
|
177 if (attributes.apiResponseOnTheRight) {
|
Daniel@0
|
178 return JSON.stringify(attributes.apiResponseOnTheRight.errors);
|
Daniel@0
|
179 } else {
|
Daniel@0
|
180 return typeof attributes.apiResponseOnTheRight;
|
Daniel@0
|
181 }
|
Daniel@0
|
182 }
|
Daniel@0
|
183 },
|
Daniel@0
|
184
|
Daniel@0
|
185
|
Daniel@0
|
186 __upateMethodOfDynamicDerivedVisInstanceDataForBase: function(force) {
|
Daniel@0
|
187 var visInstanceView = this.options.visInstanceView;
|
Daniel@0
|
188 var _this = this;
|
Daniel@0
|
189 _.each(["Right", "Left"], function(side) {
|
Daniel@0
|
190 var dynamicDefinitionForCollection = visInstanceView.dynamicDerivedConfigDataForEntity.attributes["dynamicDefinitionForCollectionOnThe" + side];
|
Daniel@0
|
191 if (!dynamicDefinitionForCollection) { // entity kind has changed (e.g. a grid was reset)
|
Daniel@0
|
192 return;
|
Daniel@0
|
193 }
|
Daniel@0
|
194
|
Daniel@0
|
195 var collectionId = dynamicDefinitionForCollection.attributes.id;
|
Daniel@0
|
196 var requestParams = _.clone(visInstanceView.dynamicDerivedConfigDataForView.attributes.basePerspectiveRequestParams);
|
Daniel@0
|
197
|
Daniel@0
|
198 if (!requestParams || !collectionId) {
|
Daniel@0
|
199 var attrs = {};
|
Daniel@0
|
200 attrs["apiRequestURIOnThe" + side] = undefined;
|
Daniel@0
|
201 attrs["apiRequestParamsHashOnThe" + side] = undefined;
|
Daniel@0
|
202 attrs["apiResponseOnThe" + side] = undefined;
|
Daniel@0
|
203 _this.set(attrs);
|
Daniel@0
|
204 return;
|
Daniel@0
|
205 }
|
Daniel@0
|
206 requestParams.cid = collectionId;
|
Daniel@0
|
207
|
Daniel@0
|
208 var apiRequestParamsHash = JSON.stringify(requestParams);
|
Daniel@0
|
209
|
Daniel@0
|
210 if (!force && apiRequestParamsHash == _this.attributes["apiRequestParamsHashOnThe" + side]) {
|
Daniel@0
|
211 return;
|
Daniel@0
|
212 }
|
Daniel@0
|
213
|
Daniel@0
|
214 var apiRequestURI = App.DataModule.CliopatriaAPI.request("getCollectionPerspective", requestParams, function(data){
|
Daniel@0
|
215 if (JSON.stringify(requestParams) != _this.attributes["apiRequestParamsHashOnThe" + side]) {
|
Daniel@0
|
216 return;
|
Daniel@0
|
217 }
|
Daniel@0
|
218 var attrs = {};
|
Daniel@0
|
219 attrs["apiRequestParamsHashOnThe" + side] = undefined;
|
Daniel@0
|
220 attrs["apiResponseOnThe" + side] = data;
|
Daniel@0
|
221 _this.set(attrs);
|
Daniel@0
|
222 });
|
Daniel@0
|
223
|
Daniel@0
|
224 var attrs = {};
|
Daniel@0
|
225 attrs["apiRequestURIOnThe" + side] = apiRequestURI;
|
Daniel@0
|
226 attrs["apiRequestParamsHashOnThe" + side] = apiRequestParamsHash;
|
Daniel@0
|
227 attrs["apiResponseOnThe" + side] = null;
|
Daniel@0
|
228 _this.set(attrs);
|
Daniel@0
|
229 });
|
Daniel@0
|
230 },
|
Daniel@0
|
231
|
Daniel@0
|
232
|
Daniel@0
|
233 generateDynamicDerivedVisInstanceDataForBase: function(visInstanceView) {
|
Daniel@0
|
234 // An empty object if comparison is not supported
|
Daniel@0
|
235 var viewMaster = visInstanceView._cachedViewMaster;
|
Daniel@0
|
236 if (!viewMaster.options.visInstanceSupportedComparisonModes.length) {
|
Daniel@0
|
237 return new RepresentationModule.DynamicDerivedVisInstanceData({});
|
Daniel@0
|
238 }
|
Daniel@0
|
239
|
Daniel@0
|
240 var optionsForThisDynamicDerivedVisInstanceDataForBase = _.clone(this.__optionsOfDynamicDerivedVisInstanceDataForBase);
|
Daniel@0
|
241 optionsForThisDynamicDerivedVisInstanceDataForBase.visInstanceView = visInstanceView;
|
Daniel@0
|
242
|
Daniel@0
|
243 var dynamicDerivedVisInstanceDataForBase = new RepresentationModule.DynamicDerivedVisInstanceData({
|
Daniel@0
|
244 apiRequestURIOnTheLeft: undefined,
|
Daniel@0
|
245 apiRequestParamsHashOnTheLeft: undefined,
|
Daniel@0
|
246 apiResponseOnTheLeft: undefined,
|
Daniel@0
|
247 apiRequestURIOnTheRight: undefined,
|
Daniel@0
|
248 apiRequestParamsHashOnTheRight: undefined,
|
Daniel@0
|
249 apiResponseOnTheRight: undefined
|
Daniel@0
|
250 }, optionsForThisDynamicDerivedVisInstanceDataForBase);
|
Daniel@0
|
251
|
Daniel@0
|
252 dynamicDerivedVisInstanceDataForBase.update = this.__upateMethodOfDynamicDerivedVisInstanceDataForBase;
|
Daniel@0
|
253
|
Daniel@0
|
254 dynamicDerivedVisInstanceDataForBase.listenTo(visInstanceView.dynamicDerivedConfigDataForEntity, "change", dynamicDerivedVisInstanceDataForBase.update);
|
Daniel@0
|
255 dynamicDerivedVisInstanceDataForBase.listenTo(visInstanceView.dynamicDerivedConfigDataForView, "change:basePerspectiveRequestParams", dynamicDerivedVisInstanceDataForBase.update);
|
Daniel@0
|
256
|
Daniel@0
|
257 dynamicDerivedVisInstanceDataForBase.update();
|
Daniel@0
|
258
|
Daniel@0
|
259 return dynamicDerivedVisInstanceDataForBase;
|
Daniel@0
|
260 },
|
Daniel@0
|
261
|
Daniel@0
|
262
|
Daniel@0
|
263 verifyAllDataForVisInstanceBase: function(visInstanceView) {
|
Daniel@0
|
264 this._verifyThatViewIsNotEmptyOrUnknown(visInstanceView);
|
Daniel@0
|
265
|
Daniel@0
|
266 // if (visInstanceView.options.entityConfig.getParameterValue("kind")
|
Daniel@0
|
267 // && visInstanceView.options.viewConfig.getParameterValue("kind") == "key-relative-chord-seq") {
|
Daniel@0
|
268 // throw new RepresentationModule.Error({type: "drawing", derivedDataToUpdate: "base"});
|
Daniel@0
|
269 // }
|
Daniel@0
|
270
|
Daniel@0
|
271 var viewMaster = visInstanceView._cachedViewMaster;
|
Daniel@0
|
272 if (!viewMaster.options.canHaveBase) {
|
Daniel@0
|
273 return;
|
Daniel@0
|
274 }
|
Daniel@0
|
275 var supportedComparisonModes = viewMaster.options.visInstanceSupportedComparisonModes;
|
Daniel@0
|
276 if (!supportedComparisonModes.length) {
|
Daniel@0
|
277 throw new RepresentationModule.Error({type: "comparison_not-supported"});
|
Daniel@0
|
278 }
|
Daniel@0
|
279 if (!_.contains(supportedComparisonModes, viewMaster._getVisInstanceViewComparisonMode(visInstanceView))) {
|
Daniel@0
|
280 throw new RepresentationModule.Error({type: "comparison_wrong-type", supportedTypes: supportedComparisonModes});
|
Daniel@0
|
281 }
|
Daniel@0
|
282
|
Daniel@0
|
283 var attributesOfDerivedConfigDataForEntityOnTheLeft = visInstanceView.dynamicDerivedConfigDataForEntity.attributes;
|
Daniel@0
|
284 var attributesOfDerivedConfigDataForEntityOnTheRight = visInstanceView.dynamicDerivedConfigDataForEntity.attributes;
|
Daniel@0
|
285 var dynamicDefinitionForCollectionOnTheLeft = attributesOfDerivedConfigDataForEntityOnTheLeft .dynamicDefinitionForCollectionOnTheLeft;
|
Daniel@0
|
286 var dynamicDefinitionForCollectionOnTheRight = attributesOfDerivedConfigDataForEntityOnTheRight.dynamicDefinitionForCollectionOnTheRight;
|
Daniel@0
|
287 var attributesOfCollectionOnTheLeft = dynamicDefinitionForCollectionOnTheLeft ? dynamicDefinitionForCollectionOnTheLeft.attributes : {};
|
Daniel@0
|
288 var attributesOfCollectionOnTheRight = dynamicDefinitionForCollectionOnTheRight ? dynamicDefinitionForCollectionOnTheRight.attributes : {};
|
Daniel@0
|
289
|
Daniel@0
|
290 if (attributesOfCollectionOnTheLeft.id === null || attributesOfCollectionOnTheRight.id === null) {
|
Daniel@0
|
291 throw new RepresentationModule.Error({type: "data-preparing_entity-derived"});
|
Daniel@0
|
292 }
|
Daniel@0
|
293 if (attributesOfCollectionOnTheLeft.id === false || attributesOfCollectionOnTheRight.id === false) {
|
Daniel@0
|
294 var apiErrorsOnTheLeft = attributesOfCollectionOnTheLeft .errors || [];
|
Daniel@0
|
295 var apiErrorsOnTheRight = attributesOfCollectionOnTheRight.errors || [];
|
Daniel@0
|
296 apiErrors = apiErrorsOnTheLeft.concat(apiErrorsOnTheRight);
|
Daniel@0
|
297 throw new RepresentationModule.Error({type: "api-error_entity-derived", apiErrors: apiErrors, coverTapAction: this.__coverTapActionThatUpdatesDynamicDerivedData, derivedDataToUpdate: "entity"});
|
Daniel@0
|
298 }
|
Daniel@0
|
299 if ((attributesOfCollectionOnTheLeft .id === "" || (attributesOfCollectionOnTheLeft .hasOwnProperty("id") && attributesOfCollectionOnTheLeft .id === undefined))
|
Daniel@0
|
300 || (attributesOfCollectionOnTheRight.id === "" || (attributesOfCollectionOnTheRight.hasOwnProperty("id") && attributesOfCollectionOnTheRight.id === undefined))) {
|
Daniel@0
|
301 throw new RepresentationModule.Error({type: "collection_no-recordings"});
|
Daniel@0
|
302 }
|
Daniel@0
|
303 if (attributesOfCollectionOnTheLeft.id === undefined || attributesOfCollectionOnTheRight.id === undefined) {
|
Daniel@0
|
304 throw new RepresentationModule.Error({type: "pair_incomplete"});
|
Daniel@0
|
305 }
|
Daniel@0
|
306
|
Daniel@0
|
307 var attribytesOfDerivedVisInstanceDataForBase = visInstanceView.dynamicDerivedVisInstanceDataForBase.attributes;
|
Daniel@0
|
308 if (!attribytesOfDerivedVisInstanceDataForBase.apiResponseOnTheLeft || !attribytesOfDerivedVisInstanceDataForBase.apiResponseOnTheRight) {
|
Daniel@0
|
309 throw new RepresentationModule.Error({type: "data-preparing_base"});
|
Daniel@0
|
310 }
|
Daniel@0
|
311 if (attribytesOfDerivedVisInstanceDataForBase.apiResponseOnTheLeft.errors || attribytesOfDerivedVisInstanceDataForBase.apiResponseOnTheRight.errors) {
|
Daniel@0
|
312 var apiErrorsOnTheLeft = attribytesOfDerivedVisInstanceDataForBase.apiResponseOnTheLeft .errors || [];
|
Daniel@0
|
313 var apiErrorsOnTheRight = attribytesOfDerivedVisInstanceDataForBase.apiResponseOnTheRight.errors || [];
|
Daniel@0
|
314 var apiErrors = apiErrorsOnTheLeft.concat(apiErrorsOnTheRight);
|
Daniel@0
|
315
|
Daniel@0
|
316 if (apiErrors[0]) {
|
Daniel@0
|
317 var error0 = apiErrors[0];
|
Daniel@0
|
318 if (((error0.code == 11 || error0.code == 12) && !apiErrors[1]) || (apiErrors[1] && (apiErrors[1].code == 11 || apiErrors[1].code == 12))) {
|
Daniel@0
|
319 throw new RepresentationModule.Error({type: "api-message_progress_base", apiErrors: apiErrors, coverTapAction: this.__coverTapActionThatUpdatesDynamicDerivedData, derivedDataToUpdate: "base"});
|
Daniel@0
|
320
|
Daniel@0
|
321 // FIXME errors like this should probably go to Master.view.xxx
|
Daniel@0
|
322 } else if ((error0.code == 20 && !apiErrors[1]) || (apiErrors[1] && (apiErrors[1].code == 20))) {
|
Daniel@0
|
323 return;
|
Daniel@0
|
324 }
|
Daniel@0
|
325
|
Daniel@0
|
326 }
|
Daniel@0
|
327
|
Daniel@0
|
328 throw new RepresentationModule.Error({type: "api-error_base", apiErrors: apiErrors, coverTapAction: this.__coverTapActionThatUpdatesDynamicDerivedData, derivedDataToUpdate: "base"});
|
Daniel@0
|
329 }
|
Daniel@0
|
330 },
|
Daniel@0
|
331 });
|
Daniel@0
|
332 });
|
Daniel@0
|
333 }, Logger);
|