|
|
@ -19,6 +19,19 @@ export async function loadTasks(): Promise<TasksFile> { |
|
|
|
return await r.json() |
|
|
|
} |
|
|
|
|
|
|
|
export async function saveTasks(tasks: TasksFile) { |
|
|
|
// request options
|
|
|
|
const options = { |
|
|
|
method: 'POST', |
|
|
|
body: JSON.stringify(tasks, null, 4), |
|
|
|
headers: { |
|
|
|
'Content-Type': 'application/json' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
fetch("/tasks.json", options) |
|
|
|
} |
|
|
|
|
|
|
|
export function createTaskMap(tasks: TasksFile): TaskMap { |
|
|
|
let m = new Map<string, TaskDescriptor>(); |
|
|
|
|
|
|
@ -42,7 +55,7 @@ export function createLinksFromTaskMap(tasks: TasksFile): SimulationLinkDatum<Ta |
|
|
|
|
|
|
|
if (t === undefined) throw `missing task with id ${id}`; |
|
|
|
|
|
|
|
const l: SimulationLinkDatum<TaskDescriptor> = {source: t, target: task}; |
|
|
|
const l: SimulationLinkDatum<TaskDescriptor> = { source: t, target: task }; |
|
|
|
links.push(l); |
|
|
|
} |
|
|
|
} |
|
|
|