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
CurrStatus = ''
end
StatusCode = 200
If ( (RIType NE '') or (CurrStatus NE '') ) then
// Perform a lookup and return a collection of objects
GoSub CreateHALCollection
If Index(QueryFields, 'showAllDetails', 1 ) then
ShowAllDetails = Http_Services('GetQueryField', 'showAllDetails')
end else
// Return a template for a new react item record
GoSub CreateHALTemplate
end
ShowAllDetails = False$
end
StatusCode = 200
GoSub CreateHALCollection
end api
@ -256,12 +254,21 @@ CreateHALCollection:
JSONCollection = ''
Abort = False$
ReactItems = React_Item_Services('GetReactItems', RIType, CurrStatus)
If RIType NE '' OR CurrStatus NE '' then
ReactItems = React_Item_Services('GetReactItems', RIType, CurrStatus)
end else
ReactItems = React_Item_Services('GetAllReactItemKeys')
end
If ReactItems NE '' then
If SRP_JSON(hJSONCollection, 'New', 'Object') then
If SRP_JSON(hReactItemsArray, 'New', 'Array') then
For each ReactItemID in ReactItems using @VM setting vPos
ReactItemJSON = React_Item_Services('ConvertRecordToJSONQuick', ReactItemID, '', FullEndpointURLNoQuery:'/':ReactItemID)
If Not(ShowAllDetails) then
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 (SRP_JSON(hReactItem, 'Parse', ReactItemJSON) EQ '') then
SRP_JSON(hReactItemsArray, 'Add', hReactItem)
@ -277,13 +284,6 @@ CreateHALCollection:
end
SRP_JSON(hReactItemsArray, 'Release')
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')
SRP_JSON(hJSONCollection, 'Release')
end

View File

@ -38,6 +38,18 @@ Return Response or ""
// 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)
@ -94,6 +106,7 @@ Service ConvertRecordToJSON(KeyID, Record, ItemURL)
SRP_JSON(objReactItem, 'SetValue', 'mfrPartNoRev', {MFR_PART_NO_REV})
SRP_JSON(objReactItem, 'SetValue', 'serialNo', {SERIAL_NO})
SRP_JSON(objReactItem, 'SetValue', 'riType', {RI_TYPE})
SRP_JSON(objReactItem, 'SetValue', 'CurrentStatus', {CURR_STATUS})
// Add available disposition codes
DispCodes = Xlate('SYSREPOSPOPUPS', 'LSL2**REACT_ITEM_DISP', 'DISPLAY', 'X')
If SRP_JSON(objReactItemDispArray, 'New', 'Array') then
@ -408,3 +421,4 @@ return