Skip to content

Commit 0741e28

Browse files
author
Dmitriy Potychkin
committed
Merge main
2 parents 5cd8848 + b8514b1 commit 0741e28

34 files changed

+611
-235
lines changed

package-lock.json

Lines changed: 240 additions & 159 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@
2424
},
2525
"private": true,
2626
"dependencies": {
27-
"@angular/animations": "^11.0.5",
27+
"@angular/animations": "^11.0.7",
2828
"@angular/cdk": "^11.0.3",
29-
"@angular/common": "^11.0.5",
30-
"@angular/compiler": "^11.0.5",
31-
"@angular/core": "^11.0.5",
29+
"@angular/common": "^11.0.7",
30+
"@angular/compiler": "^11.0.7",
31+
"@angular/core": "^11.0.7",
3232
"@angular/flex-layout": "^11.0.0-beta.33",
33-
"@angular/forms": "^11.0.5",
33+
"@angular/forms": "^11.0.7",
3434
"@angular/material": "^11.0.3",
35-
"@angular/platform-browser": "^11.0.5",
36-
"@angular/platform-browser-dynamic": "^11.0.5",
37-
"@angular/router": "^11.0.5",
35+
"@angular/platform-browser": "^11.0.7",
36+
"@angular/platform-browser-dynamic": "^11.0.7",
37+
"@angular/router": "^11.0.7",
3838
"@apollo/client": "^3.3.6",
3939
"@hypertrace/hyperdash": "^1.1.2",
4040
"@hypertrace/hyperdash-angular": "^2.3.1",
@@ -59,6 +59,7 @@
5959
"d3-zoom": "^1.8.3",
6060
"graphql": "^15.4.0",
6161
"graphql-tag": "^2.11.0",
62+
"iso8601-duration": "^1.3.0",
6263
"lodash-es": "^4.17.20",
6364
"rxjs": "~6.6.3",
6465
"tslib": "^2.1.0",
@@ -68,14 +69,14 @@
6869
"devDependencies": {
6970
"@angular-builders/jest": "^11.0.0",
7071
"@angular-devkit/build-angular": "~0.1101.1",
71-
"@angular/cli": "11.1.1",
72+
"@angular/cli": "11.1.2",
7273
"@angular/compiler-cli": "~11.0.2",
7374
"@angular/language-service": "~11.0.5",
7475
"@commitlint/cli": "^11.0.0",
7576
"@commitlint/config-conventional": "^11.0.0",
7677
"@compodoc/compodoc": "^1.1.11",
7778
"@ngneat/spectator": "^6.1.3",
78-
"@types/d3-array": "^2.8.0",
79+
"@types/d3-array": "^2.9.0",
7980
"@types/d3-axis": "^2.0.0",
8081
"@types/d3-brush": "^2.1.0",
8182
"@types/d3-drag": "^1.2.3",
@@ -101,7 +102,7 @@
101102
"jest-junit": "^12.0.0",
102103
"lodash": "^4.17.20",
103104
"ng-mocks": "^11.3.1",
104-
"ng-packagr": "^11.0.3",
105+
"ng-packagr": "^11.1.2",
105106
"prettier": "^2.2.1",
106107
"pretty-quick": "^3.0.0",
107108
"ts-node": "~9.1.1",

projects/assets-library/assets/styles/_layout.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import 'color-palette';
22

3-
$paginator-height: 50px;
3+
$paginator-height: 48px;
44

55
@mixin flex-layout($direction: column) {
66
height: 100%;

projects/common/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@angular/router": "^11.0.2",
1616
"@hypertrace/graphql-client": "^0.0.0",
1717
"core-js": "^3.7.0",
18+
"iso8601-duration": "^1.3.0",
1819
"rxjs": "~6.6.3",
1920
"zone.js": "^0.10.3",
2021
"lodash-es": "^4.17.15",

projects/common/src/time/time-duration.test.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ describe('Time duration', () => {
77
expect(new TimeDuration(4, TimeUnit.Hour).toMillis()).toBe(4 * 60 * 60 * 1000);
88
});
99

10+
test('converts to ISO 8601 duration string correctly', () => {
11+
expect(new TimeDuration(1, TimeUnit.Hour).toIso8601DurationString()).toBe('PT3600S');
12+
});
13+
1014
test('can print a multi unit string', () => {
1115
expect(
1216
new TimeDuration(4 * 60 * 60 * 1000 + 3 * 60 * 1000 + 5 * 1000 + 689, TimeUnit.Millisecond).toMultiUnitString(
@@ -76,4 +80,14 @@ describe('Time duration', () => {
7680
new TimeDuration(0, TimeUnit.Millisecond)
7781
);
7882
});
83+
84+
test('can parse ISO 8601 duration string', () => {
85+
let duration = TimeDuration.parse('PT1H');
86+
expect(duration.value).toBe(3600);
87+
expect(duration.unit).toBe(TimeUnit.Second);
88+
89+
duration = TimeDuration.parse('PT1H5M');
90+
expect(duration.value).toBe(3900);
91+
expect(duration.unit).toBe(TimeUnit.Second);
92+
});
7993
});

projects/common/src/time/time-duration.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import { parse, toSeconds } from 'iso8601-duration';
12
import { assertUnreachable } from '../utilities/lang/lang-utils';
23
import { TimeUnit } from './time-unit.type';
34

45
export class TimeDuration {
56
private readonly millis: number;
7+
68
public constructor(public readonly value: number, public readonly unit: TimeUnit) {
79
this.toUnitString(); // Fail if unrecognized TimeUnit
810
this.millis = this.normalizeToMillis(value, unit);
@@ -12,10 +14,18 @@ export class TimeDuration {
1214
return this.millis;
1315
}
1416

17+
public static parse(durationString: string): TimeDuration {
18+
return new TimeDuration(toSeconds(parse(durationString)), TimeUnit.Second);
19+
}
20+
1521
public getAmountForUnit(unit: ConvertibleTimeUnit): number {
1622
return this.toMillis() / this.unitInMillis(unit);
1723
}
1824

25+
public toIso8601DurationString(): string {
26+
return `PT${this.toMillis() / 1000}S`;
27+
}
28+
1929
public toMultiUnitString(
2030
smallestUnit: ConvertibleTimeUnit = TimeUnit.Second,
2131
displayZero: boolean = true,

projects/components/src/overlay/overlay.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class OverlayService {
3030
parentInjector: injector,
3131
position: {
3232
type: PopoverPositionType.Fixed,
33-
location: PopoverFixedPositionLocation.RightUnderHeader
33+
location: config.position ?? PopoverFixedPositionLocation.RightUnderHeader
3434
},
3535
data: metadata
3636
});

projects/components/src/overlay/sheet/sheet-overlay.component.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, Inject, Injector, TemplateRef, Type
22
import { IconType } from '@hypertrace/assets-library';
33
import { GLOBAL_HEADER_HEIGHT, LayoutChangeService } from '@hypertrace/common';
44
import { ButtonStyle } from '../../button/button';
5-
import { POPOVER_DATA } from '../../popover/popover';
5+
import { PopoverFixedPositionLocation, POPOVER_DATA } from '../../popover/popover';
66
import { PopoverRef } from '../../popover/popover-ref';
77
import { SheetConstructionData } from '../overlay.service';
88
import { SheetOverlayConfig, SheetSize } from './sheet';
@@ -58,7 +58,7 @@ export class SheetOverlayComponent {
5858
this.size = sheetConfig.size;
5959
this.isComponentSheet = !(sheetConfig.content instanceof TemplateRef);
6060
this.renderer = sheetConfig.content;
61-
this.popoverRef.height(`calc(100vh - ${globalHeaderHeight})`);
61+
this.popoverRef.height(this.getHeightForPopover(globalHeaderHeight, sheetConfig.position));
6262

6363
if (this.size === SheetSize.ResponsiveExtraLarge) {
6464
this.popoverRef.width('60%');
@@ -79,4 +79,8 @@ export class SheetOverlayComponent {
7979
this.visible = false;
8080
this.popoverRef.close();
8181
}
82+
83+
private getHeightForPopover(globalHeaderHeight: string, position?: PopoverFixedPositionLocation): string {
84+
return position === PopoverFixedPositionLocation.Right ? '100vh' : `calc(100vh - ${globalHeaderHeight})`;
85+
}
8286
}

projects/components/src/overlay/sheet/sheet.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import { InjectionToken } from '@angular/core';
22
import { Observable } from 'rxjs';
3+
import { PopoverFixedPositionLocation } from '../../popover/popover';
34
import { OverlayConfig } from './../overlay';
45

56
export interface SheetOverlayConfig<TData = unknown> extends OverlayConfig {
67
size: SheetSize;
78
data?: TData;
9+
position?: PopoverFixedPositionLocation.Right | PopoverFixedPositionLocation.RightUnderHeader;
810
}
911

1012
export const enum SheetSize {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ export class PopoverPositionBuilder {
107107
switch (popoverPosition.location) {
108108
case PopoverFixedPositionLocation.Centered:
109109
return globalPosition.centerHorizontally().centerVertically();
110+
case PopoverFixedPositionLocation.Right:
111+
return globalPosition.right('0').top('0');
110112
case PopoverFixedPositionLocation.RightUnderHeader:
111113
default:
112114
return globalPosition.right('0').top(this.headerHeight ?? '0');

0 commit comments

Comments
 (0)