-
Notifications
You must be signed in to change notification settings - Fork 528
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
Add boolean property to config #1521
Merged
yurishkuro
merged 4 commits into
jaegertracing:main
from
Binrix:feature/config-utils-function-for-link-target
Jun 27, 2023
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
f2e3e7b
Add boolean property to config
00a68f3
Update packages/jaeger-ui/src/utils/config/get-target.test.js
Binrix fcefb6a
Update packages/jaeger-ui/src/utils/config/get-target.tsx
Binrix 90d3866
Merge branch 'main' into feature/config-utils-function-for-link-target
Binrix File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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,45 @@ | ||
// Copyright (c) 2023 The Jaeger 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 * as getConfig from './get-config'; | ||
import { getTargetBlankOrTop, getTargetEmptyOrBlank } from './get-target'; | ||
|
||
let getConfigValueSpy; | ||
|
||
beforeAll(() => { | ||
getConfigValueSpy = jest.spyOn(getConfig, 'getConfigValue'); | ||
}); | ||
|
||
describe('getTarget', () => { | ||
it('getTargetEmptyOrBlank returns empty because forbidNewPage is true', () => { | ||
getConfigValueSpy.mockReturnValue(true); | ||
const target = getTargetEmptyOrBlank(); | ||
expect(target).toBe(''); | ||
}); | ||
it('getTargetEmptyOrBlank returns _blank because forbidNewPage is true', () => { | ||
getConfigValueSpy.mockReturnValue(false); | ||
const target = getTargetEmptyOrBlank(); | ||
expect(target).toBe('_blank'); | ||
}); | ||
it('getTargetBlankOrTop returns _top because forbidNewPage is true', () => { | ||
getConfigValueSpy.mockReturnValue(true); | ||
const target = getTargetBlankOrTop(); | ||
expect(target).toBe('_top'); | ||
}); | ||
it('getTargetBlankOrTop returns _blank because forbidNewPage is true', () => { | ||
getConfigValueSpy.mockReturnValue(false); | ||
const target = getTargetBlankOrTop(); | ||
expect(target).toBe('_blank'); | ||
}); | ||
}); |
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,23 @@ | ||
// Copyright (c) 2023 The Jaeger 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 { getConfigValue } from './get-config'; | ||
|
||
export function getTargetEmptyOrBlank() { | ||
return getConfigValue('forbidNewPage') ? '' : '_blank'; | ||
} | ||
|
||
export function getTargetBlankOrTop() { | ||
return getConfigValue('forbidNewPage') ? '_top' : '_blank'; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why did you not think EmptyOrBlank would work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that when the target is empty, the json will be shown in the same window and the user cannot return to the page before (at least on the instrument because it has no keyboard or possibility to reach a return button from the browser). This is why I decided to use top: when the target is top the user can still access the navigation bar and go back.