matrix-dimension/web/app/configs/bridge/hookshot-github/hookshot-github.bridge.component.html
2021-12-06 20:56:13 -07:00

64 lines
3.3 KiB
HTML

<my-bridge-config [bridgeComponent]="this">
<ng-template #bridgeParamsTemplate>
<my-ibox [isCollapsible]="false">
<h5 class="my-ibox-title">
{{'Bridge to Github' | translate}}
</h5>
<div class="my-ibox-content" *ngIf="loadingConnections">
<my-spinner></my-spinner>
</div>
<div class="my-ibox-content" *ngIf="!loadingConnections">
<div *ngIf="isBridged">
<p>{{'This room is bridged to' | translate}} {{bridgedRepoSlug}}</p>
<button type="button" class="btn btn-sm btn-danger" [disabled]="isBusy" (click)="unbridgeRoom()">
{{'Unbridge' | translate}}
</button>
</div>
<div *ngIf="!isBridged && authUrl">
<p>
{{'In order to bridge to Github, you\'ll need to authorize the bridge to access your organization(s). Please click the button below to do so.' | translate}}
</p>
<a [href]="authUrl" rel="noopener" target="_blank" class="btn btn-lg btn-link">
<img src="/assets/img/avatars/github.png" width="35" /> {{'Sign in with GitHub' | translate}}
</a>
</div>
<div *ngIf="!isBridged && orgAuthUrl">
<p>
{{'Almost there! Just need to add the bot to your organizations now.' | translate}}
</p>
<a [href]="orgAuthUrl" rel="noopener" target="_blank" class="btn btn-lg btn-link">
<img src="/assets/img/avatars/github.png" width="35" /> {{'Add to GitHub' | translate}}
</a>
</div>
<div *ngIf="!isBridged && !authUrl && !orgAuthUrl">
<label class="label-block">
{{'Organization' | translate}}
<small *ngIf="orgAddAuthUrl" style="padding-left: 16px">
<a [href]="orgAddAuthUrl" rel="noopener" target="_blank">
{{'Add to another GitHub organization' | translate}}
</a>
</small>
<select class="form-control form-control-sm" [(ngModel)]="orgId"
(change)="loadRepos()" [disabled]="isBusy">
<option *ngFor="let org of orgs" [ngValue]="org">
{{ org }}
</option>
</select>
</label>
<label class="label-block">
{{'Repository' | translate}}
<select class="form-control form-control-sm" [(ngModel)]="repoId" [disabled]="isBusy">
<option *ngFor="let repo of repos" [ngValue]="repo">
{{ repo }}
</option>
</select>
</label>
<button type="button" class="btn btn-sm btn-primary" [disabled]="isBusy" (click)="bridgeRoom()">
Bridge
</button>
</div>
</div>
</my-ibox>
</ng-template>
</my-bridge-config>