preparing for member setup during task creation
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -51,35 +51,43 @@
|
||||
}
|
||||
|
||||
async function load(){
|
||||
console.log({assignee});
|
||||
if (parent_task_id) await loadParent();
|
||||
if (project_id) loadProject();
|
||||
if (project_id) await loadProject();
|
||||
if (state_id) task.status = { code : +state_id };
|
||||
loadTags();
|
||||
await loadTags();
|
||||
console.log({task:JSON.parse(JSON.stringify(task))});
|
||||
}
|
||||
|
||||
async function loadParent(){
|
||||
console.log('loading parent task with id = '+parent_task_id);
|
||||
const url = api(`task/${parent_task_id}`);
|
||||
const resp = await get(url);
|
||||
if (resp.ok){
|
||||
parent_task = await resp.json();
|
||||
console.log(JSON.parse(JSON.stringify(parent_task)));
|
||||
task.parent_task_id = +parent_task_id;
|
||||
task.members = parent_task.members;
|
||||
project_id = +parent_task.project_id;
|
||||
yikes();
|
||||
project = null; // TODO
|
||||
project = null;
|
||||
} else error(resp);
|
||||
}
|
||||
|
||||
async function loadProject(){
|
||||
console.log('loading project '+project_id);
|
||||
const url = api(`project/${project_id}`);
|
||||
const resp = await get(url);
|
||||
if (resp.ok){
|
||||
project = await resp.json();
|
||||
console.log(JSON.parse(JSON.stringify(project)));
|
||||
task.project_id = +project_id;
|
||||
if (Object.keys(task.members).length < 1) task.members = project.members;
|
||||
if (assignee && project.members[assignee]){
|
||||
task.members[assignee] = project.members[assignee];
|
||||
task.members[assignee].permission = { name : "ASSIGNEE", code : 3 }
|
||||
}
|
||||
if (task.taks.length < 1) task.tags = project.tags;
|
||||
if (task.tags.length < 1) task.tags = project.tags;
|
||||
yikes();
|
||||
} else {
|
||||
error(resp);
|
||||
@@ -87,9 +95,11 @@
|
||||
}
|
||||
|
||||
async function loadTags(){
|
||||
|
||||
let url = null;
|
||||
if (project_id) url = api(`tags/project/${project_id}`);
|
||||
if (parent_task_id) url = api(`tags/task/${parent_task_id}`);
|
||||
console.log('loading tags: ',url);
|
||||
if (url) {
|
||||
const resp = await get(url);
|
||||
if (resp.ok) task.tags = await resp.json();
|
||||
@@ -104,6 +114,7 @@
|
||||
}
|
||||
|
||||
async function saveTask(){
|
||||
console.log({task:JSON.parse(JSON.stringify(task))});
|
||||
const url = api('task/add');
|
||||
const resp = await post(url,task);
|
||||
if (resp.ok) {
|
||||
|
||||
Reference in New Issue
Block a user