This repository has been archived by the owner on Apr 12, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(admin): #1656 added webhook creation in admin page"
- Loading branch information
1 parent
98adb28
commit e6fdadc
Showing
11 changed files
with
252 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
web/src/app/admin/conifgure-webhooks/conifgure-webhooks.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<div class="webhooks"> | ||
<div fxLayout="row" fxLayout.lt-lg="column" fxLayoutAlign.lt-lg="space-between scretch" fxLayoutAlign="space-between center"> | ||
<mat-card class="webhooks__webhooks-card" fxFlex="100%"> | ||
<mat-card-header> | ||
<div class="webhooks__webhooks-card__header"> | ||
<mat-icon class="material-icons-outlined">dashboard</mat-icon> | ||
</div> | ||
<mat-card-title class="webhooks__webhooks-card__title"> Configure webhooks </mat-card-title> | ||
<mat-card-subtitle class="webhooks__webhooks-card__title__subtitle"> Create webhooks </mat-card-subtitle> | ||
</mat-card-header> | ||
|
||
<mat-card-content class="webhooks__webhooks-card__content" *ngIf="repositories"> | ||
<table mat-table [dataSource]="repositories" class="webhooks__webhooks-card__content__table"> | ||
|
||
<ng-container matColumnDef="fullName"> | ||
<th mat-header-cell *matHeaderCellDef>Full Name</th> | ||
<td mat-cell *matCellDef="let element"> | ||
<div fxLayout.xs="column" fxLayoutAlign.xs="start start" class="webhooks__webhooks-card__content__table__title"> | ||
{{element.fullName}} | ||
</div> | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="projectLength"> | ||
<th mat-header-cell *matHeaderCellDef>Project Count </th> | ||
<td mat-cell *matCellDef="let element" class="webhooks__webhooks-card__content__table__description"> | ||
<div *ngIf="element.projects" class="webhooks__webhooks-card__content__table__description"> | ||
{{ element.projects.length }} | ||
</div> | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="webhookUpdatedOn"> | ||
<th mat-header-cell *matHeaderCellDef>Webhook last updated </th> | ||
<td mat-cell *matCellDef="let element" class="webhooks__webhooks-card__content__table__description"> | ||
<div *ngIf="element.webhook" class="webhooks__webhooks-card__content__table__description"> | ||
{{ element.webhook.updatedOn.toDate() | timeAgo }} | ||
</div> | ||
</td> | ||
</ng-container> | ||
|
||
|
||
<ng-container matColumnDef="updatedAt"> | ||
<th mat-header-cell *matHeaderCellDef>Last updated </th> | ||
<td mat-cell *matCellDef="let element" class="webhooks__webhooks-card__content__table__description"> | ||
<div *ngIf="element.updatedOn" class="webhooks__webhooks-card__content__table__description"> | ||
{{ element.updatedOn.toDate() | timeAgo }} | ||
</div> | ||
</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="actions"> | ||
<th mat-header-cell *matHeaderCellDef> Action </th> | ||
<td mat-cell *matCellDef="let element" class="webhooks__webhooks-card__content__table__description"> | ||
<button mat-stroked-button type="submit" color="warn" (click)="createWebhooks([element.uid])">Create Webhook </button> | ||
</td> | ||
</ng-container> | ||
|
||
<tr mat-header-row *matHeaderRowDef="displayedColumns;"></tr> | ||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr> | ||
</table> | ||
</mat-card-content> | ||
</mat-card> | ||
</div> | ||
</div> |
71 changes: 71 additions & 0 deletions
71
web/src/app/admin/conifgure-webhooks/conifgure-webhooks.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@import '../../../styles.scss'; | ||
@import '../../../assets/scss/variable'; | ||
|
||
.webhooks { | ||
padding: 20px 30px; | ||
@include pageContainer; | ||
|
||
&__title { | ||
@include pageHeader; | ||
} | ||
|
||
&__webhooks-card { | ||
@include cardContainer; | ||
|
||
&__header { | ||
@include header-icon; | ||
background-color: $purple-color; | ||
box-shadow: 0px 3px 6px $purple-shadow; | ||
} | ||
|
||
&__title { | ||
@include title; | ||
|
||
&__subtitle { | ||
@include subtitle; | ||
} | ||
} | ||
|
||
&__content { | ||
padding: 0; | ||
display: block; | ||
overflow: hidden; | ||
@include tableContainer; | ||
|
||
&__table { | ||
width: 100%; | ||
padding: 0; | ||
|
||
&__avatar { | ||
height: 35px; | ||
border-radius: 50%; | ||
object-fit: cover; | ||
border: 1px solid $orange-color; | ||
margin-right: 20px; | ||
} | ||
|
||
@media (max-width: $breakpoint-xs) { | ||
&__avatar { | ||
margin-right: 10px; | ||
} | ||
} | ||
|
||
&__description { | ||
margin-right: 5px; | ||
} | ||
|
||
&__title { | ||
min-width: 5vw; | ||
padding-right: 10px; | ||
} | ||
|
||
&__time { | ||
color: $dark-grey-color; | ||
font-size: 14px; | ||
font-weight: lighter; | ||
@include ellipsisText; | ||
} | ||
} | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
web/src/app/admin/conifgure-webhooks/conifgure-webhooks.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Core modules | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
// Third party modules | ||
import { Subscription } from 'rxjs'; | ||
|
||
// DashboardHub Model and services | ||
import { RepositoryService } from '@core/services/index.service'; | ||
import { RepositoryModel, IRepository } from '@shared/models/index.model'; | ||
import { take } from 'rxjs/operators'; | ||
|
||
/** | ||
* Configure webhooks component | ||
*/ | ||
@Component({ | ||
selector: 'dashboard-conifgure-webhooks', | ||
templateUrl: './conifgure-webhooks.component.html', | ||
styleUrls: ['./conifgure-webhooks.component.scss'], | ||
}) | ||
export class ConifgureWebhooksComponent implements OnInit { | ||
|
||
public displayedColumns: string[] = ['fullName', 'projectLength', 'webhookUpdatedOn', 'updatedAt', 'actions']; | ||
public userSubscription: Subscription; | ||
public repositories: RepositoryModel[]; | ||
|
||
/** | ||
* Life cycle method | ||
* @param repositoryService RepositoryService | ||
*/ | ||
constructor( | ||
private repositoryService: RepositoryService | ||
) { } | ||
|
||
/** | ||
* Life cycle init method | ||
*/ | ||
ngOnInit(): void { | ||
this.repositoryService.findAllRepositories().subscribe((repositories: RepositoryModel[]) => this.repositories = repositories); | ||
} | ||
|
||
/** | ||
* Create webhook | ||
*/ | ||
createWebhooks(repos: IRepository[]): void { | ||
this.repositoryService.createGitWebhooks(repos) | ||
.pipe(take(1)) | ||
.subscribe(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters