-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
230 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
zipkin-lens/src/components/TracePage/TraceTimelineHeader/TimeMarker.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
/* | ||
* Copyright 2015-2019 The OpenZipkin Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/styles'; | ||
import Box from '@material-ui/core/Box'; | ||
|
||
import { spanTreeWidthPercent } from '../constants'; | ||
import { formatDuration } from '../../../util/timestamp'; | ||
|
||
const propTypes = { | ||
startTs: PropTypes.number.isRequired, | ||
endTs: PropTypes.number.isRequired, | ||
}; | ||
|
||
const useStyles = makeStyles({ | ||
marker: { | ||
height: '100%', | ||
width: '1px', | ||
backgroundColor: '#999', | ||
position: 'absolute', | ||
}, | ||
label: { | ||
fontSize: '0.8rem', | ||
left: '2px', | ||
position: 'absolute', | ||
}, | ||
lastLabel: { | ||
fontSize: '0.8rem', | ||
left: 'initial', | ||
right: '2px', | ||
position: 'absolute', | ||
}, | ||
}); | ||
|
||
const numTimeMarkers = 4; | ||
|
||
const TimeMarker = ({ startTs, endTs }) => { | ||
const classes = useStyles(); | ||
|
||
const timeMarkers = []; | ||
|
||
for (let i = 0; i < numTimeMarkers; i += 1) { | ||
const label = startTs + (i / (numTimeMarkers - 1)) * (endTs - startTs); | ||
const portion = i / (numTimeMarkers - 1); | ||
|
||
timeMarkers.push( | ||
<Box | ||
key={portion} | ||
position="absolute" | ||
className={ | ||
portion < 1 ? classes.marker : '' | ||
} | ||
style={{ | ||
left: `${portion * 100}%`, | ||
}} | ||
> | ||
<Box | ||
component="span" | ||
position="absolute" | ||
className={portion < 1 ? classes.label : classes.lastLabel} | ||
> | ||
{formatDuration(label)} | ||
</Box> | ||
</Box>, | ||
); | ||
} | ||
return ( | ||
<Box | ||
display="flex" | ||
justifyContent="flex-end" | ||
> | ||
<Box | ||
mt={1} | ||
height={15} | ||
position="relative" | ||
width={`${100 - spanTreeWidthPercent}%`} | ||
> | ||
{timeMarkers} | ||
</Box> | ||
</Box> | ||
); | ||
}; | ||
|
||
TimeMarker.propTypes = propTypes; | ||
|
||
export default TimeMarker; |
88 changes: 88 additions & 0 deletions
88
zipkin-lens/src/components/TracePage/TraceTimelineHeader/TraceTimelineHeader.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* | ||
* Copyright 2015-2019 The OpenZipkin Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
import { makeStyles } from '@material-ui/styles'; | ||
import Box from '@material-ui/core/Box'; | ||
import Button from '@material-ui/core/Button'; | ||
import ButtonGroup from '@material-ui/core/ButtonGroup'; | ||
import grey from '@material-ui/core/colors/grey'; | ||
import TimeMarker from './TimeMarker'; | ||
|
||
const propTypes = { | ||
startTs: PropTypes.number.isRequired, | ||
endTs: PropTypes.number.isRequired, | ||
}; | ||
|
||
const useStyles = makeStyles({ | ||
root: { | ||
borderBottom: `1px solid ${grey[300]}`, | ||
backgroundColor: grey[100], | ||
}, | ||
textButton: { | ||
fontSize: '1.2rem', | ||
minWidth: '2rem', | ||
width: '2rem', | ||
}, | ||
}); | ||
|
||
const TraceTimelineHeader = ({ startTs, endTs }) => { | ||
const classes = useStyles(); | ||
|
||
return ( | ||
<Box className={classes.root}> | ||
<Box | ||
display="flex" | ||
alignItems="center" | ||
mt={1} | ||
mr={1} | ||
ml={1} | ||
justifyContent="space-between" | ||
> | ||
<Box> | ||
<ButtonGroup> | ||
<Button className={classes.textButton}> | ||
<Box component="span" className="fas fa-angle-up" /> | ||
</Button> | ||
<Button className={classes.textButton}> | ||
<Box component="span" className="fas fa-angle-right" /> | ||
</Button> | ||
<Button className={classes.textButton}> | ||
<Box component="span" className="fas fa-angle-down" /> | ||
</Button> | ||
<Button className={classes.textButton}> | ||
<Box component="span" className="fas fa-angle-left" /> | ||
</Button> | ||
</ButtonGroup> | ||
</Box> | ||
<ButtonGroup variant="contained"> | ||
<Button> | ||
Show Minimap | ||
</Button> | ||
<Button> | ||
Re-root | ||
</Button> | ||
<Button> | ||
Reset root | ||
</Button> | ||
</ButtonGroup> | ||
</Box> | ||
<TimeMarker startTs={startTs} endTs={endTs} /> | ||
</Box> | ||
); | ||
}; | ||
|
||
TraceTimelineHeader.propTypes = propTypes; | ||
|
||
export default TraceTimelineHeader; |
14 changes: 14 additions & 0 deletions
14
zipkin-lens/src/components/TracePage/TraceTimelineHeader/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Copyright 2015-2019 The OpenZipkin Authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License | ||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
* or implied. See the License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
export { default } from './TraceTimelineHeader'; |
File renamed without changes.