Skip to content

Commit c89608c

Browse files
authored
Merge branch 'main' into update-container-widget-style
2 parents a1c4bbb + 504e61c commit c89608c

File tree

38 files changed

+813
-49
lines changed

38 files changed

+813
-49
lines changed

projects/common/src/time/time-range.service.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,11 @@ describe('Time range service', () => {
8181
});
8282
});
8383
});
84+
85+
test('returns custom time filter', () => {
86+
const spectator = buildService();
87+
expect(spectator.service.toQueryParams(new Date(1642296703000), new Date(1642396703000))).toStrictEqual({
88+
['time']: new FixedTimeRange(new Date(1642296703000), new Date(1642396703000)).toUrlString()
89+
});
90+
});
8491
});

projects/common/src/time/time-range.service.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
22
import { isEmpty } from 'lodash-es';
33
import { EMPTY, ReplaySubject } from 'rxjs';
44
import { catchError, defaultIfEmpty, filter, map, switchMap, take } from 'rxjs/operators';
5-
import { NavigationService } from '../navigation/navigation.service';
5+
import { NavigationService, QueryParamObject } from '../navigation/navigation.service';
66
import { ReplayObservable } from '../utilities/rxjs/rxjs-utils';
77
import { FixedTimeRange } from './fixed-time-range';
88
import { RelativeTimeRange } from './relative-time-range';
@@ -110,4 +110,12 @@ export class TimeRangeService {
110110
public static toFixedTimeRange(startTime: Date, endTime: Date): FixedTimeRange {
111111
return new FixedTimeRange(startTime, endTime);
112112
}
113+
114+
public toQueryParams(startTime: Date, endTime: Date): QueryParamObject {
115+
const newTimeRange = new FixedTimeRange(startTime, endTime);
116+
117+
return {
118+
[TimeRangeService.TIME_RANGE_QUERY_PARAM]: newTimeRange.toUrlString()
119+
};
120+
}
113121
}

projects/components/src/combo-box/combo-box.component.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
}
4646
}
4747

48+
&.disabled {
49+
background-color: $gray-2;
50+
.trigger-input {
51+
color: black;
52+
}
53+
}
54+
4855
.trigger-control {
4956
height: 100%;
5057
width: 24px;

projects/components/src/combo-box/combo-box.component.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,21 @@ import { ComboBoxMode, ComboBoxOption, ComboBoxResult } from './combo-box-api';
3434
}
3535
],
3636
template: `
37-
<ht-popover (popoverOpen)="this.onPopoverOpen($event)" (popoverClose)="this.onPopoverClose()" class="combo-box">
37+
<ht-popover
38+
class="combo-box"
39+
[disabled]="this.disabled"
40+
(popoverOpen)="this.onPopoverOpen($event)"
41+
(popoverClose)="this.onPopoverClose()"
42+
>
3843
<ht-popover-trigger>
3944
<div
4045
#trigger
4146
class="popover-trigger"
4247
[ngClass]="{
4348
input: this.mode === '${ComboBoxMode.Input}',
4449
chip: this.mode === '${ComboBoxMode.Chip}',
45-
'show-border': this.showBorder
50+
'show-border': this.showBorder,
51+
disabled: this.disabled
4652
}"
4753
[class.has-text]="this.text"
4854
[class.input-focused]="input.matches(':focus')"
@@ -79,6 +85,7 @@ import { ComboBoxMode, ComboBoxOption, ComboBoxResult } from './combo-box-api';
7985
8086
<!-- Clear Button -->
8187
<div
88+
*ngIf="!this.disabled"
8289
[class.has-text]="this.text"
8390
[class.input-focused]="input.matches(':focus')"
8491
[ngClass]="this.mode"
@@ -427,6 +434,10 @@ export class ComboBoxComponent<TValue = string> implements AfterViewInit, OnChan
427434
});
428435
}
429436

437+
public setDisabledState(isDisabled?: boolean): void {
438+
this.disabled = isDisabled ?? false;
439+
}
440+
430441
private propagateValueChangeToFormControl(value?: string): void {
431442
this.propagateControlValueChange?.(value);
432443
this.propagateControlValueChangeOnTouch?.(value);

projects/components/src/input/input.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export class InputComponent<T extends string | number> implements ControlValueAc
8686
public registerOnTouched(onTouch: (value: T | undefined) => void): void {
8787
this.propagateControlValueChangeOnTouch = onTouch;
8888
}
89+
8990
public setDisabledState(isDisabled?: boolean): void {
9091
this.disabled = isDisabled ?? false;
9192
}

projects/components/src/popover/popover-position-builder.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ export class PopoverPositionBuilder {
109109
return globalPosition.centerHorizontally().centerVertically();
110110
case PopoverFixedPositionLocation.Right:
111111
return globalPosition.right('0').top('0');
112+
113+
case PopoverFixedPositionLocation.Custom:
114+
return globalPosition
115+
.left(`${popoverPosition.customLocation!.x}px`)
116+
.top(`${popoverPosition.customLocation!.y}px`);
112117
case PopoverFixedPositionLocation.RightUnderHeader:
113118
default:
114119
return globalPosition.right('0').top(this.headerHeight ?? '0');

projects/components/src/popover/popover.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ export interface PopoverRelativePosition {
3434
export interface PopoverFixedPosition {
3535
type: PopoverPositionType.Fixed;
3636
location: PopoverFixedPositionLocation;
37+
customLocation?: {
38+
x: number;
39+
y: number;
40+
};
3741
}
3842

3943
export type PopoverPosition =
@@ -65,7 +69,8 @@ export const enum PopoverRelativePositionLocation {
6569
export const enum PopoverFixedPositionLocation {
6670
RightUnderHeader,
6771
Centered,
68-
Right
72+
Right,
73+
Custom
6974
}
7075

7176
export const POPOVER_DATA = new InjectionToken<unknown>('POPOVER_DATA');

projects/components/src/select/select.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,10 @@ export class SelectComponent<V> implements ControlValueAccessor, AfterContentIni
324324
this.propagateControlValueChangeOnTouch = onTouch;
325325
}
326326

327+
public setDisabledState(isDisabled?: boolean): void {
328+
this.disabled = isDisabled ?? false;
329+
}
330+
327331
private propagateValueChangeToFormControl(value: V | undefined): void {
328332
this.propagateControlValueChange?.(value);
329333
this.propagateControlValueChangeOnTouch?.(value);

projects/observability/src/pages/apis/api-detail/metrics/api-metrics.dashboard.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,10 @@ export const apiMetricsDashboard: DashboardDefaultConfiguration = {
276276
}
277277
}
278278
}
279-
]
279+
],
280+
'selection-handler': {
281+
type: 'cartesian-explorer-selection-handler'
282+
}
280283
},
281284
{
282285
type: 'container-widget',
@@ -336,7 +339,11 @@ export const apiMetricsDashboard: DashboardDefaultConfiguration = {
336339
type: 'entity-error-percentage-timeseries-data-source'
337340
}
338341
}
339-
]
342+
],
343+
'selection-handler': {
344+
type: 'cartesian-explorer-selection-handler',
345+
'show-context-menu': true
346+
}
340347
},
341348
{
342349
type: 'cartesian-widget',
@@ -375,7 +382,11 @@ export const apiMetricsDashboard: DashboardDefaultConfiguration = {
375382
}
376383
}
377384
}
378-
]
385+
],
386+
'selection-handler': {
387+
type: 'cartesian-explorer-selection-handler',
388+
'show-context-menu': true
389+
}
379390
}
380391
]
381392
}
@@ -410,7 +421,11 @@ export const apiMetricsDashboard: DashboardDefaultConfiguration = {
410421
}
411422
}
412423
}
413-
]
424+
],
425+
'selection-handler': {
426+
type: 'cartesian-explorer-selection-handler',
427+
'show-context-menu': true
428+
}
414429
}
415430
]
416431
}

projects/observability/src/pages/apis/api-detail/overview/api-overview.dashboard.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,10 @@ export const apiOverviewDashboard: DashboardDefaultConfiguration = {
295295
}
296296
}
297297
}
298-
]
298+
],
299+
'selection-handler': {
300+
type: 'cartesian-explorer-selection-handler'
301+
}
299302
},
300303
{
301304
type: 'cartesian-widget',
@@ -389,7 +392,10 @@ export const apiOverviewDashboard: DashboardDefaultConfiguration = {
389392
}
390393
}
391394
}
392-
]
395+
],
396+
'selection-handler': {
397+
type: 'cartesian-explorer-selection-handler'
398+
}
393399
},
394400
{
395401
type: 'cartesian-widget',
@@ -483,7 +489,10 @@ export const apiOverviewDashboard: DashboardDefaultConfiguration = {
483489
}
484490
}
485491
}
486-
]
492+
],
493+
'selection-handler': {
494+
type: 'cartesian-explorer-selection-handler'
495+
}
487496
}
488497
]
489498
},

0 commit comments

Comments
 (0)