Skip to content

Commit

Permalink
Add Angular Components For Modules And Errors . ( Basic )
Browse files Browse the repository at this point in the history
  • Loading branch information
wmadzha committed Jan 10, 2020
1 parent c1bb2ee commit 76905b5
Show file tree
Hide file tree
Showing 23 changed files with 720 additions and 27 deletions.
2 changes: 1 addition & 1 deletion ErikaWine.Api.Results/ModuleResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public IActionResult Get(string projectid)
{
try
{
return new OkObjectResult(ErikaEngine.ErrorService.Get(projectid));
return new OkObjectResult(ErikaEngine.ModuleService.Get(projectid));
}
catch (Exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ export class AddErrorHttpDTO {
}
export class DeleteErrorHttpDTO {
public ErrorId: string;
constructor(errorid:string)
{
this.ErrorId = errorid;
}
}
export class GetErrorHttpDTO {
public errorNumber: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<nb-card >
<nb-card-body>
<h6>Define New Error To | {{GetModuleHttpDTO.moduleName}} | {{GetProjectHttpDTO.projectName}}
<button nbButton status="danger" style="float: right;" size='tiny' (click)="cancel()">X</button>
</h6>
<hr>
<div style="width: 600px !important;height:250px !important;">
<div class="row">
<div class="col-md-6">
Error Code
<hr>
<div class="input-group">
<input shape="semi-round"
[(ngModel)]='AddErrorHttpDTO.ErrorCode'
nbInput type="text" class="form-control" placeholder="Error Code" />
</div>
<hr>
Error Message
<hr>
<div class="input-group">
<textarea shape="semi-round" cols="1" rows="3"
[(ngModel)]='AddErrorHttpDTO.ErroMessage'
nbInput type="text" class="form-control" placeholder="Error Message" ></textarea>
</div>
<hr>
</div>
<div class="col-md-6">
Error Description
<hr>
<div class="input-group">
<textarea shape="semi-round"
[(ngModel)]='AddErrorHttpDTO.ErrorDescription'
nbInput type="text" class="form-control" cols="1" rows="8" placeholder="Error Description" ></textarea>
</div>
<hr>
</div>
<div class="col-md-12">
<div>
<button nbButton size='small' (click)='Add()' status='success'>
Add New Error
</button>
<button nbButton size='small' (click)="cancel()" style="margin-left: 10px;" status='danger'>
Cancel
</button>
</div>
</div>
</div>
</div>
</nb-card-body>
</nb-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { Component, Input ,OnInit } from '@angular/core';
import { NbDialogRef } from '@nebular/theme';
import { AddErrorHttpDTO } from '../../dto/erikawineerrordto';
import { GetProjectHttpDTO } from '../../dto/erikawineprojectdto';
import {GetModuleHttpDTO} from '../../dto/erikawinemodulesdto';
import { ErrorHttpService } from '../../services/httpservices/errorhttpservice';
@Component({
selector: 'add-error',
templateUrl: './adderror.html',
styles: [`
nb-card {
transform: translate3d(0, 0, 0);
}
`],
})
export class AddErrorComponent implements OnInit {
@Input() GetProjectHttpDTO:GetProjectHttpDTO;
@Input() GetModuleHttpDTO:GetModuleHttpDTO;
public AddErrorHttpDTO:AddErrorHttpDTO;
constructor(
protected ref: NbDialogRef<AddErrorComponent>,
private svc:ErrorHttpService,
)
{
}
ngOnInit()
{
this.AddErrorHttpDTO = new AddErrorHttpDTO(this.GetModuleHttpDTO.modulesId);
}
cancel() {
this.ref.close();
}
submit(name) {
this.ref.close(name);
}
Loader:boolean = false;
Add()
{
this.Loader = true;
this.svc.Add(this.AddErrorHttpDTO).subscribe(data=>{
this.Loader = false;
this.submit('Refresh');
})
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<nb-card >
<nb-card-body>
<h6>Update Error | {{GetModuleHttpDTO.moduleName}} | {{GetProjectHttpDTO.projectName}}
<button nbButton status="danger" style="float: right;" size='tiny' (click)="cancel()">X</button>
</h6>
<hr>
<div style="width: 600px !important;height:250px !important;">
<div class="row">
<div class="col-md-6">
Error Code
<hr>
<div class="input-group">
<input shape="semi-round"
[(ngModel)]='UpdateErrorHttpDTO.ErrorCode'
nbInput type="text" class="form-control" placeholder="Error Code" />
</div>
<hr>
Error Message
<hr>
<div class="input-group">
<textarea shape="semi-round" cols="1" rows="3"
[(ngModel)]='UpdateErrorHttpDTO.ErroMessage'
nbInput type="text" class="form-control" placeholder="Error Message" ></textarea>
</div>
<hr>
</div>
<div class="col-md-6">
Error Description
<hr>
<div class="input-group">
<textarea shape="semi-round"
[(ngModel)]='UpdateErrorHttpDTO.ErrorDescription'
nbInput type="text" class="form-control" cols="1" rows="8" placeholder="Error Description" ></textarea>
</div>
<hr>
</div>
<div class="col-md-12">
<div>
<button nbButton size='small' (click)='Add()' status='success'>
Update Error
</button>
<button nbButton size='small' (click)="cancel()" style="margin-left: 10px;" status='danger'>
Cancel
</button>
</div>
</div>
</div>
</div>
</nb-card-body>
</nb-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Component, Input ,OnInit } from '@angular/core';
import { NbDialogRef } from '@nebular/theme';
import { GetModuleHttpDTO} from '../../dto/erikawinemodulesdto';
import { GetProjectHttpDTO } from '../../dto/erikawineprojectdto';
import { ErrorHttpService } from '../../services/httpservices/errorhttpservice';
import { UpdateErrorHttpDTO ,GetErrorHttpDTO } from '../../dto/erikawineerrordto';
@Component({
selector: 'edit-error',
templateUrl: './editerror.html',
styles: [`
nb-card {
transform: translate3d(0, 0, 0);
}
`],
})
export class EditErrorComponent implements OnInit {
@Input() GetProjectHttpDTO:GetProjectHttpDTO;
@Input() GetModuleHttpDTO:GetModuleHttpDTO;
@Input() GetErrorHttpDTO:GetErrorHttpDTO;
public UpdateErrorHttpDTO:UpdateErrorHttpDTO;
constructor(
protected ref: NbDialogRef<EditErrorComponent>,
private svc:ErrorHttpService,
)
{
}
ngOnInit()
{
this.UpdateErrorHttpDTO = new UpdateErrorHttpDTO(this.GetErrorHttpDTO);
}
cancel() {
this.ref.close();
}
submit(name) {
this.ref.close(name);
}
Loader:boolean = false;
Edit()
{
this.Loader = true;
this.svc.Update(this.UpdateErrorHttpDTO).subscribe(data=>{
this.Loader = false;
this.submit('Refresh');
})
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ import { NbMenuModule } from '@nebular/theme';

import { ThemeModule } from '../../@theme/theme.module';

import {EditErrorComponent} from '../errormodule/editerror/editerror';
import {AddErrorComponent} from '../errormodule/adderror/adderror';
import {ErikaWineUIModules} from '../shareduimodules/erikawinesharedmodules';
@NgModule({
imports: [
ThemeModule,
NbMenuModule,
...ErikaWineUIModules,
],
declarations: [
EditErrorComponent,
AddErrorComponent,
],
entryComponents:[
EditErrorComponent,
AddErrorComponent,
]
})
export class ErrorModule {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

<nb-card >
<nb-card-body>
<h6>Error List | {{GetModuleHttpDTO.moduleName}} | {{GetProjectHttpDTO.projectName}}
<button nbButton status="danger" style="float: right;" size='tiny' (click)="cancel()">X</button>
</h6>
<hr>
<div style="width: 1000px !important;height:450px !important;">
<button style="margin-bottom: 20px;" nbButton size='small' (click)='Add()' status='primary'>
Add New Error
</button>
<div *ngIf='GetErrorHttpDTO.length === 0'>
<span style="margin-right: 10px;padding-left: 10px;padding-right: 10px;" class="badge badge-warning"> ! </span>
opps looks like there is no error defined found in this module
</div>
<div *ngIf='GetErrorHttpDTO.length !== 0'>
<div class="row">
<div class='col-md-2'>
Error Code
</div>
<div class='col-md-8'>
Error Message
</div>
<div class='col-md-2'>
</div>
<div class='col-md-12'>
<hr>
</div>
</div>
<div class="row" *ngFor='let errors of GetErrorHttpDTO'>
<div class='col-md-2'>
{{errors.errorCode}}
</div>
<div class='col-md-8'>
{{errors.erroMessage}}
</div>
<div class='col-md-2'>
<button style="margin-left: 10px;" (click)='Edit(errors)' nbButton size='tiny' status='info'>
Edit
</button>
<button style="margin-left: 10px;" nbButton size='tiny' (click)='Delete(errors)' status='danger'>
Delete
</button>
</div>
<div class='col-md-12'>
<hr>
</div>
</div>
</div>
</div>
<br>
</nb-card-body>
</nb-card>
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import { Component, OnInit ,Input } from '@angular/core';
import {ErrorHttpService} from '../../services/httpservices/errorhttpservice';
import { NbDialogService , NbDialogRef } from '@nebular/theme';
import {GetModuleHttpDTO}from '../../dto/erikawinemodulesdto';
import {GetErrorHttpDTO, DeleteErrorHttpDTO} from '../../dto/erikawineerrordto';
import {GetProjectHttpDTO} from '../../dto/erikawineprojectdto';
import { AddErrorComponent }from '../adderror/adderror';
import {EditErrorComponent} from '../editerror/editerror';
@Component({
selector: 'error-list',
templateUrl: './errorlist.html',
})
export class ErrorListComponent implements OnInit {
@Input() GetProjectHttpDTO:GetProjectHttpDTO;
@Input() GetModuleHttpDTO:GetModuleHttpDTO;
DeleteErrorHttpDTO:DeleteErrorHttpDTO;
constructor(
private svc:ErrorHttpService,
private NbDialogService:NbDialogService,
protected ref: NbDialogRef<AddErrorComponent>,
)
{
}
ngOnInit(){
this.Get();

}
cancel() {
this.ref.close();
}
GetErrorHttpDTO:GetErrorHttpDTO[]=[];
Get()
{
this.svc.Get('/api/error/klg4kK8O2JfyXLWDlcEpC9UtqJjq87naHEWXKxtR6gOd9?moduleid='+this.GetModuleHttpDTO.modulesId).subscribe(data=>{
this.GetErrorHttpDTO = data;
})
}
Add()
{
this.NbDialogService.open(AddErrorComponent, {
context: {
GetProjectHttpDTO:this.GetProjectHttpDTO,
GetModuleHttpDTO:this.GetModuleHttpDTO,
},
closeOnBackdropClick: false,
}).onClose.subscribe(action => {
if (action === "Refresh") {
this.Get();
}
});
}
Details(dto:GetErrorHttpDTO)
{
// this.NbDialogService.open(ProjectDetailsComponent, {
// context: {
// GetProjectHttpDTO:dto,
// },
// closeOnBackdropClick: false,
// }).onClose.subscribe(action => {
// if (action === "Refresh") {
// this.Get();
// }
// });

}
Edit(dto:GetErrorHttpDTO)
{
this.NbDialogService.open(EditErrorComponent, {
context: {
GetProjectHttpDTO:this.GetProjectHttpDTO,
GetModuleHttpDTO:this.GetModuleHttpDTO,
GetErrorHttpDTO:dto

},
closeOnBackdropClick: false,
}).onClose.subscribe(action => {
if (action === "Refresh") {
this.Get();
}
});
}
Delete(dto:GetErrorHttpDTO)
{
this.DeleteErrorHttpDTO = new DeleteErrorHttpDTO(dto.errorId);
this.svc.Delete(this.DeleteErrorHttpDTO).subscribe(
data=>{
this.Get();
}
)
}
}
Loading

0 comments on commit 76905b5

Please sign in to comment.