-
Notifications
You must be signed in to change notification settings - Fork 0
CageuUI ghost cages functionality #1012
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
64e6d53
1e434c2
dda2c9f
473bf66
cebd353
eb4a31c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| <!-- | ||
| ~ /* | ||
| ~ * Copyright (c) 2026 Board of Regents of the University of Wisconsin System | ||
| ~ * | ||
| ~ * 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. | ||
| ~ */ | ||
| --> | ||
|
|
||
| <query xmlns="http://labkey.org/data/xml/query"> | ||
| <metadata> | ||
| <tables xmlns="http://labkey.org/data/xml"> | ||
| <table tableName="ghost_cages" tableDbType="TABLE"> | ||
| <tableTitle>Ghost Cages</tableTitle> | ||
| <columns> | ||
| <column columnName="rowid"> | ||
| <isKeyField>true</isKeyField> | ||
| </column> | ||
| <column columnName="cage_objectid"/> | ||
| <column columnName="positionid"/> | ||
| <column columnName="rack_group"/> | ||
| <column columnName="rack_objectid"/> | ||
| <column columnName="group_rotation"/> | ||
| <column columnName="cage"/> | ||
| <column columnName="container"/> | ||
| <column columnName="createdby"/> | ||
| <column columnName="created"/> | ||
| <column columnName="modified"/> | ||
| <column columnName="modifiedby"/> | ||
| </columns> | ||
| </table> | ||
| </tables> | ||
| </metadata> | ||
| </query> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * | ||
| * * Copyright (c) 2026 Board of Regents of the University of Wisconsin System | ||
| * * | ||
| * * 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. | ||
| * | ||
| */ | ||
|
|
||
| DROP TABLE IF EXISTS cageui.ghost_cages; | ||
| CREATE TABLE cageui.ghost_cages | ||
| ( | ||
| rowid SERIAL NOT NULL, | ||
| cage_objectid VARCHAR NOT NULL, | ||
| positionid INTEGER, | ||
| rack_group INTEGER NOT NULL, | ||
| rack_objectid VARCHAR NOT NULL, | ||
| group_rotation INTEGER NOT NULL, | ||
| cage INTEGER NOT NULL, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most places in your CageUI (like cageUi.cage_history) use VARCHAR for 'cage' and INTEGER for 'cage_number'. Not sure if this is a typo or intentional. |
||
| container entityid NOT NULL, | ||
| createdby userid, | ||
| created TIMESTAMP, | ||
| modifiedby userid, | ||
| modified TIMESTAMP, | ||
| CONSTRAINT PK_ghost_cages PRIMARY KEY (rowid), | ||
| CONSTRAINT FK_ghost_cages_container FOREIGN KEY (container) REFERENCES core.Containers (EntityId) | ||
| ); | ||
|
|
||
| insert into ehr_lookups.lookups (set_name,container,value, category, title, description) | ||
| select setname, container, 8 as value, 'Caging' as category, 'Ghost Cage' as title, 4 as description from ehr_lookups.lookup_sets where setname='cageui_item_types'; | ||
|
|
||
| insert into ehr_lookups.lookups (set_name,container,value, title) | ||
| select setname, container, 'ghostCage' as value, '/cageui/static/cage.svg' as title from ehr_lookups.lookup_sets where setname='cageui_svg_urls'; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ | |
| import { Filter, Query } from '@labkey/api'; | ||
| import { labkeyActionSelectWithPromise } from './labkeyActions'; | ||
| import { EHRCageMods } from '../types/homeTypes'; | ||
| import { CageData, CageHistoryData, RackData } from '../types/typings'; | ||
| import { CageData, CageHistoryData, GhostCageData, RackData } from '../types/typings'; | ||
|
|
||
| export const cageModLookup = async (columns: string[], filterArray: Filter.IFilter[]): Promise<EHRCageMods[]> => { | ||
| const config: Query.SelectRowsOptions = { | ||
|
|
@@ -100,6 +100,35 @@ export const fetchCage = async (objectId: string): Promise<CageData> => { | |
| } | ||
| }; | ||
|
|
||
| export const fetchGhostCage = async (objectId: string): Promise<GhostCageData> => { | ||
| const config: Query.SelectRowsOptions = { | ||
| schemaName: 'cageui', | ||
| queryName: 'ghost_cages', | ||
| filterArray: [Filter.create('cage_objectid', objectId, Filter.Types.EQUAL)] | ||
| }; | ||
|
|
||
| try { | ||
| const res = await labkeyActionSelectWithPromise(config); | ||
| if (res.rows.length === 1) { | ||
| return { | ||
| rowid: res.rows[0].rowid, | ||
| cageObjId: res.rows[0].cage_objectid, | ||
| positionId: res.rows[0].positionid, | ||
| rackGroup: res.rows[0].rack_group, | ||
| rack: 0, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks odd as the rest are imported from 'res.rows', but I assume this '0' assignment is the entire point of this fetchGhostCage function. If that's the case, this is good to go. |
||
| rackObjId: res.rows[0].rack_objectid, | ||
| groupRotation: res.rows[0].group_rotation, | ||
| cage: res.rows[0].cage, | ||
| }; | ||
| } else { | ||
| throw new Error('Error fetching ghost cage data'); | ||
| } | ||
| } | ||
| catch (e) { | ||
| throw new Error('Error fetching ghost cage data: ' + (e as Error).message); | ||
| } | ||
| }; | ||
|
|
||
| export const fetchRack = async (objectId: string): Promise<RackData> => { | ||
| const config: Query.SelectRowsOptions = { | ||
| schemaName: 'cageui', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure there are no UI (report/query, dropdowns, etc.) using these old lookups.
Seems like you replaced this with the rack_objectid and cage_objectid so this is correct, just wanted to make sure.