2017-08-27 01:26:00 -04:00
|
|
|
import { Component, Input, Output, EventEmitter } from "@angular/core";
|
2017-05-28 02:35:40 -04:00
|
|
|
import { Integration } from "../shared/models/integration";
|
2017-08-27 01:26:00 -04:00
|
|
|
import { overlayConfigFactory } from "ngx-modialog";
|
|
|
|
import { Modal, BSModalContext } from "ngx-modialog/plugins/bootstrap";
|
2017-05-29 00:51:04 -04:00
|
|
|
import { IntegrationService } from "../shared/integration.service";
|
|
|
|
|
|
|
|
export class ConfigModalContext extends BSModalContext {
|
|
|
|
public integration: Integration;
|
|
|
|
public roomId: string;
|
|
|
|
public scalarToken: string;
|
|
|
|
}
|
2017-05-28 02:35:40 -04:00
|
|
|
|
|
|
|
@Component({
|
2017-08-27 01:26:00 -04:00
|
|
|
selector: "my-integration",
|
|
|
|
templateUrl: "./integration.component.html",
|
|
|
|
styleUrls: ["./integration.component.scss"],
|
2017-05-28 02:35:40 -04:00
|
|
|
})
|
|
|
|
export class IntegrationComponent {
|
|
|
|
|
|
|
|
@Input() integration: Integration;
|
2017-05-29 00:51:04 -04:00
|
|
|
@Input() roomId: string;
|
|
|
|
@Input() scalarToken: string;
|
2017-05-28 02:35:40 -04:00
|
|
|
@Output() updated: EventEmitter<any> = new EventEmitter();
|
|
|
|
|
2017-08-27 01:26:00 -04:00
|
|
|
constructor(/*overlay: Overlay, vcRef: ViewContainerRef, */public modal: Modal) {
|
|
|
|
// overlay.defaultViewContainer = vcRef;
|
2017-05-28 02:35:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
public update(): void {
|
|
|
|
this.integration.isEnabled = !this.integration.isEnabled;
|
|
|
|
this.updated.emit();
|
|
|
|
}
|
2017-05-29 00:51:04 -04:00
|
|
|
|
|
|
|
public configureIntegration(): void {
|
|
|
|
this.modal.open(IntegrationService.getConfigComponent(this.integration), overlayConfigFactory({
|
|
|
|
integration: this.integration,
|
|
|
|
roomId: this.roomId,
|
|
|
|
scalarToken: this.scalarToken,
|
|
|
|
isBlocking: false,
|
2017-08-27 01:26:00 -04:00
|
|
|
size: "lg"
|
2017-05-29 00:51:04 -04:00
|
|
|
}, BSModalContext));
|
|
|
|
}
|
2017-05-28 02:35:40 -04:00
|
|
|
}
|