aframe-babia-components 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/components/filters/babia-treebuilder.js +17 -12
  2. package/components/others/babia-camera.js +52 -40
  3. package/components/others/babia-experiment.js +457 -0
  4. package/components/others/babia-poster.js +383 -0
  5. package/components/others/babia-task.js +247 -0
  6. package/components/others/babia-ui.js +312 -147
  7. package/components/others/common.js +36 -5
  8. package/components/visualizers/babia-boats.js +708 -87
  9. package/components/visualizers/babia-network.js +268 -212
  10. package/dist/aframe-babia-components.js +20590 -18317
  11. package/dist/aframe-babia-components.min.js +3 -3
  12. package/dist/aframe-babia-components.min.js.map +1 -1
  13. package/docs/APIs/CHARTS.md +233 -207
  14. package/docs/APIs/OTHERS.md +143 -56
  15. package/docs/RELEASE_NOTES.md +5 -0
  16. package/docs/Tutorials/how_to_prepare_an_experiment.md +148 -0
  17. package/examples/assets/palettes/bluetored.jpg +0 -0
  18. package/examples/assets/textures/360-panorama.jpg +0 -0
  19. package/examples/assets/textures/floor-texture.jpg +0 -0
  20. package/examples/assets/textures/metalic-texture.jpg +0 -0
  21. package/examples/boats/boats_dependency/dependencieslist_cloudinary.json +1 -0
  22. package/examples/boats/boats_dependency/dependencieslist_express.json +4376 -0
  23. package/examples/boats/boats_dependency/dependencieslist_filestash.json +39533 -0
  24. package/examples/boats/boats_dependency/dependencieslist_ghdesktop.json +127660 -0
  25. package/examples/boats/boats_dependency/dependencieslist_karma.json +1 -0
  26. package/examples/boats/boats_dependency/dependencieslist_pm2.json +13726 -0
  27. package/examples/boats/boats_dependency/dependencieslist_portainer.json +41818 -0
  28. package/examples/boats/boats_dependency/dependencieslist_sh.json +5194 -0
  29. package/examples/boats/boats_dependency/experiment.html +277 -0
  30. package/examples/boats/boats_dependency/index.html +300 -0
  31. package/examples/boats/boats_dependency/index_gradient.html +209 -0
  32. package/examples/boats/boats_dependency/index_normalcity.html +207 -0
  33. package/examples/boats/boats_dependency/index_quarter_levels_01.html +213 -0
  34. package/examples/boats/boats_dependency/index_quarter_levels_02.html +213 -0
  35. package/examples/boats/boats_dependency/index_quarter_levels_03.html +213 -0
  36. package/examples/boats/boats_dependency/index_quarter_levels_querystring.html +243 -0
  37. package/examples/boats/boats_dependency/index_tree.html +211 -0
  38. package/examples/boats/boats_dependency/index_tree_gradient.html +212 -0
  39. package/examples/boats/boats_dependency/index_tree_wireframe.html +243 -0
  40. package/examples/charts/network_chart/network_chart.html +10 -2
  41. package/examples/charts/pie/index.html +3 -4
  42. package/examples/codecityjs/perceval2021/index.html +1 -1
  43. package/examples/codecityjs/projects_analysis/argouml_landscape.html +1 -1
  44. package/examples/codecityjs/projects_analysis/argouml_numfuns.html +3 -3
  45. package/examples/codecityjs/projects_analysis/argouml_table.html +1 -1
  46. package/examples/codecityjs/projects_analysis/argouml_tokens.html +1 -1
  47. package/examples/codecityjs/projects_analysis/experiment_interface.html +1 -1
  48. package/examples/codecityjs/projects_analysis/experiment_interface_task5.html +1 -1
  49. package/examples/codecityjs/projects_analysis/experiment_interface_vr_2021.html +1 -1
  50. package/examples/codecityjs/projects_analysis/experiment_interface_vr_task5.html +1 -1
  51. package/examples/codecityjs/projects_analysis/perceval_landscape.html +1 -1
  52. package/examples/codecityjs/projects_analysis/perceval_table.html +1 -1
  53. package/examples/dashboard/chaoss-dashboards.html +1 -1
  54. package/examples/dashboard/chaoss-issues.html +1 -1
  55. package/examples/dashboard/chaoss-pr.html +1 -1
  56. package/examples/dashboard/range.html +1 -1
  57. package/examples/dashboard/template.html +1 -1
  58. package/examples/experiment/city.html +352 -0
  59. package/examples/experiment/index.html +527 -0
  60. package/examples/experiment/pie.html +90 -0
  61. package/examples/experiment/sample-3s.mp3 +0 -0
  62. package/examples/experiment/sample.mp4 +0 -0
  63. package/examples/experiment/staticdata/80-percent-open-time-issues2.json +1 -0
  64. package/examples/experiment/staticdata/80-percent-open-time-pr.json +1 -0
  65. package/examples/experiment/staticdata/issues-by-organization.json +1 -0
  66. package/examples/experiment/staticdata/issues.json +1 -0
  67. package/examples/experiment/staticdata/jetuml_code_data.json +1 -0
  68. package/examples/experiment/staticdata/median-open-time-issues.json +1 -0
  69. package/examples/experiment/staticdata/median-open-time-pr.json +1 -0
  70. package/examples/experiment/staticdata/organizations-issues.json +1 -0
  71. package/examples/experiment/staticdata/organizations-pr.json +1 -0
  72. package/examples/experiment/staticdata/projects-issues.json +1 -0
  73. package/examples/experiment/staticdata/projects-pr.json +1 -0
  74. package/examples/experiment/staticdata/pull-requests-by-organization.json +1 -0
  75. package/examples/experiment/staticdata/pull-requests.json +1 -0
  76. package/examples/experiment/staticdata/repositories-issues-asignees.json +1 -0
  77. package/examples/experiment/staticdata/repositories-issues-avgdays.json +1 -0
  78. package/examples/experiment/staticdata/repositories-issues-count.json +1 -0
  79. package/examples/experiment/staticdata/repositories-issues-submitters.json +1 -0
  80. package/examples/experiment/staticdata/repositories-pr-asignees.json +1 -0
  81. package/examples/experiment/staticdata/repositories-pr-avgdays.json +1 -0
  82. package/examples/experiment/staticdata/repositories-pr-count.json +1 -0
  83. package/examples/experiment/staticdata/repositories-pr-submitters.json +1 -0
  84. package/examples/experiment/staticdata/status-issues.json +1 -0
  85. package/examples/experiment/staticdata/status-pr.json +1 -0
  86. package/examples/experiment/staticdata/submitter-issues-avgdays.json +1 -0
  87. package/examples/experiment/staticdata/submitter-issues-count.json +1 -0
  88. package/examples/experiment/staticdata/submitter-issues-repo.json +1 -0
  89. package/examples/experiment/staticdata/submitter-pr-avgdays.json +1 -0
  90. package/examples/experiment/staticdata/submitter-pr-count.json +1 -0
  91. package/examples/experiment/staticdata/submitter-pr-repo.json +1 -0
  92. package/examples/experiment/staticdata/submitters-issues.json +1 -0
  93. package/examples/experiment/staticdata/submitters-pr.json +1 -0
  94. package/examples/multi_boats/jetuml_evolution_experiment.html +1 -1
  95. package/index.js +23 -9
  96. package/package.json +1 -1
  97. package/examples/charts_querier/network_chart_querier/data.json +0 -123
  98. package/examples/charts_querier/network_chart_querier/links.json +0 -13
  99. package/examples/charts_querier/network_chart_querier/network_chart_querier.html +0 -68
  100. package/examples/charts_querier/network_chart_querier/network_chart_querier_nodes_links.html +0 -74
  101. package/examples/charts_querier/network_chart_querier/nodes.json +0 -12
@@ -13,6 +13,14 @@ let MAX_SIZE_BAR = 10
13
13
  AFRAME.registerComponent('babia-ui', {
14
14
  schema: {
15
15
  target: { type: 'string' },
16
+ hideFields: { type: 'array' },
17
+ hideRows: { type: 'array' },
18
+ showOnly: { type: 'array' },
19
+ maxPerRow: { type: 'number', default: 5 },
20
+ linesSeparation: { type: 'number', default: 0.3 },
21
+ customQuerierLabel: { type: 'string', default: 'Data' },
22
+ customAttributeSwitch: { type: 'array' },
23
+ customAttributeLabel: { type: 'array' }
16
24
  },
17
25
 
18
26
  /**
@@ -48,7 +56,7 @@ AFRAME.registerComponent('babia-ui', {
48
56
  this.findQuerierComponents(this)
49
57
 
50
58
  // Target component properties
51
- if (this.targetComponent.visProperties) {
59
+ if (this.targetComponent.visProperties) {
52
60
  this.targetComponentVisProperties = this.targetComponent.visProperties
53
61
  }
54
62
 
@@ -72,17 +80,17 @@ AFRAME.registerComponent('babia-ui', {
72
80
  nodesQueriers: undefined,
73
81
  linksQueriers: undefined,
74
82
 
75
- updateInterface: function(data) {
83
+ updateInterface: function (data) {
76
84
  let self = this;
77
- if(data){
78
- // if (!self.targetComponent.el.components['babia-network']){
79
- getDataMetrics(self,data, self.targetComponentVisProperties)
85
+ if (data) {
86
+ // if (!self.targetComponent.el.components['babia-network']){
87
+ getDataMetrics(self, data, self.targetComponentVisProperties)
80
88
  //}
81
89
  }
82
-
90
+
83
91
  while (self.el.firstChild)
84
92
  self.el.firstChild.remove();
85
-
93
+
86
94
  // Generate interface
87
95
  console.log('Generating interface...')
88
96
  if (document.querySelector('#babia-menu-hand')) {
@@ -92,63 +100,103 @@ AFRAME.registerComponent('babia-ui', {
92
100
  } else {
93
101
  self.interface = generateInterface(self, self.dataMetrics, self.el)
94
102
  }
95
-
103
+
96
104
  document.addEventListener('controllerconnected', (event) => {
97
105
  while (self.el.firstChild)
98
106
  self.el.firstChild.remove();
99
107
  // event.detail.name ----> which VR controller
100
108
  controller = event.detail.name;
101
109
  let hand = event.target.getAttribute(controller).hand
102
- if (hand === 'left' && !document.querySelector('#babia-menu-hand')){
110
+ if (hand === 'left' && !document.querySelector('#babia-menu-hand')) {
103
111
  self.handController = event.target.id
104
112
  insertInterfaceOnHand(self, self.handController)
105
- }
113
+ }
106
114
  });
107
115
  },
108
116
 
109
- findQuerierComponents: function() {
110
- if (this.targetComponent.el.components['babia-network'] && (this.targetComponent.el.components['babia-network'].data.nodesFrom || this.targetComponent.el.components['babia-network'].data.nodes)){
117
+ findQuerierComponents: function () {
118
+ if (this.targetComponent.el.components['babia-network'] && (this.targetComponent.el.components['babia-network'].data.nodesFrom || this.targetComponent.el.components['babia-network'].data.nodes)) {
111
119
  console.log("nodesFrom or nodes")
112
120
  this.nodesQueriers = [];
113
121
  this.linksQueriers = [];
114
- document.querySelectorAll('[babia-queryjson]').forEach(querier => {
122
+ document.querySelectorAll('[babia-queryjson]').forEach(querier => {
115
123
  // Skip querier data when the target visualizer has included filtered data too.
116
- if (querier.id != this.data.target || ( querier.id == this.data.target && !this.targetComponent.prodComponent.attrName == 'babia-filter')){
124
+ if (querier.id != this.data.target || (querier.id == this.data.target && !this.targetComponent.prodComponent.attrName == 'babia-filter')) {
117
125
  this.nodesQueriers.push(querier.id)
118
126
  this.linksQueriers.push(querier.id)
119
- }
127
+ }
120
128
  });
121
- document.querySelectorAll('[babia-queryes]').forEach(querier => {
129
+ document.querySelectorAll('[babia-queryes]').forEach(querier => {
122
130
  this.nodesQueriers.push(querier.id)
123
131
  this.linksQueriers.push(querier.id)
124
132
  });
125
- document.querySelectorAll('[babia-querygithub]').forEach(querier => {
133
+ document.querySelectorAll('[babia-querygithub]').forEach(querier => {
126
134
  this.nodesQueriers.push(querier.id)
127
135
  this.linksQueriers.push(querier.id)
128
136
  });
129
- document.querySelectorAll('[babia-filter]').forEach(querier => {
137
+ document.querySelectorAll('[babia-filter]').forEach(querier => {
130
138
  this.nodesQueriers.push(querier.id)
131
139
  this.linksQueriers.push(querier.id)
132
140
  });
141
+ } else if (this.targetComponent.el.components['babia-boats']) {
142
+ this.dataQueriers = []
143
+ document.querySelectorAll('[babia-treebuilder]').forEach(querier => {
144
+ this.dataQueriers.push(querier.id)
145
+ });
133
146
  } else {
134
147
  this.dataQueriers = []
135
148
  // All queriers and filterdatas of the scene
136
- document.querySelectorAll('[babia-queryjson]').forEach(querier => {
149
+ document.querySelectorAll('[babia-queryjson]').forEach(querier => {
137
150
  // Skip querier data when the target visualizer has included filtered data too.
138
- if (querier.id != this.data.target || ( querier.id == this.data.target && !this.targetComponent.prodComponent.attrName == 'babia-filter')){
151
+ if (querier.id != this.data.target || (querier.id == this.data.target && !this.targetComponent.prodComponent.attrName == 'babia-filter')) {
139
152
  this.dataQueriers.push(querier.id)
140
- }
153
+ }
141
154
  });
142
- document.querySelectorAll('[babia-queryes]').forEach(querier => {
155
+ document.querySelectorAll('[babia-queryes]').forEach(querier => {
143
156
  this.dataQueriers.push(querier.id)
144
157
  });
145
- document.querySelectorAll('[babia-querygithub]').forEach(querier => {
158
+ document.querySelectorAll('[babia-querygithub]').forEach(querier => {
146
159
  this.dataQueriers.push(querier.id)
147
160
  });
148
- document.querySelectorAll('[babia-filter]').forEach(querier => {
161
+ document.querySelectorAll('[babia-filter]').forEach(querier => {
149
162
  this.dataQueriers.push(querier.id)
150
163
  });
151
- }
164
+ }
165
+ },
166
+
167
+ hideAndInsertMetrics: function (dataMetrics, property, metrics) {
168
+ const self = this
169
+ let toAdd = {
170
+ property: property,
171
+ metrics: metrics
172
+ }
173
+
174
+ if (self.data.hideFields.length != 0) {
175
+ let metricsFiltered = []
176
+ metrics.forEach(metric => {
177
+ if (!self.data.hideFields.includes(metric)) {
178
+ metricsFiltered.push(metric)
179
+ }
180
+ })
181
+ toAdd.metrics = metricsFiltered
182
+ }
183
+
184
+ // Show only activated
185
+ if (self.data.showOnly.length > 0) {
186
+ let onlyShowThis = []
187
+ for (let i = 0; i < self.data.showOnly.length; i++) {
188
+ const toShow = self.data.showOnly[i].split(":");
189
+ if (property == toShow[0]) {
190
+ onlyShowThis.push(toShow[1])
191
+ }
192
+ }
193
+
194
+ toAdd.metrics = onlyShowThis
195
+ }
196
+
197
+ if (!self.data.hideRows.includes(property)) {
198
+ dataMetrics.push(toAdd)
199
+ }
152
200
  }
153
201
  })
154
202
 
@@ -157,24 +205,16 @@ let insertInterfaceOnHand = (self, hand) => {
157
205
  let scale = 0.03
158
206
  self.interface = generateInterface(self, self.dataMetrics, hand_entity)
159
207
  self.interface.id = 'babia-menu-hand'
160
- self.interface.setAttribute('scale', {x: scale, y: scale, z: scale})
161
- self.interface.setAttribute('position', {x: -scale * self.interface.width / 2, y: scale * self.interface.height /2, z: -0.1})
162
- self.interface.setAttribute('rotation', {x: -60})
163
- self.interface.setAttribute('rotation', {x: -60})
164
- self.interface.setAttribute('rotation', {x: -60})
165
- self.interface.setAttribute('rotation', {x: -60})
166
- self.interface.setAttribute('rotation', {x: -60})
167
- self.interface.setAttribute('rotation', {x: -60})
168
- self.interface.setAttribute('rotation', {x: -60})
169
- self.interface.setAttribute('rotation', {x: -60})
170
- self.interface.setAttribute('rotation', {x: -60})
208
+ self.interface.setAttribute('scale', { x: scale, y: scale, z: scale })
209
+ self.interface.setAttribute('position', { x: -scale * self.interface.width / 2, y: scale * self.interface.height / 2, z: -0.1 })
210
+ self.interface.setAttribute('rotation', { x: -60 })
171
211
  openCloseMenu(self.handController, self.interface)
172
212
  }
173
213
 
174
- let getDataMetrics = (self, data, properties) =>{
214
+ let getDataMetrics = (self, data, properties) => {
175
215
  if (self.targetComponent.attrName == 'babia-network') {
176
- if (data.nodes){
177
- self.dataMetrics={
216
+ if (data.nodes) {
217
+ self.dataMetrics = {
178
218
  'nodes': [],
179
219
  'links': []
180
220
  }
@@ -183,107 +223,124 @@ let getDataMetrics = (self, data, properties) =>{
183
223
  let number_properties = ['height', 'radius', 'width', 'size', 'farea', 'fheight', 'area', 'depth']
184
224
  let number_metrics = []
185
225
  let last_child
186
-
226
+
187
227
  last_child = getLastChild(data.nodes[0])
188
228
 
189
229
  Object.keys(last_child).forEach(metric => {
190
- if (typeof last_child[metric] == 'number'){
230
+ if (typeof last_child[metric] == 'number') {
191
231
  number_metrics.push(metric)
192
232
  }
193
233
  });
194
-
234
+
195
235
  properties['nodes'].forEach(property => {
196
- if (number_properties.includes(property)){
197
- self.dataMetrics['nodes'].push({property: property, metrics: number_metrics})
236
+ if (number_properties.includes(property)) {
237
+ self.hideAndInsertMetrics(self.dataMetrics['nodes'], property, number_metrics)
198
238
  } else {
199
- self.dataMetrics['nodes'].push({property: property, metrics: Object.keys(data.nodes[0])})
239
+ self.hideAndInsertMetrics(self.dataMetrics['nodes'], property, Object.keys(data.nodes[0]))
200
240
  }
201
241
  });
202
242
 
203
243
  properties['links1'].forEach(property => {
204
- if (number_properties.includes(property)){
205
- self.dataMetrics['links'].push({property: property, metrics: number_metrics})
244
+ if (number_properties.includes(property)) {
245
+ self.hideAndInsertMetrics(self.dataMetrics['links'], property, number_metrics)
206
246
  } else {
207
- self.dataMetrics['links'].push({property: property, metrics: Object.keys(data.links[0])})
247
+ self.hideAndInsertMetrics(self.dataMetrics['links'], property, Object.keys(data.links[0]))
208
248
  }
209
249
  });
210
250
  } else {
211
- self.dataMetrics=[]
251
+ self.dataMetrics = []
212
252
 
213
253
  // Create structure
214
254
  let number_properties = ['height', 'radius', 'width', 'size', 'farea', 'fheight', 'area', 'depth']
215
255
  let number_metrics = []
216
256
  let last_child
217
-
257
+
218
258
  last_child = getLastChild(data[0])
219
-
259
+
220
260
  Object.keys(last_child).forEach(metric => {
221
- if (typeof last_child[metric] == 'number'){
261
+ if (typeof last_child[metric] == 'number') {
222
262
  number_metrics.push(metric)
223
263
  }
224
264
  });
225
-
265
+
226
266
  properties['nodes'].forEach(property => {
227
- if (number_properties.includes(property)){
228
- self.dataMetrics.push({property: property, metrics: number_metrics})
267
+ if (number_properties.includes(property)) {
268
+ self.hideAndInsertMetrics(self.dataMetrics, property, number_metrics)
229
269
  } else {
230
- self.dataMetrics.push({property: property, metrics: Object.keys(data[0])})
270
+ self.hideAndInsertMetrics(self.dataMetrics, property, Object.keys(data[0]))
231
271
  }
232
272
  });
233
-
273
+
234
274
  properties['links0'].forEach(property => {
235
- if (number_properties.includes(property)){
236
- self.dataMetrics.push({property: property, metrics: number_metrics})
275
+ if (number_properties.includes(property)) {
276
+ self.hideAndInsertMetrics(self.dataMetrics, property, number_metrics)
237
277
  } else {
238
- self.dataMetrics.push({property: property, metrics: Object.keys(data[0])})
278
+ self.hideAndInsertMetrics(self.dataMetrics, property, Object.keys(data[0]))
239
279
  }
240
- });
280
+ });
241
281
  }
242
-
282
+
243
283
  } else {
244
- self.dataMetrics=[]
284
+ self.dataMetrics = []
245
285
 
246
286
  // Create structure
247
- let number_properties = ['height', 'radius', 'width', 'size', 'farea', 'fheight', 'area', 'depth']
287
+ let number_properties = ['height', 'radius', 'width', 'size', 'farea', 'fheight', 'area', 'depth', 'color']
248
288
  let number_metrics = []
249
289
  let last_child
250
290
 
251
- if(self.targetComponent.attrName == 'babia-city')
252
- {
291
+ if (self.targetComponent.attrName == 'babia-city') {
253
292
  // Get last child of the tree
254
293
  last_child = getLastChild(data)
255
- } else if (self.targetComponent.attrName == 'babia-boats'){
294
+ } else if (self.targetComponent.attrName == 'babia-boats') {
256
295
  last_child = getLastChild(data[0])
257
- } else {
258
- last_child = data[0]
296
+ } else {
297
+ last_child = data[0]
259
298
  }
260
299
 
261
300
  Object.keys(last_child).forEach(metric => {
262
- if (typeof last_child[metric] == 'number'){
301
+ if (typeof last_child[metric] == 'number') {
263
302
  number_metrics.push(metric)
264
303
  }
265
304
  });
266
305
 
267
306
  properties.forEach(property => {
268
- if (number_properties.includes(property)){
269
- self.dataMetrics.push({property: property, metrics: number_metrics})
307
+ if (number_properties.includes(property)) {
308
+ self.hideAndInsertMetrics(self.dataMetrics, property, number_metrics)
309
+
310
+ // Specific case for categoric color in boats
311
+ if (property === "color") {
312
+ if (self.targetComponent.attrName == 'babia-boats') {
313
+ let categoric_colors = []
314
+ for (const [key, value] of Object.entries(last_child)) {
315
+ if (typeof value === 'string') {
316
+ categoric_colors.push(key)
317
+ }
318
+ }
319
+
320
+ // Solo si no está activado
321
+ if (!self.data.showOnly) {
322
+ self.hideAndInsertMetrics(self.dataMetrics, property, categoric_colors)
323
+ }
324
+ }
325
+ }
326
+
270
327
  } else {
271
- self.dataMetrics.push({property: property, metrics: Object.keys(data[0])})
328
+ self.hideAndInsertMetrics(self.dataMetrics, property, Object.keys(data[0]))
272
329
  }
273
330
  });
274
331
  }
275
332
  }
276
333
 
277
- let getLastChild = (data) =>{
278
- if (data.children){
334
+ let getLastChild = (data) => {
335
+ if (data.children) {
279
336
  child = getLastChild(data.children[0])
280
- } else {
337
+ } else {
281
338
  child = data
282
339
  }
283
340
  return child
284
341
  }
285
342
 
286
- let generateInterface = (self, metrics, parent) =>{
343
+ let generateInterface = (self, metrics, parent) => {
287
344
  self.interface = document.createElement('a-entity')
288
345
  self.interface.id = "babia-menu"
289
346
 
@@ -291,112 +348,182 @@ let generateInterface = (self, metrics, parent) =>{
291
348
  let posX = 0
292
349
  let maxX = 0
293
350
 
294
- if (self.targetComponent.el.components['babia-network'] && (self.targetComponent.el.components['babia-network'].data.nodesFrom || self.targetComponent.el.components['babia-network'].data.nodes)){
351
+ // Custom attribute changes
352
+ if (self.data.customAttributeSwitch.length > 0) {
353
+ if (self.data.customAttributeLabel) {
354
+ self.customAttributesLabel = {}
355
+ self.data.customAttributeLabel.forEach(pair => {
356
+ let el = pair.split(":")
357
+ Object.defineProperty(self.customAttributesLabel, el[0], { value: el[1] })
358
+ //self.customAttributeLabel[el[0]] = el[1]
359
+ });
360
+ }
361
+
362
+ let button = createProperty("Atrributes", posX, posY)
363
+ self.interface.appendChild(button)
364
+ self.data.customAttributeSwitch.forEach((data, i) => {
365
+ let attributeValue = data.split(":")
366
+ posX += 3.25
367
+ let button = createAttributeSelect(self, attributeValue, posX, posY)
368
+ button.classList.add("babiaxraycasterclass")
369
+ self.interface.appendChild(button)
370
+
371
+ // Two lines
372
+ if (((i + 1) % self.data.maxPerRow) == 0) {
373
+ --posY
374
+ posX = 0
375
+ }
376
+ });
377
+
378
+ --posY
379
+ --posY
380
+ if (maxX < posX) { maxX = posX }
381
+ posX = 0
382
+ }
383
+
384
+ if (self.targetComponent.el.components['babia-network'] && (self.targetComponent.el.components['babia-network'].data.nodesFrom || self.targetComponent.el.components['babia-network'].data.nodes)) {
295
385
  // Nodes files
296
- if (self.nodesQueriers.length > 1) {
386
+ if (self.nodesQueriers.length > 1) {
297
387
  let button = createProperty("Nodes", posX, posY)
298
388
  self.interface.appendChild(button)
299
- self.nodesQueriers.forEach(data => {
389
+ self.nodesQueriers.forEach((data, i) => {
300
390
  posX += 3.25
301
391
  let button = createDataSelect(self, data, posX, posY, 'nodes')
302
392
  button.classList.add("babiaxraycasterclass")
303
- self.interface.appendChild(button)
393
+ self.interface.appendChild(button)
394
+
395
+ // Two lines
396
+ if (((i + 1) % self.data.maxPerRow) == 0) {
397
+ --posY
398
+ posX = 0
399
+ }
304
400
  });
305
401
  }
306
402
  --posY
307
- if(maxX < posX) { maxX = posX }
308
- posX = 0
309
-
403
+ posY = posY - self.data.linesSeparation
404
+ if (maxX < posX) { maxX = posX }
405
+ posX = 0
406
+
310
407
  // Links files
311
- if (self.linksQueriers.length > 1) {
408
+ if (self.linksQueriers.length > 1) {
312
409
  let button = createProperty("Links", posX, posY)
313
410
  self.interface.appendChild(button)
314
- self.linksQueriers.forEach(data => {
411
+ self.linksQueriers.forEach((data, i) => {
315
412
  posX += 3.25
316
413
  let button = createDataSelect(self, data, posX, posY, 'links')
317
414
  button.classList.add("babiaxraycasterclass")
318
- self.interface.appendChild(button)
415
+ self.interface.appendChild(button)
416
+
417
+ // Two lines
418
+ if (((i + 1) % self.data.maxPerRow) == 0) {
419
+ --posY
420
+ posX = 0
421
+ }
319
422
  });
320
423
  }
321
424
  --posY
322
- if(maxX < posX) { maxX = posX }
425
+ posY = posY - self.data.linesSeparation
426
+ if (maxX < posX) { maxX = posX }
323
427
  posX = 0
324
428
 
325
429
  // Properties and metrics
326
430
  metrics.nodes.forEach(property => {
327
431
  let button = createProperty(property.property, posX, posY)
328
432
  self.interface.appendChild(button)
329
- property.metrics.forEach(metric => {
330
- posX += 3.25
331
- let button = createMetric(self, property.property, metric, posX, posY)
332
- button.classList.add("babiaxraycasterclass")
333
- self.interface.appendChild(button)
433
+ property.metrics.forEach((metric, i) => {
434
+ posX += 3.25
435
+ let button = createMetric(self, property.property, metric, posX, posY)
436
+ button.classList.add("babiaxraycasterclass")
437
+ self.interface.appendChild(button)
438
+
439
+ // Two lines
440
+ if (((i + 1) % self.data.maxPerRow) == 0) {
441
+ --posY
442
+ posX = 0
443
+ }
334
444
  });
335
445
  --posY
336
- if(maxX < posX) { maxX = posX }
337
- posX = 0
446
+ if (maxX < posX) { maxX = posX }
447
+ posX = 0
338
448
  });
339
449
 
340
450
  metrics.links.forEach(property => {
341
451
  let button = createProperty(property.property, posX, posY)
342
452
  self.interface.appendChild(button)
343
- property.metrics.forEach(metric => {
453
+ property.metrics.forEach((metric, i) => {
344
454
  posX += 3.25
345
455
  let button = createMetric(self, property.property, metric, posX, posY)
346
456
  button.classList.add("babiaxraycasterclass")
347
457
  self.interface.appendChild(button)
458
+
459
+ // Two lines
460
+ if (((i + 1) % self.data.maxPerRow) == 0) {
461
+ --posY
462
+ posX = 0
463
+ }
464
+
348
465
  });
349
466
  --posY
350
- if(maxX < posX) { maxX = posX }
351
- posX = 0
467
+ if (maxX < posX) { maxX = posX }
468
+ posX = 0
352
469
  });
353
470
  } else {
354
471
  // Data files
355
- if (self.dataQueriers.length > 1) {
356
- let button = createProperty("Data", posX, posY)
472
+ if (self.dataQueriers.length > 1) {
473
+ let button = createProperty(self.data.customQuerierLabel, posX, posY)
357
474
  self.interface.appendChild(button)
358
475
  self.dataQueriers.forEach(data => {
359
476
  posX += 3.25
360
477
  let button = createDataSelect(self, data, posX, posY)
361
478
  button.classList.add("babiaxraycasterclass")
362
- self.interface.appendChild(button)
479
+ self.interface.appendChild(button)
363
480
  });
364
481
  }
365
482
  --posY
366
- if(maxX < posX) { maxX = posX }
367
- posX = 0
483
+ posY = posY - self.data.linesSeparation
484
+ if (maxX < posX) { maxX = posX }
485
+ posX = 0
368
486
 
369
487
  // Properties and metrics
370
488
  metrics.forEach(property => {
371
489
  let button = createProperty(property.property, posX, posY)
372
490
  self.interface.appendChild(button)
373
- property.metrics.forEach(metric => {
491
+
492
+ property.metrics.forEach((metric, i) => {
374
493
  posX += 3.25
375
494
  let button = createMetric(self, property.property, metric, posX, posY)
376
495
  button.classList.add("babiaxraycasterclass")
377
- self.interface.appendChild(button)
496
+ self.interface.appendChild(button)
497
+
498
+ // Two lines
499
+ if (((i + 1) % self.data.maxPerRow) == 0) {
500
+ --posY
501
+ posX = 0
502
+ }
503
+
378
504
  });
379
505
  --posY
380
- if(maxX < posX) { maxX = posX }
381
- posX = 0
506
+ posY = posY - self.data.linesSeparation
507
+ if (maxX < posX) { maxX = posX }
508
+ posX = 0
382
509
  });
383
510
  }
384
-
511
+
385
512
  self.interface.width = maxX + 3;
386
513
  self.interface.height = Math.abs(posY)
387
514
 
388
- self.interface.setAttribute('position', { x: -self.interface.width / 2, y: self.interface.height, z: 0})
515
+ self.interface.setAttribute('position', { x: -self.interface.width / 2, y: self.interface.height, z: 0 })
389
516
  parent.appendChild(self.interface)
390
517
 
391
518
  return self.interface
392
519
  }
393
520
 
394
- let createMetric = (self, property, metric, positionX, positionY) =>{
521
+ let createMetric = (self, property, metric, positionX, positionY) => {
395
522
  let entity = document.createElement('a-box')
396
523
  entity.property = property
397
524
  entity.metric = metric
398
525
  entity.classList.add("babiaxraycasterclass")
399
- entity.setAttribute('position', { x: positionX, y: positionY, z: 0})
526
+ entity.setAttribute('position', { x: positionX, y: positionY, z: 0 })
400
527
  entity.setAttribute('rotation', { x: 0, y: 0, z: 0 })
401
528
  entity.setAttribute('height', 0.8)
402
529
  entity.setAttribute('width', 3)
@@ -412,34 +539,34 @@ let createMetric = (self, property, metric, positionX, positionY) =>{
412
539
  text.setAttribute('position', "0 0 0.01")
413
540
  entity.appendChild(text)
414
541
 
415
- if (self.targetComponent.data[property] == metric){
542
+ if (self.targetComponent.data[property] == metric) {
416
543
  entity.setAttribute('color', '#555555')
417
544
  }
418
-
545
+
419
546
  selection_events(entity, self.targetComponent, false)
420
547
 
421
548
  return entity
422
549
  }
423
550
 
424
- let selection_events = (entity, visualizer, isData) =>{
425
- entity.addEventListener('mouseenter', function(){
426
- entity.children[0].setAttribute('text', {color: '#FFFFFF'})
551
+ let selection_events = (entity, visualizer, isData) => {
552
+ entity.addEventListener('mouseenter', function () {
553
+ entity.children[0].setAttribute('text', { color: '#FFFFFF' })
427
554
  entity.setAttribute('color', '#333333')
428
555
  });
429
556
 
430
- if (isData){
431
- entity.addEventListener('mouseleave', function(){
432
- entity.children[0].setAttribute('text', {color: 'black'})
433
- if(visualizer.data.from == entity.from) {
557
+ if (isData) {
558
+ entity.addEventListener('mouseleave', function () {
559
+ entity.children[0].setAttribute('text', { color: 'black' })
560
+ if (visualizer.data.from == entity.from) {
434
561
  entity.setAttribute('color', '#555555')
435
- } else if(visualizer.data.from == "" || visualizer.data.from != entity.from) {
562
+ } else if (visualizer.data.from == "" || visualizer.data.from != entity.from) {
436
563
  entity.setAttribute('color', '#FFFFFF')
437
564
  }
438
- });
565
+ });
439
566
  } else {
440
- entity.addEventListener('mouseleave', function(){
441
- entity.children[0].setAttribute('text', {color: 'black'})
442
- if (visualizer.data[entity.property] == entity.metric){
567
+ entity.addEventListener('mouseleave', function () {
568
+ entity.children[0].setAttribute('text', { color: 'black' })
569
+ if (visualizer.data[entity.property] == entity.metric) {
443
570
  entity.setAttribute('color', '#555555')
444
571
  } else {
445
572
  entity.setAttribute('color', '#FFFFFF')
@@ -447,25 +574,25 @@ let selection_events = (entity, visualizer, isData) =>{
447
574
  });
448
575
  }
449
576
 
450
- entity.addEventListener('click', function(){
577
+ entity.addEventListener('click', function () {
451
578
  // Change parameters
452
- if(entity.property && entity.metric) {
579
+ if (entity.property && entity.metric) {
453
580
  // When change from width/depth to area or vice-versa to boats component
454
- if (visualizer.attrName == 'babia-boats' && entity.property == "area"){
581
+ if (visualizer.attrName == 'babia-boats' && entity.property == "area") {
455
582
  visualizer.el.removeAttribute(visualizer.attrName, 'width')
456
583
  visualizer.el.removeAttribute(visualizer.attrName, 'depth')
457
- } else if (visualizer.attrName == 'babia-boats' && (entity.property == "width" || entity.property == "depth") && visualizer.el.getAttribute('babia-boats').area){
458
- visualizer.el.removeAttribute(visualizer.attrName, 'area')
459
- if (entity.property == "width"){
584
+ } else if (visualizer.attrName == 'babia-boats' && (entity.property == "width" || entity.property == "depth") && visualizer.el.getAttribute('babia-boats').area) {
585
+ visualizer.el.removeAttribute(visualizer.attrName, 'area')
586
+ if (entity.property == "width") {
460
587
  visualizer.el.setAttribute(visualizer.attrName, 'depth', entity.metric)
461
588
  } else {
462
- visualizer.el.setAttribute(visualizer.attrName, 'width', entity.metric)
463
- }
464
- }
589
+ visualizer.el.setAttribute(visualizer.attrName, 'width', entity.metric)
590
+ }
591
+ }
465
592
  visualizer.el.setAttribute(visualizer.attrName, entity.property, entity.metric)
466
- // Change selected querier in visualializer (from)
593
+ // Change selected querier in visualializer (from)
467
594
  } else if (entity.from) {
468
- visualizer.el.setAttribute(visualizer.attrName, "from", entity.from )
595
+ visualizer.el.setAttribute(visualizer.attrName, "from", entity.from)
469
596
  } else if (entity.nodes) {
470
597
  visualizer.el.setAttribute(visualizer.attrName, 'nodesFrom', entity.nodes)
471
598
  } else if (entity.links) {
@@ -474,9 +601,9 @@ let selection_events = (entity, visualizer, isData) =>{
474
601
  });
475
602
  }
476
603
 
477
- let createProperty = (property, positionX, positionY) =>{
604
+ let createProperty = (property, positionX, positionY) => {
478
605
  let entity = document.createElement('a-plane')
479
- entity.setAttribute('position', { x: positionX, y: positionY, z: 0})
606
+ entity.setAttribute('position', { x: positionX, y: positionY, z: 0 })
480
607
  entity.setAttribute('rotation', { x: 0, y: 0, z: 0 })
481
608
  entity.setAttribute('height', 0.8)
482
609
  entity.setAttribute('width', 3)
@@ -490,17 +617,17 @@ let createProperty = (property, positionX, positionY) =>{
490
617
  return entity
491
618
  }
492
619
 
493
- let createDataSelect = (self, id, positionX, positionY, networkType) =>{
620
+ let createDataSelect = (self, id, positionX, positionY, networkType) => {
494
621
  let entity = document.createElement('a-box')
495
- if (networkType == 'nodes'){
622
+ if (networkType == 'nodes') {
496
623
  entity.nodes = id
497
- } else if (networkType == 'links'){
624
+ } else if (networkType == 'links') {
498
625
  entity.links = id
499
626
  } else {
500
627
  entity.from = id;
501
628
  }
502
629
  entity.classList.add("babiaxraycasterclass")
503
- entity.setAttribute('position', { x: positionX, y: positionY, z: 0})
630
+ entity.setAttribute('position', { x: positionX, y: positionY, z: 0 })
504
631
  entity.setAttribute('rotation', { x: 0, y: 0, z: 0 })
505
632
  entity.setAttribute('height', 0.8)
506
633
  entity.setAttribute('width', 3)
@@ -516,22 +643,60 @@ let createDataSelect = (self, id, positionX, positionY, networkType) =>{
516
643
  text.setAttribute('position', "0 0 0.01")
517
644
  entity.appendChild(text)
518
645
 
519
- if (self.targetComponent.prodComponent && self.targetComponent.prodComponent.el.id == id){
646
+ if (self.targetComponent.prodComponent && self.targetComponent.prodComponent.el.id == id) {
520
647
  entity.setAttribute('color', '#555555')
521
648
  } else {
522
649
  entity.setAttribute('color', '#FFFFFF')
523
650
  }
524
-
651
+
525
652
  selection_events(entity, self.targetComponent, true)
526
653
 
527
654
  return entity
528
655
  }
529
656
 
530
- let openCloseMenu = (hand_id, entity_menu) =>{
657
+ let createAttributeSelect = (self, [name, value], positionX, positionY) => {
658
+ let entity = document.createElement('a-box')
659
+ entity.classList.add("babiaxraycasterclass")
660
+ entity.setAttribute('position', { x: positionX, y: positionY, z: 0 })
661
+ entity.setAttribute('rotation', { x: 0, y: 0, z: 0 })
662
+ entity.setAttribute('height', 0.8)
663
+ entity.setAttribute('width', 3)
664
+ entity.setAttribute('depth', 0.01)
665
+
666
+ let text = document.createElement('a-entity')
667
+ let textToButton = name
668
+ if (self.customAttributesLabel && self.customAttributesLabel[name]) {
669
+ textToButton = self.customAttributesLabel[name]
670
+ }
671
+ text.setAttribute('text', {
672
+ 'value': textToButton,
673
+ 'align': 'center',
674
+ 'width': '10',
675
+ 'color': 'white'
676
+ })
677
+ text.setAttribute('position', "0 0 0.01")
678
+ entity.appendChild(text)
679
+
680
+ entity.setAttribute('color', 'blue')
681
+
682
+ // Change attributes
683
+ entity.addEventListener('click', function () {
684
+ let attrsComponent = self.targetComponent.el.getAttribute(self.targetComponent.attrName)
685
+ if (attrsComponent[name] && attrsComponent[name] == value) {
686
+ self.targetComponent.el.removeAttribute("babia-boats", name)
687
+ } else {
688
+ self.targetComponent.el.setAttribute("babia-boats", name, value)
689
+ }
690
+ })
691
+
692
+ return entity
693
+ }
694
+
695
+ let openCloseMenu = (hand_id, entity_menu) => {
531
696
  let menu_opened = true
532
697
  let entity_hand = document.getElementById(hand_id)
533
- entity_hand.addEventListener('gripdown', function(){
534
- if (menu_opened){
698
+ entity_hand.addEventListener('gripdown', function () {
699
+ if (menu_opened) {
535
700
  menu_opened = false
536
701
  entity_menu.setAttribute('visible', false)
537
702
  } else {