@@ -102,11 +102,11 @@ export const devtools = {
102
102
103
103
if ( layers . state !== false ) {
104
104
client . on ( 'state' , ( ) => {
105
- let details
105
+ let data = { }
106
106
let time = Date . now ( )
107
107
108
108
if ( client . state === 'connecting' && node . connection . url ) {
109
- details = {
109
+ data = {
110
110
nodeId : node . localNodeId ,
111
111
server : node . connection . url
112
112
}
@@ -116,24 +116,17 @@ export const devtools = {
116
116
node . remoteNodeId
117
117
) {
118
118
prevConnected = true
119
- details = {
119
+ data = {
120
120
server : node . remoteNodeId
121
121
}
122
122
} else if ( ! client . connected ) {
123
123
prevConnected = false
124
124
}
125
125
126
- let data = {
127
- state : client . state
128
- }
129
-
130
- if ( details ) {
131
- data . details = details
132
- }
133
-
134
126
api . addTimelineEvent ( {
135
127
layerId : stateLayerId ,
136
128
event : {
129
+ title : client . state ,
137
130
time,
138
131
data
139
132
}
@@ -146,6 +139,8 @@ export const devtools = {
146
139
api . addTimelineEvent ( {
147
140
layerId : roleLayerId ,
148
141
event : {
142
+ title : 'Changed' ,
143
+ subtitle : client . role ,
149
144
time : Date . now ( ) ,
150
145
data : {
151
146
role : client . role
@@ -173,32 +168,25 @@ export const devtools = {
173
168
let time = Date . now ( )
174
169
175
170
if ( action . type === 'logux/subscribe' ) {
176
- let data = {
177
- type : 'subscribing' ,
178
- channel : action . channel
179
- }
180
-
181
- if ( Object . keys ( action ) . length === 2 ) {
182
- data . action = action
183
- }
184
-
185
171
api . addTimelineEvent ( {
186
172
layerId : subscriptionLayerId ,
187
- event : { time, data }
173
+ event : {
174
+ title : 'Subscribing' ,
175
+ subtitle : action . channel ,
176
+ groupId : meta . id ,
177
+ time,
178
+ data : { action, meta }
179
+ }
188
180
} )
189
181
} else if ( action . type === 'logux/unsubscribe' ) {
190
- let data = {
191
- type : 'unsubscribed' ,
192
- channel : action . channel
193
- }
194
-
195
- if ( Object . keys ( action ) . length === 2 ) {
196
- data . action = action
197
- }
198
-
199
182
api . addTimelineEvent ( {
200
183
layerId : subscriptionLayerId ,
201
- event : { time, data }
184
+ event : {
185
+ title : 'Unsubscribed' ,
186
+ subtitle : action . channel ,
187
+ time,
188
+ data : { action, meta }
189
+ }
202
190
} )
203
191
} else if ( action . type === 'logux/processed' ) {
204
192
if ( subscribing [ action . id ] ) {
@@ -207,10 +195,11 @@ export const devtools = {
207
195
api . addTimelineEvent ( {
208
196
layerId : subscriptionLayerId ,
209
197
event : {
198
+ title : 'Subscribed' ,
199
+ subtitle : processed . channel ,
200
+ groupId : action . id ,
210
201
time,
211
202
data : {
212
- type : 'subscribed' ,
213
- channel : processed . channel ,
214
203
action : processed
215
204
}
216
205
}
@@ -225,11 +214,10 @@ export const devtools = {
225
214
api . addTimelineEvent ( {
226
215
layerId : subscriptionLayerId ,
227
216
event : {
217
+ title : 'Subscribed by server' ,
218
+ subtitle : action . channel ,
228
219
time,
229
- data : {
230
- type : 'subscribed by server' ,
231
- channel : action . channel
232
- }
220
+ data : { action, meta }
233
221
}
234
222
} )
235
223
}
@@ -255,11 +243,10 @@ export const devtools = {
255
243
api . addTimelineEvent ( {
256
244
layerId : actionLayerId ,
257
245
event : {
246
+ title : 'Processed' ,
247
+ subtitle : processed . type ,
258
248
time,
259
- data : {
260
- type : 'processed' ,
261
- action : processed
262
- }
249
+ data : { processed, action, meta }
263
250
}
264
251
} )
265
252
}
@@ -268,57 +255,57 @@ export const devtools = {
268
255
api . addTimelineEvent ( {
269
256
layerId : actionLayerId ,
270
257
event : {
258
+ title : 'Processed' ,
271
259
time,
272
- data : {
273
- type : 'processed' ,
274
- action
275
- }
260
+ data : { action, meta }
276
261
}
277
262
} )
278
263
}
279
264
} else if ( action . type === 'logux/undo' ) {
280
265
let data = {
281
- type : 'undid' ,
282
- actionId : action . id ,
283
- reason : action . reason
266
+ reason : action . reason ,
267
+ action,
268
+ meta
284
269
}
285
270
286
271
if ( sent [ action . id ] ) {
287
- data . details = {
272
+ data . undone = {
288
273
action : sent [ action . id ]
289
274
}
290
275
delete sent [ action . id ]
291
276
}
292
277
293
- if ( Object . keys ( action ) . length > 3 ) {
294
- if ( ! data . details ) data . details = { }
295
- data . details . undo = action
296
- }
297
-
298
278
api . addTimelineEvent ( {
299
279
layerId : actionLayerId ,
300
- event : { time, data }
280
+ event : {
281
+ title : 'Undid' ,
282
+ subtitle : data . undone . type || '' ,
283
+ time,
284
+ data
285
+ }
301
286
} )
302
287
} else {
303
- let data = {
304
- type : 'added' ,
305
- action,
306
- meta
307
- }
288
+ let title = 'Added'
289
+ let data = { action, meta }
308
290
309
291
if ( meta . reasons . length === 0 ) {
310
292
cleaned [ meta . id ] = true
311
- data . type += ' and cleaned'
293
+ title += ' and cleaned'
312
294
}
313
295
314
296
let { nodeId } = parseId ( meta . id )
315
297
if ( nodeId !== node . localNodeId ) {
316
- data . from = nodeId
298
+ data . by = nodeId
317
299
}
318
300
319
301
api . addTimelineEvent ( {
320
302
layerId : actionLayerId ,
321
- event : { time, data }
303
+ event : {
304
+ title,
305
+ subtitle : action . type ,
306
+ time,
307
+ data
308
+ }
322
309
} )
323
310
}
324
311
}
@@ -330,6 +317,7 @@ export const devtools = {
330
317
api . addTimelineEvent ( {
331
318
layerId : userLayerId ,
332
319
event : {
320
+ title : 'Changed' ,
333
321
time : Date . now ( ) ,
334
322
data : {
335
323
userId,
@@ -353,6 +341,8 @@ export const devtools = {
353
341
api . addTimelineEvent ( {
354
342
layerId : cleanLayerId ,
355
343
event : {
344
+ title : 'Cleaned' ,
345
+ subtitle : action . type ,
356
346
time : Date . now ( ) ,
357
347
data : { action, meta }
358
348
}
0 commit comments