Skip to content

Commit c86a419

Browse files
feat: i-frame component created
1 parent 3562d56 commit c86a419

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

projects/observability/src/public-api.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,3 +388,11 @@ export * from './shared/components/bar-gauge/bar-gauge.module';
388388

389389
// Time Range utils
390390
export * from './shared/utils/time-range';
391+
392+
// Custom Dashboard
393+
export * from './pages/custom-dashboard/custom-dashboard.component';
394+
export * from './pages/custom-dashboard/custom-dashboard.module';
395+
396+
// I-frame
397+
export * from './shared/components//i-frame/i-frame.component';
398+
export * from './shared/components/i-frame/i-frame.module';

projects/observability/src/shared/components/i-frame/i-frame.component.scss

Whitespace-only changes.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { ComponentFixture, TestBed } from '@angular/core/testing';
2+
3+
import { IFrameComponent } from './i-frame.component';
4+
5+
describe('IFrameComponent', () => {
6+
let component: IFrameComponent;
7+
let fixture: ComponentFixture<IFrameComponent>;
8+
9+
beforeEach(async () => {
10+
await TestBed.configureTestingModule({
11+
declarations: [IFrameComponent]
12+
}).compileComponents();
13+
});
14+
15+
beforeEach(() => {
16+
fixture = TestBed.createComponent(IFrameComponent);
17+
component = fixture.componentInstance;
18+
fixture.detectChanges();
19+
});
20+
21+
it('should create', () => {
22+
expect(component).toBeTruthy();
23+
});
24+
});
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { ChangeDetectionStrategy, Component, Input, OnInit } from '@angular/core';
2+
import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser';
3+
4+
@Component({
5+
selector: 'ht-i-frame',
6+
changeDetection: ChangeDetectionStrategy.OnPush,
7+
template: `<iframe width="{{ this.width }}" height="{{ this.height }}" frameBorder="0" [src]="urlSafe"></iframe>`,
8+
styleUrls: ['./i-frame.component.scss']
9+
})
10+
export class IFrameComponent implements OnInit {
11+
@Input() public source: string = 'https://angular.io/api/router/RouterLink';
12+
@Input() public title?: string;
13+
@Input() public width?: string = '100%';
14+
@Input() public height?: string = '100%';
15+
@Input() public allow?: boolean;
16+
17+
public urlSafe?: SafeResourceUrl;
18+
public constructor(public sanitizer: DomSanitizer) {}
19+
20+
public ngOnInit(): void {
21+
this.urlSafe = this.sanitizer.bypassSecurityTrustResourceUrl(this.source);
22+
}
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { CommonModule } from '@angular/common';
2+
import { NgModule } from '@angular/core';
3+
import { IFrameComponent } from './i-frame.component';
4+
5+
@NgModule({
6+
declarations: [IFrameComponent],
7+
imports: [CommonModule],
8+
exports: [IFrameComponent]
9+
})
10+
export class IFrameModule {}

0 commit comments

Comments
 (0)