Browse Source

Namings.

pull/491/head
Sebastian 7 years ago
parent
commit
27a7cf9fb9
  1. 4
      backend/src/Squidex/Areas/Api/Controllers/Statistics/Models/ApiUsageDto.cs
  2. 22
      backend/src/Squidex/Areas/Api/Controllers/Statistics/Models/CurrentCallsDto.cs
  3. 13
      backend/src/Squidex/Areas/Api/Controllers/Statistics/Models/StorageUsageDto.cs
  4. 4
      frontend/app/features/dashboard/pages/dashboard-page.component.ts
  5. 8
      frontend/app/shared/services/usages.service.spec.ts
  6. 8
      frontend/app/shared/services/usages.service.ts

4
backend/src/Squidex/Areas/Api/Controllers/Statistics/Models/ApiUsageDto.cs

@ -34,13 +34,15 @@ namespace Squidex.Areas.Api.Controllers.Statistics.Models
public static ApiUsageDto FromStats(ApiStats stats)
{
return new ApiUsageDto
var result = new ApiUsageDto
{
Date = stats.Date,
TotalBytes = stats.TotalBytes,
TotalCalls = stats.TotalCalls,
AverageElapsedMs = stats.AverageElapsedMs,
};
return result;
}
}
}

22
backend/src/Squidex/Areas/Api/Controllers/Statistics/Models/CurrentCallsDto.cs

@ -1,22 +0,0 @@
// ==========================================================================
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex UG (haftungsbeschränkt)
// All rights reserved. Licensed under the MIT license.
// ==========================================================================
namespace Squidex.Areas.Api.Controllers.Statistics.Models
{
public sealed class CurrentCallsDto
{
/// <summary>
/// The number of calls.
/// </summary>
public long Count { get; set; }
/// <summary>
/// The number of maximum allowed calls.
/// </summary>
public long MaxAllowed { get; set; }
}
}

13
backend/src/Squidex/Areas/Api/Controllers/Statistics/Models/StorageUsageDto.cs

@ -20,16 +20,23 @@ namespace Squidex.Areas.Api.Controllers.Statistics.Models
/// <summary>
/// The number of assets.
/// </summary>
public long Count { get; set; }
public long TotalCount { get; set; }
/// <summary>
/// The size in bytes.
/// </summary>
public long Size { get; set; }
public long TotalSize { get; set; }
public static StorageUsageDto FromStats(AssetStats stats)
{
return new StorageUsageDto { Date = stats.Date, Count = stats.TotalCount, Size = stats.TotalSize };
var result = new StorageUsageDto
{
Date = stats.Date,
TotalCount = stats.TotalCount,
TotalSize = stats.TotalSize
};
return result;
}
}
}

4
frontend/app/features/dashboard/pages/dashboard-page.component.ts

@ -151,7 +151,7 @@ export class DashboardPageComponent extends ResourceOwner implements OnInit {
backgroundColor: `rgba(${COLORS[0]}, 0.6)`,
borderColor: `rgba(${COLORS[0]}, 1)`,
borderWidth: 1,
data: dtos.map(x => x.count)
data: dtos.map(x => x.totalCount)
}
]
};
@ -166,7 +166,7 @@ export class DashboardPageComponent extends ResourceOwner implements OnInit {
backgroundColor: `rgba(${COLORS[0]}, 0.6)`,
borderColor: `rgba(${COLORS[0]}, 1)`,
borderWidth: 1,
data: dtos.map(x => Math.round(100 * (x.size / (1024 * 1024))) / 100)
data: dtos.map(x => Math.round(100 * (x.totalSize / (1024 * 1024))) / 100)
}
]
};

8
frontend/app/shared/services/usages.service.spec.ts

@ -99,13 +99,13 @@ describe('UsagesService', () => {
req.flush([
{
date: '2017-10-12',
count: 10,
size: 130
totalCount: 10,
totalSize: 130
},
{
date: '2017-10-13',
count: 13,
size: 170
totalCount: 13,
totalSize: 170
}
]);

8
frontend/app/shared/services/usages.service.ts

@ -40,8 +40,8 @@ export class ApiUsageDto {
export class StorageUsageDto {
constructor(
public readonly date: DateTime,
public readonly count: number,
public readonly size: number
public readonly totalCount: number,
public readonly totalSize: number
) {
}
}
@ -119,8 +119,8 @@ export class UsagesService {
const usages = body.map(item =>
new StorageUsageDto(
DateTime.parseISO_UTC(item.date),
item.count,
item.size));
item.totalCount,
item.totalSize));
return usages;
}),

Loading…
Cancel
Save