Skip to content

Commit 68cd3b3

Browse files
committed
bug(behaviorConfig)
1 parent 8007c93 commit 68cd3b3

File tree

6 files changed

+28
-29
lines changed

6 files changed

+28
-29
lines changed

src/G6/behaviorConfig.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import {IG6GraphEvent} from "@antv/g6-core/lib/types";
2-
import {BehaviorOption} from "@antv/g6";
3-
import {useNodeStore} from "@/store/node.ts";
1+
import { IG6GraphEvent } from "@antv/g6-core/lib/types";
2+
import { BehaviorOption, INode, NodeConfig } from "@antv/g6";
3+
import { useNodeStore } from "@/store/node.ts";
44
import pinia from "@/store";
55

66
const nodeStore = useNodeStore(pinia);
@@ -12,8 +12,8 @@ export const activateNodeBehavior: BehaviorOption = {
1212
};
1313
},
1414
async onNodeClick(evt: IG6GraphEvent) {
15-
const node = evt.item!;
15+
const node = evt.item as INode;
1616
console.log(node.getModel().id);
17-
await nodeStore.updateData(node.getModel())
17+
await nodeStore.updateData(node.getModel() as NodeConfig);
1818
},
1919
};

src/components/BreakdownChart.vue

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<script lang="ts" setup>
22
import G6 from "@antv/g6";
3-
import {onMounted} from "vue";
4-
import {useJobStore} from "@/store/job.ts";
3+
import { onMounted } from "vue";
4+
import { useJobStore } from "@/store/job.ts";
55
66
const props = defineProps<{
77
graphId: string;
88
}>();
99
10-
const dataStore = useJobStore();
10+
const jobStore = useJobStore();
1111
1212
const getGraphNum = function () {
1313
return "mountNode-" + props.graphId;
@@ -34,9 +34,9 @@ onMounted(() => {
3434
},
3535
});
3636
37-
tree.data(dataStore.breakdownData);
37+
tree.data(jobStore.breakdownData);
3838
tree.render();
39-
tree.fitView(50);
39+
tree.fitView();
4040
});
4141
</script>
4242

src/components/WorkflowChart.vue

+4-5
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
@Date: 2024/6/7
55
-->
66
<script setup lang="ts">
7-
import {onMounted} from "vue";
7+
import { onMounted } from "vue";
88
import G6 from "@antv/g6";
9-
import {useJobStore} from "@/store/job.ts";
9+
import { useJobStore } from "@/store/job.ts";
1010

1111
const props = defineProps<{
1212
graphId: string;
1313
}>();
1414

15-
const dataStore = useJobStore();
15+
const jobStore = useJobStore();
1616

1717
const getGraphNum = function () {
1818
return "mountNode-" + props.graphId;
@@ -23,7 +23,6 @@ onMounted(() => {
2323
const graph = new G6.Graph({
2424
container: getGraphNum(),
2525
fitView: true,
26-
fitViewPadding: 100,
2726
layout: {
2827
type: "dagre",
2928
ranksep: 12,
@@ -39,7 +38,7 @@ onMounted(() => {
3938
},
4039
});
4140

42-
graph.data(dataStore.workflowData);
41+
graph.data(jobStore.workflowData);
4342
graph.render();
4443

4544
const group = graph.get("edgeGroup");

src/pages/Home/index.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import Question from "@/components/Question.vue";
1212
<TopBox />
1313
</el-header>
1414
<el-container>
15-
<el-aside width="30%">
15+
<el-aside width="50%">
1616
<LeftBox />
1717
</el-aside>
1818
<el-main>

src/store/node.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import {defineStore} from "pinia";
2-
import {reactive, ref} from "vue";
3-
import {Node} from "@/type.ts";
4-
import {NodeConfig} from "@antv/g6";
5-
import {fetchTool} from "@/api";
1+
import { defineStore } from "pinia";
2+
import { reactive, ref } from "vue";
3+
import { Node } from "@/type.ts";
4+
import { NodeConfig } from "@antv/g6";
5+
import { fetchTool } from "@/api";
66

77
export const useNodeStore = defineStore("node", () => {
88
const node = reactive<Node>({
@@ -16,11 +16,11 @@ export const useNodeStore = defineStore("node", () => {
1616

1717
async function updateData(nodeConfig: NodeConfig) {
1818
node.id = nodeConfig.id;
19-
node.name = nodeConfig.label;
20-
node.description = nodeConfig.description;
19+
node.name = nodeConfig.label as string;
20+
node.description = nodeConfig.description!;
2121
// TODO fetchTool
2222
// const res = await fetchTool(node.id).data;
23-
const res = (await fetchTool(node.id) as { data: any; }).data;
23+
const res = ((await fetchTool(node.id)) as { data: any }).data;
2424
node.args = res.args;
2525
configDisplay.value = true;
2626
}

src/store/session.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {defineStore} from "pinia";
2-
import {reactive, ref} from "vue";
3-
import {generateId} from "@/utils/graphUtil";
4-
import {useJobStore} from "@/store/job.ts";
1+
import { defineStore } from "pinia";
2+
import { reactive, ref } from "vue";
3+
import { generateId } from "@/utils/graphUtil";
4+
import { useJobStore } from "@/store/job.ts";
55

66
type Session = {
77
sessionId: string;
@@ -25,5 +25,5 @@ export const useSessionStore = defineStore("session", () => {
2525
graphShow.value = true;
2626
}
2727

28-
return {session, graphShow, chatted};
28+
return { session, graphShow, chatted };
2929
});

0 commit comments

Comments
 (0)