Now parsing visibility

This commit is contained in:
Maximilian Giller 2021-04-12 12:50:40 +02:00
parent 6e179766a8
commit 2556a424a1

View file

@ -22,7 +22,7 @@ export const jugglService = {
getProjects() { getProjects() {
return apiService.post("/getProjects.php").then(r => { return apiService.post("/getProjects.php").then(r => {
return { return {
data: r.data, data: { projects: processProjects(r.data.projects) },
msg: "" msg: ""
}; };
}); });
@ -31,7 +31,7 @@ export const jugglService = {
getTags() { getTags() {
return apiService.post("/getRecordTags.php").then(r => { return apiService.post("/getRecordTags.php").then(r => {
return { return {
data: r.data, data: { record_tags: processTags(r.data.record_tags) },
msg: "" msg: ""
}; };
}); });
@ -248,7 +248,29 @@ function processRecords(data) {
rec.duration = helperService.calcDurationInSeconds(rec.start_time); rec.duration = helperService.calcDurationInSeconds(rec.start_time);
} }
rec.tags = Object.values(rec.tags); rec.tags = processTags(Object.values(rec.tags));
}); });
return data; return data;
} }
function processTags(tags) {
Object.values(tags).forEach(tag => {
if (tag.visible === "1") {
tag.visible = true;
} else {
tag.visible = false;
}
});
return tags;
}
function processProjects(projects) {
Object.values(projects).forEach(pro => {
if (pro.visible === "1") {
pro.visible = true;
} else {
pro.visible = false;
}
});
return projects;
}