Skip to content

Commit

Permalink
Ticket 49336: New Groups in Learn - fixes for navigation to the group…
Browse files Browse the repository at this point in the history
… summary page, and Groups not displaying in Learn and the Study page. (#631)

- Fix for groups not displaying on Learn pages.
- Query update (studyCuratedGrpWithLabel.sql) to display Curated groups on Study pages, instead of having to update studyCuratedGroup table each time a new group is created, which is going to have different group id on staging and production and client would have to update tables on both staging and prod and run an ETL for the data to get populated - this query update eliminates all these steps.
- Get the label from the clicked item and find the corresponding record based on the label instead of using Ext's auto mechanism of using store index.
- Update 'Edit group' to 'Save as'
  • Loading branch information
labkey-bpatel authored Jan 23, 2024
1 parent 44807bd commit 7b814be
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 17 deletions.
2 changes: 1 addition & 1 deletion resources/queries/cds/learn_groups.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ afs.assay_identifier,

FROM
study.subjectgroupmap sgm
LEFT JOIN study.subjectcategory sc ON sgm.groupId.label = sc.label
LEFT JOIN study.subjectcategory sc ON sgm.groupId.CategoryId.RowId = sc.RowId
LEFT JOIN cds.study s ON sgm.container.name = s.study_name -- each study protocol has a container of the same name as the study protocol
LEFT JOIN cds.learn_productsforstudies pfs ON sgm.container.name = pfs.study_name
LEFT JOIN cds.learn_assaysforstudies afs ON sgm.container.name = afs.prot
Expand Down
2 changes: 1 addition & 1 deletion resources/queries/cds/learn_studiesforgroups.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ s.description

FROM
study.subjectgroupmap sgm
LEFT JOIN study.subjectcategory sc ON sgm.groupId.label = sc.label
LEFT JOIN study.subjectcategory sc ON sgm.groupId.CategoryId.RowId = sc.RowId
LEFT JOIN cds.study s ON sgm.container.name = s.study_name -- each study protocol has a container of the same name as the study protocol
LEFT JOIN cds.learn_productsforstudies pfs ON sgm.container.name = pfs.study_name
LEFT JOIN cds.learn_assaysforstudies afs ON sgm.container.name = afs.prot
Expand Down
14 changes: 5 additions & 9 deletions resources/queries/cds/studyCuratedGrpWithLabel.sql
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
SELECT
sg.Label as label,
scg.cds_saved_group_id,
scg.prot
FROM cds.studyCuratedGroup scg
LEFT JOIN study.SubjectGroup sg
ON scg.cds_saved_group_id = sg.RowId
LEFT JOIN study.SubjectCategory sc
ON sc.RowId = sg.categoryId
SELECT DISTINCT sgm.groupId.rowid AS cds_saved_group_id,
sgm.GroupId.label,
sgm.container.name AS prot -- each study protocol has a container of the same name as the study protocol
FROM study.subjectgroupmap sgm
LEFT JOIN study.subjectcategory sc ON sgm.groupId.CategoryId.RowId = sc.RowId
WHERE sc.ownerId = -1 --filter to only show curated/shared groups
2 changes: 2 additions & 0 deletions test/src/org/labkey/test/tests/cds/CDSGroupTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ public void verifyInteractiveAndCuratedLinks()
log("inserting the value between report and assay");
updateLinkBetweenAssayAndReport("ICS", reportName);

clickFolder("q2");
_apiPermissionsHelper.setUserPermissions(NEW_USER_ACCOUNTS[0], "Reader");
goToProjectHome();
impersonate(NEW_USER_ACCOUNTS[0]);
cds.enterApplication();
Expand Down
18 changes: 15 additions & 3 deletions webapp/Connector/src/controller/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,23 @@ Ext.define('Connector.controller.Group', {
['.selectionpanel', '.filterpanel', '.filterstatus .emptytext'],
'div', 'grouprow');

if (grp.get('type') === 'mab') {
this.getViewManager().changeView('group', 'mabgroupsummary', [grp.get('rowid')]);
// itemclick event automatically uses the store's index to get the 'grp' value,
// however, on the Home page we are only displaying 5 groups at a time, first under 'My Saved Groups' and then under 'Curated groups' section,
// and if more than 5 groups are present under 'My Saved Groups', then this index will be incorrect for the Groups listed under 'Curated groups'
// since both the sections share one store. For this reason, we will get the label from the clicked item and find the corresponding
// record based on the label as done below.

// Access the label from the clicked item with selector 'grouprow'
var label = item.firstChild.getAttribute('data-label');

// Find the corresponding record based on the label
var clickedRecord = v.getStore().findRecord('label', label);

if (clickedRecord.get('type') === 'mab') {
this.getViewManager().changeView('group', 'mabgroupsummary', [clickedRecord.get('rowid')]);
}
else {
this.getViewManager().changeView('group', 'groupsummary', [grp.get('id')]);
this.getViewManager().changeView('group', 'groupsummary', [clickedRecord.get('id')]);
}
},
render: function(view) {
Expand Down
4 changes: 2 additions & 2 deletions webapp/Connector/src/panel/GroupList.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Ext.define('Connector.view.GroupListView', {
'<tpl if="this.savedGroupCounter &lt; 6">',
'{[this.renderGroupHeading(values, parent, xindex)]}',
'<div class="grouprow">',
'<div title="{description:htmlEncode}" class="grouplabel">{label:this.groupLabel}</div>',
'<div title="{description:htmlEncode}" class="grouplabel" data-label="{label}">{label:this.groupLabel}</div>',
'<tpl if="this.plotter(containsPlot)">',
'<div class="groupicon"><img src="' + Connector.resourceContext.imgPath + '/plot.png"></div>',
'</tpl>',
Expand All @@ -89,7 +89,7 @@ Ext.define('Connector.view.GroupListView', {
'<tpl if="this.sharedGroupCounter &lt; 6">',
'{[this.renderGroupHeading(values, parent, xindex)]}',
'<div class="grouprow">',
'<div title="{description:htmlEncode}" class="grouplabel">{label:this.groupLabel}</div>',
'<div title="{description:htmlEncode}" class="grouplabel" data-label="{label}">{label:this.groupLabel}</div>',
'<tpl if="this.plotter(containsPlot)">',
'<div class="groupicon"><img src="' + Connector.resourceContext.imgPath + '/plot.png"></div>',
'</tpl>',
Expand Down
2 changes: 1 addition & 1 deletion webapp/Connector/src/view/FilterStatus.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ Ext.define('Connector.view.FilterStatus', {
items: [{
xtype: 'button',
id: 'editgroupbtn-id',
text: 'Edit group',
text: 'Save as', //previously 'Edit group'
ui: 'rounded-inverted-accent-small',
cls: 'edit-group-btn',
itemId: 'editgroupbtn-itemid',
Expand Down

0 comments on commit 7b814be

Please sign in to comment.