From 328fba202fa54164ab082094a48affe82a935f84 Mon Sep 17 00:00:00 2001 From: jgauffin Date: Thu, 11 Jul 2019 20:13:57 +0200 Subject: [PATCH 1/2] analyze menu --- .../Inbound/SaveReportHandler.cs | 18 ++++++++++- .../components/analyze/menu.vue.html | 32 +++++++++++++------ .../components/analyze/myincidents.ts | 22 ++++++++++--- .../Controllers/ReportReceiverController.cs | 7 ++++ src/Server/Coderr.Server.Web/Startup.cs | 27 ++++++++-------- 5 files changed, 78 insertions(+), 28 deletions(-) diff --git a/src/Server/Coderr.Server.ReportAnalyzer/Inbound/SaveReportHandler.cs b/src/Server/Coderr.Server.ReportAnalyzer/Inbound/SaveReportHandler.cs index fa43640e..7c63b403 100644 --- a/src/Server/Coderr.Server.ReportAnalyzer/Inbound/SaveReportHandler.cs +++ b/src/Server/Coderr.Server.ReportAnalyzer/Inbound/SaveReportHandler.cs @@ -64,7 +64,8 @@ public async Task BuildReportAsync(ClaimsPrincipal user, string appKey, string s throw new InvalidCredentialException($"AppKey was not found in the database. Key '{appKey}'."); } - if (!ReportValidator.ValidateBody(application.SharedSecret, signatureProvidedByTheClient, reportBody)) + // web(js) applications do not sign the body + if (signatureProvidedByTheClient != null && !ReportValidator.ValidateBody(application.SharedSecret, signatureProvidedByTheClient, reportBody)) { await StoreInvalidReportAsync(appKey, signatureProvidedByTheClient, remoteAddress, reportBody); throw new AuthenticationException( @@ -158,6 +159,21 @@ private NewReportDTO DeserializeBody(byte[] body) if (string.IsNullOrEmpty(dto.EnvironmentName) && !string.IsNullOrEmpty(dto.Environment)) dto.EnvironmentName = dto.Environment; + + // Safeguard against malformed reports (other clients than the built in ones) + if (dto.Exception == null) + return null; + if (string.IsNullOrWhiteSpace(dto.Exception.Name) && string.IsNullOrWhiteSpace(dto.Exception.FullName)) + return null; + if (string.IsNullOrWhiteSpace(dto.Exception.Name)) + dto.Exception.Name = dto.Exception.FullName; + if (string.IsNullOrWhiteSpace(dto.Exception.FullName)) + dto.Exception.FullName = dto.Exception.Name; + if (dto.Exception.BaseClasses == null) + dto.Exception.BaseClasses = new string[0]; + if (dto.Exception.Namespace == null) + dto.Exception.Namespace = ""; + return dto; } diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.vue.html b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.vue.html index 3988147a..08f15fab 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.vue.html +++ b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.vue.html @@ -3,15 +3,10 @@ +
+ + + + + + + +
+ + {{item.title}} + + + {{item.applicationNAme}} + + {{item.age}} +
+ +
diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts index 66380568..c617b013 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts @@ -21,6 +21,8 @@ export interface incidentListChanged { export interface IMyIncident { incidentId: number; applicationId: number; + applicationName: string; + assignedAtUtc: Date; title: string; /** @@ -142,9 +144,15 @@ export class MyIncidents { var index = this.allMyIncidents$.findIndex(menuItem => menuItem.incidentId === assignedIncident.Id); var item: IMyIncident; if (index === -1) { - item = this.createItem(assignedIncident.Id, + item = this.createItem( + assignedIncident.Id, assignedIncident.ApplicationId, - assignedIncident.Description); + '', + assignedIncident.AssignedAtUtc, + assignedIncident.Description + ); + AppRoot.Instance.applicationService.get(item.applicationId) + .then(x => item.applicationName = x.name); this.allMyIncidents$.push(item); } else { item = this.allMyIncidents$[index]; @@ -182,7 +190,9 @@ export class MyIncidents { } mine.forEach(dto => { if (!this.allMyIncidents$.find(item => item.incidentId === dto.Id)) { - var item = this.createItem(dto.Id, parseInt(dto.ApplicationId, 10), dto.Name); + var item = this.createItem(dto.Id, parseInt(dto.ApplicationId, 10), '', dto.CreatedAtUtc, dto.Name); + AppRoot.Instance.applicationService.get(item.applicationId) + .then(x => item.applicationName = x.name); this.allMyIncidents$.push(item); } }); @@ -200,7 +210,7 @@ export class MyIncidents { }); } - private createItem(incidentId: number, applicationId: number, title: string): IMyIncident { + private createItem(incidentId: number, applicationId: number, applicationName: string, assignedAtUtc: Date, title: string): IMyIncident { let shortTitle = title; if (shortTitle.length > 50) { shortTitle = title.substr(0, 45) + '[...]'; @@ -210,7 +220,9 @@ export class MyIncidents { title: title, shortTitle: shortTitle, incidentId: incidentId, - applicationId: applicationId + applicationId: applicationId, + applicationName: applicationName, + assignedAtUtc: assignedAtUtc }; return item; } diff --git a/src/Server/Coderr.Server.Web/Controllers/ReportReceiverController.cs b/src/Server/Coderr.Server.Web/Controllers/ReportReceiverController.cs index 480c011b..80e83d43 100644 --- a/src/Server/Coderr.Server.Web/Controllers/ReportReceiverController.cs +++ b/src/Server/Coderr.Server.Web/Controllers/ReportReceiverController.cs @@ -53,6 +53,13 @@ public async Task Post(string appKey, string sig) if (contentLength == null || contentLength < 1) return BadRequest("Content required."); + // Sig may be null for web applications + // as I don't know how to protect the secretKey in web applications + if (sig == null && Request.ContentType != "application/json") + { + return BadRequest("Must sign error report with the sharedSecret"); + } + try { var buffer = new byte[contentLength.Value]; diff --git a/src/Server/Coderr.Server.Web/Startup.cs b/src/Server/Coderr.Server.Web/Startup.cs index 8e5291b4..c75a9a6b 100644 --- a/src/Server/Coderr.Server.Web/Startup.cs +++ b/src/Server/Coderr.Server.Web/Startup.cs @@ -145,18 +145,7 @@ private void UpgradeDatabaseSchema() public void ConfigureServices(IServiceCollection services) { - services.AddMvc(options => - { - AddCoderrToMvc(options); - options.Filters.Add(); - options.Filters.Add(); - }) - .AddJsonOptions(jsonOptions => - { - jsonOptions.SerializerSettings.ContractResolver = new IncludeNonPublicMembersContractResolver(); - }); - - if (Configuration["EnableCors"] == "true") + if (Configuration["EnableCors"].Equals("true", StringComparison.OrdinalIgnoreCase)) { services.AddCors(o => o.AddPolicy("CorsPolicy", builder => { @@ -168,13 +157,25 @@ public void ConfigureServices(IServiceCollection services) else { // Add the policy, but do not allow any origins - // which means that the policy is effectivly denying everything. + // which means that the policy is effectively denying everything. services.AddCors(o => o.AddPolicy("CorsPolicy", builder => { builder.AllowAnyHeader(); })); } + services.AddMvc(options => + { + AddCoderrToMvc(options); + options.Filters.Add(); + options.Filters.Add(); + }) + .AddJsonOptions(jsonOptions => + { + jsonOptions.SerializerSettings.ContractResolver = new IncludeNonPublicMembersContractResolver(); + }); + + var authenticationBuilder = services.AddAuthentication("Cookies"); authenticationBuilder.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, options => { From 26f1f4feab6856e0b0a789fec2127fb1d15860a2 Mon Sep 17 00:00:00 2001 From: Jonas Gauffin Date: Fri, 12 Jul 2019 12:28:35 +0200 Subject: [PATCH 2/2] Menu is working --- .../Queries/FindIncidentsResultItem.cs | 7 +- .../Queries/FindIncidentResultItemMapper.cs | 5 +- .../Coderr.Server.Web/ClientApp/boot.ts | 1 - .../components/analyze/incidents/incident.ts | 5 +- .../analyze/incidents/incident.vue.html | 2 +- .../ClientApp/components/analyze/menu.css | 6 +- .../ClientApp/components/analyze/menu.ts | 28 ++++- .../components/analyze/menu.vue.html | 105 ++++++++++-------- .../components/analyze/myincidents.ts | 32 +++++- .../discover/incidents/incident.vue.html | 2 +- .../components/discover/incidents/search.ts | 2 +- .../components/home/navmenu/navmenu.ts | 3 + .../shared/incidents/ContextNavigator.ts | 1 - .../ClientApp/dto/Core/Accounts.ts | 1 + .../ClientApp/dto/Core/ApiKeys.ts | 2 + .../ClientApp/dto/Core/Incidents.ts | 5 +- .../ClientApp/services/AppRoot.ts | 1 + .../applications/ApplicationService.ts | 1 + .../services/incidents/IncidentService.ts | 6 +- .../Coderr.Server.Web/ClientApp/vue-shim.d.ts | 4 +- src/Server/Coderr.Server.Web/appsettings.json | 2 +- src/Server/Coderr.Server.Web/tsconfig.json | 9 +- 22 files changed, 156 insertions(+), 74 deletions(-) diff --git a/src/Server/Coderr.Server.Api/Core/Incidents/Queries/FindIncidentsResultItem.cs b/src/Server/Coderr.Server.Api/Core/Incidents/Queries/FindIncidentsResultItem.cs index 908e9a31..9e9dcac6 100644 --- a/src/Server/Coderr.Server.Api/Core/Incidents/Queries/FindIncidentsResultItem.cs +++ b/src/Server/Coderr.Server.Api/Core/Incidents/Queries/FindIncidentsResultItem.cs @@ -31,7 +31,7 @@ protected FindIncidentsResultItem() /// /// Id of the application that this incident belongs to /// - public string ApplicationId { get; set; } + public int ApplicationId { get; set; } /// /// Name of the application that this incident belongs to @@ -43,6 +43,11 @@ protected FindIncidentsResultItem() /// public DateTime CreatedAtUtc { get; set; } + /// + /// When the incident was assigned to someone. + /// + public DateTime? AssignedAtUtc { get; set; } + /// /// Incident id /// diff --git a/src/Server/Coderr.Server.SqlServer/Core/Incidents/Queries/FindIncidentResultItemMapper.cs b/src/Server/Coderr.Server.SqlServer/Core/Incidents/Queries/FindIncidentResultItemMapper.cs index 641c4fc4..2a4ac18d 100644 --- a/src/Server/Coderr.Server.SqlServer/Core/Incidents/Queries/FindIncidentResultItemMapper.cs +++ b/src/Server/Coderr.Server.SqlServer/Core/Incidents/Queries/FindIncidentResultItemMapper.cs @@ -20,7 +20,7 @@ public void Map(IDataRecord source, object destination) public void Map(IDataRecord source, FindIncidentsResultItem destination) { destination.ApplicationName = (string) source["ApplicationName"]; - destination.ApplicationId = source["ApplicationId"].ToString(); + destination.ApplicationId = (int)source["ApplicationId"]; destination.IsReOpened = source["IsReopened"].Equals(1); destination.ReportCount = (int) source["ReportCount"]; destination.CreatedAtUtc = (DateTime)source["CreatedAtUtc"]; @@ -31,6 +31,9 @@ public void Map(IDataRecord source, FindIncidentsResultItem destination) value = source["LastReportAtUtc"]; destination.LastReportReceivedAtUtc = (DateTime) (value is DBNull ? destination.LastUpdateAtUtc : value); + + value = source["AssignedAtUtc"]; + destination.AssignedAtUtc = (DateTime?)(value is DBNull ? null : value); } } } \ No newline at end of file diff --git a/src/Server/Coderr.Server.Web/ClientApp/boot.ts b/src/Server/Coderr.Server.Web/ClientApp/boot.ts index 703074ef..bb7697a4 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/boot.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/boot.ts @@ -3,7 +3,6 @@ import Vue from "vue"; import VueRouter from "vue-router"; import moment from "moment"; import { AppRoot } from "./services/AppRoot" -//import VeeValidate from 'vee-validate'; import { IUser } from "./vue-shim"; //Vue.use(VeeValidate); diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.ts b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.ts index 6f4ca67f..5d7bc603 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.ts @@ -27,11 +27,12 @@ export default class AnalyzeIncidentComponent extends Vue { currentCollectionName: string = ''; created() { + // required for contextnavigator + this.incidentId = parseInt(this.$route.params.incidentId, 10); } mounted() { - var incidentId = parseInt(this.$route.params.incidentId, 10); - this.loadIncident(incidentId); + this.loadIncident(this.incidentId); MyIncidents.Instance.subscribeOnSelectedIncident(this.selectIncident); } diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.vue.html b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.vue.html index 038cf6a7..00271499 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.vue.html +++ b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/incident.vue.html @@ -69,7 +69,7 @@

Quick facts

- +
diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.css b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.css index f193e68b..5c4d056c 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.css +++ b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.css @@ -10,4 +10,8 @@ .bg-light .router-link-exact-active { color: #333333; font-weight: bold; -}*/ \ No newline at end of file +}*/ +td { + padding-right: 15px; + padding-top: 5px; +} \ No newline at end of file diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.ts b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.ts index 0d3af6bb..4cae836d 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.ts @@ -1,5 +1,7 @@ +import { PubSubService, MessageContext } from "../../services/PubSub"; import * as MenuApi from "../../services/menu/MenuApi"; -import Vue from 'vue'; +import Vue from "vue"; +import { AppRoot } from '../../services/AppRoot'; import { Component, Watch } from 'vue-property-decorator'; import { MyIncidents, IMyIncident } from "./myincidents"; @@ -18,11 +20,15 @@ export default class AnalyzeMenuComponent extends Vue { incidents: IMyIncident[] = []; title = ''; incidentId: number | null = null; + toggleMenu = false; + applicationId: number | null = null; created() { if (this.$route.params.incidentId) { this.incidentId = parseInt(this.$route.params.incidentId, 10); } + this.applicationId = AppRoot.Instance.currentApplicationId; + PubSubService.Instance.subscribe(MenuApi.MessagingTopics.ApplicationChanged, this.onApplicationChangedInNavMenu); MyIncidents.Instance.subscribeOnSelectedIncident(this.onIncidentSelected); MyIncidents.Instance.subscribeOnListChanges(this.onListChanged); } @@ -41,6 +47,12 @@ export default class AnalyzeMenuComponent extends Vue { destroyed() { MyIncidents.Instance.unsubscribe(this.onIncidentSelected); MyIncidents.Instance.unsubscribe(this.onListChanged); + PubSubService.Instance.unsubscribe(MenuApi.MessagingTopics.ApplicationChanged, this.onApplicationChangedInNavMenu); + } + + toggleIncidentMenu() { + this.toggleMenu = !this.toggleMenu; + } private onListChanged(args: any) { @@ -62,6 +74,20 @@ export default class AnalyzeMenuComponent extends Vue { } } + @Watch('$route.params.applicationId') + onAppRoute(value: string, oldValue: string) { + if (!value) { + this.applicationId = null; + return; + } else { + this.applicationId = parseInt(value, 10); + } + } + private onApplicationChangedInNavMenu(ctx: MessageContext) { + var body = ctx.message.body; + this.applicationId = body.applicationId; + } + @Watch('$route.params.incidentId') onIncidentRoute(value: string, oldValue: string) { if (this.$route.fullPath.indexOf('/analyze/') === -1) { diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.vue.html b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.vue.html index 08f15fab..d244e33b 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.vue.html +++ b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/menu.vue.html @@ -1,54 +1,65 @@ diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts index c617b013..6a7f3c07 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/components/analyze/myincidents.ts @@ -2,6 +2,7 @@ import * as MenuApi from "../../services/menu/MenuApi"; import { AppRoot } from "../../services/AppRoot"; import { PubSubService, MessageContext } from "../../services/PubSub"; import { IncidentTopcis, IncidentAssigned, IncidentClosed, IncidentIgnored } from "../../services/incidents/IncidentService"; +import * as incidents from "../../dto/Core/Incidents"; /** * null if the user do not have any assigned incidents (for the selected application) @@ -22,6 +23,7 @@ export interface IMyIncident { incidentId: number; applicationId: number; applicationName: string; + createdAtUtc: Date; assignedAtUtc: Date; title: string; @@ -148,10 +150,11 @@ export class MyIncidents { assignedIncident.Id, assignedIncident.ApplicationId, '', + assignedIncident.CreatedAtUtc, assignedIncident.AssignedAtUtc, assignedIncident.Description ); - AppRoot.Instance.applicationService.get(item.applicationId) + AppRoot.Instance.applicationService.get(assignedIncident.ApplicationId) .then(x => item.applicationName = x.name); this.allMyIncidents$.push(item); } else { @@ -190,9 +193,7 @@ export class MyIncidents { } mine.forEach(dto => { if (!this.allMyIncidents$.find(item => item.incidentId === dto.Id)) { - var item = this.createItem(dto.Id, parseInt(dto.ApplicationId, 10), '', dto.CreatedAtUtc, dto.Name); - AppRoot.Instance.applicationService.get(item.applicationId) - .then(x => item.applicationName = x.name); + var item = this.createItem2(dto); this.allMyIncidents$.push(item); } }); @@ -210,7 +211,7 @@ export class MyIncidents { }); } - private createItem(incidentId: number, applicationId: number, applicationName: string, assignedAtUtc: Date, title: string): IMyIncident { + private createItem(incidentId: number, applicationId: number, applicationName: string, createdAtUtc: Date, assignedAtUtc: Date, title: string): IMyIncident { let shortTitle = title; if (shortTitle.length > 50) { shortTitle = title.substr(0, 45) + '[...]'; @@ -220,6 +221,7 @@ export class MyIncidents { title: title, shortTitle: shortTitle, incidentId: incidentId, + createdAtUtc: createdAtUtc, applicationId: applicationId, applicationName: applicationName, assignedAtUtc: assignedAtUtc @@ -227,6 +229,24 @@ export class MyIncidents { return item; } + private createItem2(incident: incidents.FindIncidentsResultItem): IMyIncident { + let shortTitle = incident.Name; + if (shortTitle.length > 50) { + shortTitle = incident.Name.substr(0, 45) + '[...]'; + } + + var item: IMyIncident = { + title: incident.Name, + shortTitle: shortTitle, + incidentId: incident.Id, + createdAtUtc: incident.CreatedAtUtc, + applicationId: incident.ApplicationId, + applicationName: incident.ApplicationName, + assignedAtUtc: incident.AssignedAtUtc + }; + return item; + } + private async getIncident(incidentId: number): Promise { for (var i = 0; i < this.allMyIncidents$.length; i++) { if (this.allMyIncidents$[i].incidentId === incidentId) { @@ -239,7 +259,7 @@ export class MyIncidents { var foundItem: IMyIncident = null; allMine.forEach(myIncident => { if (myIncident.Id === incidentId) { - var item = this.createItem(myIncident.Id, parseInt(myIncident.ApplicationId, 10), myIncident.Name); + var item = this.createItem2(myIncident); this.allMyIncidents$.push(item); foundItem = item; } diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/incident.vue.html b/src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/incident.vue.html index 54d4d405..8cd5fe96 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/incident.vue.html +++ b/src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/incident.vue.html @@ -55,7 +55,7 @@

Report history

- +
diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/search.ts b/src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/search.ts index e7e57437..dc246ac7 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/search.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/search.ts @@ -289,7 +289,7 @@ export default class IncidentSearchComponent extends Vue { this.incidents.splice(0); result.Items.forEach(item => { var entity: Incident = { - ApplicationId: parseInt(item.ApplicationId, 10), + ApplicationId: item.ApplicationId, ApplicationName: item.ApplicationName, CreatedAtUtc: item.CreatedAtUtc, Id: item.Id, diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/home/navmenu/navmenu.ts b/src/Server/Coderr.Server.Web/ClientApp/components/home/navmenu/navmenu.ts index 4f566d47..5aa8d556 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/home/navmenu/navmenu.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/components/home/navmenu/navmenu.ts @@ -37,15 +37,18 @@ export default class NavMenuComponent extends Vue { @Watch('$route.params.applicationId') onApplicationChanged(value: string, oldValue: string) { + if (!value) { // analyze uses it's own logic if (this.$route.path.indexOf('/analyze/') !== -1) return; + AppRoot.Instance.currentApplicationId = null; this.updateCurrent(0); return; } var applicationId = parseInt(value); + AppRoot.Instance.currentApplicationId = applicationId; this.updateCurrent(applicationId); } diff --git a/src/Server/Coderr.Server.Web/ClientApp/components/shared/incidents/ContextNavigator.ts b/src/Server/Coderr.Server.Web/ClientApp/components/shared/incidents/ContextNavigator.ts index 9f3fce76..0d985bdc 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/components/shared/incidents/ContextNavigator.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/components/shared/incidents/ContextNavigator.ts @@ -97,7 +97,6 @@ export default class ContextNavigatorComponent extends Vue { item.htmlValue = ''; item.value = null; } - console.log('Adding', item); this.currentCollectionProperties.push(item); }; return; diff --git a/src/Server/Coderr.Server.Web/ClientApp/dto/Core/Accounts.ts b/src/Server/Coderr.Server.Web/ClientApp/dto/Core/Accounts.ts index e04fef8e..742fd9a8 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/dto/Core/Accounts.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/dto/Core/Accounts.ts @@ -1,3 +1,4 @@ +// ReSharper disable InconsistentNaming export class RegisterSimple { public static TYPE_NAME: string = 'RegisterSimple'; diff --git a/src/Server/Coderr.Server.Web/ClientApp/dto/Core/ApiKeys.ts b/src/Server/Coderr.Server.Web/ClientApp/dto/Core/ApiKeys.ts index b932ebf4..32b6cd78 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/dto/Core/ApiKeys.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/dto/Core/ApiKeys.ts @@ -1,3 +1,5 @@ +// ReSharper disable InconsistentNaming + export class GetApiKey { public static TYPE_NAME: string = 'GetApiKey'; diff --git a/src/Server/Coderr.Server.Web/ClientApp/dto/Core/Incidents.ts b/src/Server/Coderr.Server.Web/ClientApp/dto/Core/Incidents.ts index b12940c7..0d29edd0 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/dto/Core/Incidents.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/dto/Core/Incidents.ts @@ -1,4 +1,6 @@ import {ReportDTO} from './Reports' +// ReSharper disable InconsistentNaming + export enum IncidentOrder { Newest = 0, @@ -52,8 +54,9 @@ export class FindIncidentsResult export class FindIncidentsResultItem { public static TYPE_NAME: string = 'FindIncidentsResultItem'; - public ApplicationId: string; + public ApplicationId: number; public ApplicationName: string; + public AssignedAtUtc: Date|null; public CreatedAtUtc: Date; public Id: number; public IsReOpened: boolean; diff --git a/src/Server/Coderr.Server.Web/ClientApp/services/AppRoot.ts b/src/Server/Coderr.Server.Web/ClientApp/services/AppRoot.ts index e719b38a..593432c3 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/services/AppRoot.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/services/AppRoot.ts @@ -50,6 +50,7 @@ export class AppRoot { public apiClient: ApiClient; public incidentService: IncidentService; public applicationService: ApplicationService; + public currentApplicationId: number | null; constructor() { var base = document.head.querySelector('base'); diff --git a/src/Server/Coderr.Server.Web/ClientApp/services/applications/ApplicationService.ts b/src/Server/Coderr.Server.Web/ClientApp/services/applications/ApplicationService.ts index c75cc3c6..59e3eeeb 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/services/applications/ApplicationService.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/services/applications/ApplicationService.ts @@ -13,6 +13,7 @@ export class AppEvents { static readonly Created: string = "application/created"; static readonly Removed: string = "application/removed"; static readonly Updated: string = "application/updated"; + static readonly Selected: string = "application/selected"; }; export class ApplicationCreated { diff --git a/src/Server/Coderr.Server.Web/ClientApp/services/incidents/IncidentService.ts b/src/Server/Coderr.Server.Web/ClientApp/services/incidents/IncidentService.ts index bc455fdb..3371c29c 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/services/incidents/IncidentService.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/services/incidents/IncidentService.ts @@ -239,7 +239,7 @@ export class IncidentService { async getMine(applicationId?: number, ignoreId?: number): Promise { if (this.myIncidents.length > 0 && this.haveFetchedMine) { if (applicationId) { - return this.myIncidents.filter(x => x.ApplicationId === applicationId.toString()); + return this.myIncidents.filter(x => x.ApplicationId === applicationId); } return this.myIncidents; } @@ -338,7 +338,7 @@ export class IncidentService { let myItem = new FindIncidentsResultItem(); myItem.Id = item.Id; - myItem.ApplicationId = item.ApplicationId.toString(); + myItem.ApplicationId = item.ApplicationId; myItem.CreatedAtUtc = item.CreatedAtUtc; myItem.ReportCount = item.ReportCount; myItem.LastReportReceivedAtUtc = item.LastReportReceivedAtUtc; @@ -349,7 +349,7 @@ export class IncidentService { var incident = await this.get(incidentId); let myItem = new FindIncidentsResultItem(); myItem.Id = incident.Id; - myItem.ApplicationId = incident.ApplicationId.toString(); + myItem.ApplicationId = incident.ApplicationId; myItem.CreatedAtUtc = incident.CreatedAtUtc; myItem.ReportCount = incident.ReportCount; myItem.LastReportReceivedAtUtc = incident.LastReportReceivedAtUtc; diff --git a/src/Server/Coderr.Server.Web/ClientApp/vue-shim.d.ts b/src/Server/Coderr.Server.Web/ClientApp/vue-shim.d.ts index 693ad745..a4e8368a 100644 --- a/src/Server/Coderr.Server.Web/ClientApp/vue-shim.d.ts +++ b/src/Server/Coderr.Server.Web/ClientApp/vue-shim.d.ts @@ -22,8 +22,8 @@ export interface IUser { declare module 'vue/types/vue' { interface Vue { - //$router: VueRouter; - //$route: Route; + $router: VueRouter; + $route: Route; user$: IUser; } } \ No newline at end of file diff --git a/src/Server/Coderr.Server.Web/appsettings.json b/src/Server/Coderr.Server.Web/appsettings.json index 28f62b11..468b7483 100644 --- a/src/Server/Coderr.Server.Web/appsettings.json +++ b/src/Server/Coderr.Server.Web/appsettings.json @@ -5,7 +5,7 @@ } , "EnableCors": true, "ConnectionStrings": { - "Db": "Data Source=.;Initial Catalog=Coderr;Integrated Security=True;Connect Timeout=15;" + "Db": "Data Source=.;Initial Catalog=Coderr99;Integrated Security=True;Connect Timeout=15;" }, "Logging": { "IncludeScopes": false, diff --git a/src/Server/Coderr.Server.Web/tsconfig.json b/src/Server/Coderr.Server.Web/tsconfig.json index c1003a34..b0fb50dc 100644 --- a/src/Server/Coderr.Server.Web/tsconfig.json +++ b/src/Server/Coderr.Server.Web/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "allowSyntheticDefaultImports": true, - "emitDecoratorMetadata": true, + "emitDecoratorMetadata": true, "experimentalDecorators": true, "lib": [ "es2015", "dom" ], "module": "es2015", @@ -9,10 +9,13 @@ "target": "es5", "sourceMap": true, "skipDefaultLibCheck": true, - "strictNullChecks": false, + "strictNullChecks": false, "strict": true, - "types": ["webpack-env"] + "types": [ "webpack-env" ] }, + "include": [ + "ClientApp/**/*" + ], "exclude": [ "bin", "node_modules",