index.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <div class="absolute top-0 right-0 p-16px flex flex-col gap-12px">
  3. <el-tooltip content="节点" placement="left">
  4. <el-popover placement="left-start" width="360px">
  5. <NodeLibary @add-node="(val) => $emit('create:node', val)" />
  6. <template #reference>
  7. <IconButton type="primary" class="ml-12px" icon="lucide:package-plus" square />
  8. </template>
  9. </el-popover>
  10. </el-tooltip>
  11. <el-tooltip content="注释" placement="left">
  12. <IconButton
  13. icon="lucide:file-plus-corner"
  14. square
  15. @click="$emit('create:node', 'stickyNote')"
  16. />
  17. </el-tooltip>
  18. <el-tooltip content="运行" placement="left">
  19. <IconButton
  20. icon="lucide:play"
  21. icon-color="#fff"
  22. type="success"
  23. square
  24. @click="$emit('run')"
  25. />
  26. </el-tooltip>
  27. <el-tooltip content="环境变量" placement="left">
  28. <IconButton icon="eos-icons:env" icon-color="#666" square @click="showEnvDialog = true" />
  29. </el-tooltip>
  30. <AgentEnvDialog v-model="showEnvDialog" @change="handleEnvChange" :value="envVars" />
  31. </div>
  32. </template>
  33. <script setup lang="ts">
  34. import { IconButton } from '@repo/ui'
  35. import { ref } from 'vue'
  36. import NodeLibary from '@/features/nodeLibary/index.vue'
  37. import AgentEnvDialog from './AgentEnvDialog.vue'
  38. const props = defineProps<{
  39. envVars: {
  40. name: string
  41. value: string
  42. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  43. }[]
  44. }>()
  45. const emit = defineEmits<{
  46. (
  47. e: 'changeEnvVars',
  48. value: {
  49. name: string
  50. value: string
  51. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  52. }[]
  53. ): void
  54. (e: 'run'): void
  55. (e: 'create:node', value: { type: string } | string): void
  56. }>()
  57. const showEnvDialog = ref(false)
  58. function handleEnvChange(
  59. payload: {
  60. name: string
  61. value: string
  62. type: 'string' | 'number' | 'boolean' | 'object' | 'array'
  63. }[]
  64. ) {
  65. emit('changeEnvVars', payload)
  66. }
  67. </script>
  68. <style scoped></style>