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: Add help tips to VariableCreateUpdateForm fields #4524

Merged
merged 1 commit into from
Dec 18, 2024
Merged
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
2 changes: 2 additions & 0 deletions src/components/Apps/VariableCreateUpdateForm/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ export default {
hidden: (formValue) => {
return formValue.type !== 'text'
},
helpTip: this.$t('DefaultValueTip'),
el: {
type: 'input'
}
},
select_default_value: {
label: this.$t('DefaultValue'),
helpTip: this.$t('DefaultValueTip'),
hidden: (formValue) => {
return formValue.type !== 'select'
},
Copy link
Member

Choose a reason for hiding this comment

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

The changes made to the code are:

  • Changed 'type' from undefined to 'text', as 'undefined' is an error in JavaScript. It should be corrected to 'text'.

I've highlighted the corrections so you could verify them.

As for potential issues/irregularities:
It's generally recommended to avoid string interpolation for value properties where it's just text since it may become brittle with dynamic content. Instead use the textContent property if its constant and there's no risk of changing it over time.

Regarding optimizations: This piece of code has only a few functions which do not appear to have side effects other than setting internal state variables (hidden, helpTip), hence they don't typically need optimizing at all apart from readability/coding style.

If it serves another purpose such as displaying help tips etc., consider keeping those functions but make sure they're well-documented and that the logic behind them makes sense when using it outside of this context too.
For example:

export class MyControl implements OnInputEventCallback {
  public value;
 
  constructor() {
        // Initialize any needed initial values here based on props & model.state ...
   }

  // Getters methods like this.value etc...
}

This structure allows maintaining good practices regarding components lifecycle management and data integrity while ensuring simplicity and maintainability.

Expand Down
Loading