Merged PR 12311: Created routine and adjusted API code to allow for report of all items

Created routine and adjusted API code to allow for report of all items. This is to enable management to have a report so that they can perform data cleanup/remediation.
This commit is contained in:
Ouellette Jonathan (CSC FI SPS MESLEO) 2025-03-06 21:16:03 +01:00
parent 091ce6b8d1
commit 5c60fd93a8
2 changed files with 31 additions and 17 deletions

View File

@ -72,16 +72,14 @@ API reactItems.GET
end else end else
CurrStatus = '' CurrStatus = ''
end end
If Index(QueryFields, 'showAllDetails', 1 ) then
StatusCode = 200 ShowAllDetails = Http_Services('GetQueryField', 'showAllDetails')
If ( (RIType NE '') or (CurrStatus NE '') ) then
// Perform a lookup and return a collection of objects
GoSub CreateHALCollection
end else end else
// Return a template for a new react item record ShowAllDetails = False$
GoSub CreateHALTemplate
end end
StatusCode = 200
GoSub CreateHALCollection
end api end api
@ -256,12 +254,21 @@ CreateHALCollection:
JSONCollection = '' JSONCollection = ''
Abort = False$ Abort = False$
If RIType NE '' OR CurrStatus NE '' then
ReactItems = React_Item_Services('GetReactItems', RIType, CurrStatus) ReactItems = React_Item_Services('GetReactItems', RIType, CurrStatus)
end else
ReactItems = React_Item_Services('GetAllReactItemKeys')
end
If ReactItems NE '' then If ReactItems NE '' then
If SRP_JSON(hJSONCollection, 'New', 'Object') then If SRP_JSON(hJSONCollection, 'New', 'Object') then
If SRP_JSON(hReactItemsArray, 'New', 'Array') then If SRP_JSON(hReactItemsArray, 'New', 'Array') then
For each ReactItemID in ReactItems using @VM setting vPos For each ReactItemID in ReactItems using @VM setting vPos
If Not(ShowAllDetails) then
ReactItemJSON = React_Item_Services('ConvertRecordToJSONQuick', ReactItemID, '', FullEndpointURLNoQuery:'/':ReactItemID) ReactItemJSON = React_Item_Services('ConvertRecordToJSONQuick', ReactItemID, '', FullEndpointURLNoQuery:'/':ReactItemID)
end else
ReactItemJSON = React_Item_Services('ConvertRecordToJSON', ReactItemID, '', FullEndpointURLNoQuery:'/':ReactItemID)
end
If Error_Services('NoError') then If Error_Services('NoError') then
If (SRP_JSON(hReactItem, 'Parse', ReactItemJSON) EQ '') then If (SRP_JSON(hReactItem, 'Parse', ReactItemJSON) EQ '') then
SRP_JSON(hReactItemsArray, 'Add', hReactItem) SRP_JSON(hReactItemsArray, 'Add', hReactItem)
@ -277,13 +284,6 @@ CreateHALCollection:
end end
SRP_JSON(hReactItemsArray, 'Release') SRP_JSON(hReactItemsArray, 'Release')
end end
* ReactItemTemplateJSON = React_Item_Services('GetReactItemTemplateJSON')
* If Error_Services('NoError') then
* If (SRP_JSON(hReactItemTemplate, 'Parse', ReactItemTemplateJSON) EQ '') then
* SRP_JSON(hJSONCollection, 'Set', 'reactItemOptions', hReactItemTemplate)
* SRP_JSON(hReactItemTemplate, 'Release')
* end
* end
JSONCollection = SRP_JSON(hJSONCollection, 'Stringify', 'Styled') JSONCollection = SRP_JSON(hJSONCollection, 'Stringify', 'Styled')
SRP_JSON(hJSONCollection, 'Release') SRP_JSON(hJSONCollection, 'Release')
end end

View File

@ -38,6 +38,18 @@ Return Response or ""
// SERVICES // SERVICES
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
Service GetAllReactItemKeys()
AllKeys = ''
RList('SELECT REACT_ITEM', TARGET_ACTIVELIST$, '', '', '')
Done = False$
Reactors = ''
Loop
Readnext keyId else Done = True$
Until Done
AllKeys<1,-1> = keyId
Repeat
Response = AllKeys
end service
Service GetReactItems(RIType, CurrStatus) Service GetReactItems(RIType, CurrStatus)
@ -94,6 +106,7 @@ Service ConvertRecordToJSON(KeyID, Record, ItemURL)
SRP_JSON(objReactItem, 'SetValue', 'mfrPartNoRev', {MFR_PART_NO_REV}) SRP_JSON(objReactItem, 'SetValue', 'mfrPartNoRev', {MFR_PART_NO_REV})
SRP_JSON(objReactItem, 'SetValue', 'serialNo', {SERIAL_NO}) SRP_JSON(objReactItem, 'SetValue', 'serialNo', {SERIAL_NO})
SRP_JSON(objReactItem, 'SetValue', 'riType', {RI_TYPE}) SRP_JSON(objReactItem, 'SetValue', 'riType', {RI_TYPE})
SRP_JSON(objReactItem, 'SetValue', 'CurrentStatus', {CURR_STATUS})
// Add available disposition codes // Add available disposition codes
DispCodes = Xlate('SYSREPOSPOPUPS', 'LSL2**REACT_ITEM_DISP', 'DISPLAY', 'X') DispCodes = Xlate('SYSREPOSPOPUPS', 'LSL2**REACT_ITEM_DISP', 'DISPLAY', 'X')
If SRP_JSON(objReactItemDispArray, 'New', 'Array') then If SRP_JSON(objReactItemDispArray, 'New', 'Array') then
@ -408,3 +421,4 @@ return