-
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
1 parent
77466bf
commit 4174d2a
Showing
7 changed files
with
128 additions
and
99 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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import {defineStore} from "pinia"; | ||
import {job2G6Tree, jobLeafNode2G6Graph} from "@/utils/graphUtil.ts"; | ||
import {computed} from "vue"; | ||
import {mockFetchJob} from "@/api/fetch.ts"; | ||
import {Task} from "@/type.ts"; | ||
// import axios from "@/api"; | ||
|
||
export const useJobStore = defineStore("job", () => { | ||
let _job; | ||
|
||
async function fetchData(task: string) { | ||
const res = ((await mockFetchJob(task)) as { data: any }).data; | ||
// localData = (await axios.fetchJob(`{"task":"${task}"}`)).data; | ||
console.debug("res", res); | ||
_job = convertData(res); | ||
|
||
function convertData(data: any) { | ||
const children = data.subtasks; | ||
const task = new Task(data.task, data.toolId, data.toolName); | ||
|
||
if (children && children.length > 0) { | ||
for (let i = 0; i < children.length; i++) { | ||
task.addChild(convertData(children[i])); | ||
} | ||
} | ||
return task; | ||
} | ||
} | ||
|
||
const breakdownData = computed(() => job2G6Tree(_job)); | ||
|
||
const workflowData = computed(() => jobLeafNode2G6Graph(_job)); | ||
|
||
const job = computed(() => { | ||
if (!_job) { | ||
return new Task(); | ||
} else { | ||
return _job; | ||
} | ||
}) | ||
|
||
return {fetchData, job, breakdownData, workflowData}; | ||
}); |
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