Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions ui/src/assets/sort.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 14 additions & 2 deletions ui/src/workflow/nodes/base-node/component/ApiInputFieldTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@
ref="tableRef"
row-key="field"
>
<el-table-column prop="variable" :label="$t('dynamicsForm.paramForm.field.label')" />
<el-table-column prop="default_value" :label="$t('dynamicsForm.default.label')" />
<el-table-column prop="variable" :label="$t('dynamicsForm.paramForm.field.label')">
<template #default="{ row }">
<span class="ellipsis-1" :title="row.variable">
{{ row.variable }}
</span>
</template>
</el-table-column>
<el-table-column prop="default_value" :label="$t('dynamicsForm.default.label')">
<template #default="{ row }">
<span class="ellipsis-1" :title="row.default_value">
{{ row.default_value }}
</span>
</template>
</el-table-column>
<el-table-column :label="$t('common.required')">
<template #default="{ row }">
<div @click.stop>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No significant irregularities or obvious optimizations were found in the provided code snippet. It appears to correctly format an el-table column with ellipsis truncation for both 'variable' and 'default_value'. Additionally, the template is structured slightly differently but serves similar functionality. If this changes the behavior of your table (e.g., causing performance issues), you might need further testing on specific data sets. Otherwise, no adjustments seem necessary.

Expand Down
29 changes: 26 additions & 3 deletions ui/src/workflow/nodes/condition-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@
<el-card
v-resize="(wh: any) => resizeCondition(wh, item, index)"
shadow="never"
class="card-never mb-8"
class="drag-card card-never mb-8"
:class="{ 'no-drag': index === form_data.branch.length - 1 }"
style="--el-card-padding: 12px"
>
<div class="handle flex-between lighter">
{{ item.type }}
<span class="flex align-center">
<img src="@/assets/sort.svg" alt="" height="15" class="handle-img mr-4" />
{{ item.type }}
</span>
<div class="info" v-if="item.conditions.length > 1">
<span>{{
$t('views.applicationWorkflow.nodes.conditionNode.conditions.info')
Expand Down Expand Up @@ -337,4 +340,24 @@ onMounted(() => {
set(props.nodeModel, 'validate', validate)
})
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.drag-card.no-drag {
.handle {
.handle-img {
display: none;
}
}
}
.drag-card:not(.no-drag) {
.handle {
.handle-img {
display: none;
}
&:hover {
.handle-img {
display: block;
}
}
}
}
</style>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Your code has several minor issues and suggestions for improvement:

  1. Duplicate Code Block: The first handle class rules are duplicated in the .drag-card:not(.no-drag) block, which is unnecessary duplication.

  2. Flexbox Alignment: In the <span> element within the handle, there's an additional inline-block (align-items) that doesn't make sense with existing flex properties.

  3. Image Display Condition: Ensure that the image only appears when hovering over non-droppable items to avoid confusion for users.

Here's a revised version of your component:

<template>
  <el-card
    v-resize="(wh: any) => resizeCondition(wh, item, index)"
    shadow="never"
    class="drag-card card-never mb-8"
    :class="{ 'no-drag': index === form_data.branch.length - 1 }"
    style="--el-card-padding: 12px;"
  >
    <div class="handle flex-between lighter">
      <span class="flex-align-center">
        <img src="@/assets/sort.svg" alt="" height="15" :class="{ 'mr-4': !index === form_data.branch.length - 1 }" />
        {{ item.type }}
      </span>
      <div class="info" v-if="item.conditions.length > 1">
        <!-- Your condition info content here -->
      </div>
    </div>
  </el-card>
</template>

<script setup lang="ts">
// Import necessary components and define props if needed

const { form_data, item_model } = defineProps<{
  form_data: object;
  item_model: object;
}>()

onMounted(() => {
  set(item_model, 'validate', validate);
});
</script>

<style scoped lang="scss">
.drag-card.no-drag {
  .handle {
    img.handle-img {
      // No need for separate styling since it doesn't change anyway
    }
  }
}

.drag-card:not(.no-drag) {
  .handle {
    img.handle-img {
      &:hover {
        display: block;
      }
    }
  }
}
</style>

Key Changes Made:

  1. Removed duplicate rules in the .drag-card:not(.no-drag) section.
  2. Simplified CSS for hover effect by using direct child selectors.
  3. Adjusted spacing and alignment logic for better readability and user experience.

These changes ensure cleaner and more maintainable code while addressing some of the identified issues.

2 changes: 1 addition & 1 deletion ui/src/workflow/nodes/start-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@mouseenter="showicon = true"
@mouseleave="showicon = false"
>
<span>{{ item.label }} {{ '{' + item.value + '}' }}</span>
<span class="break-all">{{ item.label }} {{ '{' + item.value + '}' }}</span>
<el-tooltip
effect="dark"
:content="$t('views.applicationWorkflow.setting.copyParam')"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The provided code has two main areas for improvement:

  1. Break All Text: The line <span class="break-all">{{ item.label }} {{ '{' + item.value + '}' }}</span> is adding a CSS class break-all to the span element containing text that might be too long or wide to fit in its container. This prevents overflow and ensures all content is shown regardless of width. Consider wrapping long labels or values within a div with the same style if necessary.

  2. Optimization: There isn't anything specific about the current implementation that appears to need optimization at this time. However, ensure that any event handlers (@mouseenter, @mouseleave) are efficient and perform their functions without unnecessary computations. Also, verify that the $i18n.t function call (used in the tooltip) is properly loaded and works correctly across translations.

Here's the cleaned-up version with minor adjustments:

<span v-if="item.label" class="break-all">
  <span>{{ item.label }}
  {{ '{' + item.value + '}' }}
</span>

<el-tooltip effect="dark" :content="$t('views.applicationWorkflow.setting.copyParam')" placement="right-start"></el-tooltip>

Ensure proper HTML structure integrity and test the changes in various environments to confirm they meet functionality requirements.

Expand Down