12578 - Support posting multiple tiles with file-list datatypes#12579
12578 - Support posting multiple tiles with file-list datatypes#12579
Conversation
|
@apeters - I guess my concern with this is if we start just overriding larger amounts of arches core functionality in the ancillary apps then then we're setting ourselves more more brittleness as both of them mature. With a new frontend being developed in v9 some of the existing assumptions may no longer be valid (in this case that only one tile will be updated / added at a time) and the earlier we get in front of those the better off we'll be. |
I get that, but I feel like that ship has already sailed. In fact I think it's probably the other way around. I think that the querysets/component lab/modular reports apps will eventually become the new standard and that we'll be selectively porting code/developing new patterns in these new apps such that they ultimately represent "core" Arches. However it happens these things will conceptually "merge" at some point. I think that having references to TileTree attributes within core Arches when querysets is still very much in it's infancy and not required by core is potentially confusing. Conversely, these overridden methods in querysets are already pretty well established and simply adding to that doesn't "break" from that. These, of course, are just my suggestions. Happy to hear from others out there on this. |
|
@apeters - This is a more generic approach for supporting multiple file-list tiles to be sent in a single POST. It defaults to the original nodeid-scoped naming convention, but falls back to the tileid / nodeid scoped if that fails. |
arches/app/datatypes/datatypes.py
Outdated
| # This adds support for saving multiple tiles in one POST | ||
| if len(files) == 0: | ||
| # First check to see if the files have been set using the tile ID | ||
| file_list_key = f"file-list_{tile.tileid}-{nodeid}" |
There was a problem hiding this comment.
what happens when new tiles are submitted and don't have a tileid?
There was a problem hiding this comment.
It's already caught above. I chose to use the existing implementation first so it would be a no-op when used by the existing the code base. Lines 1324-1330 implement the existing logic of nodeid-only namespacing.
There was a problem hiding this comment.
So if submitting more than one new tile (w/o tileids) via querysets, then this will just revert back to the original logic which sill won't solve the issue of not being able to associate a tile with a file, correct?
There was a problem hiding this comment.
Although I haven't done any mods to querysets, the solution for this I think would be to pre-populate the tileid in querysets, and then the file-save logic would work in arches core. We have this working here, using querysets and pre-populating the the tileid even before it hits querysets. I think the approach in my mind is to have the apps (in this case querysets) prepare the data so it can be handled by the base datatype. This would eliminate having to override the whole save function and just focus on preparing the data so it can be consumed properly by the datatype.
Other option would be to pull the functionality to get the files from the request out into its own function so that could be overridden. I've checked that in as an option to consider:
There was a problem hiding this comment.
Yeah, I think breaking that out has no downside. We should be mindful of populating tileids on the client as the backend logic might rely on the absence of tileids to inform its diffing logic.
apeters
left a comment
There was a problem hiding this comment.
I"m not able to produce a PUT request that can exercise this code. Can you provide some instructions on how to repro this?
Types of changes
Description of Change
Initial cut of this is for discussion only. This brings knowledge of
arches-querysetsaliased_datainto core, which shouldn't be done. Will tidy up or close when a strategy has been developed.Issues Solved
Closes #12578
Checklist
Accessibility Checklist
Developer Guide
Ticket Background
Further comments