Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions CageUI/resources/queries/cageui/ghost_cages.query.xml
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>
9 changes: 1 addition & 8 deletions CageUI/resources/queries/cageui/layout_history.query.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,7 @@
<isKeyField>true</isKeyField>
</column>
<column columnName="historyid"/>
<column columnName="cage">
<fk>
<fkDbSchema>cageui</fkDbSchema>
<fkTable>cages</fkTable>
<fkColumnName>objectid</fkColumnName>
<fkDisplayColumnName>cage_number</fkDisplayColumnName>
</fk>
</column>
<column columnName="cage"/>
<column columnName="extra_context"/>
<column columnName="object_type">
<datatype>integer</datatype>
Expand Down
16 changes: 16 additions & 0 deletions CageUI/resources/schemas/cageui.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,20 @@
<column columnName="modifiedby"/>
</columns>
</table>
<table tableName="ghost_cages" tableDbType="TABLE">
<columns>
<column columnName="rowid"/>
<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>
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,
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';
42 changes: 22 additions & 20 deletions CageUI/resources/web/CageUI/static/legend.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion CageUI/src/client/api/labkeyActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export function saveRoomLayout(room: Room, mods: CageMods[], prevRoomName: strin

export function createNewRoomFromRackChange(room: Room, newRackOption: RackSwitchOption, prevRack: Rack ): Promise<{
room: Room,
rack: string;
rack: string,
errors: any[]
}> {
return new Promise((resolve, reject) => {
Expand Down
31 changes: 30 additions & 1 deletion CageUI/src/client/api/popularQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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,
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',
Expand Down
2 changes: 1 addition & 1 deletion CageUI/src/client/components/home/RoomList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const RoomList: FC = () => {
} else {
tempRacks.push({
id: r.svgId,
name: `Rack-${r.itemId}`,
name: r.itemId === 0 ? 'Ghost Rack' : `Rack-${r.itemId}`,
cages: [{
name: c.cageNum,
id: c.svgId
Expand Down
13 changes: 11 additions & 2 deletions CageUI/src/client/components/home/rackView/ChangeRackPopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { RackSwitchOption } from '../../../types/homeTypes';
import { LayoutErrors } from '../../LayoutErrors';
import { LoadingScreen } from '../../LoadingScreen';
import { useHomeNavigationContext } from '../../../context/HomeNavigationContextManager';
import { generateUUID } from '../../../utils/helpers';

interface ChangeRackPopupProps {
showChangeRackPopup: React.Dispatch<React.SetStateAction<boolean>>;
Expand Down Expand Up @@ -89,7 +90,7 @@ export const ChangeRackPopup: FC<ChangeRackPopupProps> = (props) => {
};
labkeyActionSelectWithPromise(racksConfig).then((racksResult) => {
if (racksResult.rowCount > 0) {
const options = racksResult.rows.reduce((acc, row) => {
let options = racksResult.rows.reduce((acc, row) => {
acc.push({
value: {
objectId: row.objectid,
Expand All @@ -100,6 +101,15 @@ export const ChangeRackPopup: FC<ChangeRackPopupProps> = (props) => {
});
return acc;
}, [] as RackSwitchOption[]);
const ghostCageOption: RackSwitchOption = {
value: {
objectId: generateUUID(),
rackId: 0,
typeRowId: 0
},
label: "Ghost Rack"
}
options = [ghostCageOption, ...options];
setRackOptions(options);
}
});
Expand Down Expand Up @@ -149,7 +159,6 @@ export const ChangeRackPopup: FC<ChangeRackPopupProps> = (props) => {
'home',
ActionURL.getContainer(),
{room: res.roomName, rack: res.rack});

} else {
setIsSaving(false);
if (res?.reason) {
Expand Down
Loading