adding a selfhosted slack bridge used to add it a gitter bridge instead
This commit is contained in:
Jona Abdinghoff 2019-12-09 22:51:10 +01:00 committed by GitHub
parent fbf587823c
commit 9a3d6787a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@ import { Component } from "@angular/core";
import { ToasterService } from "angular2-toaster"; import { ToasterService } from "angular2-toaster";
import { DialogRef, ModalComponent } from "ngx-modialog"; import { DialogRef, ModalComponent } from "ngx-modialog";
import { BSModalContext } from "ngx-modialog/plugins/bootstrap"; import { BSModalContext } from "ngx-modialog/plugins/bootstrap";
import { AdminGitterApiService } from "../../../../shared/services/admin/admin-gitter-api.service"; import { AdminSlackApiService } from "../../../../shared/services/admin/admin-slack-api.service";
export class ManageSelfhostedSlackBridgeDialogContext extends BSModalContext { export class ManageSelfhostedSlackBridgeDialogContext extends BSModalContext {
public provisionUrl: string; public provisionUrl: string;
@ -21,7 +21,7 @@ export class AdminSlackBridgeManageSelfhostedComponent implements ModalComponent
public isAdding = false; public isAdding = false;
constructor(public dialog: DialogRef<ManageSelfhostedSlackBridgeDialogContext>, constructor(public dialog: DialogRef<ManageSelfhostedSlackBridgeDialogContext>,
private gitterApi: AdminGitterApiService, private slackApi: AdminSlackApiService,
private toaster: ToasterService) { private toaster: ToasterService) {
this.provisionUrl = dialog.context.provisionUrl; this.provisionUrl = dialog.context.provisionUrl;
this.bridgeId = dialog.context.bridgeId; this.bridgeId = dialog.context.bridgeId;
@ -31,7 +31,7 @@ export class AdminSlackBridgeManageSelfhostedComponent implements ModalComponent
public add() { public add() {
this.isSaving = true; this.isSaving = true;
if (this.isAdding) { if (this.isAdding) {
this.gitterApi.newSelfhosted(this.provisionUrl).then(() => { this.slackApi.newSelfhosted(this.provisionUrl).then(() => {
this.toaster.pop("success", "Slack bridge added"); this.toaster.pop("success", "Slack bridge added");
this.dialog.close(); this.dialog.close();
}).catch(err => { }).catch(err => {
@ -40,7 +40,7 @@ export class AdminSlackBridgeManageSelfhostedComponent implements ModalComponent
this.toaster.pop("error", "Failed to create Slack bridge"); this.toaster.pop("error", "Failed to create Slack bridge");
}); });
} else { } else {
this.gitterApi.updateSelfhosted(this.bridgeId, this.provisionUrl).then(() => { this.slackApi.updateSelfhosted(this.bridgeId, this.provisionUrl).then(() => {
this.toaster.pop("success", "Slack bridge updated"); this.toaster.pop("success", "Slack bridge updated");
this.dialog.close(); this.dialog.close();
}).catch(err => { }).catch(err => {