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

fix: Workflow text to speech node cannot be added #2147

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

shaohuzhang1
Copy link
Contributor

fix: Workflow text to speech node cannot be added

Copy link

f2c-ci-robot bot commented Feb 7, 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.

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/test-infra repository.

Copy link

f2c-ci-robot bot commented Feb 7, 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.

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 d9e18f1 into main Feb 7, 2025
4 checks passed
@shaohuzhang1 shaohuzhang1 deleted the pr@main@fix_workflow_tts_node branch February 7, 2025 04:14
</NodeContainer>
<TTSModeParamSettingDialog ref="TTSModeParamSettingDialogRef" @refresh="refreshTTSForm" />
</template>

<script setup lang="ts">
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 code you provided looks mostly correct with minimal issues. However, there are a few minor points to consider for organization and readability:

  1. Duplicate TTSModeParamSettingDialog Reference:
    The <TTSModeParamSettingDialog> component is instantiated twice within the template, which could be misleading or unnecessary if it's meant to be reusable.

  2. Conditional Rendering Refinement (Optional):
    If you need to conditionally render this dialog based on certain conditions, you might want to remove one instance of the reference and use conditional rendering (v-if, etc.) in the template instead.

  3. Styling Consideration:
    Ensure that the styling associated with [ref="TTSModeParamSettingDialogRef"] does not conflict with any other styles elsewhere in your application.

Here's an improved version of the code considering these points:

<template>
  <NodeContainer>
    <el-form :model="ttsParameters" :rules="ttsRules" ref="TTSFormRef">
      <!-- Form items -->
      <el-form-item label="Parameter 1" prop="param1">
        <el-input v-model="ttsParameters.param1"></el-input>
      </el-form-item>
      
      <el-form-item label="Parameter 2" prop="param2">
        <el-input v-model="ttsParameters.param2"></el-input>
      </el-form-item>

      <!-- More form items -->

      <button @click="submit">Submit</button>
    </el-form>
  </NodeContainer>

  <TTSModeParamSettingDialog 
    ref="TTSModeParamSettingDialogRef"
    @refresh="refreshTTSForm"/>
</template>

<script setup lang="ts">
import { reactive } from 'vue';

// Assuming ttsRules are defined somewhere else
const ttsParameters = reactive({
  param1: '',
  param2: ''
});

const refreshTTSForm = () => {
  // This function should update ttS parameters as needed
};

function submit() {
  const validateStatus = ($index, $valid) => {
    return !($index > 1 && !$valid); // Example validation logic
  };
  
  const rulesWithValidation = Object.assign({}, ttsRules, {
    "parameter": [{ validator: validateStatus }]
  });

  this.$refs.TTSFormRef.validate((valid) => {
    if (valid) {
      console.log('form submission');
    } else {
      console.log('error!');
      return false;
    }
  });
}

defineComponent({
  components: {
    TTSModeParamSettingDialog
  },
});
</script>

<style scoped>
/* Add your CSS here */
</style>

This version removes the duplicate instantiation and adds basic input handling with a submit button. Adjust the refreshTTSForm method as needed depending on your data flow requirements.

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.

1 participant