diff --git a/BTCPayServer/Controllers/ServerController.Storage.cs b/BTCPayServer/Controllers/ServerController.Storage.cs index 18b470b30..495a884a9 100644 --- a/BTCPayServer/Controllers/ServerController.Storage.cs +++ b/BTCPayServer/Controllers/ServerController.Storage.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using BTCPayServer.Abstractions.Extensions; @@ -19,6 +20,8 @@ using BTCPayServer.Storage.ViewModels; using BTCPayServer.Views; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.AspNetCore.Mvc.ViewFeatures; using Newtonsoft.Json.Linq; namespace BTCPayServer.Controllers @@ -175,8 +178,13 @@ namespace BTCPayServer.Controllers var savedSettings = await _SettingsRepository.GetSettingAsync(); if (forceChoice || savedSettings == null) { + var providersList = _StorageProviderServices.Select(a => + new SelectListItem(a.StorageProvider().ToString(), a.StorageProvider().ToString()) + ); + return View(new ChooseStorageViewModel() { + ProvidersList = providersList, ShowChangeWarning = savedSettings != null, Provider = savedSettings?.Provider ?? BTCPayServer.Storage.Models.StorageProvider.FileSystem }); diff --git a/BTCPayServer/Storage/ViewModels/ChooseStorageViewModel.cs b/BTCPayServer/Storage/ViewModels/ChooseStorageViewModel.cs index 9346f7aea..844c01d1c 100644 --- a/BTCPayServer/Storage/ViewModels/ChooseStorageViewModel.cs +++ b/BTCPayServer/Storage/ViewModels/ChooseStorageViewModel.cs @@ -1,9 +1,12 @@ +using System.Collections.Generic; using BTCPayServer.Storage.Models; +using Microsoft.AspNetCore.Mvc.Rendering; namespace BTCPayServer.Storage.ViewModels { public class ChooseStorageViewModel { + public IEnumerable ProvidersList { get; set; } public StorageProvider Provider { get; set; } public bool ShowChangeWarning { get; set; } } diff --git a/BTCPayServer/Views/Server/Storage.cshtml b/BTCPayServer/Views/Server/Storage.cshtml index d7a258977..6c4bf7187 100644 --- a/BTCPayServer/Views/Server/Storage.cshtml +++ b/BTCPayServer/Views/Server/Storage.cshtml @@ -1,4 +1,4 @@ -@using BTCPayServer.Storage.Models +@using BTCPayServer.Storage.Models @model BTCPayServer.Storage.ViewModels.ChooseStorageViewModel @{ ViewData.SetActivePageAndTitle(ServerNavPages.Services, "Storage"); @@ -22,7 +22,7 @@ }
- +