-
+
diff --git a/packages/jaeger-ui/src/components/common/__snapshots__/CircularProgressbar.test.js.snap b/packages/jaeger-ui/src/components/common/__snapshots__/CircularProgressbar.test.js.snap
new file mode 100644
index 0000000000..2cf6efcc3d
--- /dev/null
+++ b/packages/jaeger-ui/src/components/common/__snapshots__/CircularProgressbar.test.js.snap
@@ -0,0 +1,79 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`CircularProgressbar handles minimal props 1`] = `
+
+`;
+
+exports[`CircularProgressbar renders as expected with all props 1`] = `
+
+`;
diff --git a/packages/jaeger-ui/src/components/common/__snapshots__/ExamplesLink.test.js.snap b/packages/jaeger-ui/src/components/common/__snapshots__/ExamplesLink.test.js.snap
new file mode 100644
index 0000000000..20762163b9
--- /dev/null
+++ b/packages/jaeger-ui/src/components/common/__snapshots__/ExamplesLink.test.js.snap
@@ -0,0 +1,37 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`ExamplesLink renders as expected when given both span and trace links 1`] = `
+
+
+
+`;
+
+exports[`ExamplesLink renders as expected when given span links 1`] = `
+
+
+
+`;
+
+exports[`ExamplesLink renders as expected when given trace links 1`] = `
+
+
+
+`;
diff --git a/packages/jaeger-ui/src/model/path-agnostic-decorations/__snapshots__/index.test.js.snap b/packages/jaeger-ui/src/model/path-agnostic-decorations/__snapshots__/index.test.js.snap
new file mode 100644
index 0000000000..bb7d98a6a8
--- /dev/null
+++ b/packages/jaeger-ui/src/model/path-agnostic-decorations/__snapshots__/index.test.js.snap
@@ -0,0 +1,23 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`extractDecorationFromState prefers operation specific decoration over service decoration 1`] = `
+
+`;
+
+exports[`extractDecorationFromState returns service decoration 1`] = `
+
+`;
diff --git a/packages/jaeger-ui/src/model/path-agnostic-decorations/index.test.js b/packages/jaeger-ui/src/model/path-agnostic-decorations/index.test.js
new file mode 100644
index 0000000000..e737fe607d
--- /dev/null
+++ b/packages/jaeger-ui/src/model/path-agnostic-decorations/index.test.js
@@ -0,0 +1,108 @@
+// Copyright (c) 2020 Uber Technologies, Inc.
+//
+// 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 _set from 'lodash/set';
+import queryString from 'query-string';
+
+import extractDecorationFromState from '.';
+
+describe('extractDecorationFromState', () => {
+ const decorationID = 'test decoration id';
+ const service = 'test service';
+ const operation = 'test operation';
+ const decorationValue = 42;
+ const decorationMax = 108;
+
+ function makeState({ decoration = decorationID, opValue, opMax, withoutOpValue, withoutOpMax }) {
+ const state = {};
+ const deco = Array.isArray(decoration) ? decoration[0] : decoration;
+
+ _set(state, 'router.location.search', decoration ? queryString.stringify({ decoration }) : '');
+ if (opValue !== undefined)
+ _set(state, `pathAgnosticDecorations.${deco}.withOp.${service}.${operation}`, opValue);
+ if (opMax !== undefined) _set(state, `pathAgnosticDecorations.${deco}.withOpMax`, opMax);
+ if (withoutOpValue !== undefined)
+ _set(state, `pathAgnosticDecorations.${deco}.withoutOp.${service}`, withoutOpValue);
+ if (withoutOpMax !== undefined) _set(state, `pathAgnosticDecorations.${deco}.withoutOpMax`, withoutOpMax);
+
+ return state;
+ }
+
+ function extractWrapper(stateArgs, svpOp = { service, operation }) {
+ return extractDecorationFromState(makeState(stateArgs), svpOp);
+ }
+
+ it('returns an empty object if url lacks a decorationID', () => {
+ expect(extractWrapper({ decoration: null })).toEqual({});
+ });
+
+ it('prefers operation specific decoration over service decoration', () => {
+ const otherValue = 'other value';
+ const otherMax = 'other max';
+ const res = extractWrapper({
+ opValue: decorationValue,
+ opMax: decorationMax,
+ withoutOpValue: otherValue,
+ withoutOpMax: otherMax,
+ });
+ expect(res).toEqual(
+ expect.objectContaining({
+ decorationID,
+ decorationValue,
+ })
+ );
+ expect(res.decorationProgressbar).toMatchSnapshot();
+ });
+
+ it('returns service decoration', () => {
+ const res = extractWrapper({
+ withoutOpValue: decorationValue,
+ withoutOpMax: decorationMax,
+ });
+ expect(res).toEqual(
+ expect.objectContaining({
+ decorationID,
+ decorationValue,
+ })
+ );
+ expect(res.decorationProgressbar).toMatchSnapshot();
+ });
+
+ it('omits CircularProgressbar if value is a string', () => {
+ const withoutOpValue = 'without op string value';
+ const res = extractWrapper({
+ withoutOpValue,
+ withoutOpMax: decorationMax,
+ });
+ expect(res).toEqual({
+ decorationID,
+ decorationValue: withoutOpValue,
+ decorationProgressbar: undefined,
+ });
+ });
+
+ it('uses first decoration if multiple exist in url', () => {
+ const withoutOpValue = 'without op string value';
+ const res = extractWrapper({
+ decoration: [decorationID, `not-${decorationID}`],
+ withoutOpValue,
+ withoutOpMax: decorationMax,
+ });
+ expect(res).toEqual({
+ decorationID,
+ decorationValue: withoutOpValue,
+ decorationProgressbar: undefined,
+ });
+ });
+});
diff --git a/packages/jaeger-ui/src/model/path-agnostic-decorations/types.tsx b/packages/jaeger-ui/src/model/path-agnostic-decorations/types.tsx
index 6b1e20ef8f..96cc12d726 100644
--- a/packages/jaeger-ui/src/model/path-agnostic-decorations/types.tsx
+++ b/packages/jaeger-ui/src/model/path-agnostic-decorations/types.tsx
@@ -12,13 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-import React from 'react';
-
-export type TExample = {
- spanIDs?: string[];
- traceID: string;
-};
-
export type TPathAgnosticDecorationSchema = {
acronym: string;
id: string;
@@ -36,25 +29,6 @@ export type TPathAgnosticDecorationSchema = {
opDetailColumnDefPath?: string;
};
-export type TStyledValue = {
- linkTo?: string;
- styling?: React.CSSProperties;
- value: string | React.ReactElement;
-};
-
-export type TPadColumnDef = {
- key: string;
- label?: string;
- preventSort?: boolean;
- styling?: React.CSSProperties;
-};
-
-export type TPadColumnDefs = (string | TPadColumnDef)[];
-
-export type TPadRow = Record
;
-
-export type TPadDetails = string | string[] | TPadRow[];
-
export type TPadEntry = number | string;
export type TNewData = Record<