From 9909f4777ed404142d259d51f5068839dba00742 Mon Sep 17 00:00:00 2001 From: Alberto Gutierrez Date: Mon, 8 Oct 2018 12:33:10 +0200 Subject: [PATCH] Embed components --- packages/jaeger-ui/src/components/App/Page.js | 9 +++-- .../SearchTracePage/SearchResults/index.js | 5 ++- .../src/components/SearchTracePage/index.js | 39 ++++++++++++------- 3 files changed, 33 insertions(+), 20 deletions(-) diff --git a/packages/jaeger-ui/src/components/App/Page.js b/packages/jaeger-ui/src/components/App/Page.js index 47fe93fd98..ddc646933b 100644 --- a/packages/jaeger-ui/src/components/App/Page.js +++ b/packages/jaeger-ui/src/components/App/Page.js @@ -52,13 +52,16 @@ export class PageImpl extends React.Component { } render() { + const isEmbed = this.props.search.includes('embed'); return (
-
- -
+ {!isEmbed && ( +
+ +
+ )} {this.props.children}
diff --git a/packages/jaeger-ui/src/components/SearchTracePage/SearchResults/index.js b/packages/jaeger-ui/src/components/SearchTracePage/SearchResults/index.js index bfaa2a670c..0e3678c51a 100644 --- a/packages/jaeger-ui/src/components/SearchTracePage/SearchResults/index.js +++ b/packages/jaeger-ui/src/components/SearchTracePage/SearchResults/index.js @@ -37,6 +37,7 @@ type SearchResultsProps = { cohortRemoveTrace: string => void, diffCohort: FetchedTrace[], goToTrace: string => void, + isEmbed?: boolean, loading: boolean, maxTraceDuration: number, skipMessage?: boolean, @@ -107,7 +108,7 @@ export default class SearchResults extends React.PureComponent ); } - const { goToTrace, maxTraceDuration } = this.props; + const { goToTrace, isEmbed, maxTraceDuration } = this.props; const cohortIds = new Set(diffCohort.map(datum => datum.id)); return (
@@ -143,7 +144,7 @@ export default class SearchResults extends React.PureComponent diff --git a/packages/jaeger-ui/src/components/SearchTracePage/index.js b/packages/jaeger-ui/src/components/SearchTracePage/index.js index 65cd1b59d8..c36191e350 100644 --- a/packages/jaeger-ui/src/components/SearchTracePage/index.js +++ b/packages/jaeger-ui/src/components/SearchTracePage/index.js @@ -60,7 +60,8 @@ export class SearchTracePageImpl extends Component { } goToTrace = traceID => { - this.props.history.push(prefixUrl(`/trace/${traceID}`)); + const url = this.props.isEmbed ? `/trace/${traceID}?embed` : `/trace/${traceID}`; + this.props.history.push(prefixUrl(url)); }; render() { @@ -75,6 +76,7 @@ export class SearchTracePageImpl extends Component { maxTraceDuration, services, traceResults, + isEmbed, } = this.props; const hasTraceResults = traceResults && traceResults.length > 0; const showErrors = errors && !loadingTraces; @@ -82,12 +84,14 @@ export class SearchTracePageImpl extends Component { return (
- -
-

Find Traces

- {!loadingServices && services ? : } -
- + {!isEmbed && ( + +
+

Find Traces

+ {!loadingServices && services ? : } +
+ + )} {showErrors && (
@@ -105,16 +109,18 @@ export class SearchTracePageImpl extends Component { diffCohort={diffCohort} skipMessage={isHomepage} traces={traceResults} + isEmbed={isEmbed} /> )} - {showLogo && ( - presentation - )} + {showLogo && + !isEmbed && ( + presentation + )}
@@ -124,6 +130,7 @@ export class SearchTracePageImpl extends Component { SearchTracePageImpl.propTypes = { isHomepage: PropTypes.bool, + isEmbed: PropTypes.bool, // eslint-disable-next-line react/forbid-prop-types traceResults: PropTypes.array, diffCohort: PropTypes.array, @@ -196,6 +203,7 @@ const stateServicesXformer = getLastXformCacher(stateServices => { // export to test export function mapStateToProps(state) { const query = queryString.parse(state.router.location.search); + const isEmbed = 'embed' in query; const isHomepage = !Object.keys(query).length; const { traces, maxDuration, traceError, loadingTraces } = stateTraceXformer(state.trace); const diffCohort = stateTraceDiffXformer(state.trace, state.traceDiff); @@ -211,6 +219,7 @@ export function mapStateToProps(state) { const traceResults = sortedTracesXformer(traces, sortBy); return { diffCohort, + isEmbed, isHomepage, loadingServices, loadingTraces,