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

Add more time ranges #971

Merged
merged 4 commits into from
Jul 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,18 @@ exports[`<MonitorATMServicesView> ATM snapshot test 1`] = `
},
"disabled": null,
"options": Array [
Object {
"label": "Last 5 minutes",
"value": 300000,
},
Object {
"label": "Last 15 minutes",
"value": 900000,
},
Object {
"label": "Last 30 minutes",
"value": 1800000,
},
Object {
"label": "Last Hour",
"value": 3600000,
Expand Down Expand Up @@ -477,6 +489,18 @@ exports[`<MonitorATMServicesView> ATM snapshot test with no metrics 1`] = `
},
"disabled": null,
"options": Array [
Object {
"label": "Last 5 minutes",
"value": 300000,
},
Object {
"label": "Last 15 minutes",
"value": 900000,
},
Object {
"label": "Last 30 minutes",
"value": 1800000,
},
Object {
"label": "Last Hour",
"value": 3600000,
Expand Down Expand Up @@ -789,6 +813,18 @@ exports[`<MonitorATMServicesView> render one service latency 1`] = `
},
"disabled": null,
"options": Array [
Object {
"label": "Last 5 minutes",
"value": 300000,
},
Object {
"label": "Last 15 minutes",
"value": 900000,
},
Object {
"label": "Last 30 minutes",
"value": 1800000,
},
Object {
"label": "Last Hour",
"value": 3600000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ limitations under the License.

.select-a-timeframe-input {
font-size: 14px;
width: 128px;
width: 135px;
}

.over-the-last {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,11 @@ const AdaptedVirtualSelect = reduxFormFieldAdapter({

const serviceFormSelector = formValueSelector('serviceForm');
const oneHourInMilliSeconds = 3600000;
const oneMinuteInMilliSeconds = 60000;
export const timeFrameOptions = [
{ label: 'Last 5 minutes', value: 5 * oneMinuteInMilliSeconds },
{ label: 'Last 15 minutes', value: 15 * oneMinuteInMilliSeconds },
{ label: 'Last 30 minutes', value: 30 * oneMinuteInMilliSeconds },
{ label: 'Last Hour', value: oneHourInMilliSeconds },
{ label: 'Last 2 hours', value: 2 * oneHourInMilliSeconds },
{ label: 'Last 6 hours', value: 6 * oneHourInMilliSeconds },
Expand Down Expand Up @@ -311,7 +315,7 @@ export class MonitorATMServicesViewImpl extends React.PureComponent<TProps, Stat
}}
props={{
className: 'select-a-timeframe-input',
defaultValue: timeFrameOptions[0],
defaultValue: timeFrameOptions[3],
value: selectedTimeFrame,
disabled: metrics.operationMetricsLoading,
clearable: false,
Expand Down
12 changes: 12 additions & 0 deletions packages/jaeger-ui/src/components/SearchTracePage/SearchForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ export function lookbackToTimestamp(lookback, from) {
}

const lookbackOptions = [
{
label: '5 Minutes',
value: '5m',
},
{
label: '15 Minutes',
value: '15m',
},
{
label: '30 Minutes',
value: '30m',
},
{
label: 'Hour',
value: '1h',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,18 @@ describe('lookback utils', () => {

describe('optionsWithinMaxLookback', () => {
const threeHoursOfExpectedOptions = [
{
label: '5 Minutes',
value: '5m',
},
{
label: '15 Minutes',
value: '15m',
},
{
label: '30 Minutes',
value: '30m',
},
{
label: 'Hour',
value: '1h',
Expand All @@ -198,7 +210,7 @@ describe('lookback utils', () => {
});

it('returns options within config.search.maxLookback', () => {
const configValue = threeHoursOfExpectedOptions[2];
const configValue = threeHoursOfExpectedOptions[threeHoursOfExpectedOptions.length - 1];
const options = optionsWithinMaxLookback(configValue);

expect(options.length).toBe(threeHoursOfExpectedOptions.length);
Expand Down Expand Up @@ -228,7 +240,8 @@ describe('lookback utils', () => {
label: '180 minutes is equivalent to 3 hours',
value: '180m',
};
const expectedOptions = [threeHoursOfExpectedOptions[0], threeHoursOfExpectedOptions[1], configValue];

const expectedOptions = [...threeHoursOfExpectedOptions.slice(0, -1), configValue];
const options = optionsWithinMaxLookback(configValue);

expect(options.length).toBe(expectedOptions.length);
Expand Down