Showing
3 changed files
with
18 additions
and
1 deletions
@@ -23,6 +23,7 @@ import { | @@ -23,6 +23,7 @@ import { | ||
23 | NodeScriptTestDialogComponent, | 23 | NodeScriptTestDialogComponent, |
24 | NodeScriptTestDialogData | 24 | NodeScriptTestDialogData |
25 | } from '@shared/components/dialog/node-script-test-dialog.component'; | 25 | } from '@shared/components/dialog/node-script-test-dialog.component'; |
26 | +import { sortObjectKeys } from '@core/utils'; | ||
26 | 27 | ||
27 | @Injectable({ | 28 | @Injectable({ |
28 | providedIn: 'root' | 29 | providedIn: 'root' |
@@ -75,6 +76,8 @@ export class NodeScriptTestService { | @@ -75,6 +76,8 @@ export class NodeScriptTestService { | ||
75 | deviceName: 'Test Device', | 76 | deviceName: 'Test Device', |
76 | ts: new Date().getTime() + '' | 77 | ts: new Date().getTime() + '' |
77 | }; | 78 | }; |
79 | + } else { | ||
80 | + metadata = sortObjectKeys(metadata) as {[key: string]: string}; | ||
78 | } | 81 | } |
79 | if (!msgType) { | 82 | if (!msgType) { |
80 | msgType = 'POST_TELEMETRY_REQUEST'; | 83 | msgType = 'POST_TELEMETRY_REQUEST'; |
@@ -510,3 +510,10 @@ export function padValue(val: any, dec: number): string { | @@ -510,3 +510,10 @@ export function padValue(val: any, dec: number): string { | ||
510 | strVal = (n ? '-' : '') + strVal; | 510 | strVal = (n ? '-' : '') + strVal; |
511 | return strVal; | 511 | return strVal; |
512 | } | 512 | } |
513 | + | ||
514 | +export function sortObjectKeys(obj: object): object{ | ||
515 | + return Object.keys(obj).sort().reduce((acc,key)=>{ | ||
516 | + acc[key]=obj[key]; | ||
517 | + return acc; | ||
518 | + },{}); | ||
519 | +} |
@@ -38,6 +38,7 @@ import { | @@ -38,6 +38,7 @@ import { | ||
38 | EventContentDialogComponent, | 38 | EventContentDialogComponent, |
39 | EventContentDialogData | 39 | EventContentDialogData |
40 | } from '@home/components/event/event-content-dialog.component'; | 40 | } from '@home/components/event/event-content-dialog.component'; |
41 | +import { sortObjectKeys } from '@core/utils'; | ||
41 | 42 | ||
42 | export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { | 43 | export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { |
43 | 44 | ||
@@ -233,11 +234,17 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { | @@ -233,11 +234,17 @@ export class EventTableConfig extends EntityTableConfig<Event, TimePageLink> { | ||
233 | if ($event) { | 234 | if ($event) { |
234 | $event.stopPropagation(); | 235 | $event.stopPropagation(); |
235 | } | 236 | } |
237 | + let sortedContent: string; | ||
238 | + try { | ||
239 | + sortedContent = JSON.stringify(sortObjectKeys(JSON.parse(content))); | ||
240 | + } catch() { | ||
241 | + sortedContent = content; | ||
242 | + } | ||
236 | this.dialog.open<EventContentDialogComponent, EventContentDialogData>(EventContentDialogComponent, { | 243 | this.dialog.open<EventContentDialogComponent, EventContentDialogData>(EventContentDialogComponent, { |
237 | disableClose: true, | 244 | disableClose: true, |
238 | panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], | 245 | panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], |
239 | data: { | 246 | data: { |
240 | - content, | 247 | + constent: sortedContent, |
241 | title, | 248 | title, |
242 | contentType | 249 | contentType |
243 | } | 250 | } |