-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
95 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,68 @@ | ||
<script setup lang="ts"> | ||
import {Close} from "@element-plus/icons-vue"; | ||
import {useNodeStore} from "@/store/task.ts"; | ||
import {storeToRefs} from "pinia"; | ||
import { Close } from "@element-plus/icons-vue"; | ||
import { useTaskStore } from "@/store/task.ts"; | ||
import { storeToRefs } from "pinia"; | ||
const nodeStore = useNodeStore(); | ||
const {task} = storeToRefs(nodeStore); | ||
const taskStore = useTaskStore(); | ||
const { tool } = storeToRefs(taskStore); | ||
const onSave = () => { | ||
alert("save!"); | ||
}; | ||
const onCancel = () => { | ||
nodeStore.close(); | ||
taskStore.close(); | ||
}; | ||
const onExecute = () => { | ||
alert("execute!"); | ||
}; | ||
// console.log(argCfg.value); | ||
</script> | ||
<template> | ||
<el-card v-if="nodeStore.isShowed" | ||
<el-card | ||
v-if="taskStore.isShowed" | ||
style="position: absolute; bottom: 120px; right: 30px; width: 500px" | ||
shadow="hover" | ||
> | ||
<el-button | ||
:icon="Close" | ||
text | ||
style="position: absolute; top: 15px; right: 15px" | ||
@click="nodeStore.close()" | ||
@click="taskStore.close()" | ||
/> | ||
|
||
<el-form label-position="top" style="margin: 20px"> | ||
<el-descriptions direction="vertical" :column="1"> | ||
<el-descriptions-item label="Tool name"> | ||
{{ task.tool.name }} | ||
{{ tool.id + " " + tool.name }} | ||
</el-descriptions-item> | ||
<el-descriptions-item label="Tool description"> | ||
{{ task.tool.description }} | ||
{{ tool.description }} | ||
</el-descriptions-item> | ||
</el-descriptions> | ||
<el-form-item label="Args"> | ||
<el-table :data="task.tool.args" style="width: 100%"> | ||
<el-table-column prop="name" label="Name" width="180" /> | ||
<el-table-column prop="description" label="Description" width="180" /> | ||
<el-table :data="tool.args" header-cell-class-name="header-cell-class"> | ||
<el-table-column prop="name" label="Name" /> | ||
<el-table-column prop="description" label="Description" /> | ||
<el-table-column :prop="' '" label="Input" /> | ||
</el-table> | ||
</el-form-item> | ||
<el-descriptions direction="vertical" :column="1"> | ||
<el-descriptions-item label="Result"> | ||
{{ "resutl" }} | ||
</el-descriptions-item> | ||
</el-descriptions> | ||
<el-form-item> | ||
<el-button @click="onSave">Save</el-button> | ||
<el-button @click="onCancel">Cancel</el-button> | ||
<el-button | ||
style="position: absolute; right: 0" | ||
type="primary" | ||
@click="onExecute" | ||
>Execute | ||
</el-button> | ||
<div style="width: 100%; display: flex; justify-content: space-between"> | ||
<el-button @click="onCancel">Cancel</el-button> | ||
<el-button type="primary" @click="onExecute">Execute </el-button> | ||
</div> | ||
</el-form-item> | ||
</el-form> | ||
|
||
</el-card> | ||
</template> | ||
|
||
<style scoped lang="less"> | ||
@import "./index.less"; | ||
.header-cell-class { | ||
background-color: aqua; | ||
border-color: aqua; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,39 @@ | ||
import {defineStore} from "pinia"; | ||
import {ref} from "vue"; | ||
import {Task} from "@/type.ts"; | ||
import {fetchTool} from "@/api"; | ||
import { defineStore } from "pinia"; | ||
import { computed, ref } from "vue"; | ||
import { Task } from "@/type.ts"; | ||
import { fetchTool } from "@/api"; | ||
|
||
export const useNodeStore = defineStore("node", () => { | ||
export const useTaskStore = defineStore("node", () => { | ||
let _task = ref<Task>({} as Task); | ||
|
||
let _task = ref<Task>({} as Task); | ||
const tool = computed(() => _task.value.tool); | ||
|
||
let isShowed = ref(false); | ||
let isShowed = ref(false); | ||
|
||
async function updateData(task: Task) { | ||
_task.value = task; | ||
// TODO Fetch the tool | ||
// const res = await fetchTool(node.tool.id).data; | ||
const res = ((await fetchTool(_task.value.tool.id)) as { data: any }).data; | ||
_task.value.tool.args = res.args; | ||
} | ||
async function updateData(task: Task) { | ||
_task.value = task; | ||
// TODO Fetch the tool | ||
// const res = await fetchTool(node.tool.id).data; | ||
_task.value.tool = ( | ||
(await fetchTool(_task.value.tool.id)) as { data: any } | ||
).data; | ||
console.log(_task.value); | ||
} | ||
|
||
function show() { | ||
isShowed.value = true; | ||
} | ||
function show() { | ||
isShowed.value = true; | ||
} | ||
|
||
function close() { | ||
isShowed.value = false; | ||
} | ||
function close() { | ||
isShowed.value = false; | ||
} | ||
|
||
return { | ||
task: _task, | ||
isShowed, | ||
updateData, | ||
show, | ||
close, | ||
}; | ||
return { | ||
task: _task, | ||
isShowed, | ||
updateData, | ||
show, | ||
close, | ||
tool, | ||
}; | ||
}); |