Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: The user input parameter was set to non mandatory, but after re entering the canvas editing, it became a mandatory parameter

…entering the canvas editing, it became a mandatory parameter
@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 16, 2025

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 16, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@shaohuzhang1 shaohuzhang1 merged commit bf86e19 into v2 Dec 16, 2025
3 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_workflow branch December 16, 2025 03:30
item.required = item.required == undefined ? item.is_required : item.required
switch (item.type) {
case 'input':
item.input_type = 'TextInput'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

{
 "type": "error",
 "message": "The line `item.required = item.required == undefined ? item.is_required : item.required;` can be simplified to use JavaScript's nullish coalescing operator (`??`) and logical OR operator (||) for better readability.",
 "solutions": [
   "Replace the line with:\n```javascript\nitem.required ||= item.is_required;\n```\nor if you prefer a more explicit version based on truthy values of `null`, `undefined`, or empty strings:\n```javascript\n// Option 1: Only consider non-empty strings or falsy but not true for required field.\ncurrentRequired = !!(item.required || '');\nif (!currentRequired && !!item.is_required) {\n  currentRequired = item.is_required;\n}\notherwise...\n// Option 2: Use ternary operator directly.\nitem.required = item.required ?? item.is_required;\nmaybeOption3..\n```\nor simply,\nnormalized option without using conditionals for clarity:\n```javascript\nitem.normalizedRequiredValue = normalizeBoolean(item?.required ?? '');
function normalizeBoolean(rawValue) { // Helper function could also apply custom parsing logic here if needed.\n  return rawValue !== false && rawValue !== '';\n}
```\n**Important Note:** Ensure consistency within your application regarding how boolean flags are handled before applying these solutions."
]
}

# Updated TypeScript Function Definition:

---

Now, please ensure that all files referenced in the above changes have their respective imports included:
- Import lodash for array cloning functionality.
- Import Vue components necessary for dynamic rendering within Vue templates.

Here is how it would look in one comprehensive solution format:

```typescript
import { ref, onMounted } from 'vue';
import { set, cloneDeep} from 'lodash';
import Sortable from 'sortablejs';

onMounted(async () => {
 const inputFieldList = ref<Array<{ label?: string, field?: string, type: string, value?: any, input_type?: string, options?: object, required?: boolean | null }>>([
     ...
     ]);
   }

/* Define a utility/helper function called normalizeBoolean here */
export async function validateInput(value): Promise<boolean> {
   /* Check against some specific criteria to determine validity. For example,
       valid inputs might include true/false, strings like 'enabled', 'yes',
       numbers 1/0, etc. */

   try {

       if (/^true|false$/i.test(String(value))) {// Assuming 'value' is either a string or number

           return String(value).toLowerCase() === 'true'; 
           // Convert the given string into lower case for comparison ('true' & 'False' both will be considered as True)

       }
   
       throw new Error("Invalid boolean value!");
       
   } catch(err){
   console.error('An error occurred while validating:', err);
   }

};
// And then call this helper whenever you need to validate any Boolean values.

shaohuzhang1 added a commit that referenced this pull request Dec 17, 2025
…entering the canvas editing, it became a mandatory parameter (#4521)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants