Feat: Add copy-existing-asset tab to asset creation flow#2195
Feat: Add copy-existing-asset tab to asset creation flow#2195joshuaunity wants to merge 17 commits into
Conversation
…form Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
nhoening
left a comment
There was a problem hiding this comment.
I tried this out, but then the copied asset was created under its original parent asset, rather than the asset named in the form URL (parent_asset_id)
The issue writes:
"The search form opens pre-set with "Template" in the text field and the checkbox for including public assets ticked."
That is not there yet. Please check that list again.
Finally, I found a corner case problem by accident: if an asset has external_id, remove it, as the ID is uniue per account. I got: failed to create asset: (psycopg2.errors.UniqueViolation) duplicate key value violates unique constraint "generic_asset_account_id_external_id_key" DETAIL: Key (account_id, external_id)=(2, )
|
I like the design, and the filtering by type makes sense, too! Can you make each card's title a link to the asset, as well? |
Co-authored-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
Regarding this, I forgot to mention that if the search field is set to "template", it immediately searches for assets named "template". Would you rather it be a placeholder? So instead of the placeholder "Search asset..." we have "template," or you had something else in mind when you suggested this. |
Oh wow, that's a good catch. I'll fix that. |
Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
…int conflicts Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
…et creation script Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
Do you mean the parent asset shouldn't be NULL? cause we can't copy an asset under itself |
No I meant the copy asset was created as a sibling of the original asset, so it stayed under the parent of the original. We need it to be a child of the form's parent_asset_id. |
My original ideas was indeed that that search happens on opening. Right now, a search also happens, without filters (sending much data). I don't know if users will really get it (might have to tweak that UX later a bit), but we believe that the main the use case for the copy-asset feature is that usually you copy pre-made templates . |
Okay, what's the preferred approach? Should I keep the "template" input, even though it often returns no results? I think fetching data without an initial search is acceptable, as the page renders quickly and the card design is simple to maintain performance. |
Could you share how the "parent_asset_id" in the form is populated, and what use case(s) trigger its usage? For me i it returns an empty value. |
I think this happens when in the asset context view you click on "Create new child asset." |
Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
…deserialization Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
…straint conflicts Signed-off-by: Joshua Edward <oghenerobojosh01@gmail.com>
nhoening
left a comment
There was a problem hiding this comment.
Some comments inline, but one of my original problems is still there: the copied asset is created as a sibling of the original asset, so it stays under the parent of the original. We need the parent to be the asset of the currently shown page.
Also, I tested copying a public asset, and got an error that I am not allowed to do that. Can you ask Copilot to tell us why, then we can make a decision what we want to do about it.
| // Ensure stable ordering across pages to avoid page-overlap duplicates. | ||
| params.set("sort_by", "id"); | ||
| params.set("sort_dir", "asc"); | ||
| params.set("all_accessible", "true"); |
There was a problem hiding this comment.
As a ite admin, I am now seeing way too many assets. So I would actually use my initial plan to not show everything right away.
- Either we paginate, but that would be some UX work.
- Or we do not query on opening, but tell the user to select some filter. Maybe even a suggestion: a link ("Search template assets") which fills in "Template" in the text field and hits Enter
Either would be fine with me.
There was a problem hiding this comment.
we currently have pagination, but i implemented an infinite scroll, so as you scroll down, it fetches more. its liek an auto pagaintion.
There was a problem hiding this comment.
So i can reduce the items per page, but for the infinite scroll to still work well, i need to reduce how many items are rendered per row.
Do you prefer the infinite scroll to stay, or would you prefer button navigations
There was a problem hiding this comment.
Mh, a senior UX person would probably advise to stick with one way to do it, and we already went with buttons in other views. Let's do that.
Yeah, the initial number is really high, 10 should suffice.
And is that link idea possible? I would like to guide the user to this Template idea.
There was a problem hiding this comment.
Maybe even a suggestion: a link ("Search template assets") which fills in "Template" in the text field and hits Enter
For this, what is the template idea? is it mock data or an actual asset template?
There was a problem hiding this comment.
We will later add some example templates with "Template" in the name
There was a problem hiding this comment.
ok, that means with this implemented it will intentionally be an empty search result.
Co-authored-by: Nicolas Höning <nicolas@seita.nl> Signed-off-by: JDev <45713692+joshuaunity@users.noreply.github.com>
|
@copilot, look into why copying public assets fails |
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
i tested myself, and this happens when no parent or account is set. The current logic doesn't allow for that, as the defaults of these two parameters hinder the asset from being copied. That is, it defaults to the copied asset's parent and account. In the case of a public asset, both are None. Do you think we should still allow a public asset to be copied? The logic could be refactored. Or you want to keep it as is and we return a proper message. |
Description
This PR adds a new "Copy an existing" tab to the asset creation page so users can create assets from templates instead of starting from scratch. It introduces searchable asset selection with filters (text, type, include public assets), a compact multi-column result layout, and a copy action wired to the existing API. On copy, the UI now shows progress and success/error toast messages, creates the new asset under the current parent asset, and redirects to the new asset page after success.
Look & Feel
Further Improvements
None
Related Items
This PR closes #2166
Sign-off