From d8ffb4309350b7cc2a6525623e9b159174d97d89 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 2 May 2019 21:32:28 +0200 Subject: [PATCH] Checkbox styling. --- .../Backups/BackupContentController.cs | 23 ++++++++++++++++--- .../forms/checkbox-group.component.html | 4 ++-- .../forms/checkbox-group.component.scss | 8 +++++-- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/Squidex/Areas/Api/Controllers/Backups/BackupContentController.cs b/src/Squidex/Areas/Api/Controllers/Backups/BackupContentController.cs index 25c965033..5965fd808 100644 --- a/src/Squidex/Areas/Api/Controllers/Backups/BackupContentController.cs +++ b/src/Squidex/Areas/Api/Controllers/Backups/BackupContentController.cs @@ -6,8 +6,11 @@ // ========================================================================== using System; +using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Orleans; +using Squidex.Domain.Apps.Entities.Backup; using Squidex.Infrastructure.Assets; using Squidex.Infrastructure.Commands; using Squidex.Web; @@ -21,11 +24,13 @@ namespace Squidex.Areas.Api.Controllers.Backups public class BackupContentController : ApiController { private readonly IAssetStore assetStore; + private readonly IGrainFactory grainFactory; - public BackupContentController(ICommandBus commandBus, IAssetStore assetStore) + public BackupContentController(ICommandBus commandBus, IAssetStore assetStore, IGrainFactory grainFactory) : base(commandBus) { this.assetStore = assetStore; + this.grainFactory = grainFactory; } /// @@ -43,9 +48,21 @@ namespace Squidex.Areas.Api.Controllers.Backups [ProducesResponseType(typeof(FileResult), 200)] [ApiCosts(0)] [AllowAnonymous] - public IActionResult GetBackupContent(string app, Guid id) + public async Task GetBackupContent(string app, Guid id) { - return new FileCallbackResult("application/zip", "Backup.zip", false, bodyStream => + var backupGrain = grainFactory.GetGrain(AppId); + + var backups = await backupGrain.GetStateAsync(); + var backup = backups.Value.Find(x => x.Id == id); + + if (backup == null || backup.Status != JobStatus.Completed) + { + return NotFound(); + } + + var fileName = $"backup-{app}-{backup.Started:yyyy-MM-dd_HH-mm-ss}"; + + return new FileCallbackResult("application/zip", fileName, false, bodyStream => { return assetStore.DownloadAsync(id.ToString(), 0, null, bodyStream); }); diff --git a/src/Squidex/app/framework/angular/forms/checkbox-group.component.html b/src/Squidex/app/framework/angular/forms/checkbox-group.component.html index f3245e6f2..03ac612dd 100644 --- a/src/Squidex/app/framework/angular/forms/checkbox-group.component.html +++ b/src/Squidex/app/framework/angular/forms/checkbox-group.component.html @@ -1,4 +1,4 @@ - +
- \ No newline at end of file +
\ No newline at end of file diff --git a/src/Squidex/app/framework/angular/forms/checkbox-group.component.scss b/src/Squidex/app/framework/angular/forms/checkbox-group.component.scss index c30feb8f0..773582ba7 100644 --- a/src/Squidex/app/framework/angular/forms/checkbox-group.component.scss +++ b/src/Squidex/app/framework/angular/forms/checkbox-group.component.scss @@ -2,11 +2,15 @@ @import '_vars'; .form-check { - display: inline-block; + display: block; margin-left: 0; - margin-right: 1rem; + margin-bottom: .5rem; } .form-check-input { margin-top: .4rem; +} + +label { + min-width: 5rem; } \ No newline at end of file