@@ -22,6 +22,23 @@ import { connect } from 'react-redux'
2222import { withBus } from 'react-suber'
2323import { Bus } from 'suber'
2424
25+ import { ConfirmationButton } from 'browser-components/buttons/ConfirmationButton'
26+ import { Duration } from 'neo4j-driver'
27+ import { GlobalState } from 'project-root/src/shared/globalState'
28+ import { gte } from 'semver'
29+ import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'
30+ import {
31+ CONNECTED_STATE ,
32+ getConnectionState
33+ } from 'shared/modules/connections/connectionsDuck'
34+ import { CYPHER_REQUEST } from 'shared/modules/cypher/cypherDuck'
35+ import {
36+ getRawVersion ,
37+ getSemanticVersion ,
38+ hasProcedure ,
39+ isOnCluster
40+ } from 'shared/modules/dbMeta/dbMetaDuck'
41+ import { Frame } from 'shared/modules/frames/framesDuck'
2542import FrameBodyTemplate from '../../Frame/FrameBodyTemplate'
2643import FrameError from '../../Frame/FrameError'
2744import {
@@ -30,6 +47,9 @@ import {
3047 StatusbarWrapper ,
3148 StyledStatusBar
3249} from '../AutoRefresh/styled'
50+ import LegacyQueriesFrame , {
51+ LegacyQueriesFrameProps
52+ } from './LegacyQueriesFrame'
3353import {
3454 Code ,
3555 StyledHeaderRow ,
@@ -38,26 +58,6 @@ import {
3858 StyledTd ,
3959 StyledTh
4060} from './styled'
41- import { ConfirmationButton } from 'browser-components/buttons/ConfirmationButton'
42- import { GlobalState } from 'project-root/src/shared/globalState'
43- import { NEO4J_BROWSER_USER_ACTION_QUERY } from 'services/bolt/txMetadata'
44- import {
45- CONNECTED_STATE ,
46- getConnectionState
47- } from 'shared/modules/connections/connectionsDuck'
48- import { CYPHER_REQUEST } from 'shared/modules/cypher/cypherDuck'
49- import { durationFormat } from 'services/bolt/cypherTypesFormatting'
50- import { Frame } from 'shared/modules/frames/framesDuck'
51- import LegacyQueriesFrame , {
52- LegacyQueriesFrameProps
53- } from './LegacyQueriesFrame'
54- import {
55- getRawVersion ,
56- getSemanticVersion ,
57- hasProcedure ,
58- isOnCluster
59- } from 'shared/modules/dbMeta/dbMetaDuck'
60- import { gte } from 'semver'
6161
6262type QueriesFrameState = {
6363 queries : any [ ]
@@ -84,6 +84,22 @@ function constructOverviewMessage(queries: any, errors: string[]) {
8484 : successMessage
8585}
8686
87+ function prettyPrintDuration ( duration : Duration ) {
88+ const { months, days, seconds, nanoseconds } = duration
89+
90+ let resultsString = ''
91+ if ( months . toNumber ( ) > 0 ) {
92+ resultsString += `${ months } months, `
93+ }
94+ if ( days . toNumber ( ) > 0 ) {
95+ resultsString += `${ days } days, `
96+ }
97+ const millis = seconds . toNumber ( ) * 1000 + nanoseconds . toNumber ( ) / 1000000
98+ resultsString += `${ millis } ms`
99+
100+ return resultsString
101+ }
102+
87103export class QueriesFrame extends Component <
88104 QueriesFrameProps ,
89105 QueriesFrameState
@@ -153,7 +169,7 @@ export class QueriesFrame extends Component<
153169 ...data ,
154170 host : `neo4j://${ nonNullHost } ` ,
155171 query : data . currentQuery ,
156- elapsedTimeMillis : durationFormat ( data . elapsedTime ) ,
172+ elapsedTimeMillis : prettyPrintDuration ( data . elapsedTime ) ,
157173 queryId : data . transactionId
158174 }
159175 }
@@ -267,7 +283,7 @@ export class QueriesFrame extends Component<
267283 < Code > { JSON . stringify ( query . metaData , null , 2 ) } </ Code >
268284 </ StyledTd >
269285 < StyledTd key = "time" width = { tableHeaderSizes [ 5 ] [ 1 ] } >
270- { query . elapsedTimeMillis } ms
286+ { query . elapsedTimeMillis }
271287 </ StyledTd >
272288 < StyledTd key = "actions" width = { tableHeaderSizes [ 6 ] [ 1 ] } >
273289 < ConfirmationButton
0 commit comments