Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove disabled fields from showing on redeployment in server mode #839

Merged
merged 3 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/AWS.Deploy.CLI/ServerMode/Controllers/DeploymentController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,24 @@ private List<OptionSettingItemSummary> ListOptionSettingSummary(IOptionSettingHa

foreach (var setting in configurableOptionSettings)
{
var settingSummary = new OptionSettingItemSummary(setting.Id, setting.FullyQualifiedId, setting.Name, setting.Description, setting.Type.ToString())
var settingSummary = new OptionSettingItemSummary(
setting.Id,
setting.FullyQualifiedId,
setting.Name,
setting.Description,
setting.Type.ToString())
{
Category = setting.Category,
TypeHint = setting.TypeHint?.ToString(),
TypeHintData = setting.TypeHintData,
Value = optionSettingHandler.GetOptionSettingValue(recommendation, setting),
Advanced = setting.AdvancedSetting,
ReadOnly = recommendation.IsExistingCloudApplication && !setting.Updatable,
Visible = optionSettingHandler.IsOptionSettingDisplayable(recommendation, setting),
Visible =
optionSettingHandler.IsOptionSettingDisplayable(recommendation, setting) &&
// Updating visibility of settings in server-mode to be determined by 'VisibleOnRedeployment'
// when performing a redeployment and 'Updatable' is set to false.
!(recommendation.IsExistingCloudApplication && !setting.Updatable && !setting.VisibleOnRedeployment),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • can test coverage be applied to this new logic
  • "visible on redeployment" sounds definitive, but this isn't the case. It appears that "Updatable" takes priority (which makes sense). How can future maintainers avoid assumptions when they set VisibleOn to true and expect their field to always appear?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a server mode test to mimic the behavior in the toolkit. This change only applies to server mode.
The JSON schema for the recipe explains this. I did not want to make the setting name very long.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also move this logic into IsOptionSettingDisplayable? With a name like that I'd expect it to make the final determination, and wouldn't want some other caller of it to miss adding the new logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially my changes were in IsOptionSettingDisplayable but that impacts both the CLI, server mode, summary view and detailed view of option settings which is not what I want. So I moved it to server-mode specifically.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that'd be good context to add as a comment, but not a deal breaker if you're not already revisiting this file again.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment

SummaryDisplayable = optionSettingHandler.IsSummaryDisplayable(recommendation, setting),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you hide these from the summary as well? This pane still has the "Create new" language that kicked this off.

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opted to leave the summary view as is to give the customer an idea of all the settings they have already selected. However, not all of them are editable, so when they click Edit settings they will only see the ones that are editable as well as the disabled ones that we want visible.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The highlighted Create New is specifically what was called out first in aws/aws-toolkit-visual-studio#429, so I still think it'd be great to get it out of the summary. The "Create New Roles" too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed internally, the summary view will show all currently applied settings while the edit view will show the updatable settings plus the ones we decided should be visible. In order to remove the Create New and similar options from the summary view, I need to add custom logic which I prefer to treat as a separate effort.

AllowedValues = setting.AllowedValues,
ValueMapping = setting.ValueMapping,
Expand Down
5 changes: 5 additions & 0 deletions src/AWS.Deploy.Common/Recipes/OptionSettingItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ public partial class OptionSettingItem : IOptionSettingItem
/// </summary>
public bool Updatable { get; set; }

/// <summary>
/// If the value is true, the setting will be displayed during a redeployment. This only applies to server-mode clients.
/// </summary>
public bool VisibleOnRedeployment { get; set; }

/// <summary>
/// List of all validators that should be run when configuring this OptionSettingItem.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
"TypeHint": "AppRunnerService",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
Copy link
Member

@ashovlin ashovlin Jul 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throughout, I'd probably be a little more conservative and leave anywhere we're displaying an ID/ARN/etc. visible if possible. In case a user is using this as a reference and then doing something else with the associated resources in the console or on another screen.

  • AppRunner - KMS key
  • Fargate - VPC Id, Load Balancer ARN
  • Beanstalk - IAM role ARN, EC2 key pair

But not a deal breaker if anyone feels strongly, and this is something we can toggle as needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the summary screen shows all the currently selected options, I wanted the edit screen to be mostly the updatable settings which is why I wasn't very generous with visibility of disabled settings. Curious what @normj and @96malhar think? and as you said, changing the visibility of the disabled settings is not a breaking change and we can update based on feedback.

Copy link
Contributor

@96malhar 96malhar Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a user, I'd prefer to always see the AWS resources associated with my application across all configuration views (including the edit screen) even if I cannot modify them.

To be explicit about the immutability of certain settings on a re-deployment, we should append a line to the OptionSetting description saying - "The configured value cannot be changed during a redeployment to an existing Cloud Application". This line should be appended wherever Updatable is set to false and VisibleOnRedeployment is set to true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the resources that Alex mentioned visible. Also, I have experimented with adding a message to the description but it looked weird and repetetive in the toolkit. This message should be added by the Toolkit and should look different than the description so it could stand out.

"DefaultValue": "{StackName}-service",
"Validators": [
{
Expand Down Expand Up @@ -288,6 +289,7 @@
"Type": "String",
"AdvancedSetting": true,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"TypeHint": "ECSCluster",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -136,6 +137,7 @@
"TypeHint": "ExistingECSCluster",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand All @@ -160,6 +162,7 @@
"DefaultValue": "{StackName}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -195,6 +198,7 @@
"DefaultValue": "{StackName}-service",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -304,6 +308,7 @@
"TypeHint": "Vpc",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "IsDefault",
Expand Down Expand Up @@ -360,6 +365,7 @@
"DefaultValue": "{DefaultVpcId}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -533,6 +539,7 @@
"DefaultValue": null,
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -738,7 +745,8 @@
"Type": "Bool",
"DefaultValue": true,
"AdvancedSetting": false,
"Updatable": false
"Updatable": false,
"VisibleOnRedeployment": true
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"TypeHint": "BeanstalkApplication",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -155,6 +156,7 @@
"DefaultValue": "{StackName}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"DependsOn": [
{
"Id": "BeanstalkApplication.CreateNew",
Expand Down Expand Up @@ -187,6 +189,7 @@
"DefaultValue": "{StackName}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"DependsOn": [
{
"Id": "BeanstalkApplication.CreateNew",
Expand Down Expand Up @@ -215,6 +218,7 @@
"Type": "Object",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "EnvironmentName",
Expand All @@ -225,6 +229,7 @@
"DefaultValue": "{StackName}-dev",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -314,6 +319,7 @@
},
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -335,6 +341,7 @@
},
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"DependsOn": [
{
"Id": "ApplicationIAMRole.CreateNew",
Expand Down Expand Up @@ -365,6 +372,7 @@
},
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -386,6 +394,7 @@
},
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"DependsOn": [
{
"Id": "ServiceIAMRole.CreateNew",
Expand Down Expand Up @@ -414,6 +423,7 @@
"DefaultValue": "",
"AdvancedSetting": true,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -793,6 +803,7 @@
"DefaultValue": "{DefaultVpcId}",
"AdvancedSetting": true,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"TypeHint": "BeanstalkApplication",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -155,6 +156,7 @@
"DefaultValue": "{StackName}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"DependsOn": [
{
"Id": "BeanstalkApplication.CreateNew",
Expand Down Expand Up @@ -187,6 +189,7 @@
"DefaultValue": "{StackName}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"DependsOn": [
{
"Id": "BeanstalkApplication.CreateNew",
Expand Down Expand Up @@ -216,6 +219,7 @@
"DefaultValue": "{StackName}-dev",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -303,6 +307,7 @@
},
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -324,6 +329,7 @@
},
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"DependsOn": [
{
"Id": "ApplicationIAMRole.CreateNew",
Expand Down Expand Up @@ -354,6 +360,7 @@
},
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -375,6 +382,7 @@
},
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"DependsOn": [
{
"Id": "ServiceIAMRole.CreateNew",
Expand Down Expand Up @@ -403,6 +411,7 @@
"DefaultValue": "",
"AdvancedSetting": true,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -788,6 +797,7 @@
"DefaultValue": "{DefaultVpcId}",
"AdvancedSetting": true,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"TypeHint": "ECSCluster",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -154,6 +155,7 @@
"TypeHint": "ExistingECSCluster",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand All @@ -178,6 +180,7 @@
"DefaultValue": "{StackName}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -323,6 +326,7 @@
"DefaultValue": "{DefaultVpcId}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"TypeHint": "ECSCluster",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "CreateNew",
Expand All @@ -194,6 +195,7 @@
"TypeHint": "ExistingECSCluster",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand All @@ -218,6 +220,7 @@
"DefaultValue": "{StackName}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -247,6 +250,7 @@
"DefaultValue": "{StackName}-service",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down Expand Up @@ -336,6 +340,7 @@
"TypeHint": "Vpc",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"ChildOptionSettings": [
{
"Id": "IsDefault",
Expand Down Expand Up @@ -392,6 +397,7 @@
"DefaultValue": "{DefaultVpcId}",
"AdvancedSetting": false,
"Updatable": false,
"VisibleOnRedeployment": true,
"Validators": [
{
"ValidatorType": "Regex",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,12 @@
"description": "If the setting is false the setting can not be changed during redeployment.",
"minLength": 1
},
"VisibleOnRedeployment": {
"type": "boolean",
"title": "VisibleOnRedeployment",
"description": "If the value is true, the setting will be displayed during a redeployment. This only applies to server-mode clients.",
"minLength": 1
},
"DependsOn": {
"type": "array",
"title": "",
Expand Down
Loading
Loading