-
Notifications
You must be signed in to change notification settings - Fork 2.6k
style: MCP config dialog style #3911
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,7 @@ | |
| <img src="@/assets/workflow/icon_tool.svg" style="width: 58%" alt="" /> | ||
| </el-avatar> | ||
| <div class="pre-wrap ml-8"> | ||
| <div class="lighter">{{ $t('views.tool.form.create') }}</div> | ||
| <div class="lighter">{{ $t('views.tool.createTool') }}</div> | ||
| </div> | ||
| </div> | ||
| </el-dropdown-item> | ||
|
|
@@ -60,7 +60,7 @@ | |
| <img src="@/assets/workflow/icon_mcp.svg" style="width: 75%" alt="" /> | ||
| </el-avatar> | ||
| <div class="pre-wrap ml-8"> | ||
| <div class="lighter">{{ $t('views.tool.form.createMcp') }}</div> | ||
| <div class="lighter">{{ $t('views.tool.createMcpTool') }}</div> | ||
| </div> | ||
| </div> | ||
| </el-dropdown-item> | ||
|
|
@@ -222,8 +222,8 @@ | |
| v-if="item.tool_type === 'MCP'" | ||
| @click.stop="showMcpConfig(item)" | ||
| > | ||
| <AppIcon iconName="app-edit" class="color-secondary"></AppIcon> | ||
| {{ $t('views.tool.form.mcpConfig') }} | ||
| <AppIcon iconName="app-operate-log" class="color-secondary"></AppIcon> | ||
| {{ $t('views.tool.mcpConfig') }} | ||
| </el-dropdown-item> | ||
| <el-dropdown-item | ||
| v-if="item.template_id && permissionPrecise.edit(item.id)" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code you provided seems to contain some issues related to string translations and possibly incorrect permissions checking logic. Here are the key points to consider:
Here is a revised version addressing the identified issues: @@ -50,7 +50,7 @@
<img :src="$require('../../assets/workflow/icon_tool.svg')" style="width: 58%; height: auto;" alt="" />
</el-avatar>
<div class="pre-wrap ml-8">
- <div class="lighter">{{ $t('view.toolbar.tools.newTool') }}</div> <!-- Assuming there is such a translation -->
+ <div class="lighter">{{ $t('view.toolbar.tools.createTool') }}</div> <!-- Check the actual translation key -->
</div>
</div>
</el-dropdown-item>
@@ -60,7 +60,7 @@
<img :src="$require('../../assets/workflow/icon_mcp.svg')" style="width: 75%"; height: auto;" alt="" />
</el-avatar>
<div class="pre-wrap ml-8" v-if="item.type.toLowerCase() === 'mcp'" data-tool-type="mcptool">
- <span>{{ $t('view.toolbar.tools.mcPconfig', { name: item.name }) }}</span>
+ <span>{{ $t('view.toolbar.tools.configMCPTool', { name: item.name }) }}</span> <!-- Adjust the translation key as needed -->
<!-- Use the correct permission checking function -->
<template v-if="hasEditPermissionForMcP(item)">{{ __('Edit MCP Config') }}</template>Make sure the above changes align with your actual translation system and that all translated strings exist in your locale files (e.g., en.json). Additionally, ensure |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,12 +20,10 @@ | |
| </el-button> | ||
| </el-tooltip> | ||
| </div> | ||
| <template v-if="nodeModel.properties.config.chatFields"> | ||
| <template v-if="nodeModel.properties.config.chatFields?.length"> | ||
| <h5 class="title-decoration-1 mb-8">{{ $t('views.applicationWorkflow.variable.chat') }}</h5> | ||
| <div | ||
| v-for="(item, index) in nodeModel.properties.config.chatFields | ||
| ? nodeModel.properties.config.chatFields | ||
| : []" | ||
| v-for="(item, index) in nodeModel.properties.config.chatFields || []" | ||
| :key="index" | ||
| class="flex-between border-r-6 p-8-12 mb-8 layout-bg lighter" | ||
| @mouseenter="showicon = true" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code you provided contains several improvements that address potential issues and improve readability:
Here's the revised version of your code with these improvements: <div>
<!-- Existing content -->
</div>
<template v-if="nodeModel.properties.config && nodeModel.properties.config.chatFields?.length">
<h5 class="title-decoration-1 mb-8">{{ $t('views.applicationWorkflow.variable.chat') }}</h5>
<div
v-for="(item, index) in nodeModel.properties.config.chatFields || []
:key="index"
class="flex-between border-r-6 p-8-12 mb-8 layout-bg lighter"
@mouseenter="showicon = true" @mouseleave="showicon = false"
>
<!-- Content for chat fields -->
</div>
</template>
<!-- Example additional line added to demonstrate better understanding -->
let showicon = false; // To store whether icon should be shown on hoverThese changes make the code more robust, easier to understand, and less prone to runtime errors caused by unexpected data structures. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review and Optimization Suggestions
General Checks:
refis imported only once at the beginning of the file to avoid redundancy.showIcon) in thedata()block which can be removed for simplicity..config-textareaduplicates some styling from within:deep(.el-textarea__inner). Remove unnecessary duplication.Potential Issues:
<template>not being closed properly. Ensure all tags have matching closing elements.Optimizations:
v-bind:class.Revised Code:
<template> <el-dialog :title="$t('views.tool.mcpConfig')" width="600" v-model="dialogVisible" :close-on-click-modal="false" :close-on-press-escape="false" :destroy-on-close="true" :before-close="close" append-to-body class="mcp-config-dialog" > <el-form label-width="auto" label-position="top"> <el-form-item> <el-input v-model="mcp_servers" rows="8" disabled class="config-textarea" ></el-input> <span @mouseenter.stop="handleShowIcon(true)" @mouseleave.stop="handleShowIcon(false)" class="copy-icon" :class="{ 'opacity-85': showIcon }" > <AppIcon iconName="app-copy" class="color-secondary"/> </span> </el-form-item> </el-form> </el-dialog> </template> <script setup lang="ts"> import { ref, defineExpose } from "vue"; import { copyClick } from "@/utils/clipboard"; let mcp_servers = ref(""); let dialogVisible = ref(false); let showIcon = ref(false); const close = () => { dialogVisible.value = false; }; const open = (item: any) => { dialogVisible.value = true; }; defineExpose({ open, }); const handleShowIcon = (flag: boolean) => { showIcon.value = flag; }; </script> <style scoped lang="scss"> $mcp-config-dialog-border-radius: 8px; .mcp-config-dialog { border-radius: $mcp-config-dialog-border-radius; padding-bottom: 1em; .copy-icon { position: absolute; top: calc(50% - 14px); /** Adjusted for vertical alignment */ right: 10px; box-shadow: none; /* Removed for transparency effect */ } &:hover .copy-icon { opacity: 1; } } </style>Changes Made:
<style>element.@mouseenterand@mouseleave.:.config-textarea::deep(...)with a more direct approach.box-shadow: noneto allow text highlighting without shadows appearing under the icons, enhancing user experience.