From 16a9f0745bd9dbef5c3b08c4983a638a1558cbc6 Mon Sep 17 00:00:00 2001 From: mhatvan Date: Tue, 27 Aug 2019 23:24:01 +0200 Subject: [PATCH] * add .vscode/ custom workspace settings to .gitignore * ensure consistent single blank line between methods and single final newline * remove unnecessary comments in app.component.html * move interfaces to its own *.model.ts files * change various variables to conform to camel case Signed-off-by: mhatvan --- .gitignore | 3 ++ .../grid.component.html | 8 ++--- .../Param_SourceName_Kebab/grid.component.ts | 21 +++++++----- .../Param_SourceName_Kebab/grid.model.ts | 5 +++ .../Param_SourceName_Kebab/grid.service.ts | 8 +---- .../list-form/list-form.component.ts | 1 + .../list-item/list-item.component.ts | 4 +-- .../list.component.html | 6 ++-- .../Param_SourceName_Kebab/list.component.ts | 33 ++++++++++--------- .../Param_SourceName_Kebab/list.model.ts | 4 +++ .../Param_SourceName_Kebab/list.service.ts | 10 +++--- .../master-detail-page.component.ts | 4 +-- .../master-detail.component.ts | 22 ++++++------- .../master-detail.model.ts | 10 ++++++ .../master-detail.service.ts | 12 +------ .../AngularDefault/src/app/app.component.html | 8 +---- .../AngularDefault/src/app/app.component.ts | 1 + .../warning-message.component.ts | 4 +-- 18 files changed, 85 insertions(+), 79 deletions(-) create mode 100644 templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.model.ts create mode 100644 templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.model.ts create mode 100644 templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.model.ts diff --git a/.gitignore b/.gitignore index b0a5aa9ac..0bfebd177 100644 --- a/.gitignore +++ b/.gitignore @@ -291,6 +291,9 @@ paket-files/ .idea/ *.sln.iml +# VSCode custom workspace settings +.vscode/ + # CodeRush .cr/ diff --git a/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.component.html b/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.component.html index 5980f585b..394424e24 100644 --- a/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.component.html +++ b/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.component.html @@ -21,15 +21,15 @@ [key]="textAssets.id" [header]="textAssets.title" [description]="textAssets.shortDescription" - [image]="GreyBox" + [image]="greyBox" > diff --git a/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.component.ts b/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.component.ts index d75755008..643813de0 100644 --- a/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.component.ts +++ b/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; -import { GridService, IGridTextItem } from './grid.service'; +import { GridService } from './grid.service'; +import { IGridTextItem } from './grid.model'; @Component({ selector: 'app-grid', @@ -9,9 +10,9 @@ import { GridService, IGridTextItem } from './grid.service'; }) export class GridComponent implements OnInit { - GreyBox = require('../../../assets/GreyBox.svg') as string; - WarningMessageText = 'Request to get grid text failed:'; - WarningMessageOpen = false; + greyBox = require('../../../assets/GreyBox.svg') as string; + warningMessageText = 'Request to get grid text failed:'; + warningMessageOpen = false; gridTextAssets: IGridTextItem[] = [ { description: 'example1', @@ -24,21 +25,23 @@ export class GridComponent implements OnInit { id: 1 } ]; + constructor(private gridService: GridService) { } ngOnInit() { this.gridService.getGridItems().subscribe( - result => { + (result: IGridTextItem[]) => { this.gridTextAssets = result; }, error => { - this.WarningMessageOpen = true; - this.WarningMessageText = `Request to get grid text failed: ${error}`; + this.warningMessageOpen = true; + this.warningMessageText = `Request to get grid text failed: ${error}`; } ); } + handleWarningClose(open: boolean) { - this.WarningMessageOpen = open; - this.WarningMessageText = ''; + this.warningMessageOpen = open; + this.warningMessageText = ''; } } diff --git a/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.model.ts b/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.model.ts new file mode 100644 index 000000000..82d965c8b --- /dev/null +++ b/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.model.ts @@ -0,0 +1,5 @@ +export interface IGridTextItem { + description: string; + header: string; + id: number; +} diff --git a/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.service.ts b/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.service.ts index 4bdd4c327..935914dcb 100644 --- a/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.service.ts +++ b/templates/Web/Pages/Angular.Grid/src/app/app-shell/Param_SourceName_Kebab/grid.service.ts @@ -3,6 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { environment } from '../../../environments/environment'; +import { IGridTextItem } from './grid.model'; @Injectable({ providedIn: 'root' @@ -17,10 +18,3 @@ export class GridService { return this.http.get(this.listUrl); } } - - -export interface IGridTextItem { - description: string; - header: string; - id: number; -} diff --git a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list-form/list-form.component.ts b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list-form/list-form.component.ts index ef15b388e..167b709cb 100644 --- a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list-form/list-form.component.ts +++ b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list-form/list-form.component.ts @@ -7,6 +7,7 @@ import { FormControl, FormGroup } from '@angular/forms'; styleUrls: ['./list-form.component.css'] }) export class ListFormComponent implements OnInit { + listForm: FormGroup; @Output() inputText = new EventEmitter(); diff --git a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list-item/list-item.component.ts b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list-item/list-item.component.ts index ceace9313..e50565399 100644 --- a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list-item/list-item.component.ts +++ b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list-item/list-item.component.ts @@ -6,10 +6,11 @@ styleUrls: ['./list-item.component.css'] }) export class ListItemComponent implements OnInit { - // tslint:disable-next-line + // tslint:disable-next-line:variable-name @Input() _id: number; @Input() text: string; @Output() deleteText = new EventEmitter(); + constructor() { } ngOnInit() { @@ -18,5 +19,4 @@ export class ListItemComponent implements OnInit { onDeleteListItem() { this.deleteText.emit(this._id); } - } diff --git a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.component.html b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.component.html index 0c2b03c8c..0bf041524 100644 --- a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.component.html +++ b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.component.html @@ -16,9 +16,9 @@ diff --git a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.component.ts b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.component.ts index 1ae20bd55..3c076e4ef 100644 --- a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.component.ts +++ b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; -import { ListService, IListItem } from './list.service'; +import { ListService } from './list.service'; +import { IListItem } from './list.model'; @Component({ selector: 'app-list', @@ -8,49 +9,51 @@ import { ListService, IListItem } from './list.service'; styleUrls: ['./list.component.css'] }) export class ListComponent implements OnInit { + listItems: IListItem[] = []; - WarningMessageText = 'Request to get list items failed:'; - WarningMessageOpen = false; + warningMessageText = 'Request to get list items failed:'; + warningMessageOpen = false; + constructor(private listService: ListService) { } ngOnInit() { this.listService.getListItems().subscribe( - response => { + (response: IListItem[]) => { this.listItems = response; }, error => { - this.WarningMessageOpen = true; - this.WarningMessageText = `Request to get list items failed: ${error}`; + this.warningMessageOpen = true; + this.warningMessageText = `Request to get list items failed: ${error}`; } ); } handleAddListItem(inputText: string) { this.listService.addListItem(inputText).subscribe( - (response) => { + (response: IListItem) => { this.listItems.splice(0, 0, response); }, error => { - this.WarningMessageOpen = true; - this.WarningMessageText = `Request to add list item failed: ${error}`; + this.warningMessageOpen = true; + this.warningMessageText = `Request to add list item failed: ${error}`; } ); } handleDeleteListItem(id: number) { - this.listService.deleteListItem(id).subscribe( - response => { + (response: IListItem) => { this.listItems = this.listItems.filter(item => item._id !== response._id); }, error => { - this.WarningMessageOpen = true; - this.WarningMessageText = `Request to delete list item failed: ${error}`; + this.warningMessageOpen = true; + this.warningMessageText = `Request to delete list item failed: ${error}`; } ); } + handleWarningClose(open: boolean) { - this.WarningMessageOpen = open; - this.WarningMessageText = ''; + this.warningMessageOpen = open; + this.warningMessageText = ''; } } diff --git a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.model.ts b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.model.ts new file mode 100644 index 000000000..0db606e13 --- /dev/null +++ b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.model.ts @@ -0,0 +1,4 @@ +export interface IListItem { + _id: number; + text: string; +} diff --git a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.service.ts b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.service.ts index d49c1b54e..46edd8cc2 100644 --- a/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.service.ts +++ b/templates/Web/Pages/Angular.List/src/app/app-shell/Param_SourceName_Kebab/list.service.ts @@ -3,11 +3,13 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs'; import { environment } from '../../../environments/environment'; +import { IListItem } from './list.model'; @Injectable({ providedIn: 'root' }) export class ListService { + private listUrl = environment.endpoint.list; constructor(private http: HttpClient) { } @@ -22,9 +24,11 @@ export class ListService { 'Content-Type': 'application/json' }) }; + const body = JSON.stringify({ text: inputText }); + return this.http.post(this.listUrl, body, httpOptions); } @@ -32,9 +36,3 @@ export class ListService { return this.http.delete(`${environment.endpoint.list}/${id}`); } } - -export interface IListItem { - _id: number; - text: string; -} - diff --git a/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail-page/master-detail-page.component.ts b/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail-page/master-detail-page.component.ts index 6f4e79d3a..4de68437c 100644 --- a/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail-page/master-detail-page.component.ts +++ b/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail-page/master-detail-page.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit, Input } from '@angular/core'; -import { IMasterDetailText } from '../master-detail.service'; +import { IMasterDetailText } from '../master-detail.model'; @Component({ selector: 'app-master-detail-page', @@ -9,6 +9,7 @@ import { IMasterDetailText } from '../master-detail.service'; export class MasterDetailPageComponent implements OnInit { @Input() textSampleData: IMasterDetailText; + constructor() { } ngOnInit() { @@ -23,5 +24,4 @@ export class MasterDetailPageComponent implements OnInit { id: 0 }; } - } diff --git a/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.component.ts b/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.component.ts index 617b323d0..84105e7b7 100644 --- a/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.component.ts +++ b/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit } from '@angular/core'; -import { MasterDetailService, IMasterDetailText } from './master-detail.service'; +import { MasterDetailService } from './master-detail.service'; +import { IMasterDetailText } from './master-detail.model'; @Component({ selector: 'app-master-detail', @@ -9,9 +10,9 @@ import { MasterDetailService, IMasterDetailText } from './master-detail.service' }) export class MasterDetailComponent implements OnInit { - GreyAvatar = require('../../../assets/GreyAvatar.svg') as string; - WarningMessageText = 'Request to get master detail text failed:'; - WarningMessageOpen = false; + greyAvatar = require('../../../assets/GreyAvatar.svg') as string; + warningMessageText = 'Request to get master detail text failed:'; + warningMessageOpen = false; currentDisplayTabIndex = 0; masterDetailText: IMasterDetailText[] = []; @@ -19,12 +20,12 @@ export class MasterDetailComponent implements OnInit { ngOnInit() { this.masterDetailService.getMasterDetailItems().subscribe( - result => { + (result: IMasterDetailText[]) => { this.masterDetailText = result; }, error => { - this.WarningMessageOpen = true; - this.WarningMessageText = `Request to get master detail text failed: ${error}`; + this.warningMessageOpen = true; + this.warningMessageText = `Request to get master detail text failed: ${error}`; } ); } @@ -32,10 +33,9 @@ export class MasterDetailComponent implements OnInit { handleDisplayTabClick(id: number) { this.currentDisplayTabIndex = id; } + handleWarningClose(open: boolean) { - this.WarningMessageOpen = open; - this.WarningMessageText = ''; + this.warningMessageOpen = open; + this.warningMessageText = ''; } } - - diff --git a/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.model.ts b/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.model.ts new file mode 100644 index 000000000..e6081df8f --- /dev/null +++ b/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.model.ts @@ -0,0 +1,10 @@ +export interface IMasterDetailText { + title: string; + id: number; + status: string; + orderDate: string; + shipTo: string; + orderTotal: number; + shortDescription: string; + longDescription: string; +} diff --git a/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.service.ts b/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.service.ts index 2983e9b9f..a7c4791d7 100644 --- a/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.service.ts +++ b/templates/Web/Pages/Angular.MasterDetail/src/app/app-shell/Param_SourceName_Kebab/master-detail.service.ts @@ -3,6 +3,7 @@ import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { environment } from '../../../environments/environment'; +import { IMasterDetailText } from './master-detail.model'; @Injectable({ providedIn: 'root' @@ -17,14 +18,3 @@ export class MasterDetailService { return this.http.get(this.listUrl); } } - -export interface IMasterDetailText { - title: string; - id: number; - status: string; - orderDate: string; - shipTo: string; - orderTotal: number; - shortDescription: string; - longDescription: string; -} diff --git a/templates/Web/Projects/AngularDefault/src/app/app.component.html b/templates/Web/Projects/AngularDefault/src/app/app.component.html index 7bc960da0..a178df372 100644 --- a/templates/Web/Projects/AngularDefault/src/app/app.component.html +++ b/templates/Web/Projects/AngularDefault/src/app/app.component.html @@ -1,11 +1,5 @@ - - - - + - - - diff --git a/templates/Web/Projects/AngularDefault/src/app/app.component.ts b/templates/Web/Projects/AngularDefault/src/app/app.component.ts index 4a44705f1..56f8668a6 100644 --- a/templates/Web/Projects/AngularDefault/src/app/app.component.ts +++ b/templates/Web/Projects/AngularDefault/src/app/app.component.ts @@ -6,5 +6,6 @@ styleUrls: ['./app.component.css'] }) export class AppComponent { + title = 'wts.AngularDefault'; } diff --git a/templates/Web/_composition/AngularJS/Page.Angular.AddWarnings/src/app/shared/warning-message/warning-message.component.ts b/templates/Web/_composition/AngularJS/Page.Angular.AddWarnings/src/app/shared/warning-message/warning-message.component.ts index 08ad7c8c0..c332924f5 100644 --- a/templates/Web/_composition/AngularJS/Page.Angular.AddWarnings/src/app/shared/warning-message/warning-message.component.ts +++ b/templates/Web/_composition/AngularJS/Page.Angular.AddWarnings/src/app/shared/warning-message/warning-message.component.ts @@ -9,7 +9,7 @@ export class WarningMessageComponent implements OnInit { open = false; @Input() text = ''; - @Output() WarningMessageOpen = new EventEmitter(); + @Output() warningMessageOpen = new EventEmitter(); constructor() { } @@ -19,6 +19,6 @@ export class WarningMessageComponent implements OnInit { onWarningClose() { this.text = ''; this.open = false; - this.WarningMessageOpen.emit(this.open); + this.warningMessageOpen.emit(this.open); } }