Skip to content

Commit

Permalink
feat: add SummaryDisplayable field for Option Item Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
philasmar committed Oct 13, 2021
1 parent daf2912 commit 7153286
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
12 changes: 1 addition & 11 deletions src/AWS.Deploy.CLI/Commands/DeployCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,17 +299,7 @@ private async Task<Recommendation> GetSelectedRecommendationFromPreviousDeployme
selectedRecommendation
.Recipe
.OptionSettings
.Where(x =>
{
if (!selectedRecommendation.IsOptionSettingDisplayable(x))
return false;
var value = selectedRecommendation.GetOptionSettingValue(x);
if (value == null || value.ToString() == string.Empty)
return false;
return true;
})
.Where(x => selectedRecommendation.IsSummaryDisplayable(x))
.ToArray();

foreach (var setting in optionSettings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ private List<OptionSettingItemSummary> ListOptionSettingSummary(Recommendation r
Advanced = setting.AdvancedSetting,
ReadOnly = recommendation.IsExistingCloudApplication && !setting.Updatable,
Visible = recommendation.IsOptionSettingDisplayable(setting),
SummaryDisplayable = recommendation.IsSummaryDisplayable(setting),
AllowedValues = setting.AllowedValues,
ValueMapping = setting.ValueMapping,
ChildOptionSettings = ListOptionSettingSummary(recommendation, setting.ChildOptionSettings)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public class OptionSettingItemSummary

public bool Visible { get; set; }

public bool SummaryDisplayable { get; set; }

public IList<string> AllowedValues { get; set; } = new List<string>();

public IDictionary<string, string> ValueMapping { get; set; } = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
Expand Down
15 changes: 15 additions & 0 deletions src/AWS.Deploy.Common/Recommendation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,20 @@ public bool IsOptionSettingDisplayable(OptionSettingItem optionSetting)

return true;
}

/// <summary>
/// Checks whether the Option Setting Item can be displayed as part of the settings summary of the previous deployment.
/// </summary>
public bool IsSummaryDisplayable(OptionSettingItem optionSettingItem)
{
if (!IsOptionSettingDisplayable(optionSettingItem))
return false;

var value = GetOptionSettingValue(optionSettingItem);
if (string.IsNullOrEmpty(value?.ToString()))
return false;

return true;
}
}
}
3 changes: 3 additions & 0 deletions src/AWS.Deploy.ServerMode.Client/RestAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,9 @@ public partial class OptionSettingItemSummary
[Newtonsoft.Json.JsonProperty("visible", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool Visible { get; set; }

[Newtonsoft.Json.JsonProperty("summaryDisplayable", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool SummaryDisplayable { get; set; }

[Newtonsoft.Json.JsonProperty("allowedValues", Required = Newtonsoft.Json.Required.Default, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public System.Collections.Generic.ICollection<string> AllowedValues { get; set; }

Expand Down

0 comments on commit 7153286

Please sign in to comment.