Skip to content

Conversation

@shaohuzhang1
Copy link
Contributor

fix: Default data for local file nodes

@f2c-ci-robot
Copy link

f2c-ci-robot bot commented Dec 3, 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 3, 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

file_count_limit: 50,
}
const form_data = computed({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The provided code does not contain any immediate irregularities, but there are some areas where it can be improved or optimized:

  1. Prop Default Values: The nodeModel prop is defined with any, which should ideally specify a more specific type for better TypeScript type checking.

  2. Form Initialization: While the current initial values of form_type_list and file_count_limit seem appropriate, having these hard-coded in JavaScript literals can make it harder to modify later if needed. Consider using an environment variable or configuration file to manage static data like this.

  3. Computed Properties: Using computed to calculate properties that only depend on reactive data is generally good practice. However, ensure there's no unnecessary computation happening within these computed properties.

  4. Code Style Consistency: Ensure consistent spacing and indentation throughout the codebase, as it improves readability and maintainability.

Here's a slightly modified version with some of these considerations:

import { defineProps, computed } from 'vue';

const props = defineProps<{ nodeModel: any }>();

// Define static constants outside components to improve reusability and maintainability
export const FILE_TYPE_LIST_OPTIONS = [
  'TXT',
  'DOCX',
  'PDF',
  'HTML',
  'XLS',
  'XLSX',
  'ZIP',
  'CSV'
];

const form = {
  file_type_list: FILE_TYPE_LIST_OPTIONS,
  // Set reasonable limits for file size and count considering typical use cases
  file_size_limit: 100 * 1024 * 1024, // e.g., 100 MB
  file_count_limit: 50,
};

const formData = computed(() => ({
  selectedFileTypeList: getSelectedFileTypes(), // Implement a helper function separately
}));

// Helper function to filter out unselected types dynamically based on user input
function getSelectedFileTypes() {
  // Example logic: return checked/selected file types here
}

Summary:

  • Use defineProps consistently throughout your Vue.js application.
  • Separate dynamic configuration (like default values) into modules or external files.
  • Avoid redundant computations within computed properties unless absolutely necessary.
  • Maintain consistency through proper coding style practices.

node_data: {},
config: {
fields: [
{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are no major irregularities or significant issues in the provided code snippet. However, there is an unnecessary property (node_data) being defined within the config object. This could be removed as it seems to serve no purpose at this point.

Here's a revised version of the code that removes the unused node_data property:

// ...

export const dataSourceLocalNode = {
  height: 728.375,
  stepName: t('views.workflow.nodes.dataSourceLocalNode.label'),
  input_field_list: [],
  // Removed: node_data: {},
  config: {
    fields: [
      {
        // ...
      }
    ],
    // Other configuration properties...
  },
};

This change reduces redundancy and maintains clarity in the component's structure.

@shaohuzhang1 shaohuzhang1 merged commit d07fc15 into v2 Dec 3, 2025
4 of 5 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@v2@fix_datasource_local branch December 3, 2025 07:16
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