Skip to content

Commit

Permalink
fixed the issue that showing case closed if ANYONE closed the case. C…
Browse files Browse the repository at this point in the history
…urrently, only current user can close their own case.
  • Loading branch information
nanli-emory committed Oct 3, 2023
1 parent 836bc84 commit 0299fee
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions apps/vis-table/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ closeCaseBtn.addEventListener('click', async ()=>{
const domNode = colTree.get_node($D.selectedNode, true);
domNode.addClass('text-success');
$UI.message.add(`The Collection <span class='text-blue'>${fullPathName($D.selectedNode)}</span> Case Closed!`);

// disable level based on leve flag TODO
// disable level based on leve flag
toggleLevelFlag(false);
} else {
// db update error
Expand Down Expand Up @@ -368,12 +367,13 @@ async function createGridCards() {
slides.sort((a, b) => a.order - b.order).forEach((slide) => {
$UI.gridViewContainer.append(createGridCard(slide, crumbList));
});

// level flage control
if (closeCaseBtn.disabled) {
toggleLevelFlag(true);
} else {
toggleLevelFlag(false);
}
// if (closeCaseBtn.disabled) {
// toggleLevelFlag(true);
// } else {
// toggleLevelFlag(false);
// }
}

function createGridCard(d, crumbList) {
Expand Down Expand Up @@ -510,8 +510,8 @@ function generateDropdownMenu(elt, data, informativenessSlides) {
const domNode = colTree.get_node($D.selectedNode, true);
domNode.removeClass('text-success');
$UI.message.add(`The Collection <span class='text-blue'>${fullPathName($D.selectedNode)}</span> Case Reopened!`);

// enable level flag based on level value TODO
closeCaseBtn.disabled = false;
// enable level flag based on level value
toggleLevelFlag(true);
} else {
// db update error
Expand Down Expand Up @@ -777,16 +777,19 @@ window.addEventListener('load', async ()=> {
cases.forEach((c) => getAllParents(c, data));

$D.collectionData.forEach((d)=>{
//d.id = d._id.$oid;
// show case closed if ANYONE closed the case
if (d.users&&d.users.some((u)=>(u.task_status))) {
d.id = d._id.$oid;

// show case closed if current user closed the case
if (d.users&&d.users.some((u)=>(u.user==$D.user.key && u.task_status))) {
d.icon = './check-folder.png';
d.li_attr = {'class': 'text-success'};
toggleLevelFlag(false);
} else {
d.icon = './folder.png';
toggleLevelFlag(true);

}
d.name = d.text;
d.id = d['_id']['$oid'];
delete d._id;
// set tree state if treeStates exist
var treeStates = sessionStorage.getItem('treeStates');
Expand Down

0 comments on commit 0299fee

Please sign in to comment.