Skip to content

Commit

Permalink
feat: 右侧点击展示菜单
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Sep 12, 2024
1 parent e8e4db1 commit 1488e50
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
18 changes: 16 additions & 2 deletions ui/src/workflow/common/NodeContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,19 @@
</div>
</div>
</div>
<el-collapse-transition>
<div
style="height: 400px; left: 100%; top: 50%; transform: translate(0, -50%)"
v-show="showAnchor"
class="workflow-dropdown-menu border border-r-4"
>
内容嘻嘻嘻
</div>
</el-collapse-transition>
</div>
</template>
<script setup lang="ts">
import { ref, computed } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { set } from 'lodash'
import { iconComponent } from '../icons/utils'
import { copyClick } from '@/utils/clipboard'
Expand All @@ -100,7 +109,7 @@ const height = ref<{
inputContainerHeight: 0,
outputContainerHeight: 0
})
const showAnchor = ref<boolean>(false)
const node_status = computed(() => {
if (props.nodeModel.properties.status) {
return props.nodeModel.properties.status
Expand Down Expand Up @@ -173,6 +182,11 @@ const nodeFields = computed(() => {
function showOperate(type: string) {
return type !== WorkflowType.Base && type !== WorkflowType.Start
}
onMounted(() => {
set(props.nodeModel, 'openNodeMenu', () => {
showAnchor.value = !showAnchor.value
})
})
</script>
<style lang="scss" scoped>
.workflow-node-container {
Expand Down
6 changes: 6 additions & 0 deletions ui/src/workflow/common/app-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ class AppNode extends HtmlResize.view {
},
[
lh('div', {
style: { zindex: 0 },
onClick: () => {
if (!isConnect && type == 'right') {
this.props.model.openNodeMenu()
}
},
dangerouslySetInnerHTML: {
__html: isConnect
? `<svg width="100%" height="100%" viewBox="0 0 42 42" fill="none" xmlns="http://www.w3.org/2000/svg">
Expand Down
3 changes: 2 additions & 1 deletion ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const envDir = './env'
// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
const ENV = loadEnv(mode, envDir)
const prefix = process.env.VITE_DYNAMIC_PREFIX || ENV.VITE_BASE_PATH;
const proxyConf: Record<string, string | ProxyOptions> = {}
proxyConf['/api'] = {
target: 'http://127.0.0.1:8080',
Expand All @@ -18,7 +19,7 @@ export default defineConfig(({ mode }) => {
return {
preflight: false,
lintOnSave: false,
base: ENV.VITE_BASE_PATH,
base: prefix,
envDir: envDir,
plugins: [vue(), DefineOptions()],
server: {
Expand Down

0 comments on commit 1488e50

Please sign in to comment.