matrix-dimension/web/app/integration/integration.component.ts

45 lines
1.4 KiB
TypeScript
Raw Normal View History

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