Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable regexes and functions in link patterns #817

10 changes: 0 additions & 10 deletions packages/jaeger-ui/src/model/link-patterns.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ describe('processTemplate()', () => {
);
});

/*
// kept on ice until #123 is implemented:

it('correctly returns the same object when passing an already processed template', () => {
const alreadyProcessed = {
parameters: ['b'],
Expand All @@ -58,8 +55,6 @@ describe('processTemplate()', () => {
expect(processedTemplate).toBe(alreadyProcessed);
});

*/

it('reports an error when passing an object that does not look like an already processed template', () => {
expect(() =>
processTemplate(
Expand Down Expand Up @@ -98,9 +93,6 @@ describe('createTestFunction()', () => {
expect(testFn('otherValue')).toBe(false);
});

/*
// kept on ice until #123 is implemented:

it('accepts a regular expression', () => {
const testFn = createTestFunction(/^my.*Value$/);
expect(testFn('myValue')).toBe(true);
Expand Down Expand Up @@ -131,8 +123,6 @@ describe('createTestFunction()', () => {
expect(mockCallback).toHaveBeenCalledWith('otherValue');
});

*/

it('accepts undefined', () => {
const testFn = createTestFunction();
expect(testFn('myValue')).toBe(true);
Expand Down
11 changes: 1 addition & 10 deletions packages/jaeger-ui/src/model/link-patterns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ type TLinksRV = { url: string; text: string }[];

export function processTemplate(template: any, encodeFn: (unencoded: any) => string): ProcessedTemplate {
if (typeof template !== 'string') {
/*

// kept on ice until #123 is implemented:
if (template && Array.isArray(template.parameters) && (typeof template.template === 'function')) {
if (template && Array.isArray(template.parameters) && typeof template.template === 'function') {
return template;
}

*/
throw new Error('Invalid template');
}
return {
Expand All @@ -63,17 +59,12 @@ export function createTestFunction(entry: any) {
if (Array.isArray(entry)) {
return (arg: any) => entry.indexOf(arg) > -1;
}
/*

// kept on ice until #123 is implemented:
if (entry instanceof RegExp) {
return (arg: any) => entry.test(arg);
}
if (typeof entry === 'function') {
return entry;
}

*/
if (entry == null) {
return () => true;
}
Expand Down