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

Do not show Configuration diff for PreDeployments #879

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

dotNomad
Copy link
Collaborator

This PR avoids showing the Configuration diff view for each attribute in the configuration when looking at a PreDeployment

Intent

Type of Change

    • Bug Fix
    • New Feature
    • Breaking Change
    • Documentation
    • Refactor
    • Tooling

Approach

The approach here was to avoid passing deployment down to every Configuration component and checking if it was a pre-deployment. Instead we can check that directly in the ConfigSetting.vue component which determines whether or not to show the plaintext value or the diff views. To do this without a lot of nested props we can use Provide / Inject.

Since all attributes are new (since this PreDeployment has never been deployed) we need to check if this is a PreDeployment so new attributes still work for Redeployments.

Comment on lines +7 to +11
export const deploymentKey = Symbol('deployment') as InjectionKey<
PreDeployment |
Deployment |
DeploymentError
>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This methodology is describe in Vue's docs under Typing Provide / Inject.

const deployment = inject(deploymentKey);

const showDiff = computed((): boolean => {
const isPre = deployment ? isPreDeployment(deployment) : false;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We aren't guaranteed to get a deployment. There is no way in Vue to tell it we are for sure provided a key value, but we can easily default to the previous behavior of comparing just the values if we aren't provided a deployment.

Copy link
Collaborator

@sagerb sagerb left a comment

Choose a reason for hiding this comment

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

LGTM!

@dotNomad dotNomad merged commit 5ef8f15 into main Jan 25, 2024
22 checks passed
@dotNomad dotNomad deleted the dotnomad/pre-deployment-diff branch January 25, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PreDeployment shows all config details as new
2 participants