For Group reports, UI client is misinterpretting Report record schema as well sending incorrect InvocationContext

Description

The new UI related to running Reports has uncovered what I think are some inconsistencies with how both the UI and back-end are handling things. These inconsistencies have probably been around for years and years.

Take a look at the schema for Report resources/records: https://github.com/collectionspace/services/blob/master/services/report/jaxb/src/main/resources/reports-common.xsd The four "supports" boolean fields should be used by the report author to assert what the report supports. And the UI (or any client trying to invoke reports) should be using these fields when deciding what actions users can take.

The UI is currently using the Report record's "forDocTypes" value(s) in combination with "supportsSingleDoc" to filter which Report records appear in the right sidebar of the Group UI page. Instead, it should be checking the "supportsGroup" field -the value of "forDocTypes" shouldn't come into play.

I also noticed the UI is using the invocationContext incorrectly when running Reports with a group record. Here is the schema for the InvocationContext: https://github.com/collectionspace/services/blob/master/services/jaxb/src/main/resources/invocationContext.xsd

If the report Record's "supportsGroup" field is set to 'true', then the UI should be setting the InvocationContext's "groupCSID", not the "singleCSID" like it's doing.

There may be other issues that I haven't noticed yet.

I think we should fix these issues. Obviously, this would break some of the existing reports. Therefore, I propose adding a "version" field to the Report record's schema. The UI could use the value of this field to support backward compatibility when building the InvocationContext to send to the back-end until we've had a chance to update existing reports to deal with the changes in the InvocationContext. An empty/missing "version" field would indicate an old/legacy report. Once a report has been updated to deal with the correct InvocationContext, the report records can be updated to have a "version" field value of "2".

There may be other (better) solutions to this, so let's all think about this. Some point soon, I'd like to address this.

Environment

None

Assignee

Ray Lee

Reporter

Richard Millet

Labels

None

CC

None

Task Order

None

Components

Priority

Major
Configure