Sebastian Stehle
4 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
30 additions and
16 deletions
-
backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs
-
backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryByQuery.cs
-
backend/src/Squidex.Domain.Apps.Entities.MongoDb/MongoCountCollection.cs
-
backend/src/Squidex/Areas/Api/Controllers/Statistics/UsagesController.cs
-
frontend/src/app/framework/angular/modals/dialog-renderer.component.html
-
frontend/src/app/framework/services/dialog.service.ts
-
frontend/src/app/shared/components/contents/content-value.component.html
-
frontend/src/app/shared/components/contents/content-value.component.ts
|
|
|
@ -138,8 +138,8 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets |
|
|
|
} |
|
|
|
else if (isDefaultQuery) |
|
|
|
{ |
|
|
|
// Cache total count by app and folder.
|
|
|
|
var totalKey = parentId.HasValue ? DomainId.Combine(appId, parentId.Value) : appId; |
|
|
|
// Cache total count by app and asset folder.
|
|
|
|
var totalKey = $"{appId}_{parentId}"; |
|
|
|
|
|
|
|
assetTotal = await countCollection.GetOrAddAsync(totalKey, ct => Collection.Find(filter).CountDocumentsAsync(ct), ct); |
|
|
|
} |
|
|
|
|
|
|
|
@ -153,7 +153,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Operations |
|
|
|
else if (isDefault) |
|
|
|
{ |
|
|
|
// Cache total count by app and schema.
|
|
|
|
var totalKey = DomainId.Combine(app.Id, schema.Id); |
|
|
|
var totalKey = $"{app.Id}_{schema.Id}"; |
|
|
|
|
|
|
|
contentTotal = await countCollection.GetOrAddAsync(totalKey, ct => Collection.Find(filter).CountDocumentsAsync(ct), ct); |
|
|
|
} |
|
|
|
|
|
|
|
@ -30,12 +30,6 @@ namespace Squidex.Domain.Apps.Entities.MongoDb |
|
|
|
return name; |
|
|
|
} |
|
|
|
|
|
|
|
public Task<long> GetOrAddAsync(DomainId key, Func<CancellationToken, Task<long>> provider, |
|
|
|
CancellationToken ct) |
|
|
|
{ |
|
|
|
return GetOrAddAsync(key.ToString(), provider, ct); |
|
|
|
} |
|
|
|
|
|
|
|
public async Task<long> GetOrAddAsync(string key, Func<CancellationToken, Task<long>> provider, |
|
|
|
CancellationToken ct) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -170,13 +170,12 @@ namespace Squidex.Areas.Api.Controllers.Statistics |
|
|
|
{ |
|
|
|
var appId = DomainId.Create(dataProtector.Unprotect(token)); |
|
|
|
|
|
|
|
var today = DateTime.UtcNow.Date; |
|
|
|
|
|
|
|
var fileName = $"Usage-{today:yyy-MM-dd}.csv"; |
|
|
|
var fileDate = DateTime.UtcNow.Date; |
|
|
|
var fileName = $"Usage-{fileDate:yyy-MM-dd}.csv"; |
|
|
|
|
|
|
|
var callback = new FileCallback((body, range, ct) => |
|
|
|
{ |
|
|
|
return appLogStore.ReadLogAsync(appId, today.AddDays(-30), today, body, ct); |
|
|
|
return appLogStore.ReadLogAsync(appId, fileDate.AddDays(-30), fileDate, body, ct); |
|
|
|
}); |
|
|
|
|
|
|
|
return new FileCallbackResult("text/csv", callback) |
|
|
|
|
|
|
|
@ -43,8 +43,8 @@ |
|
|
|
<div class="tooltip2 tooltip2-{{tooltip.textPosition}}" |
|
|
|
[sqxAnchoredTo]="tooltip.target" |
|
|
|
[position]="tooltip.textPosition" |
|
|
|
[offsetY]="6" |
|
|
|
[offsetX]="6"> |
|
|
|
[offsetY]="tooltip.offsetY" |
|
|
|
[offsetX]="tooltip.offsetX"> |
|
|
|
{{tooltip.text | sqxTranslate}} |
|
|
|
|
|
|
|
<ng-container *ngIf="tooltip.shortcut"> |
|
|
|
|
|
|
|
@ -60,6 +60,16 @@ export class DialogRequest { |
|
|
|
} |
|
|
|
|
|
|
|
export class Tooltip { |
|
|
|
private readonly isHorizontal; |
|
|
|
|
|
|
|
public get offsetX() { |
|
|
|
return this.isHorizontal ? 6 : 0; |
|
|
|
} |
|
|
|
|
|
|
|
public get offsetY() { |
|
|
|
return this.isHorizontal ? 0 : 6; |
|
|
|
} |
|
|
|
|
|
|
|
constructor( |
|
|
|
public readonly target: any, |
|
|
|
public readonly text: string | null | undefined, |
|
|
|
@ -67,6 +77,13 @@ export class Tooltip { |
|
|
|
public readonly multiple?: boolean, |
|
|
|
public readonly shortcut?: string, |
|
|
|
) { |
|
|
|
this.isHorizontal = |
|
|
|
textPosition === 'left-bottom' || |
|
|
|
textPosition === 'left-center' || |
|
|
|
textPosition === 'left-top' || |
|
|
|
textPosition === 'right-bottom' || |
|
|
|
textPosition === 'right-center' || |
|
|
|
textPosition === 'right-top'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1,5 +1,5 @@ |
|
|
|
<ng-container *ngIf="isPlain; else html"> |
|
|
|
<div class="value-container"> |
|
|
|
<div class="value-container" [title]="title" titlePosition="top-left"> |
|
|
|
<div #valueElement [class.truncate]="!wrapping">{{value}}</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
@ -35,6 +35,10 @@ export class ContentValueComponent extends ResourceOwner implements OnChanges { |
|
|
|
return !Types.is(this.value, HtmlValue); |
|
|
|
} |
|
|
|
|
|
|
|
public get title() { |
|
|
|
return this.isString ? this.value : undefined; |
|
|
|
} |
|
|
|
|
|
|
|
constructor( |
|
|
|
private readonly changeDetector: ChangeDetectorRef, |
|
|
|
) { |
|
|
|
|