Skip to content

Commit

Permalink
Merge pull request #6 from squzy/feat/notification
Browse files Browse the repository at this point in the history
Feat/notification
  • Loading branch information
PxyUp committed Jul 19, 2020
2 parents 869e933 + 4afbae2 commit 07d829f
Show file tree
Hide file tree
Showing 36 changed files with 1,092 additions and 16 deletions.
7 changes: 7 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ const routes: Routes = [
loadChildren: () =>
import('./modules/incidents/incidents.module').then((m) => m.IncidentsModule),
},
{
path: 'notification-methods',
loadChildren: () =>
import('./modules/notifications/notification.module').then(
(m) => m.NotificationMethodsModule,
),
},
];

@NgModule({
Expand Down
4 changes: 4 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export class AppComponent implements OnInit, OnDestroy {
path: 'incidents',
text: 'MENU.INCIDNETS',
},
{
path: 'notification-methods',
text: 'MENU.NOTIFICATION_METHODS',
},
];

private readonly STORAGE_KEY = 'LANG';
Expand Down
2 changes: 2 additions & 0 deletions src/app/modules/agents/agents.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { ReactiveFormsModule } from '@angular/forms';
import { MatInputModule } from '@angular/material/input';
import { TranslateModule } from '@ngx-translate/core';
import { RulesModule } from 'src/app/shared/modules/rules/rules.module';
import { NotificationListModule } from 'src/app/shared/modules/notifications/notifications-list.module';

const routes: Routes = [
{
Expand Down Expand Up @@ -51,6 +52,7 @@ const routes: Routes = [
ReactiveFormsModule,
MatInputModule,
RulesModule,
NotificationListModule,
TranslateModule.forChild({}),
],
declarations: [AgentsComponent],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
<sqd-rule-list [ownerId]="id" [ownerType]="AGENT_TYPE"></sqd-rule-list>
</mat-card-content>
</mat-card>
<mat-card class="content">
<mat-card-header>
<mat-card-title>{{ 'MODULES.CHECKERS.PAGE.NOTIFICATION_METHODS_LIST' | translate }}</mat-card-title>
</mat-card-header>
<mat-card-content>
<sqd-notifcation-list [ownerId]="id" [ownerType]="AGENT_TYPE"></sqd-notifcation-list>
</mat-card-content>
</mat-card>
</div>
</ng-container>

Expand Down
2 changes: 2 additions & 0 deletions src/app/modules/applications/applications.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { QueryParamModule } from '@ngqp/core';
import { ApplicationsService } from './services/applications.service';
import { TranslateModule } from '@ngx-translate/core';
import { RulesModule } from 'src/app/shared/modules/rules/rules.module';
import { NotificationListModule } from 'src/app/shared/modules/notifications/notifications-list.module';

const routes: Routes = [
{
Expand Down Expand Up @@ -85,6 +86,7 @@ const routes: Routes = [
MatSidenavModule,
QueryParamModule,
RulesModule,
NotificationListModule,
TranslateModule.forChild({}),
],
entryComponents: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,25 @@
</ng-template>
</mat-card>

<mat-card>
<mat-card-header>
<mat-card-title>{{ 'MODULES.CHECKERS.PAGE.INCIDENT_RULES' | translate }}</mat-card-title>
</mat-card-header>
<mat-card-content>
<sqd-rule-list [ownerId]="currentId$ | async" [ownerType]="APPLICATION_TYPE"></sqd-rule-list>
</mat-card-content>
</mat-card>
<ng-container *ngIf="currentId$ | async as id">
<mat-card>
<mat-card-header>
<mat-card-title>{{ 'MODULES.CHECKERS.PAGE.INCIDENT_RULES' | translate }}</mat-card-title>
</mat-card-header>
<mat-card-content>
<sqd-rule-list [ownerId]="id" [ownerType]="APPLICATION_TYPE"></sqd-rule-list>
</mat-card-content>
</mat-card>

<mat-card>
<mat-card-header>
<mat-card-title>{{ 'MODULES.CHECKERS.PAGE.NOTIFICATION_METHODS_LIST' | translate }}</mat-card-title>
</mat-card-header>
<mat-card-content>
<sqd-notifcation-list [ownerId]="id" [ownerType]="APPLICATION_TYPE"></sqd-notifcation-list>
</mat-card-content>
</mat-card>
</ng-container>

<mat-card>
<mat-card-header>
Expand Down
2 changes: 2 additions & 0 deletions src/app/modules/checkers/checkers.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { SchedulerSnapshotComponent } from './components/checker/snapshot/snapsh
import { MatSelectModule } from '@angular/material/select';
import { TranslateModule } from '@ngx-translate/core';
import { RulesModule } from 'src/app/shared/modules/rules/rules.module';
import { NotificationListModule } from 'src/app/shared/modules/notifications/notifications-list.module';

const routes: Routes = [
{
Expand Down Expand Up @@ -61,6 +62,7 @@ const routes: Routes = [
MatCheckboxModule,
MatProgressSpinnerModule,
RulesModule,
NotificationListModule,
TranslateModule.forChild({}),
],
providers: [CheckersService],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@
</mat-card-content>
</mat-card>

<mat-card>
<mat-card-header>
<mat-card-title>{{ 'MODULES.CHECKERS.PAGE.NOTIFICATION_METHODS_LIST' | translate }}</mat-card-title>
</mat-card-header>
<mat-card-content>
<sqd-notifcation-list [ownerId]="currentId$ | async" [ownerType]="SCHDEDULER_TYPE"></sqd-notifcation-list>
</mat-card-content>
</mat-card>

<mat-card>
<mat-card-content class="flex">
<form [formGroup]="filterForm">
Expand Down
1 change: 1 addition & 0 deletions src/app/modules/checkers/components/list/list.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class ListComponent implements OnInit, OnDestroy {

ngOnDestroy() {
this.destroyed$.next();
this.destroyed$.complete();
}

clickRow(row) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<pre>{{data.Method | json}}</pre>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Component, ChangeDetectionStrategy, Inject } from '@angular/core';
import { MAT_BOTTOM_SHEET_DATA } from '@angular/material/bottom-sheet';
import { NotificationMethod } from 'src/app/shared/interfaces/notifications.interface';

@Component({
selector: 'sqd-notification-method-config',
templateUrl: './config.component.html',
styleUrls: ['./config.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SchedulerConfigComponent {
constructor(@Inject(MAT_BOTTOM_SHEET_DATA) public data: NotificationMethod) {}
}
92 changes: 92 additions & 0 deletions src/app/modules/notifications/components/list/list.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<mat-card>
<mat-card-header>
<button
mat-stroked-button
(click)="addMethod()"
>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.ADD' | translate }}</button>
<button
[disabled]="!selection.selected.length"
mat-stroked-button
(click)="activateSelected()"
>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.ACTIVATE' | translate }}</button>
<button
[disabled]="!selection.selected.length"
mat-stroked-button
(click)="deactivateSelected()"
>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.DEACTIVATE' | translate }}</button>
<button
[disabled]="!selection.selected.length"
mat-stroked-button
(click)="removeSelected()"
>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.REMOVE' | translate }}</button>
</mat-card-header>
<mat-card-content>
<mat-form-field>
<mat-label>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.FILTER' | translate }}</mat-label>
<input matInput #filterInput>
</mat-form-field>
<table mat-table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="select">
<th mat-header-cell *matHeaderCellDef>
<mat-checkbox
(change)="$event ? masterToggle() : null"
[checked]="selection.hasValue() && isAllSelected()"
[indeterminate]="selection.hasValue() && !isAllSelected()"
></mat-checkbox>
</th>
<td mat-cell *matCellDef="let element">
<mat-checkbox
(click)="$event.stopPropagation()"
(change)="$event ? selection.toggle(element) : null"
[checked]="selection.isSelected(element)"
></mat-checkbox>
</td>
</ng-container>

<ng-container matColumnDef="ID">
<th
mat-header-cell
*matHeaderCellDef
>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.ID' | translate }}</th>
<td mat-cell *matCellDef="let element">{{ element.id }}</td>
</ng-container>

<ng-container matColumnDef="name">
<th
mat-header-cell
*matHeaderCellDef
mat-sort-header
>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.NAME' | translate }}</th>
<td mat-cell *matCellDef="let element">{{ element.name ? element.name : '-' }}</td>
</ng-container>

<ng-container matColumnDef="type">
<th
mat-header-cell
*matHeaderCellDef
mat-sort-header
>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.TYPE' | translate }}</th>
<td
mat-cell
*matCellDef="let element"
>{{ 'ENUMS.NOTIFICATION_METHODS.TYPE.' + element.type | translate }}</td>
</ng-container>

<ng-container matColumnDef="status">
<th
mat-header-cell
*matHeaderCellDef
mat-sort-header
>{{ 'MODULES.NOTIFICATION_METHODS.TABLE.STATUS' | translate }}</th>
<td
mat-cell
*matCellDef="let element"
>{{ 'ENUMS.NOTIFICATION_METHODS.STATUS.' + element.status | translate }}</td>
</ng-container>

<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns" (click)="clickRow(row)"></tr>
</table>
<mat-paginator [pageSizeOptions]="[5, 10, 20]" showFirstLastButtons></mat-paginator>
</mat-card-content>
</mat-card>
29 changes: 29 additions & 0 deletions src/app/modules/notifications/components/list/list.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$padding: 40px;

:host {
padding: $padding;
display: flex;
justify-content: center;
flex-direction: column;
mat-card {
mat-card-header::ng-deep {
width: 100%;
display: flex;
justify-content: space-around;
.mat-card-header-text {
display: none;
}
}
}
mat-form-field {
width: 100%;
}
table {
.mat-row {
&:hover {
cursor: pointer;
background: #b4b4b433;
}
}
}
}
Loading

0 comments on commit 07d829f

Please sign in to comment.