Skip to content

Commit

Permalink
Merge 20.3 to develop
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-tchad committed Apr 10, 2020
2 parents ae00266 + d006749 commit e7901e8
Show file tree
Hide file tree
Showing 13 changed files with 8,927 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package org.labkey.test.categories;

public abstract class MacCossLabModules extends Weekly
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import org.labkey.test.BaseWebDriverTest;
import org.labkey.test.Locator;
import org.labkey.test.TestTimeoutException;
import org.labkey.test.categories.DailyB;
import org.labkey.test.categories.MS2;
import org.labkey.test.categories.External;
import org.labkey.test.categories.MacCossLabModules;
import org.labkey.test.components.BodyWebPart;
import org.labkey.test.components.CustomizeView;
import org.labkey.test.pages.InsertPage;
Expand All @@ -24,7 +24,7 @@

import static org.junit.Assert.assertEquals;

@Category({DailyB.class, MS2.class})
@Category({External.class, MacCossLabModules.class})
@BaseWebDriverTest.ClassTimeout(minutes = 5)
public class PanoramaPublicTest extends TargetedMSTest implements PostgresOnlyTest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.labkey.test.Locator;
import org.labkey.test.categories.CustomModules;
import org.labkey.test.categories.External;
import org.labkey.test.categories.MacCossLabModules;
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.PostgresOnlyTest;
import org.labkey.test.util.UIContainerHelper;

import java.util.List;

@Category({CustomModules.class})
@Category({External.class, MacCossLabModules.class})
public class PassportTest extends PassportTestPart implements PostgresOnlyTest
{
public PassportTest()
Expand Down
6 changes: 6 additions & 0 deletions pwebdashboard/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import org.labkey.gradle.util.BuildUtils;

dependencies {
BuildUtils.addLabKeyDependency(project: project, config: "implementation", depProjectPath: ":server:modules:targetedms", depProjectConfig: "apiJarFile")
BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: ":server:modules:targetedms", depProjectConfig: "published", depExtension: "module")
}
8 changes: 8 additions & 0 deletions pwebdashboard/module.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Name: PanoramaWeb Dashboard
ModuleClass: org.labkey.pwebdashboard.PwebDashboardModule
Label: PanoramaWeb Dashboard
Description: Queries and code to render PanoramaWeb usage charts.
URL: https://panoramaweb.org/wiki/home/page.view?name=Dashboard
License: Apache 2.0
LicenseURL: http://www.apache.org/licenses/LICENSE-2.0
SupportedDatabases: pgsql
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
SELECT FolderDocs.Project,
SUM(FolderDocs.Documents) AS TotalDocs,
SUM((CASE WHEN FolderDocs.TargetedMSFolderType='Experiment' OR FolderDocs.TargetedMSFolderType IS NULL THEN FolderDocs.Documents ELSE 0 END)) AS ExpDocs,
SUM((CASE WHEN FolderDocs.TargetedMSFolderType='Library' OR FolderDocs.TargetedMSFolderType='LibraryProtein' THEN FolderDocs.Documents ELSE 0 END)) AS LibDocs,
SUM((CASE WHEN FolderDocs.TargetedMSFolderType='QC' THEN FolderDocs.Documents ELSE 0 END)) AS QcDocs,
MAX(FolderDocs.LastUpload) AS LastUpload
FROM FolderDocs GROUP BY FolderDocs.Project
98 changes: 98 additions & 0 deletions pwebdashboard/src/org/labkey/pwebdashboard/FolderDocsTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package org.labkey.pwebdashboard;

import org.jetbrains.annotations.NotNull;
import org.labkey.api.data.BaseColumnInfo;
import org.labkey.api.data.ContainerFilter;
import org.labkey.api.data.ContainerForeignKey;
import org.labkey.api.data.ContainerManager;
import org.labkey.api.data.ContainerTable;
import org.labkey.api.data.CoreSchema;
import org.labkey.api.data.JdbcType;
import org.labkey.api.data.SQLFragment;
import org.labkey.api.data.WrappedColumn;
import org.labkey.api.query.ExprColumn;
import org.labkey.api.query.FieldKey;
import org.labkey.api.targetedms.TargetedMSService;

import java.util.ArrayList;
import java.util.List;

/**
* Created by vsharma on 12/8/2016.
*/
public class FolderDocsTable extends ContainerTable
{
public static final String NAME = "FolderDocs";

public FolderDocsTable(@NotNull PwebDashboardSchema userSchema, ContainerFilter cf)
{
super(userSchema, cf);

setName(NAME);

BaseColumnInfo folderCol = new WrappedColumn(getColumn("EntityId"), "Folder");
ContainerForeignKey.initColumn(folderCol, userSchema);
addColumn(folderCol);

/*
WITH RECURSIVE project(parent, entityId, name) AS (
SELECT parent, entityId, name FROM core.containers WHERE name='QC Subfolder 2a'
UNION
SELECT a.parent AS parent, p.parent AS entityId, a.name AS name FROM project p, core.containers a
WHERE a.entityId = p.parent
) SELECT * FROM project WHERE parent = (SELECT entityId FROM core.containers WHERE parent IS NULL)
*/
// Get the project for the folder. Traverse up the folder tree.
SQLFragment projectColSql = new SQLFragment("(WITH RECURSIVE project(parent, entityId, name) AS ( ");
projectColSql.append(" SELECT parent, entityId, name FROM ").append(CoreSchema.getInstance().getTableInfoContainers(), "c");
projectColSql.append(" WHERE entityId=").append(ExprColumn.STR_TABLE_ALIAS).append(".EntityId");
projectColSql.append(" UNION ");
projectColSql.append(" SELECT a.parent AS parent, p.parent AS entityId, a.name AS name FROM project p, core.containers a WHERE a.entityId = p.parent ");
projectColSql.append(" ) SELECT entityId FROM project WHERE parent = ?)");
projectColSql.add(ContainerManager.getRoot().getEntityId());
ExprColumn projectCol = new ExprColumn(this, "Project", projectColSql, JdbcType.VARCHAR);
projectCol.setReadOnly(true);
ContainerForeignKey.initColumn(projectCol, userSchema);
addColumn(projectCol);

TargetedMSService tmsService = TargetedMSService.get();

SQLFragment docCountSql = new SQLFragment(" (SELECT COUNT(*) FROM ");
docCountSql.append(tmsService.getTableInfoRuns(), "r");
docCountSql.append(" WHERE container=").append(ExprColumn.STR_TABLE_ALIAS).append(".EntityId");
docCountSql.append(" AND deleted = FALSE AND statusId=1) ");
ExprColumn documentCountCol = new ExprColumn(this, "Documents", docCountSql, JdbcType.INTEGER);
addColumn(documentCountCol);

SQLFragment lastUploadSql = new SQLFragment(" (SELECT MAX(Created) FROM ");
lastUploadSql.append(tmsService.getTableInfoRuns(), "r");
lastUploadSql.append(" WHERE container=").append(ExprColumn.STR_TABLE_ALIAS).append(".EntityId");
lastUploadSql.append(" AND deleted = FALSE AND statusId=1) ");
ExprColumn lastUploadCol = new ExprColumn(this, "LastUpload", lastUploadSql, JdbcType.DATE);
addColumn(lastUploadCol);

SQLFragment folderTypeColSql = new SQLFragment(" (SELECT p.value FROM prop.properties AS p INNER JOIN prop.propertySets AS ps ON p.set = ps.set ");
folderTypeColSql.append(" WHERE p.Name=?");
folderTypeColSql.add(tmsService.FOLDER_TYPE_PROP_NAME);
folderTypeColSql.append(" AND ps.category=?");
folderTypeColSql.add("moduleProperties." + tmsService.MODULE_NAME);
folderTypeColSql.append(" AND ps.ObjectId=").append(ExprColumn.STR_TABLE_ALIAS).append(".EntityId");
folderTypeColSql.append(") ");
ExprColumn folderTypeCol = new ExprColumn(this, "TargetedMSFolderType", folderTypeColSql, JdbcType.VARCHAR);
addColumn(folderTypeCol);


List<FieldKey> visibleColumns = new ArrayList<>();
visibleColumns.add(FieldKey.fromParts("Project"));
visibleColumns.add(FieldKey.fromParts("Created"));
visibleColumns.add(FieldKey.fromParts("CreatedBy"));
visibleColumns.add(FieldKey.fromParts("Folder"));
visibleColumns.add(FieldKey.fromParts("TargetedMSFolderType"));
visibleColumns.add(FieldKey.fromParts("Documents"));
visibleColumns.add(FieldKey.fromParts("LastUpload"));
setDefaultVisibleColumns(visibleColumns);

SQLFragment sql = new SQLFragment("(CreatedBy IS NOT NULL)");
addCondition(sql);
}
}
Loading

0 comments on commit e7901e8

Please sign in to comment.