-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1738b10
commit 4c6aec1
Showing
4 changed files
with
82 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...Datahub.Portal/Pages/Workspace/Toolbox/ConfigurationForms/PostgresConfigurationForm.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@using Datahub.Shared.Entities | ||
@using Datahub.Portal.Pages.Account | ||
|
||
<SettingsField Label="@Localizer["Database tier"]" | ||
Description="@Localizer["Choose a tier for the compute of your database. This will affect the performance and cost of your database."]"> | ||
<MudSelect T="string" Label="@Localizer["Database tier"]" @bind-Value="@Configuration.PSQL_SKU"> | ||
@foreach (var tier in AvailableTiers) | ||
{ | ||
<MudSelectItem Value="@tier.PSQL_SKU"> | ||
@TierLabel(tier.PSQL_SKU) | ||
</MudSelectItem> | ||
} | ||
</MudSelect> | ||
</SettingsField> | ||
|
||
|
||
@code { | ||
[Parameter] public PostgresConfiguration Configuration { get; set; } | ||
|
||
private List<PostgresTier> AvailableTiers { get; set; } | ||
private PostgresTier DefaultTier => AvailableTiers.First(t => t.PSQL_SKU == "B_Standard_B1ms"); | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
await base.OnInitializedAsync(); | ||
AvailableTiers = PostgresTier.GetPostgresTiers().Where(t => t.IsAvailable).ToList(); | ||
Configuration.PSQL_SKU ??= DefaultTier.PSQL_SKU; | ||
} | ||
|
||
private string TierLabel(string sku) | ||
{ | ||
var skuTier = AvailableTiers.FirstOrDefault(t => t.PSQL_SKU == sku); | ||
if (skuTier == null) | ||
{ | ||
return sku; | ||
} | ||
|
||
return Localizer["{0} - {1} vCores, {2} RAM, {3}", skuTier.SKUName, skuTier.Cores, skuTier.MemorySize, skuTier.Cost]; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters