-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1901 from bcgov/develop
Deployment PR - 1337
- Loading branch information
Showing
242 changed files
with
11,646 additions
and
2,440 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,4 @@ playwright-report/ | |
playwright/.cache/ | ||
.~lock.* | ||
|
||
/ora2pg_data | ||
/ora2pg_data |
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
36 changes: 36 additions & 0 deletions
36
...pp/features/admin/tag/tag-category/tag-category-dialog/tag-category-dialog.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,36 @@ | ||
<div mat-dialog-title> | ||
<h4>{{ isEdit ? 'Edit' : 'Create New' }} Category</h4> | ||
</div> | ||
<div mat-dialog-content class="dialog"> | ||
<form (ngSubmit)="onSubmit()" #form="ngForm"> | ||
|
||
<div class="full-width"> | ||
<mat-form-field class="description" appearance="outline"> | ||
<mat-label>Name</mat-label> | ||
<input required matInput id="name" [(ngModel)]="name" name="name" (ngModelChange)="onChange()" [formControl]="nameControl" /> | ||
</mat-form-field> | ||
<div class="warning-section"> | ||
<div class="warning" *ngIf="showNameWarning"> | ||
<mat-icon>info</mat-icon> <b>Warning: </b> Category already exists. Choose a different category name. | ||
</div> | ||
</div> | ||
</div> | ||
|
||
</form> | ||
|
||
<mat-dialog-actions align="end"> | ||
<div class="button-container"> | ||
<button mat-stroked-button color="primary" mat-dialog-close="false">Close</button> | ||
<button | ||
[loading]="isLoading" | ||
(click)="onSubmit()" | ||
mat-flat-button | ||
color="primary" | ||
type="submit" | ||
[disabled]="!form.form.valid" | ||
> | ||
Save | ||
</button> | ||
</div> | ||
</mat-dialog-actions> | ||
</div> |
55 changes: 55 additions & 0 deletions
55
...pp/features/admin/tag/tag-category/tag-category-dialog/tag-category-dialog.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,55 @@ | ||
@use '../../../../../../styles/colors'; | ||
|
||
mat-dialog-title { | ||
margin-bottom: 24px; | ||
} | ||
|
||
.warning-banner { | ||
margin-top: 8px; | ||
background-color: green; | ||
padding: 16px; | ||
|
||
.display-none { | ||
display: none !important; | ||
} | ||
} | ||
|
||
.warning { | ||
padding: 16px; | ||
font-size: 14px; | ||
background-color: rgba(colors.$field-warning-bg-color, 0.5); | ||
border-radius: 8px; | ||
display: flex; | ||
align-items: center; | ||
color: colors.$dark-contrast-text; | ||
margin-top: 8px; | ||
|
||
mat-icon { | ||
color: colors.$dark-contrast-text; | ||
margin-right: 16px; | ||
} | ||
} | ||
|
||
.dialog { | ||
padding: 24px; | ||
|
||
form { | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
row-gap: 24px; | ||
column-gap: 24px; | ||
margin-bottom: 12px; | ||
|
||
.description { | ||
margin-top: 20px; | ||
} | ||
|
||
.full-width { | ||
grid-column: 1/3; | ||
} | ||
|
||
.mat-mdc-form-field { | ||
width: 100%; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...features/admin/tag/tag-category/tag-category-dialog/tag-category-dialog.component.spec.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,36 @@ | ||
import { NO_ERRORS_SCHEMA } from '@angular/core'; | ||
import { ComponentFixture, TestBed } from '@angular/core/testing'; | ||
import { FormsModule, ReactiveFormsModule } from '@angular/forms'; | ||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; | ||
import { TagCategoryService } from '../../../../../services/tag/tag-category/tag-category.service'; | ||
|
||
import { TagCategoryDialogComponent } from './tag-category-dialog.component'; | ||
|
||
describe('TagCategoryDialogComponent', () => { | ||
let component: TagCategoryDialogComponent; | ||
let fixture: ComponentFixture<TagCategoryDialogComponent>; | ||
|
||
beforeEach(async () => { | ||
await TestBed.configureTestingModule({ | ||
imports: [ReactiveFormsModule, FormsModule], | ||
declarations: [TagCategoryDialogComponent], | ||
providers: [ | ||
{ provide: MAT_DIALOG_DATA, useValue: undefined }, | ||
{ provide: MatDialogRef, useValue: {} }, | ||
{ | ||
provide: TagCategoryService, | ||
useValue: {}, | ||
}, | ||
], | ||
schemas: [NO_ERRORS_SCHEMA], | ||
}).compileComponents(); | ||
|
||
fixture = TestBed.createComponent(TagCategoryDialogComponent); | ||
component = fixture.componentInstance; | ||
fixture.detectChanges(); | ||
}); | ||
|
||
it('should create', () => { | ||
expect(component).toBeTruthy(); | ||
}); | ||
}); |
70 changes: 70 additions & 0 deletions
70
.../app/features/admin/tag/tag-category/tag-category-dialog/tag-category-dialog.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,70 @@ | ||
import { Component, Inject } from '@angular/core'; | ||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; | ||
import { TagCategoryDto } from '../../../../../services/tag/tag-category/tag-category.dto'; | ||
import { TagCategoryService } from '../../../../../services/tag/tag-category/tag-category.service'; | ||
import { FormControl } from '@angular/forms'; | ||
|
||
@Component({ | ||
selector: 'app-tag-category-dialog', | ||
templateUrl: './tag-category-dialog.component.html', | ||
styleUrls: ['./tag-category-dialog.component.scss'], | ||
}) | ||
export class TagCategoryDialogComponent { | ||
name = ''; | ||
uuid = ''; | ||
|
||
isLoading = false; | ||
isEdit = false; | ||
showNameWarning = false; | ||
nameControl = new FormControl(); | ||
|
||
constructor( | ||
@Inject(MAT_DIALOG_DATA) public data: TagCategoryDto | undefined, | ||
private dialogRef: MatDialogRef<TagCategoryDialogComponent>, | ||
private tagCategoryService: TagCategoryService, | ||
) { | ||
if (data) { | ||
this.uuid = data.uuid; | ||
this.name = data.name; | ||
} | ||
this.isEdit = !!data; | ||
} | ||
|
||
async onSubmit() { | ||
this.isLoading = true; | ||
|
||
const dto: TagCategoryDto = { | ||
uuid: this.uuid, | ||
name: this.name, | ||
}; | ||
|
||
if (this.isEdit) { | ||
try { | ||
await this.tagCategoryService.update(this.uuid, dto); | ||
} catch (e) { | ||
this.showWarning(); | ||
this.isLoading = false; | ||
return; | ||
} | ||
} else { | ||
try { | ||
await this.tagCategoryService.create(dto); | ||
} catch (e) { | ||
this.showWarning(); | ||
this.isLoading = false; | ||
return; | ||
} | ||
} | ||
this.isLoading = false; | ||
this.dialogRef.close(true); | ||
} | ||
|
||
onChange() { | ||
this.showNameWarning = false; | ||
} | ||
|
||
private showWarning() { | ||
this.showNameWarning = true; | ||
this.nameControl.setErrors({"invalid": true}); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
alcs-frontend/src/app/features/admin/tag/tag-category/tag-category.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,58 @@ | ||
<div class="container"> | ||
<div class="actions-bar"> | ||
<div> | ||
<div class="search-control"> | ||
<mat-form-field> | ||
<mat-label>Enter category</mat-label> | ||
<input matInput placeholder="Category Name" type="text" [(ngModel)]="search" [matAutocomplete]="auto" (ngModelChange)='updateFilter($event)'> | ||
<mat-autocomplete autoActiveFirstOption #auto="matAutocomplete"> | ||
<mat-option *ngFor="let option of filteredOptions" [value]="option"> | ||
{{option}} | ||
</mat-option> | ||
</mat-autocomplete> | ||
</mat-form-field> | ||
</div> | ||
<div class="search-control"> | ||
<button mat-flat-button color="primary" (click)="fetch()">Search</button> | ||
</div> | ||
</div> | ||
<div class="right"> | ||
<button mat-flat-button color="primary" (click)="onCreate()">Create</button> | ||
</div> | ||
</div> | ||
|
||
<table mat-table [dataSource]="categories"> | ||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr> | ||
<tr mat-row *matRowDef="let row; columns: displayedColumns"></tr> | ||
|
||
<ng-container matColumnDef="number"> | ||
<th mat-header-cell *matHeaderCellDef>Number</th> | ||
<td mat-cell *matCellDef="let row">{{ row.number }}</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="name"> | ||
<th mat-header-cell *matHeaderCellDef>Name</th> | ||
<td mat-cell *matCellDef="let row">{{ row.name }}</td> | ||
</ng-container> | ||
|
||
<ng-container matColumnDef="actions"> | ||
<th mat-header-cell *matHeaderCellDef>Actions</th> | ||
<td mat-cell *matCellDef="let row"> | ||
<button class="edit-btn" mat-flat-button (click)="onEdit(row)"> | ||
<mat-icon>edit</mat-icon> | ||
</button> | ||
<button class="delete-btn" mat-flat-button (click)="onDelete(row)"> | ||
<mat-icon>delete</mat-icon> | ||
</button> | ||
</td> | ||
</ng-container> | ||
</table> | ||
|
||
<mat-paginator | ||
[length]="total" | ||
[pageSize]="20" | ||
[pageSizeOptions]="[20, 50, 100]" | ||
(page)="onPageChange($event)" | ||
aria-label="Select page of categories" | ||
></mat-paginator> | ||
</div> |
48 changes: 48 additions & 0 deletions
48
alcs-frontend/src/app/features/admin/tag/tag-category/tag-category.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,48 @@ | ||
@use '../../../../../styles/colors'; | ||
|
||
.container { | ||
.actions-bar { | ||
margin-top: 30px; | ||
display: flex; | ||
justify-content: space-between; | ||
} | ||
|
||
.search-control { | ||
margin-right: 30px; | ||
display: inline-block; | ||
} | ||
|
||
table { | ||
margin: 35px 2px 30px 2px; | ||
box-shadow: 2px 2px 8px 2px #00000040; | ||
} | ||
|
||
.mdc-data-table__table { | ||
min-width: unset!important; | ||
width: 99%; | ||
} | ||
|
||
.delete-btn { | ||
color: colors.$error-color; | ||
width: 48px!important; | ||
min-width: unset!important; | ||
} | ||
|
||
.mat-icon { | ||
margin-right: 1px; | ||
} | ||
|
||
.edit-btn { | ||
color: colors.$primary-color-dark; | ||
width: 48px!important; | ||
min-width: unset!important; | ||
} | ||
|
||
.mat-column-name { | ||
width: 70%; | ||
} | ||
|
||
.mat-column-actions { | ||
width: 30%; | ||
} | ||
} |
Oops, something went wrong.