Skip to content

Commit fb73076

Browse files
committed
2 parents 168ee8f + 4e554f8 commit fb73076

File tree

17 files changed

+174
-71
lines changed

17 files changed

+174
-71
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net461</TargetFramework>
4+
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
5+
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
6+
</PropertyGroup>
7+
8+
<ItemGroup>
9+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
10+
<PackageReference Include="xunit" Version="2.4.1" />
11+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
12+
<PrivateAssets>all</PrivateAssets>
13+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
14+
</PackageReference>
15+
<PackageReference Include="FluentAssertions" Version="5.10.0" />
16+
<PackageReference Include="NSubstitute" Version="4.2.1" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<ProjectReference Include="..\Coderr.Server.Domain\Coderr.Server.Domain.csproj" />
21+
<ProjectReference Include="..\Coderr.Server.ReportAnalyzer\Coderr.Server.ReportAnalyzer.csproj" />
22+
</ItemGroup>
23+
24+
<ItemGroup>
25+
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}"></Service>
26+
</ItemGroup>
27+
28+
</Project>

src/Server/Coderr.Server.SqlServer/Core/Incidents/Queries/GetReportListHandler.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ public async Task<GetReportListResult> HandleAsync(IMessageContext context, GetR
2626
cmd.AddParameter("incidentId", query.IncidentId);
2727
if (query.PageNumber > 0)
2828
{
29+
if (query.PageSize == 0)
30+
{
31+
query.PageSize = 10;
32+
}
33+
2934
cmd.CommandText = "SELECT cast(count(Id) as int) FROM ErrorReports WHERE IncidentId = @incidentId";
3035
totalCount = (int) cmd.ExecuteScalar();
3136

src/Server/Coderr.Server.Web/ClientApp/boot.ts

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import "bootstrap";
22
import Vue from "vue";
33
import VueRouter from "vue-router";
4-
import moment from "moment";
54
import { AppRoot } from "./services/AppRoot"
65
import { IUser } from "./vue-shim";
6+
import { DateTime } from 'luxon';
7+
import * as helpers from "./helpers";
78

89
//Vue.use(VeeValidate);
910
Vue.use(VueRouter);
@@ -18,8 +19,12 @@ declare module 'vue/types/vue' {
1819

1920
Vue.filter("ago",
2021
(value: string) => {
21-
if (!value) return "n/a";
22-
return moment.utc(value).fromNow();
22+
return helpers.ago(value);
23+
});
24+
25+
Vue.filter("monthDay",
26+
(value: string | Date) => {
27+
return helpers.monthDay(value);
2328
});
2429

2530
Vue.filter("isoDate",
@@ -30,32 +35,17 @@ Vue.filter("isoDate",
3035

3136
Vue.filter("niceTime",
3237
(value: string) => {
33-
if (!value) return "n/a";
34-
return moment.utc(value).local().format("LLLL");
38+
return helpers.niceTime(value);
3539
});
3640

3741
Vue.filter("agoOrDate",
3842
(value: string) => {
39-
var today = moment(new Date());
40-
var reportDate = moment(value);
41-
var diff = reportDate.diff(today, "days");
42-
43-
if (!value) return "n/a";
44-
return moment.utc(value).fromNow();
43+
return helpers.agoOrDate(value);
4544
});
4645

4746
Vue.filter("incidentState",
4847
(value: string) => {
49-
switch (value) {
50-
case "0":
51-
return "New";
52-
case "1":
53-
return "Assigned";
54-
case "2":
55-
return "Ignored";
56-
case "3":
57-
return "Closed";
58-
}
48+
return helpers.incidentState(value);
5949
});
6050

6151
Vue.component('context-navigator', require('./components/shared/incidents/ContextNavigator.vue.html').default);

src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/report.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default class AnalyzeReportComponent extends Vue {
1919
indexInTotalSet = 0;
2020
totalCount = 0;
2121

22-
reportedAt = new Date();
22+
reportedAt: string = '';
2323
stackTrace = '';
2424
reportId: number;
2525
incidentId: number;
@@ -105,7 +105,7 @@ export default class AnalyzeReportComponent extends Vue {
105105
AppRoot.Instance.apiClient.query<GetReportResult>(q)
106106
.then(report => {
107107
this.stackTrace = report.StackTrace;
108-
this.reportedAt = report.CreatedAtUtc;
108+
this.reportedAt = this.$options.filters.niceTime(report.CreatedAtUtc);
109109
this.contextCollections = report.ContextCollections;
110110
this.userFeedback = report.UserFeedback;
111111
if (report.EmailAddress != null) {

src/Server/Coderr.Server.Web/ClientApp/components/analyze/incidents/report.vue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="ReportsView">
33
<div class="card">
44
<div class="card-header">
5-
Analyze reports, current: {{reportedAt|niceTime}}
5+
Analyze reports, current: {{reportedAt}}
66
</div>
77
<div class="card-body">
88
<div v-if="userFeedback != null">

src/Server/Coderr.Server.Web/ClientApp/components/applications/application-details.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { GetApplicationInfo, GetApplicationInfoResult, GetApplicationOverview, G
44
import Vue from "vue";
55
import { Component } from "vue-property-decorator";
66
import Chartist from "chartist";
7-
import * as moment from 'moment';
87
import * as Incidents from "../../dto/Core/Incidents";
98
import FindIncidentsResultItem = Incidents.FindIncidentsResultItem;
9+
import { DateTime } from 'luxon';
1010

1111

1212
interface ISeries {
@@ -103,7 +103,7 @@ export default class ApplicationDetailsComponent extends Vue {
103103
if (index % 3 !== 0) {
104104
return '';
105105
}
106-
return moment(value).format('MMM D');
106+
return DateTime.utc(value).toFormat('MMM D');
107107
}
108108
}
109109
};

src/Server/Coderr.Server.Web/ClientApp/components/deployment/home/home.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
import Vue from "vue";
77
import { Component, Watch } from "vue-property-decorator";
88
import Chartist from "chartist";
9-
import moment from "moment";
9+
import { DateTime } from 'luxon';
1010

1111

1212
interface ISeries {
@@ -157,7 +157,7 @@ export default class DeploymentHomeComponent extends Vue {
157157
//if (index % 3 !== 0) {
158158
// return '';
159159
//}
160-
return moment(value).format('MMM D');
160+
return DateTime.fromISO(value).toFormat('MMM D');
161161
}
162162
}
163163
};

src/Server/Coderr.Server.Web/ClientApp/components/deployment/version/summary.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
import { AppRoot } from '../../../services/AppRoot';
2-
import {
3-
GetVersionHistory, GetVersionHistoryResult, GetVersionHistorySeries,
4-
GetApplicationVersions, GetApplicationVersionsResult, GetApplicationVersionsResultItem
5-
} from "../../../dto/Modules/Versions";
62
import {
73
GetIncidentStateSummary, GetIncidentStateSummaryResult,
84
GetIncidentsForStates, GetIncidentsForStatesResult, GetIncidentsForStatesResultItem
95
} from "../../../dto/Modules/History";
10-
import {
11-
FindIncidents, FindIncidentsResult, FindIncidentsResultItem
12-
} from "../../../dto/Core/Incidents";
136
import Vue from "vue";
147
import { Component, Watch } from "vue-property-decorator";
15-
import moment from "moment";
16-
17-
188

199
@Component
2010
export default class DeploymentSummaryComponent extends Vue {

src/Server/Coderr.Server.Web/ClientApp/components/discover/home/home.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { GetApplicationOverview, GetApplicationOverviewResult, GetApplicationLis
77
import { Component, Mixins } from "vue-property-decorator";
88
import { AppAware } from "@/AppMixins";
99
import Chartist from "chartist";
10-
import * as moment from "moment";
1110
import { FindIncidentsResultItem } from "@/dto/Core/Incidents";
11+
import * as helpers from "@/helpers";
1212

1313
interface ISeries {
1414
name?: string;
@@ -54,7 +54,6 @@ export default class DiscoverHomeComponent extends Mixins(AppAware) {
5454
return;
5555
}
5656
if (applicationId === 0) {
57-
console.log('generic');
5857
this.applicationId = 0;
5958
this.firstApplicationId = 0;
6059
this.loadGenericOverview();
@@ -152,6 +151,7 @@ export default class DiscoverHomeComponent extends Mixins(AppAware) {
152151
labels.push(value);
153152
}
154153

154+
155155
var options = {
156156
fullWidth: true,
157157
chartPadding: {
@@ -162,11 +162,12 @@ export default class DiscoverHomeComponent extends Mixins(AppAware) {
162162
offset: 0
163163
},
164164
axisX: {
165-
labelInterpolationFnc(value: any, index: number, labels: any) {
165+
labelInterpolationFnc(value: any, index: number, labels: any): string {
166166
if (index % 3 !== 0) {
167-
return '';
167+
return "";
168168
}
169-
return moment(value).format('MMM D');
169+
170+
return helpers.monthDay(value);
170171
}
171172
}
172173
};
@@ -211,11 +212,11 @@ export default class DiscoverHomeComponent extends Mixins(AppAware) {
211212
low: 0
212213
},
213214
axisX: {
214-
labelInterpolationFnc(value: any, index: number, labels: any) {
215+
labelInterpolationFnc(value: Date, index: number, labels: any) {
215216
if (index % 3 !== 0) {
216217
return '';
217218
}
218-
return moment(value).format('MMM D');
219+
return helpers.monthDay(value);
219220
}
220221
}
221222
};

src/Server/Coderr.Server.Web/ClientApp/components/discover/incidents/incident.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import { PubSubService } from "../../../services/PubSub";
2-
import { IHighlight, IncidentService } from "@/services/incidents/IncidentService";
3-
import { AppRoot } from '../../../services/AppRoot';
4-
import { ApplicationMember } from "../../../services/applications/ApplicationService";
5-
import { GetIncident, GetIncidentResult, GetIncidentStatistics, GetIncidentStatisticsResult, ReportDay, QuickFact } from "../../../dto/Core/Incidents";
6-
import Vue from "vue";
7-
import { Component } from "vue-property-decorator";
1+
import { IHighlight } from "@/services/incidents/IncidentService";
2+
import { AppRoot } from '@/services/AppRoot';
3+
import { ApplicationMember } from "@/services/applications/ApplicationService";
4+
import { GetIncidentResult, ReportDay, QuickFact } from "@/dto/Core/Incidents";
5+
import { Component, Vue } from "vue-property-decorator";
86
import Chartist from "chartist";
9-
import * as moment from 'moment';
107
import * as Reports from "../../../dto/Core/Reports";
118

9+
import { DateTime } from 'luxon';
1210
@Component
1311
export default class IncidentComponent extends Vue {
1412
incidentId: number;
@@ -27,10 +25,11 @@ export default class IncidentComponent extends Vue {
2725
this.isIgnored = result.IsIgnored;
2826
this.isClosed = result.IsSolved;
2927
result.Facts = result.Facts.filter(v => v.Value !== '0');
30-
28+
3129
if (result.AssignedToId > 0) {
3230
var fact = new QuickFact();
33-
fact.Description = 'Assigned at ' + moment(result.AssignedAtUtc);
31+
console.log(result.AssignedAtUtc, typeof result.AssignedAtUtc);
32+
fact.Description = 'Assigned at ' + this.$options.filters.niceTime(result.AssignedAtUtc);
3433
fact.Title = "Assigned to";
3534
fact.Value = result.AssignedTo;
3635
result.Facts.push(fact);
@@ -170,6 +169,7 @@ export default class IncidentComponent extends Vue {
170169
var labels: Date[] = [];
171170
var series: number[] = [];
172171
for (var i = 0; i < days.length; i++) {
172+
173173
var value = new Date(days[i].Date);
174174
labels.push(value);
175175
series.push(days[i].Count);
@@ -181,11 +181,11 @@ export default class IncidentComponent extends Vue {
181181
offset: 0
182182
},
183183
axisX: {
184-
labelInterpolationFnc(value: any, index: number, labels: any) {
184+
labelInterpolationFnc(value: Date, index: number, labels: any) {
185185
if (index % 3 !== 0) {
186186
return '';
187187
}
188-
return moment(value).format('MMM D');
188+
return DateTime.fromJSDate(value).toFormat('LLL dd');
189189
}
190190
}
191191
};

0 commit comments

Comments
 (0)