From c9aaaf197d493d8e165fb2ef393be456295a7e9e Mon Sep 17 00:00:00 2001 From: labkey-tchad Date: Mon, 24 Feb 2025 16:55:36 -0800 Subject: [PATCH] Remove module code. Moved to https://github.com/LabKey/premiumModules --- .gitattributes | 47 -- README.md | 1 + build.gradle | 9 - module.properties | 13 - pull_request_template.md | 8 - .../postgresql/reagent-0.00-13.30.sql | 225 ------ .../sqlserver/reagent-0.000-21.000.sql | 290 -------- resources/schemas/reagent.xml | 701 ------------------ resources/views/begin.html | 67 -- resources/views/initialize.html | 582 --------------- resources/views/initialize.view.xml | 5 - resources/views/insert.html | 25 - resources/views/insert.view.xml | 8 - resources/views/lot.html | 98 --- resources/views/lot.view.xml | 6 - resources/views/reagent.html | 68 -- resources/views/reagent.view.xml | 6 - resources/views/titration.html | 111 --- resources/views/titration.view.xml | 6 - resources/views/update.html | 37 - resources/views/update.view.xml | 8 - resources/views/vial.html | 111 --- resources/views/vial.view.xml | 6 - resources/web/reagent/util.js | 603 --------------- .../test/tests/reagent/ReagentTest.java | 338 --------- 25 files changed, 1 insertion(+), 3378 deletions(-) delete mode 100644 .gitattributes create mode 100644 README.md delete mode 100644 build.gradle delete mode 100644 module.properties delete mode 100644 pull_request_template.md delete mode 100644 resources/schemas/dbscripts/postgresql/reagent-0.00-13.30.sql delete mode 100644 resources/schemas/dbscripts/sqlserver/reagent-0.000-21.000.sql delete mode 100644 resources/schemas/reagent.xml delete mode 100644 resources/views/begin.html delete mode 100644 resources/views/initialize.html delete mode 100644 resources/views/initialize.view.xml delete mode 100644 resources/views/insert.html delete mode 100644 resources/views/insert.view.xml delete mode 100644 resources/views/lot.html delete mode 100644 resources/views/lot.view.xml delete mode 100644 resources/views/reagent.html delete mode 100644 resources/views/reagent.view.xml delete mode 100644 resources/views/titration.html delete mode 100644 resources/views/titration.view.xml delete mode 100644 resources/views/update.html delete mode 100644 resources/views/update.view.xml delete mode 100644 resources/views/vial.html delete mode 100644 resources/views/vial.view.xml delete mode 100644 resources/web/reagent/util.js delete mode 100644 test/src/org/labkey/test/tests/reagent/ReagentTest.java diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 5aeb7c0..0000000 --- a/.gitattributes +++ /dev/null @@ -1,47 +0,0 @@ -# Convert text files to OS line-endings on checkout, and LF on check-in -* text=auto !eol - -# Text files to convert -*.css text diff=css -*.htm text diff=html -*.html text diff=html -*.java text diff=java -*.js text -*.json text -*.jsp text -*.jspf text -*.jspx text -*.properties text -*.py text diff=python -*.sql text -*.tld text -*.ts text -*.txt text -*.xml text -*.yml text - -# Keep unix endings -*.bash text eol=lf -*.sh text eol=lf - -# Keep Windows endings -*.bat text eol=crlf -*.cmd text eol=crlf - -# Known binary files -- Don't change (binary is a macro for -text -diff) -*.bin binary -*.class binary -*.dll binary -*.ear binary -*.exe binary -*.gif binary -*.gz binary -*.ico binary -*.jar binary -*.jpg binary -*.jpeg binary -*.png binary -*.so binary -*.tar binary -*.war binary -*.zip binary diff --git a/README.md b/README.md new file mode 100644 index 0000000..b0093f2 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Module moved to [LabKey/premiumModules](https://github.com/LabKey/premiumModules) in 25.3 diff --git a/build.gradle b/build.gradle deleted file mode 100644 index c30ac88..0000000 --- a/build.gradle +++ /dev/null @@ -1,9 +0,0 @@ -import org.labkey.gradle.util.BuildUtils - -plugins { - id 'org.labkey.build.module' -} - -dependencies { - BuildUtils.addLabKeyDependency(project: project, config: "modules", depProjectPath: BuildUtils.getPlatformModuleProjectPath(project.gradle, "experiment"), depProjectConfig: 'published', depExtension: 'module') -} diff --git a/module.properties b/module.properties deleted file mode 100644 index 229dd3d..0000000 --- a/module.properties +++ /dev/null @@ -1,13 +0,0 @@ -Name: reagent -SchemaVersion: 25.000 -Label: Reagent Inventory Management -Description: Manage lab inventory of reagent lots and vials \ - with the ability to add custom fields. -URL: https://www.labkey.org/Documentation/wiki-page.view?name=reagentModule -Author: Kevin Krouse -Maintainer: Kevin Krouse -Organization: LabKey -OrganizationURL: https://www.labkey.com/ -License: Apache 2.0 -LicenseURL: http://www.apache.org/licenses/LICENSE-2.0 -ManageVersion: true diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 2a1c8ac..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,8 +0,0 @@ -#### Rationale - - -#### Related Pull Requests -* - -#### Changes -* diff --git a/resources/schemas/dbscripts/postgresql/reagent-0.00-13.30.sql b/resources/schemas/dbscripts/postgresql/reagent-0.00-13.30.sql deleted file mode 100644 index 5918eea..0000000 --- a/resources/schemas/dbscripts/postgresql/reagent-0.00-13.30.sql +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2010-2015 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* reagent-0.00-10.10.sql */ - -CREATE SCHEMA reagent; - -CREATE TABLE reagent.Antigens -( - RowId SERIAL NOT NULL, - Container ENTITYID NOT NULL, - Name VARCHAR(255) NOT NULL, - Description TEXT, - Aliases VARCHAR(255), - - CONSTRAINT PK_Antigens PRIMARY KEY (RowId), - CONSTRAINT UQ_Antigens UNIQUE (Container, Name) -); - -CREATE TABLE reagent.Labels -( - RowId SERIAL NOT NULL, - Container ENTITYID NOT NULL, - Name VARCHAR(255) NOT NULL, - Description TEXT, - Aliases VARCHAR(255), - - CONSTRAINT PK_Labels PRIMARY KEY (RowId), - CONSTRAINT UQ_Labels UNIQUE (Container, Name) -); - -CREATE TABLE reagent.Manufacturers -( - RowId SERIAL NOT NULL, - Container ENTITYID NOT NULL, - Name VARCHAR(255) NOT NULL, - - CONSTRAINT PK_Manufacturers PRIMARY KEY (RowId), - CONSTRAINT UQ_Manufacturers UNIQUE (Container, Name) -); - -CREATE TABLE reagent.Reagents -( - RowId SERIAL NOT NULL, - Container ENTITYID NOT NULL, - CreatedBy USERID NOT NULL, - Created TIMESTAMP NOT NULL, - ModifiedBy USERID NOT NULL, - Modified TIMESTAMP NOT NULL, - - AntigenId INT4 NOT NULL, - LabelId INT4 NOT NULL, - Clone VARCHAR(255), - Description TEXT NULL, - - CONSTRAINT PK_Reagents PRIMARY KEY (RowId), - CONSTRAINT FK_Reagents_Antigens FOREIGN KEY (AntigenId) REFERENCES reagent.Antigens(RowId), - CONSTRAINT FK_Reagents_Labels FOREIGN KEY (LabelId) REFERENCES reagent.Labels(RowId), - CONSTRAINT UQ_Reagents UNIQUE (Container, AntigenId, LabelId, Clone) -); - -CREATE TABLE reagent.Lots -( - RowId SERIAL NOT NULL, - Container ENTITYID NOT NULL, - CreatedBy USERID NOT NULL, - Created TIMESTAMP NOT NULL, - ModifiedBy USERID NOT NULL, - Modified TIMESTAMP NOT NULL, - - ReagentId INT4 NOT NULL, - ManufacturerId INT4 NOT NULL, - LotNumber VARCHAR(255) NOT NULL, - CatalogNumber VARCHAR(255), - Expiration TIMESTAMP NULL, - Description TEXT NULL, - - CONSTRAINT PK_Lots PRIMARY KEY (RowId), - CONSTRAINT FK_Lots_Reagents FOREIGN KEY (ReagentId) REFERENCES reagent.Reagents(RowId), - CONSTRAINT FK_Lots_Manufacturers FOREIGN KEY (ManufacturerId) REFERENCES reagent.Manufacturers(RowId), - CONSTRAINT UQ_Lots UNIQUE (Container, ManufacturerId, LotNumber, CatalogNumber, ReagentId) -); - -CREATE TABLE reagent.Vials -( - RowId SERIAL NOT NULL, - Container ENTITYID NOT NULL, - CreatedBy USERID NOT NULL, - Created TIMESTAMP NOT NULL, - ModifiedBy USERID NOT NULL, - Modified TIMESTAMP NOT NULL, - - LotId INT4 NOT NULL, - Location VARCHAR(255), - Box VARCHAR(30), - Row VARCHAR(30), - Col VARCHAR(30), - Used BOOLEAN NOT NULL, - OwnedBy VARCHAR(30), - - CONSTRAINT PK_Vials PRIMARY KEY (RowId), - CONSTRAINT FK_Vials_Lots FOREIGN KEY (LotId) REFERENCES reagent.Lots(RowId) -); - -CREATE TABLE reagent.Titrations -( - RowId SERIAL NOT NULL, - Container ENTITYID NOT NULL, - CreatedBy USERID NOT NULL, - Created TIMESTAMP NOT NULL, - ModifiedBy USERID NOT NULL, - Modified TIMESTAMP NOT NULL, - - LotId INT4 NOT NULL, - ExperimentId VARCHAR(255), - PerformedBy VARCHAR(30), - Type VARCHAR(30) NOT NULL, -- 'Surface', 'Intercellular', '0 Degree' - Result VARCHAR(30) NOT NULL, - Description TEXT, - - CONSTRAINT PK_Titrations PRIMARY KEY (RowId), - CONSTRAINT FK_Titrations_Lots FOREIGN KEY (LotId) REFERENCES reagent.Lots(RowId) -); - -/* reagent-10.20-10.30.sql */ - -CREATE TABLE reagent.Species -( - RowId SERIAL NOT NULL, - Container ENTITYID NOT NULL, - Name VARCHAR(255) NOT NULL, - - CONSTRAINT PK_Species PRIMARY KEY (RowId), - CONSTRAINT UQ_Species UNIQUE (Container, Name) -); - - -CREATE TABLE reagent.ReagentSpecies -( - ReagentId INT4 NOT NULL, - SpeciesId INT4 NOT NULL, - - CONSTRAINT PK_ReagentSpecies PRIMARY KEY (ReagentId, SpeciesId), - CONSTRAINT FK_ReagentSpecies_Reagent FOREIGN KEY (ReagentId) - REFERENCES reagent.reagents (rowid), - CONSTRAINT FK_ReagentSpecies_Species FOREIGN KEY (SpeciesId) - REFERENCES reagent.Species (RowId) -); - -CREATE INDEX IX_ReagentSpecies ON reagent.ReagentSpecies USING btree (ReagentId); - -ALTER TABLE reagent.Reagents ADD COLUMN Lsid LsidType null; -ALTER TABLE reagent.Lots ADD COLUMN Lsid LsidType null; -ALTER TABLE reagent.Vials ADD COLUMN Lsid LsidType null; -ALTER TABLE reagent.Titrations ADD COLUMN Lsid LsidType null; - --- Add a Container column to ReagentSpecies to ease Container delete -ALTER TABLE reagent.ReagentSpecies ADD COLUMN Container ENTITYID null; -UPDATE reagent.ReagentSpecies SET Container = (SELECT Container FROM reagent.Reagents r WHERE r.RowId = ReagentId); -ALTER TABLE reagent.ReagentSpecies ALTER COLUMN Container SET NOT NULL; - --- Deleting Reagent will delete associated ReagentSpecies -ALTER TABLE reagent.ReagentSpecies DROP CONSTRAINT FK_ReagentSpecies_Reagent; -ALTER TABLE reagent.ReagentSpecies ADD CONSTRAINT - FK_ReagentSpecies_Reagent FOREIGN KEY (ReagentId) REFERENCES reagent.Reagents (RowId) - ON DELETE CASCADE; - --- Add Container FKs -ALTER TABLE reagent.Titrations ADD CONSTRAINT FK_Titrations_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); -ALTER TABLE reagent.Vials ADD CONSTRAINT FK_Vials_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); -ALTER TABLE reagent.Lots ADD CONSTRAINT FK_Lots_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); -ALTER TABLE reagent.Manufacturers ADD CONSTRAINT FK_Manufacturers_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); -ALTER TABLE reagent.ReagentSpecies ADD CONSTRAINT FK_ReagentSpecies_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); -ALTER TABLE reagent.Species ADD CONSTRAINT FK_Species_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); -ALTER TABLE reagent.Reagents ADD CONSTRAINT FK_Reagents_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); -ALTER TABLE reagent.Labels ADD CONSTRAINT FK_Labels_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); -ALTER TABLE reagent.Antigens ADD CONSTRAINT FK_Antigens_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID); - --- Add LSID FKs -ALTER TABLE reagent.Titrations ADD CONSTRAINT FK_Titrations_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Vials ADD CONSTRAINT FK_Vials_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Lots ADD CONSTRAINT FK_Lots_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Reagents ADD CONSTRAINT FK_Reagents_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); - -/* reagent-12.30-13.10.sql */ - -ALTER TABLE reagent.Titrations DROP CONSTRAINT FK_Titrations_LSID; -ALTER TABLE reagent.Vials DROP CONSTRAINT FK_Vials_LSID; -ALTER TABLE reagent.Lots DROP CONSTRAINT FK_Lots_LSID; -ALTER TABLE reagent.Reagents DROP CONSTRAINT FK_Reagents_LSID; - -/* reagent-13.10-13.20.sql */ - --- Null out any LSIDs that were created that don't have an associated exp.Object -UPDATE reagent.titrations r SET lsid = NULL WHERE r.lsid IS NOT NULL AND r.lsid NOT IN (SELECT objecturi FROM exp.object); -UPDATE reagent.vials r SET lsid = NULL WHERE r.lsid IS NOT NULL AND r.lsid NOT IN (SELECT objecturi FROM exp.object); -UPDATE reagent.lots r SET lsid = NULL WHERE r.lsid IS NOT NULL AND r.lsid NOT IN (SELECT objecturi FROM exp.object); -UPDATE reagent.reagents r SET lsid = NULL WHERE r.lsid IS NOT NULL AND r.lsid NOT IN (SELECT objecturi FROM exp.object); - --- Restore LSID FKs -ALTER TABLE reagent.Titrations ADD CONSTRAINT FK_Titrations_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Vials ADD CONSTRAINT FK_Vials_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Lots ADD CONSTRAINT FK_Lots_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Reagents ADD CONSTRAINT FK_Reagents_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); - -/* reagent-13.20-13.30.sql */ - --- Make the reamaining reagent tables extensible -ALTER TABLE reagent.Antigens ADD COLUMN Lsid LsidType null; -ALTER TABLE reagent.Labels ADD COLUMN Lsid LsidType null; -ALTER TABLE reagent.Manufacturers ADD COLUMN Lsid LsidType null; -ALTER TABLE reagent.Species ADD COLUMN Lsid LsidType null; \ No newline at end of file diff --git a/resources/schemas/dbscripts/sqlserver/reagent-0.000-21.000.sql b/resources/schemas/dbscripts/sqlserver/reagent-0.000-21.000.sql deleted file mode 100644 index 34154cd..0000000 --- a/resources/schemas/dbscripts/sqlserver/reagent-0.000-21.000.sql +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright (c) 2010-2015 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* reagent-10.20-10.30.sql */ - -CREATE SCHEMA reagent; -GO - -CREATE TABLE reagent.Antigens -( - RowId INT IDENTITY(1,1) NOT NULL, - Container EntityID NOT NULL, - Name VARCHAR(255) NOT NULL, - Description TEXT, - - CONSTRAINT PK_Antigens PRIMARY KEY (RowId), - CONSTRAINT UQ_Antigens UNIQUE (Container, Name) -) - -CREATE TABLE reagent.Labels -( - RowId INT IDENTITY(1,1) NOT NULL, - Container EntityID NOT NULL, - Name VARCHAR(255) NOT NULL, - Description TEXT, - - CONSTRAINT PK_Labels PRIMARY KEY (RowId), - CONSTRAINT UQ_Labels UNIQUE (Container, Name) -) - -CREATE TABLE reagent.Manufacturers -( - RowId INT IDENTITY(1,1) NOT NULL, - Container EntityID NOT NULL, - Name VARCHAR(255) NOT NULL, - - CONSTRAINT PK_Manufacturers PRIMARY KEY (RowId), - CONSTRAINT UQ_Manufacturers UNIQUE (Container, Name) -) - -CREATE TABLE reagent.Reagents -( - RowId INT IDENTITY(1,1) NOT NULL, - Container EntityID NOT NULL, - CreatedBy USERID NOT NULL, - Created DATETIME NOT NULL, - ModifiedBy USERID NOT NULL, - Modified DATETIME NOT NULL, - - AntigenId INT NOT NULL, - LabelId INT NOT NULL, - Clone VARCHAR(255), - - CONSTRAINT PK_Reagents PRIMARY KEY (RowId), - CONSTRAINT FK_Reagents_Antigens FOREIGN KEY (AntigenId) REFERENCES reagent.Antigens(RowId), - CONSTRAINT FK_Reagents_Labels FOREIGN KEY (LabelId) REFERENCES reagent.Labels(RowId), - CONSTRAINT UQ_Reagents UNIQUE (Container, AntigenId, LabelId, Clone) -) - -CREATE TABLE reagent.Lots -( - RowId INT IDENTITY(1,1) NOT NULL, - Container EntityID NOT NULL, - CreatedBy USERID NOT NULL, - Created DATETIME NOT NULL, - ModifiedBy USERID NOT NULL, - Modified DATETIME NOT NULL, - - ReagentId INT NOT NULL, - ManufacturerId INT NOT NULL, - LotNumber VARCHAR(255) NOT NULL, - CatalogNumber VARCHAR(255), - - CONSTRAINT PK_Lots PRIMARY KEY (RowId), - CONSTRAINT FK_Lots_Reagents FOREIGN KEY (ReagentId) REFERENCES reagent.Reagents(RowId), - CONSTRAINT FK_Lots_Manufacturers FOREIGN KEY (ManufacturerId) REFERENCES reagent.Manufacturers(RowId), - CONSTRAINT UQ_Lots UNIQUE (Container, ManufacturerId, LotNumber, CatalogNumber, ReagentId) -) - -CREATE TABLE reagent.Vials -( - RowId INT IDENTITY(1,1) NOT NULL, - Container EntityID NOT NULL, - CreatedBy USERID NOT NULL, - Created DATETIME NOT NULL, - ModifiedBy USERID NOT NULL, - Modified DATETIME NOT NULL, - - LotId INT NOT NULL, - Freezer VARCHAR(255), - Box VARCHAR(30), - Row INT, - Col INT, - Used BIT NOT NULL, - - CONSTRAINT PK_Vials PRIMARY KEY (RowId), - CONSTRAINT FK_Vials_Lots FOREIGN KEY (LotId) REFERENCES reagent.Lots(RowId) -) - -EXEC sp_rename 'reagent.Vials.Freezer', 'Location', 'COLUMN' -ALTER TABLE reagent.Vials ALTER COLUMN [Row] VARCHAR(30) -ALTER TABLE reagent.Vials ALTER COLUMN Col VARCHAR(30) -ALTER TABLE reagent.Vials ADD Owner VARCHAR(30) NULL - -ALTER TABLE reagent.Antigens ADD Aliases VARCHAR(255) NULL -ALTER TABLE reagent.Labels ADD Aliases VARCHAR(255) NULL - -ALTER TABLE Reagent.Reagents ADD Description TEXT NULL - -ALTER TABLE Reagent.Lots ADD Expiration DATETIME NULL -ALTER TABLE Reagent.Lots ADD Description TEXT NULL - -CREATE TABLE reagent.Titrations -( - RowId INT IDENTITY(1,1) NOT NULL, - Container EntityID NOT NULL, - CreatedBy USERID NOT NULL, - Created DATETIME NOT NULL, - ModifiedBy USERID NOT NULL, - Modified DATETIME NOT NULL, - - LotId INT NOT NULL, - ExperimentId VARCHAR(255), - Owner VARCHAR(30), - Type VARCHAR(30) NOT NULL, -- 'Surface', 'Intercellular', '0 Degree' - Result VARCHAR(30) NOT NULL, - Description TEXT, - - CONSTRAINT PK_Titrations PRIMARY KEY (RowId), - CONSTRAINT FK_Titrations_Lots FOREIGN KEY (LotId) REFERENCES reagent.Lots(RowId) -) - -EXEC sp_rename 'reagent.Vials.Owner', 'OwnedBy', 'COLUMN' -EXEC sp_rename 'reagent.Titrations.Owner', 'PerformedBy', 'COLUMN' - -CREATE TABLE reagent.Species -( - RowId INT IDENTITY(1,1) NOT NULL, - Container EntityID NOT NULL, - Name VARCHAR(255) NOT NULL, - - CONSTRAINT PK_Species PRIMARY KEY (RowId), - CONSTRAINT UQ_Species UNIQUE (Container, Name) -) - -CREATE TABLE reagent.ReagentSpecies -( - ReagentId INT NOT NULL, - SpeciesId INT NOT NULL, - - CONSTRAINT PK_ReagentSpecies PRIMARY KEY (ReagentId, SpeciesId), - CONSTRAINT FK_ReagentSpecies_Reagent FOREIGN KEY (ReagentId) - REFERENCES reagent.reagents (rowid), - CONSTRAINT FK_ReagentSpecies_Species FOREIGN KEY (SpeciesId) - REFERENCES reagent.Species (RowId) -) - -CREATE INDEX IX_ReagentSpecies ON reagent.ReagentSpecies (ReagentId) - -ALTER TABLE reagent.Reagents ADD Lsid LsidType null; -ALTER TABLE reagent.Lots ADD Lsid LsidType null; -ALTER TABLE reagent.Vials ADD Lsid LsidType null; -ALTER TABLE reagent.Titrations ADD Lsid LsidType null; -GO - --- Add a Container column to ReagentSpecies to ease Container delete -ALTER TABLE reagent.ReagentSpecies ADD Container ENTITYID null -GO - -UPDATE reagent.ReagentSpecies SET Container = (SELECT Container FROM reagent.Reagents r WHERE r.RowId = ReagentId) -GO - -ALTER TABLE reagent.ReagentSpecies ALTER COLUMN Container ENTITYID NOT NULL -GO - --- Deleting Reagent will delete associated ReagentSpecies -ALTER TABLE reagent.ReagentSpecies DROP CONSTRAINT FK_ReagentSpecies_Reagent -GO - -ALTER TABLE reagent.ReagentSpecies ADD CONSTRAINT - FK_ReagentSpecies_Reagent FOREIGN KEY (ReagentId) REFERENCES reagent.Reagents (RowId) - ON DELETE CASCADE -GO - - --- Add Container FKs -ALTER TABLE reagent.Titrations ADD CONSTRAINT FK_Titrations_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -ALTER TABLE reagent.Vials ADD CONSTRAINT FK_Vials_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -ALTER TABLE reagent.Lots ADD CONSTRAINT FK_Lots_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -ALTER TABLE reagent.Manufacturers ADD CONSTRAINT FK_Manufacturers_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -ALTER TABLE reagent.ReagentSpecies ADD CONSTRAINT FK_ReagentSpecies_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -ALTER TABLE reagent.Species ADD CONSTRAINT FK_Species_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -ALTER TABLE reagent.Reagents ADD CONSTRAINT FK_Reagents_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -ALTER TABLE reagent.Labels ADD CONSTRAINT FK_Labels_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -ALTER TABLE reagent.Antigens ADD CONSTRAINT FK_Antigens_Container FOREIGN KEY (Container) REFERENCES core.Containers (EntityID) -GO - --- Add LSID FKs -ALTER TABLE reagent.Vials ADD CONSTRAINT FK_Vials_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI) -ALTER TABLE reagent.Titrations ADD CONSTRAINT FK_Titrations_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI) -ALTER TABLE reagent.Lots ADD CONSTRAINT FK_Lots_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI) -ALTER TABLE reagent.Reagents ADD CONSTRAINT FK_Reagents_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI) -GO - -/* reagent-12.30-13.10.sql */ - -ALTER TABLE reagent.Titrations DROP CONSTRAINT FK_Titrations_LSID; -ALTER TABLE reagent.Vials DROP CONSTRAINT FK_Vials_LSID; -ALTER TABLE reagent.Lots DROP CONSTRAINT FK_Lots_LSID; -ALTER TABLE reagent.Reagents DROP CONSTRAINT FK_Reagents_LSID; - -/* reagent-13.10-13.20.sql */ - --- Null out any LSIDs that were created that don't have an associated exp.Object -UPDATE reagent.titrations SET lsid = NULL WHERE lsid IS NOT NULL AND lsid NOT IN (SELECT objecturi FROM exp.object); -UPDATE reagent.vials SET lsid = NULL WHERE lsid IS NOT NULL AND lsid NOT IN (SELECT objecturi FROM exp.object); -UPDATE reagent.lots SET lsid = NULL WHERE lsid IS NOT NULL AND lsid NOT IN (SELECT objecturi FROM exp.object); -UPDATE reagent.reagents SET lsid = NULL WHERE lsid IS NOT NULL AND lsid NOT IN (SELECT objecturi FROM exp.object); -GO - --- Restore LSID FKs -ALTER TABLE reagent.Vials ADD CONSTRAINT FK_Vials_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Titrations ADD CONSTRAINT FK_Titrations_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Lots ADD CONSTRAINT FK_Lots_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -ALTER TABLE reagent.Reagents ADD CONSTRAINT FK_Reagents_LSID FOREIGN KEY (Lsid) REFERENCES exp.Object (ObjectURI); -GO - -/* reagent-13.20-13.30.sql */ - --- Make the remaining reagent tables extensible -ALTER TABLE reagent.Antigens ADD Lsid LsidType null; -ALTER TABLE reagent.Labels ADD Lsid LsidType null; -ALTER TABLE reagent.Manufacturers ADD Lsid LsidType null; -ALTER TABLE reagent.Species ADD Lsid LsidType null; - -ALTER TABLE reagent.Antigens DROP CONSTRAINT UQ_Antigens; -ALTER TABLE reagent.Antigens ALTER COLUMN Name NVARCHAR(255) NULL; -ALTER TABLE reagent.Antigens ADD CONSTRAINT UQ_Antigens UNIQUE (Container, Name); -ALTER TABLE reagent.Antigens ALTER COLUMN Description NVARCHAR(max) NULL; -ALTER TABLE reagent.Antigens ALTER COLUMN Aliases NVARCHAR(255) NULL; - -ALTER TABLE reagent.Labels DROP CONSTRAINT UQ_Labels; -ALTER TABLE reagent.Labels ALTER COLUMN Name NVARCHAR(255) NULL; -ALTER TABLE reagent.Labels ADD CONSTRAINT UQ_Labels UNIQUE (Container, Name); -ALTER TABLE reagent.Labels ALTER COLUMN Description NVARCHAR(max) NULL; -ALTER TABLE reagent.Labels ALTER COLUMN Aliases NVARCHAR(255) NULL; - -ALTER TABLE reagent.Lots DROP CONSTRAINT UQ_Lots; -ALTER TABLE reagent.Lots ALTER COLUMN LotNumber NVARCHAR(255) NULL; -ALTER TABLE reagent.Lots ALTER COLUMN CatalogNumber NVARCHAR(255) NULL; -ALTER TABLE reagent.Lots ADD CONSTRAINT UQ_Lots UNIQUE (Container, ManufacturerId, LotNumber, CatalogNumber, ReagentId); -ALTER TABLE reagent.Lots ALTER COLUMN Description NVARCHAR(max) NULL; - -ALTER TABLE reagent.Manufacturers DROP CONSTRAINT UQ_Manufacturers; -ALTER TABLE reagent.Manufacturers ALTER COLUMN Name NVARCHAR(255) NULL; -ALTER TABLE reagent.Manufacturers ADD CONSTRAINT UQ_Manufacturers UNIQUE (Container, Name); - -ALTER TABLE reagent.Reagents DROP CONSTRAINT UQ_Reagents; -ALTER TABLE reagent.Reagents ALTER COLUMN Clone NVARCHAR(255) NULL; -ALTER TABLE reagent.Reagents ADD CONSTRAINT UQ_Reagents UNIQUE (Container, AntigenId, Clone, LabelId); -ALTER TABLE reagent.Reagents ALTER COLUMN Description NVARCHAR(max) NULL; - -ALTER TABLE reagent.Species DROP CONSTRAINT UQ_Species; -ALTER TABLE reagent.Species ALTER COLUMN Name NVARCHAR(255) NULL; -ALTER TABLE reagent.Species ADD CONSTRAINT UQ_Species UNIQUE (Container, Name); - -ALTER TABLE reagent.Titrations ALTER COLUMN ExperimentId NVARCHAR(255) NULL; -ALTER TABLE reagent.Titrations ALTER COLUMN PerformedBy NVARCHAR(30) NULL; -ALTER TABLE reagent.Titrations ALTER COLUMN Type NVARCHAR(30) NULL; -ALTER TABLE reagent.Titrations ALTER COLUMN Result NVARCHAR(30) NULL; -ALTER TABLE reagent.Titrations ALTER COLUMN Description NVARCHAR(max) NULL; - -ALTER TABLE reagent.Vials ALTER COLUMN Location NVARCHAR(255) NULL; -ALTER TABLE reagent.Vials ALTER COLUMN Box NVARCHAR(30) NULL; -ALTER TABLE reagent.Vials ALTER COLUMN Row NVARCHAR(30) NULL; -ALTER TABLE reagent.Vials ALTER COLUMN Col NVARCHAR(30) NULL; -ALTER TABLE reagent.Vials ALTER COLUMN OwnedBy NVARCHAR(max) NULL; \ No newline at end of file diff --git a/resources/schemas/reagent.xml b/resources/schemas/reagent.xml deleted file mode 100644 index 343f58c..0000000 --- a/resources/schemas/reagent.xml +++ /dev/null @@ -1,701 +0,0 @@ - - - - - - Contains Antigens in this folder. - RowId - /reagent/insert.view?schemaName=reagent&queryName=Antigens - /reagent/update.view?schemaName=reagent&queryName=Antigens&RowId=${RowId} - Name - - - Antigen Id - int - true - 10 - false - true - true - true - - - lsidtype - true - true - false - true - - ObjectUri - Object - exp - - - - false - entityid - true - - - varchar - 255 - - - varchar - 255 - - - true - text - - - - - /reagent/update.view?schemaName=reagent&queryName=Antigens&selected=true&selectionKey=${selectionKey} - - - - LABKEY.requiresScript('/reagent/util.js', function () { editDomain('Antigens'); }); - - - -
- - - Contains Labels in this folder. - RowId - /reagent/insert.view?schemaName=reagent&queryName=Labels - /reagent/update.view?schemaName=reagent&queryName=Labels&RowId=${RowId} - Name - - - Label Id - int - true - 10 - false - true - true - true - - - lsidtype - true - true - false - true - - ObjectUri - Object - exp - - - - false - entityid - true - - - varchar - 255 - - - varchar - 255 - - - true - text - - - - - /reagent/update.view?schemaName=reagent&queryName=Labels&selected=true&selectionKey=${selectionKey} - - - - LABKEY.requiresScript('/reagent/util.js', function () { editDomain('Labels'); }); - - - -
- - - Contains Manufacturers in this folder. - RowId - /reagent/insert.view?schemaName=reagent&queryName=Manufacturers - /reagent/update.view?schemaName=reagent&queryName=Manufacturers&RowId=${RowId} - Name - - - Manufacturer Id - int - true - 10 - false - true - true - true - - - lsidtype - true - true - false - true - - ObjectUri - Object - exp - - - - false - entityid - true - - - varchar - 255 - - - - - /reagent/update.view?schemaName=reagent&queryName=Manufacturers&selected=true&selectionKey=${selectionKey} - - - - LABKEY.requiresScript('/reagent/util.js', function () { editDomain('Manufacturers'); }); - - - -
- - - Contains Species names in this folder. - RowId - /reagent/insert.view?schemaName=reagent&queryName=Species - /reagent/update.view?schemaName=reagent&queryName=Species&RowId=${RowId} - Name - - - Species Id - int - true - 10 - false - true - true - true - - - lsidtype - true - true - false - true - - ObjectUri - Object - exp - - - - false - entityid - true - - - varchar - 255 - - - - - /reagent/update.view?schemaName=reagent&queryName=Manufacturers&selected=true&selectionKey=${selectionKey} - - - - LABKEY.requiresScript('/reagent/util.js', function () { editDomain('Species'); }); - - - -
- - - - - false - entityid - true - - - Reagent - - RowId - Reagent - reagent - - int4 - false - true - true - - - Species - - RowId - Species - reagent - - int4 - false - true - true - - - - - - Contains Reagents composed of Antigens, Labels, a clone number, and list of reactive Species. - RowId - /reagent/insert.view?schemaName=reagent&queryName=Reagents - /reagent/update.view?schemaName=reagent&queryName=Reagents&RowId=${RowId} - /reagent/reagent.view?RowId=${RowId} - - RowId - - - Reagent Id - int - true - 10 - false - true - true - true - - - lsidtype - true - true - false - true - - ObjectUri - Object - exp - - - - false - entityid - true - - - false - userid - true - - - false - true - - - false - userid - true - - - false - true - - - Antigen - - RowId - Antigens - reagent - - int4 - - - Label - - RowId - Labels - reagent - - int4 - - - true - true - true - true - - reagent - ReagentSpecies - ReagentId - junction - SpeciesId - - - - true - varchar - 255 - - - true - text - - - - - /reagent/update.view?schemaName=reagent&queryName=Reagents&selected=true&selectionKey=${selectionKey} - - - - LABKEY.requiresScript('/reagent/util.js', function () { editDomain('Reagents'); }); - - - -
- - - Contains Lots composed of a Reagent, Manufacturer, and other lot information. - /reagent/insert.view?schemaName=reagent&queryName=Lots - /reagent/update.view?schemaName=reagent&queryName=Lots&RowId=${RowId} - /reagent/lot.view?RowId=${RowId} - RowId - - RowId - - - int - true - 10 - false - true - false - true - true - Lot Id - - - lsidtype - true - true - false - true - - ObjectUri - Object - exp - - - - false - entityid - true - - - false - userid - true - - - false - true - - - false - userid - true - - - false - true - - - Reagent - - RowId - Reagents - reagent - - int4 - 10 - - - Manufacturer - - RowId - Manufacturers - reagent - - int4 - 10 - - - varchar - 255 - - - true - varchar - 255 - - - true - - - true - text - - - - - /reagent/update.view?schemaName=reagent&queryName=Lots&selected=true&selectionKey=${selectionKey} - - - - LABKEY.requiresScript('/reagent/util.js', function () { editDomain('Lots'); }); - - - -
- - - Contains Vials associated with a Lot and storage location information. - /reagent/insert.view?schemaName=reagent&queryName=Vials - /reagent/update.view?schemaName=reagent&queryName=Vials&RowId=${RowId} - /reagent/vial.view?RowId=${RowId} - RowId - RowId - - - int - true - 10 - false - true - true - true - Vial Id - - - lsidtype - true - true - false - true - - ObjectUri - Object - exp - - - - false - entityid - true - - - false - userid - true - - - false - true - - - false - userid - true - - - false - true - - - Lot - - RowId - Lots - reagent - - int4 - 10 - - - bool - - - true - userid - 30 - - UserId - Users - core - - - - true - varchar - 255 - - - true - varchar - 30 - - - true - varchar - 30 - - - true - varchar - 30 - - - - - /reagent/update.view?schemaName=reagent&queryName=Vials&selected=true&selectionKey=${selectionKey} - - - - LABKEY.requiresScript('/reagent/util.js', function () { editDomain('Vials'); }); - - - -
- - - Contains Titration experiment information associated with a Lot. - /reagent/insert.view?schemaName=reagent&queryName=Titrations - /reagent/update.view?schemaName=reagent&queryName=Titrations&RowId=${RowId} - /reagent/titration.view?RowId=${RowId} - RowId - RowId - - - int - true - 10 - false - true - true - true - Titration Id - - - lsidtype - true - true - false - true - - ObjectUri - Object - exp - - - - false - entityid - true - - - false - userid - true - - - false - true - - - false - userid - true - - - false - true - - - Lot - - RowId - Lots - reagent - - int4 - 10 - - - true - varchar - 255 - - - Performed By - true - userid - 30 - - UserId - Users - core - - - - Titration type, e.g. "Intercellular", "Surface", "0 Degree" - varchar - 30 - - - Result of titration, e.g., "2ul/50ul" - varchar - 30 - - - true - text - - - - - /reagent/update.view?schemaName=reagent&queryName=Titrations&selected=true&selectionKey=${selectionKey} - - - - LABKEY.requiresScript('/reagent/util.js', function () { editDomain('Titrations'); }); - - - -
- -
diff --git a/resources/views/begin.html b/resources/views/begin.html deleted file mode 100644 index 7ba15e2..0000000 --- a/resources/views/begin.html +++ /dev/null @@ -1,67 +0,0 @@ -Welcome to the reagent database. -

Setup:

-

-The first time the module is installed and on every upgrade, you should run -the initialize script to populate the database. -

-After initializing, add or remove -Manufacturers, -Antigens, -Labels, and -Species -specific for your site. Once you have added Manufactuers, Antigens, Labels, and Species, you can add new -Reagents -and -Lots. After adding Lots, -you may want to add a -Titration -experiment and -Vials -to the Lot. - -

Summary of tables:

-

-

- - diff --git a/resources/views/initialize.html b/resources/views/initialize.html deleted file mode 100644 index a04bf84..0000000 --- a/resources/views/initialize.html +++ /dev/null @@ -1,582 +0,0 @@ -
Click the 'Initialize' button to populate the reagent database with some generic data and to configure some views.
-Initialize -
-
- - diff --git a/resources/views/initialize.view.xml b/resources/views/initialize.view.xml deleted file mode 100644 index 85e91e4..0000000 --- a/resources/views/initialize.view.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/resources/views/insert.html b/resources/views/insert.html deleted file mode 100644 index c4d78c0..0000000 --- a/resources/views/insert.html +++ /dev/null @@ -1,25 +0,0 @@ -
-
- - diff --git a/resources/views/insert.view.xml b/resources/views/insert.view.xml deleted file mode 100644 index 0212ac6..0000000 --- a/resources/views/insert.view.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/resources/views/lot.html b/resources/views/lot.html deleted file mode 100644 index a27cf00..0000000 --- a/resources/views/lot.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -
Lot Number:
Manufacturer:
Catalog Number:
Reagent:
Description:
-

-Edit -View Grid -View Reagent - -

-

- -

-

- - - diff --git a/resources/views/lot.view.xml b/resources/views/lot.view.xml deleted file mode 100644 index 39ee3fb..0000000 --- a/resources/views/lot.view.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/resources/views/reagent.html b/resources/views/reagent.html deleted file mode 100644 index 9a15a36..0000000 --- a/resources/views/reagent.html +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - -
Antigen:
Label:
Clone:
-

-Edit -View Grid - -

-

- - diff --git a/resources/views/reagent.view.xml b/resources/views/reagent.view.xml deleted file mode 100644 index 39ee3fb..0000000 --- a/resources/views/reagent.view.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/resources/views/titration.html b/resources/views/titration.html deleted file mode 100644 index 9f28faf..0000000 --- a/resources/views/titration.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Lot:
Reagent:
Experiment Id:
Performed By:
Type:
Result:
Description:
-

-Edit -View Grid -View Reagent -View Lot - -

-

- - - diff --git a/resources/views/titration.view.xml b/resources/views/titration.view.xml deleted file mode 100644 index 39ee3fb..0000000 --- a/resources/views/titration.view.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/resources/views/update.html b/resources/views/update.html deleted file mode 100644 index 5b4faff..0000000 --- a/resources/views/update.html +++ /dev/null @@ -1,37 +0,0 @@ -
-
- - - - diff --git a/resources/views/update.view.xml b/resources/views/update.view.xml deleted file mode 100644 index 0212ac6..0000000 --- a/resources/views/update.view.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/resources/views/vial.html b/resources/views/vial.html deleted file mode 100644 index f6bc339..0000000 --- a/resources/views/vial.html +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -
Lot:
Reagent:
Owned By:
Location:
Used:
-

-Edit -View Grid -View Reagent -View Lot - -

-

- - - diff --git a/resources/views/vial.view.xml b/resources/views/vial.view.xml deleted file mode 100644 index 39ee3fb..0000000 --- a/resources/views/vial.view.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/resources/web/reagent/util.js b/resources/web/reagent/util.js deleted file mode 100644 index 173e4fc..0000000 --- a/resources/web/reagent/util.js +++ /dev/null @@ -1,603 +0,0 @@ -/* - * Copyright (c) 2009-2016 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0 - */ -var ColumnSets = { - Antigens: [ 'Name', 'Aliases', 'Description' ], - Labels: [ 'Name', 'Aliases', 'Description' ], - Manufacturers: [ 'Name' ], - Species: [ 'Name' ], - Reagents: [ 'Antigen', 'Label', 'Clone', 'Species/RowId', 'Description' ], - Lots: [ 'Reagent', 'Manufacturer', 'CatalogNumber', 'LotNumber', 'Description' ], - Vials: [ 'Lot', 'OwnedBy', 'Location', 'Box', 'Row', 'Col', 'Used' ], - Titrations: [ 'Lot', 'PerformedBy', 'ExperimentId', 'Type', 'Result', 'Description' ] -}; - -var ExcludeColumnSets = { - Antigens: [ 'Container' ], - Labels: [ 'Container' ], - Manufacturers: [ 'Container' ], - Species: [ 'Container' ], - Reagents: [ 'Species', 'Container', 'CreatedBy', 'Created', 'ModifiedBy', 'Modified', 'Lsid' ], - Lots: [ 'Container', 'CreatedBy', 'Created', 'ModifiedBy', 'Modified', 'Lsid' ], - Vials: [ 'Container', 'CreatedBy', 'Created', 'ModifiedBy', 'Modified', 'Lsid' ], - Titrations: [ 'Container', 'CreatedBy', 'Created', 'ModifiedBy', 'Modified', 'Lsid' ] -}; - -Ext.QuickTips.init(); - -var returnUrl = null; - -function initReturnUrl(schemaName, queryName) -{ - returnUrl = LABKEY.ActionURL.getReturnUrl(); - if (!returnUrl) { - returnUrl = LABKEY.ActionURL.buildURL('query', 'executeQuery.view', null, { - schemaName: schemaName, - 'query.queryName': queryName - }); - } -} - -function navReturnUrl() -{ - window.location = returnUrl; -} - -function editDomain(queryName) -{ - var url = LABKEY.ActionURL.buildURL("property", "editDomain", null, { - domainKind: "ExtensibleTable", - createOrEdit: true, - schemaName: "reagent", - queryName: queryName - }); - window.location = url; -} - -// UNDONE: insert/update of Reagent and ReagentSpecies should be part of the same transaction -function saveReagentSpecies(schemaName, queryName, initialValues, updatedRows, modifiedSpecies, successCb, errorCb) -{ - var deleteCommand = { - schemaName: schemaName, - queryName: "ReagentSpecies", - command: "delete", - rows: [] - }; - var insertCommand = { - schemaName: schemaName, - queryName: "ReagentSpecies", - command: "insert", - rows: [] - }; - - for (var i = 0; i < updatedRows.length; i++) - { - var updatedRow = updatedRows[i]; - var rowid = updatedRow.rowid || updatedRow.RowId || updatedRow.rowId; - - // delete the original values in the ReagentSpecies table if found - for (var j = 0; j < initialValues.length; j++) - { - var initialValue = initialValues[j]; - var initialValueRowId = initialValue.rowid ? initialValue.rowid.value : - initialValue.RowId ? initialValue.RowId.value : - initialValue.rowId ? initialValue.rowId.value : -1; - if (initialValueRowId == rowid) - { - var initialSpecies = initialValue["Species/RowId"].value; - for (var k = 0; k < initialSpecies.length; k++) - { - var speciesId = +initialSpecies[k]; - deleteCommand.rows.push({ReagentId: rowid, SpeciesId: speciesId}); - } - break; - } - } - - // insert new values into the ReagentSpecies table - var species = modifiedSpecies[i]; - if (species) - { - if (Ext.isString(species)) - species = species.split(","); // ugh - for (var m = 0; m < species.length; m++) - { - var speciesId = +species[m]; - insertCommand.rows.push({ReagentId: rowid, SpeciesId: speciesId}); - } - } - } - - var commands = []; - if (deleteCommand.rows.length > 0) - commands.push(deleteCommand); - if (insertCommand.rows.length > 0) - commands.push(insertCommand); - - // nothing to delete or insert - if (commands.length === 0) { - successCb(); - } - else { - LABKEY.Query.saveRows({ - commands: commands, - successCallback: successCb, - errorCallback: errorCb, - transacted: true - }); - } -} - -function save(selected, updateRowId, schemaName, queryName, initialValues, values) -{ - Ext.MessageBox.wait("Saving...", "Saving..."); - - // stash away the species for insertion later - var species = null; - if (queryName == "Reagents") - { - species = []; - for (var i = 0; i < values.length; i++) - { - species.push(values[i]["Species/RowId"]); - delete values[i]["Species/RowId"]; - } - } - - var fn = LABKEY.Query.insertRows; - if (selected || updateRowId) { - fn = LABKEY.Query.updateRows; - } - - function successCallback() { - Ext.MessageBox.updateProgress(1, "Saved."); - Ext.MessageBox.hide(); - navReturnUrl(); - } - - function errorCallback(errorInfo) { - Ext.MessageBox.updateProgress(1); - Ext.MessageBox.hide(); - Ext.MessageBox.alert("Error Saving", errorInfo.exception || errorInfo.statusText); - } - - // insert or update the row, possibly updating the ReagentSpecies junction table. - fn({ - schemaName: schemaName, - queryName: queryName, - rows: values, - successCallback: function (data) { - if (data.rows.length != values.length) - { - errorCallback({statusText: "Expected to save " + values.length + " rows, but received only " + data.rows.length + " rows."}); - } - else - { - if (species) - saveReagentSpecies(schemaName, queryName, initialValues, data.rows, species, successCallback, errorCallback); - else - successCallback(); - } - }, - errorCallback: errorCallback - }); -} - -var ReagentFormPanel = Ext.extend(LABKEY.ext.FormPanel, { - - // excludes some fields and any duplicates caused by adding '*' to the selected columns - initFieldDefaults : function (config) { - var allFields = ReagentFormPanel.superclass.initFieldDefaults.call(this, config); - var seen = {}; - if (config.excludeItems) - { - var fields = []; - for (var i = 0; i < allFields.length; i++) - { - if (!(allFields[i].name in seen) && config.excludeItems.indexOf(allFields[i].name) == -1) - { - seen[allFields[i].name] = true; - fields.push(allFields[i]); - } - } - allFields = fields; - } - return allFields; - } -}); - -/** - * Initializes the FormPanel. - * @param selected {Boolean} true when updating multiple records that have been checked on the grid. - * @param updateRowId {Integer} The row id of the record to update. - * @param schemaName - * @param queryName - */ -function initForm(selected, updateRowId, schemaName, queryName, selectionKey) -{ - initReturnUrl(schemaName, queryName); - - function createForm(data) - { - if (selected || updateRowId) - { - if (data.rows.length == 0) - { - Ext.fly("msgDiv").update("No rows were selected to update!"); - return; - } - } - else - { - // clear out any values if we're creating an empty insert form. - data.rows = []; - - // If there are any equals query filters on the URL, use them as initial values. - // When looking at the Lot details page and the user clicks "Insert New" to add Titration - // the parameter "query.LotId~eq=2" should be on the URL and can be used as a default value. - var params = LABKEY.ActionURL.getParameters(); - for (var key in params) - { - // starts with "query." ends with "~eq" - if (key.indexOf("query.") == 0 && key.indexOf("~eq") == key.length - "~eq".length) - { - var col = key.substring("query.".length, key.length - "~eq".length); - var val = params[key]; - - if (data.rows.length == 0) - { - // Add the dummy row - data.rows[0] = {}; - data.rowCount = 1; - } - - data.rows[0][col] = { value: val }; - } - } - } - - function augmentItem(c) - { - var name = c.name; - switch (name) { - case 'ReagentId': - augmentReagentCombo(c); - break; - - case 'LotId': - augmentLotCombo(c); - break; - - case 'AntigenId': - case 'LabelId': - case 'ManufacturerId': - augmentCombo(c); - break; - - case 'Species/RowId': - augmentSpeciesCombo(c); - break; - - case 'OwnedBy': - // XXX: on update, the userid combo shows the userid value rather than the displayName - augmentUserCombo(c, queryName); - c.value = c.value || LABKEY.user.displayName; - break; - - case 'PerformedBy': - // XXX: on update, the userid combo shows the userid value rather than the displayName - augmentUserCombo(c, queryName); - break; - - case 'Clone': - case 'CatalogNumber': - case 'Location': - case 'Box': - case 'Row': - case 'Col': - case 'Type': - augmentTextCombo(c, queryName); - break; - } - - return c; - } - - var f = new ReagentFormPanel({ - id: 'reagentForm', - border: false, - bodyStyle:'padding:5px 5px', - selectRowsResults: data, - defaults: { width: 350, msgTarget: "qtip" }, - //items: items, - excludeItems: ExcludeColumnSets[queryName] || [], - addAllFields: true, - lazyCreateStore: true, - buttonAlign: 'left', - buttons: [{ - text: 'Save', - handler: function () { - var form = f.getForm(); - if (form.isValid()) { - var values = f.getFormValues(); - save(selected, updateRowId, schemaName, queryName, f.initialConfig.values || [], values); - } - else { - Ext.MessageBox.alert('Error saving', 'There are errors on the form.'); - } - } - },{ - text: 'Cancel', - handler: navReturnUrl - }], - listeners : { - applydefaults: function (fp, c) { - augmentItem(c); - } - } - }); - - f.render('formDiv'); - } - - // If not getting the selected rows, either get the update row by id or no row (id=0) - var filters = [ ]; - if (!selected) - { - var filterRowId = updateRowId || 0; - filters.push(LABKEY.Filter.create('RowId', filterRowId)); - } - - var columns = ColumnSets[queryName] || []; - columns.push("*"); - - LABKEY.Query.selectRows({ - requiredVersion: 9.1, - schemaName: schemaName, - queryName: queryName, - selectionKey: selectionKey, - columns: columns, - filterArray: filters, - showRows: selected ? "selected" : "all", - successCallback: createForm, - errorCallback: function (errorInfo) { - var error = (errorInfo && errorInfo.exception) ? errorInfo.exception : "An error occurred"; - Ext.fly("msgDiv").update("" + Ext.util.Format.htmlEncode(error) + ""); - } - }); -} - - -function augmentReagentCombo(field) -{ - field.store.columns = ['RowId', 'AntigenId/Name', 'LabelId/Name', 'Clone'].join(','); - field.store.sort = 'AntigenId/Name,LabelId/Name,Clone'; - field.store.listeners = { - load: function (store, records, options) { - var len = records.length; - for (var i = 0; i < len; i++) { - var r = records[i]; - var display = r.data['AntigenId/Name'] + ', ' + r.data['LabelId/Name'] + ' (' + r.data['Clone'] + ')'; - r.data['ReagentDisplay'] = display; - } - } - }; - - field.typeAhead = true; - field.minChars = 0; - field.mode = 'local'; - field.displayField = 'ReagentDisplay'; - field.tpl = '
{[values["AntigenId/Name"]]} {[values["LabelId/Name"]]} ({[values["Clone"]]})
'; -} - -function augmentLotCombo(field) -{ - field.store.columns = ['RowId', 'LotNumber', 'CatalogNumber', 'ManufacturerId/Name', 'ReagentId/AntigenId/Name', 'ReagentId/LabelId/Name', 'ReagentId/Clone'].join(','); - field.store.sort = 'LotNumber,ReagentId/AntigenId/Name,ReagentId/LabelId/Name,ReagentId/Clone,ManufacturerId'; - field.store.listeners = { - load: function (store, records, options) { - var len = records.length; - for (var i = 0; i < len; i++) { - var r = records[i]; - var display = r.data['LotNumber'] + ': ' + r.data['ReagentId/AntigenId/Name'] + ', ' + r.data['ReagentId/LabelId/Name'] + ' (' + r.data['ReagentId/Clone'] + ') ' + r.data['ManufacturerId/Name']; - r.data['LotDisplay'] = display; - } - } - }; - - field.typeAhead = true; - field.minChars = 0; - field.mode = 'local'; - field.displayField = 'LotDisplay'; - field.tpl = '
{[values["LotNumber"]]}: {[values["ReagentId/AntigenId/Name"]]}, {[values["ReagentId/LabelId/Name"]]} ({[values["ReagentId/Clone"]]})  {[values["ManufacturerId/Name"]]}
'; -} - -function augmentCombo(field) -{ - field.store.columns = ['RowId', 'Name', 'Aliases', 'Description'].join(','); - field.store.sort = 'Name'; - if (field.allowBlank && field.store.nullRecord) - field.store.nullRecord.nullCaption = "[Keep original values]"; - field.typeAhead = true; - field.minChars = 0; - field.mode = 'local'; - if (field.name == 'ManufacturerId') - field.tpl = '
{Name}
'; - else - field.tpl = '' + - '
' + - '
' + - '{[values["Aliases"] ? values["Aliases"] : ""]}' + - '{[values["Name"] ? values["Name"] : ""]}' + - '
' + - '{[values["Description"] ? values["Description"] : ""]}' + - '
' + - '
'; -} - -function augmentSpeciesCombo(field) -{ - field.fieldLabel = 'Species'; - field.xtype = 'lovcombo'; - field.forceSelection = true; - field.typeAhead = true; - field.minChars = 0; - field.mode = 'local'; - field.hiddenId = (new Ext.Component()).getId(); - field.triggerAction ='all'; - field.disabled = false; - field.displayField = "Name"; - field.valueField = "RowId"; - field.allowBlank = true; - field.store = { - xtype: 'labkey-store', - schemaName: 'reagent', - queryName: 'Species', - columns: ['RowId', 'Name'], - containerPath: LABKEY.container.path, - updatable: false, - autoLoad: true, - listeners: { - metachange: function (store, meta) { - // Add a 'checked' field for the LovCombo to store its state. - meta.fields.push({name: "checked", type: "boolean", mvEnabled: false}); - var rtype = Ext.data.Record.create(meta.fields); - store.fields = rtype.prototype.fields; - store.columns = store.fields.keys; - store.recordType = store.reader.recordType = rtype; - } - } - }; -} - -function augmentTextCombo(field, queryName) -{ - var h = Ext.util.Format.htmlEncode; - var table_column = h(queryName + "." + field.name); - - field.xtype = 'combo'; - field.fieldLabel = field.name; - // Don't restrict to values previously entered. - field.forceSelection = false; - field.typeAhead = true; - field.minChars = 0; - field.mode = 'local'; - field.hiddenName = field.name; - field.hiddenId = (new Ext.Component()).getId(); - field.triggerAction ='all'; - //field.valueField = field.name; // valueField shouldn't be set since we're not mapping to row ids. - field.displayField = field.name; - field.tpl = '
{[values["' + field.name + '"]]}
'; - field.listClass = 'labkey-grid-editor'; - field.store = { - xtype: 'labkey-store', - schemaName: 'reagent', - containerPath: LABKEY.container.path, - sql: 'SELECT DISTINCT ' + table_column + ' FROM ' + h(queryName) + ' WHERE ' + table_column + ' IS NOT NULL ORDER BY ' + table_column + ' LIMIT 1000', - updateable: false, - autoLoad: true - }; -// if (field.allowBlank) -// field.store.nullRecord = { -// displayColumn: field.displayField, -// nullCaption: "[Keep original values]" -// }; -} - -function augmentUserCombo(field, queryName) -{ - var h = Ext.util.Format.htmlEncode; - - var table_column = h(queryName + "." + field.name); - /* - var sql = 'SELECT DISTINCT X.' + h(meta.name) + ', U.DisplayName ' + - 'FROM reagent.' + h(queryName) + ' X ' + - 'INNER JOIN core.Users U ON U.UserId = CONVERT(X.' + h(meta.name) + ' AS integer) ' + - 'WHERE X.' + h(meta.name) + ' IS NOT NULL'; - */ - - var sql = -'SELECT DISTINCT X.' + h(field.name) + ', X.DisplayName FROM (' + -'SELECT' + -' T.' + h(field.name) + ',' + -' (CASE WHEN U.DisplayName IS NULL THEN T.' + h(field.name) + ' ELSE U.DisplayName END) AS DisplayName' + -' FROM ' + h(queryName) + ' T' + -' LEFT OUTER JOIN core.Users U ON CONVERT(U.UserId, varchar) = T.' + h(field.name) + -' WHERE T.' + h(field.name) + ' IS NOT NULL' + -' UNION' + -' SELECT CONVERT(U.UserId, varchar) AS ' + h(field.name) + ', U.DisplayName' + -' FROM core.Users U' + -') X'; - - - field.xtype = 'combo'; - field.fieldLabel = field.name; - // Don't restrict to values previously entered. - field.forceSelection = false; - field.typeAhead = true; - field.minChars = 0; - field.mode = 'local'; - field.hiddenName = field.name; - field.hiddenId = (new Ext.Component()).getId(); - field.triggerAction ='all'; - field.valueField = field.name; // valueField shouldn't be set since we're not mapping to row ids. - field.displayField = "DisplayName"; - field.tpl = '
{[values["DisplayName"]]}
'; - field.listClass = 'labkey-grid-editor'; - field.store = { - xtype: 'labkey-store', - schemaName: 'reagent', - containerPath: LABKEY.container.path, - sql: sql, - updateable: false, - autoLoad: true - }; -} - -// Get the parent
element from FrameType.PORTAL generated DOM. -// Example rendered DOM for a webpart panel: -/* -
-
-

- - Update - -

  -
-
-
-
- ... rest of content -
-
-
-*/ -function portalEl(webpartContentId) { - if (!webpartContentId) { - return null; - } - - let contentEl = document.getElementById(webpartContentId); - if (contentEl) { - let portalBodyEl = contentEl.parentElement; - if (portalBodyEl) { - return portalBodyEl.parentElement; - } - } - - return null; -} - -// get the element -function webPartTitleEl(webpartContentId) { - let panelEl = portalEl(webpartContentId); - if (panelEl) { - return panelEl.querySelector('span.labkey-wp-title-text'); - } - - return null; -} - diff --git a/test/src/org/labkey/test/tests/reagent/ReagentTest.java b/test/src/org/labkey/test/tests/reagent/ReagentTest.java deleted file mode 100644 index 290756c..0000000 --- a/test/src/org/labkey/test/tests/reagent/ReagentTest.java +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2010-2018 LabKey Corporation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.labkey.test.tests.reagent; - -import org.awaitility.Awaitility; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.experimental.categories.Category; -import org.labkey.test.BaseWebDriverTest; -import org.labkey.test.Locator; -import org.labkey.test.Locators; -import org.labkey.test.categories.CustomModules; -import org.labkey.test.pages.ImportDataPage; -import org.labkey.test.util.DataRegionTable; -import org.labkey.test.util.ExtHelper; -import org.labkey.test.util.LogMethod; -import org.labkey.test.util.LoggedParam; -import org.labkey.test.util.PortalHelper; -import org.labkey.test.util.PostgresOnlyTest; -import org.openqa.selenium.Keys; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.interactions.Actions; - -import java.time.Duration; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Random; - -import static org.hamcrest.CoreMatchers.containsString; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -@Category({CustomModules.class}) -@BaseWebDriverTest.ClassTimeout(minutes = 4) -public class ReagentTest extends BaseWebDriverTest implements PostgresOnlyTest -{ - protected static final String PROJECT_NAME = "ReagentProject"; - protected static final String FOLDER_NAME = "ReagentFolder"; - - @Override - public List getAssociatedModules() - { - return Arrays.asList("reagent"); - } - - @Override - protected String getProjectName() - { - return PROJECT_NAME; - } - - @BeforeClass - public static void doSetup() - { - ReagentTest test = (ReagentTest)getCurrentTest(); - test.setup(); - } - - public void setup() - { - createProject(); - } - - public void createProject() - { - log("** Create Project"); - _containerHelper.createProject(PROJECT_NAME, null); - _containerHelper.createSubfolder(PROJECT_NAME, FOLDER_NAME); - _containerHelper.enableModule("reagent"); - - PortalHelper portalHelper = new PortalHelper(this); - portalHelper.addQueryWebPart("reagent"); - - beginAt(PROJECT_NAME + "/" + FOLDER_NAME + "/reagent-initialize.view"); - clickButton("Initialize", 0); - waitForElement(Locator.tag("span").withText("Done."), 2 * WAIT_FOR_JAVASCRIPT); - waitForText("Inserted Manufacturers:", "Inserted Labels:", "Inserted Species:", "Inserted Reagents:"); - assertElementNotPresent(Locators.labkeyError); - } - - @Test - public void testInsert() - { - log("** Inserting new Reagent"); - beginAt(PROJECT_NAME + "/" + FOLDER_NAME + "/query-executeQuery.view?schemaName=reagent&query.queryName=Reagents"); - DataRegionTable table = new DataRegionTable("query", this); - table.clickInsertNewRow(); - - waitForElement(Locator.extButton("Cancel"), WAIT_FOR_JAVASCRIPT); - - WebElement el = Locator.tagWithClass("span", "labkey-wp-title-text").findElement(getDriver()); - assertEquals("Insert New Reagent", el.getText()); - - log("** Selecting AntigenId from ComboBox list"); - // click on ComboBox trigger image - _extHelper.selectComboBoxItem("Antigen:", "AVDLSHFLK"); - - log("** Filtering LabelId ComboBox by 'Alexa'"); - - click(Locator.xpath("//input[@name='LabelId']/../img")); - setFormElement(Locator.xpath("//input[@name='LabelId']/../input[contains(@class, 'x-form-field')]"), "Alexa"); - Locator locator = Locator.tag("div").withClass("x-combo-list-item").notHidden().containing("Alexa"); - // Wait for combo box to be filtered - Awaitility.await().atMost(Duration.ofSeconds(2)).untilAsserted(() -> - assertEquals("Expected to find 5 Alexa labels", 5, locator.findElements(getDriver()).size())); - - Actions builder = new Actions(getDriver()); - builder.sendKeys(Keys.ARROW_DOWN, Keys.ARROW_DOWN).build().perform(); - - waitAndClick(Locator.tag("div").withClass("x-combo-selected").withText("Alexa 680").notHidden()); - assertFormElementEquals(Locator.xpath("//input[@name='LabelId']/../input[contains(@class, 'x-form-field')]"), "Alexa 680"); - - String clone = "jimmy " + Math.random(); - setComboBoxInput("Clone:", clone); - - _extHelper.clickExtButton("Save"); - table = new DataRegionTable("query", this); - table.setFilter("Clone", "Equals", clone); - assertEquals(1, table.getDataRowCount()); - - Map rowMap = table.getRowDataAsMap(0); - assertEquals(clone, rowMap.get("Clone")); - assertEquals("AVDLSHFLK", rowMap.get("AntigenId")); - assertEquals("Alexa 680", rowMap.get("LabelId")); - } - - @Test - public void testUpdate() - { - log("** Navigate to Reagents and filter to clone='8D4-8'"); - beginAt(PROJECT_NAME + "/" + FOLDER_NAME + "/query-executeQuery.view?schemaName=reagent&query.queryName=Reagents&query.Clone~eq=8D4-8"); - - log("** Update existing Reagent"); - DataRegionTable table = new DataRegionTable("query", this); - table.clickEditRow(0); - waitForElement(Locator.extButton("Cancel"), WAIT_FOR_JAVASCRIPT); - - WebElement el = Locator.tagWithClass("span", "labkey-wp-title-text").findElement(getDriver()); - assertEquals("Update Reagent", el.getText()); - - String description = "update " + Math.random(); - _extHelper.setExtFormElementByLabel("Description:", description); - - _extHelper.clickExtButton("Save"); - table = new DataRegionTable("query", this); - table.setFilter("Description", "Equals", description); - assertEquals(1, table.getDataRowCount()); - } - - @Test - public void testBulkUpdate() - { - log("** Navigate to Reagents and filter to Label='Alexa 405'"); - beginAt(PROJECT_NAME + "/" + FOLDER_NAME + "/query-executeQuery.view?schemaName=reagent&query.queryName=Reagents&query.LabelId%2FName~eq=Alexa%20405"); - - DataRegionTable table = new DataRegionTable("query", this); - assertEquals(4, table.getDataRowCount()); - - WebElement bulkEditEl = table.getHeaderButton("Bulk Edit"); - assertThat(bulkEditEl.getAttribute("class"), containsString("labkey-disabled-button")); - - table.checkAllOnPage(); - assertThat(bulkEditEl.getAttribute("class"), not(containsString("labkey-disabled-button"))); - bulkEditEl.click(); - waitForElement(Locator.extButton("Cancel"), WAIT_FOR_JAVASCRIPT); - - WebElement el = Locator.tagWithClass("span", "labkey-wp-title-text").findElement(getDriver()); - assertEquals("Bulk Update Selected Reagents", el.getText()); - - assertEquals("Selected rows have different values for this field.", getComboBoxInput("Antigen:")); - - assertEquals("Alexa 405", getComboBoxInput("Label:")); - - assertEquals("Selected rows have different values for this field.", getComboBoxInput("Clone:")); - - _extHelper.selectComboBoxItem("Antigen:", "Via-Probe"); - - _extHelper.clickExtButton("Save"); - - beginAt(PROJECT_NAME + "/" + FOLDER_NAME + "/query-executeQuery.view?schemaName=reagent&query.queryName=Reagents&query.LabelId%2FName~eq=Alexa%20405"); - - table = new DataRegionTable("query", this); - assertEquals(4, table.getDataRowCount()); - for (int i = 0; i < table.getDataRowCount(); i++) - { - var row = table.getRowDataAsMap(i); - assertEquals("Via-Probe", row.get("AntigenId")); - assertEquals("Alexa 405", row.get("LabelId")); - } - } - - @Test - public void testInsertLotAndTiter() - { - String antigenName = "CCR7"; - String labelName = "PE-Cy7"; - String clone = "3D12"; - String reagentName = antigenName + ", " + labelName + " (" + clone + ")"; - - log("** Navigate to Reagents and filter to Clone='" + clone + "'"); - beginAt(PROJECT_NAME + "/" + FOLDER_NAME + "/query-executeQuery.view?schemaName=reagent&query.queryName=Reagents&query.Clone~eq=" + clone); - - DataRegionTable table = new DataRegionTable("query", this); - assertEquals(1, table.getDataRowCount()); - - assertEquals(antigenName, table.getDataAsText(0, "AntigenId")); - assertEquals(labelName, table.getDataAsText(0, "LabelId")); - assertEquals(clone, table.getDataAsText(0, "Clone")); - - log("** Navigate to Reagent details"); - table.clickRowDetails(0); - - // wait for nested Lots grid - waitForElement(Locator.id("reagentLots").descendant(Locator.tagWithAttribute("h3", "title", "Lots")), WAIT_FOR_JAVASCRIPT); - - DataRegionTable lotsTable = new DataRegionTable("aqwp101", getDriver()); - assertEquals(0, lotsTable.getDataRowCount()); - - log("** Insert new Lot"); - lotsTable.clickInsertNewRow(); - waitForElement(Locator.extButton("Cancel"), WAIT_FOR_JAVASCRIPT); - - WebElement el = Locator.tagWithClass("span", "labkey-wp-title-text").findElement(getDriver()); - assertEquals("Insert New Lot", el.getText()); - - String lotNumber = "lot-" + Math.random(); - - // reagent combo should pre-select the reagent we started with - waitFor(()-> reagentName.equals(getComboBoxInput("Reagent:")), - "reagent combo should pre-select the reagent we started with", WAIT_FOR_JAVASCRIPT); - _extHelper.selectComboBoxItem("Manufacturer:", "Immunotech"); - _extHelper.setExtFormElementByLabel("Lot Number:", lotNumber); - setComboBoxInput("CatalogNumber:", "IM2712X"); - //_extHelper.setExtFormElementByLabel("Expiration:", "2050-12-07"); - - _extHelper.clickExtButton("Save"); - - // wait for nested Lots grid - waitForElement(Locator.id("reagentLots").descendant(Locator.tagWithAttribute("h3", "title", "Lots")), WAIT_FOR_JAVASCRIPT); - - lotsTable = new DataRegionTable("aqwp101", getDriver()); - assertEquals(1, lotsTable.getDataRowCount()); - - log("** Navigate to Lot details"); - lotsTable.clickRowDetails(0); - - // wait for nested Vials grid - waitForElement(Locator.id("lotVials").descendant(Locator.tagWithAttribute("h3", "title", "Vials")), WAIT_FOR_JAVASCRIPT); - - // wait for nested Titrations grid - waitForElement(Locator.id("lotTitrations").descendant(Locator.tagWithAttribute("h3", "title", "Titrations")), WAIT_FOR_JAVASCRIPT); - - log("** Navigate to Lots grid"); - clickButton("View Grid"); - - table = new DataRegionTable("query", this); - table.setFilter("LotNumber", "Equals", lotNumber); - assertEquals(1, table.getDataRowCount()); - - } - - @Test - public void testImportLookupByAlternateKey() - { - beginAt(PROJECT_NAME + "/" + FOLDER_NAME + "/query-executeQuery.view?schemaName=reagent&query.queryName=Reagents"); - - DataRegionTable table = new DataRegionTable("query", this); - table.clickImportBulkData(); - - String antigen = "CD28/CD49d"; - String label = "PE-Texas Red"; - String clone = "clone" + new Random().nextInt(10000); - String description = "covfefe"; - String tsv = - "antigenId\tlabelId\tclone\tdescription\tspecies\n" + - antigen + "\t" + label + "\t" + clone + "\t" + description + "\t"; - - ImportDataPage page = new ImportDataPage(this.getDriver()); - page.setText(tsv); - page.setImportLookupByAlternateKey(true); - page.submit(); - - // We should be back on grid - assertTitleContains("Reagents: /" + getProjectName()); - - table.setFilter("Clone", "Equals", clone); - assertEquals("Expected to find a single row for clone '" + clone + "'", 1, table.getDataRowCount()); - assertEquals(antigen, table.getDataAsText(0, "Antigen")); - assertEquals(label, table.getDataAsText(0, "Label")); - assertEquals(clone, table.getDataAsText(0, "Clone")); - assertEquals(description, table.getDataAsText(0, "Description")); - } - - - @LogMethod(quiet = true) - public void setComboBoxInput(@LoggedParam String label, @LoggedParam String text) - { - Locator comboLoc = ExtHelper.Locators.formItemWithLabel(label).notHidden(); - WebElement comboEl = comboLoc.findElement(getDriver()); - - Locator inputLoc = Locator.xpath("//input[contains(@class, 'x-form-field')]"); - WebElement inputEl = inputLoc.findElement(comboEl); - setFormElement(inputEl, text); - } - - @LogMethod(quiet = true) - public String getComboBoxInput(@LoggedParam String label) - { - Locator comboLoc = ExtHelper.Locators.formItemWithLabel(label).notHidden(); - WebElement comboEl = comboLoc.findElement(getDriver()); - - Locator inputLoc = Locator.xpath("//input[contains(@class, 'x-form-field')]"); - WebElement inputEl = inputLoc.findElement(comboEl); - WebElement hiddenImput = Locator.xpath(".").precedingSibling("input").findElement(inputEl); - String hiddenValue = hiddenImput.getAttribute("value"); - if (!hiddenValue.isBlank()) - { - waitFor(() -> !getFormElement(inputEl).equals(hiddenValue), "Display values did not load", 1000); - } - return getFormElement(inputEl); - } - -}