Browse Source

Title for content values

pull/892/head
Sebastian Stehle 4 years ago
committed by GitHub
parent
commit
dacf3dfea2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs
  2. 2
      backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryByQuery.cs
  3. 6
      backend/src/Squidex.Domain.Apps.Entities.MongoDb/MongoCountCollection.cs
  4. 7
      backend/src/Squidex/Areas/Api/Controllers/Statistics/UsagesController.cs
  5. 4
      frontend/src/app/framework/angular/modals/dialog-renderer.component.html
  6. 17
      frontend/src/app/framework/services/dialog.service.ts
  7. 2
      frontend/src/app/shared/components/contents/content-value.component.html
  8. 4
      frontend/src/app/shared/components/contents/content-value.component.ts

4
backend/src/Squidex.Domain.Apps.Entities.MongoDb/Assets/MongoAssetRepository.cs

@ -138,8 +138,8 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Assets
} }
else if (isDefaultQuery) else if (isDefaultQuery)
{ {
// Cache total count by app and folder. // Cache total count by app and asset folder.
var totalKey = parentId.HasValue ? DomainId.Combine(appId, parentId.Value) : appId; var totalKey = $"{appId}_{parentId}";
assetTotal = await countCollection.GetOrAddAsync(totalKey, ct => Collection.Find(filter).CountDocumentsAsync(ct), ct); assetTotal = await countCollection.GetOrAddAsync(totalKey, ct => Collection.Find(filter).CountDocumentsAsync(ct), ct);
} }

2
backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/Operations/QueryByQuery.cs

@ -153,7 +153,7 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents.Operations
else if (isDefault) else if (isDefault)
{ {
// Cache total count by app and schema. // 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); contentTotal = await countCollection.GetOrAddAsync(totalKey, ct => Collection.Find(filter).CountDocumentsAsync(ct), ct);
} }

6
backend/src/Squidex.Domain.Apps.Entities.MongoDb/MongoCountCollection.cs

@ -30,12 +30,6 @@ namespace Squidex.Domain.Apps.Entities.MongoDb
return name; 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, public async Task<long> GetOrAddAsync(string key, Func<CancellationToken, Task<long>> provider,
CancellationToken ct) CancellationToken ct)
{ {

7
backend/src/Squidex/Areas/Api/Controllers/Statistics/UsagesController.cs

@ -170,13 +170,12 @@ namespace Squidex.Areas.Api.Controllers.Statistics
{ {
var appId = DomainId.Create(dataProtector.Unprotect(token)); var appId = DomainId.Create(dataProtector.Unprotect(token));
var today = DateTime.UtcNow.Date; var fileDate = DateTime.UtcNow.Date;
var fileName = $"Usage-{fileDate:yyy-MM-dd}.csv";
var fileName = $"Usage-{today:yyy-MM-dd}.csv";
var callback = new FileCallback((body, range, ct) => 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) return new FileCallbackResult("text/csv", callback)

4
frontend/src/app/framework/angular/modals/dialog-renderer.component.html

@ -43,8 +43,8 @@
<div class="tooltip2 tooltip2-{{tooltip.textPosition}}" <div class="tooltip2 tooltip2-{{tooltip.textPosition}}"
[sqxAnchoredTo]="tooltip.target" [sqxAnchoredTo]="tooltip.target"
[position]="tooltip.textPosition" [position]="tooltip.textPosition"
[offsetY]="6" [offsetY]="tooltip.offsetY"
[offsetX]="6"> [offsetX]="tooltip.offsetX">
{{tooltip.text | sqxTranslate}} {{tooltip.text | sqxTranslate}}
<ng-container *ngIf="tooltip.shortcut"> <ng-container *ngIf="tooltip.shortcut">

17
frontend/src/app/framework/services/dialog.service.ts

@ -60,6 +60,16 @@ export class DialogRequest {
} }
export class Tooltip { export class Tooltip {
private readonly isHorizontal;
public get offsetX() {
return this.isHorizontal ? 6 : 0;
}
public get offsetY() {
return this.isHorizontal ? 0 : 6;
}
constructor( constructor(
public readonly target: any, public readonly target: any,
public readonly text: string | null | undefined, public readonly text: string | null | undefined,
@ -67,6 +77,13 @@ export class Tooltip {
public readonly multiple?: boolean, public readonly multiple?: boolean,
public readonly shortcut?: string, public readonly shortcut?: string,
) { ) {
this.isHorizontal =
textPosition === 'left-bottom' ||
textPosition === 'left-center' ||
textPosition === 'left-top' ||
textPosition === 'right-bottom' ||
textPosition === 'right-center' ||
textPosition === 'right-top';
} }
} }

2
frontend/src/app/shared/components/contents/content-value.component.html

@ -1,5 +1,5 @@
<ng-container *ngIf="isPlain; else html"> <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 #valueElement [class.truncate]="!wrapping">{{value}}</div>
</div> </div>

4
frontend/src/app/shared/components/contents/content-value.component.ts

@ -35,6 +35,10 @@ export class ContentValueComponent extends ResourceOwner implements OnChanges {
return !Types.is(this.value, HtmlValue); return !Types.is(this.value, HtmlValue);
} }
public get title() {
return this.isString ? this.value : undefined;
}
constructor( constructor(
private readonly changeDetector: ChangeDetectorRef, private readonly changeDetector: ChangeDetectorRef,
) { ) {

Loading…
Cancel
Save