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 19 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.
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. |
nhoening
left a comment
There was a problem hiding this comment.
I like the pagination!
I still have the main problem from last week: 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. You asked how that parent ID is known to the view, but we still need to use it in the call to the copy endpoint.
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.
Yes, that should be possible as it is the basic idea (we'll provide publlic templates for everybody). What would this refactoring include?
The refactoring will include the ability to copy a public asset |
…nt and parent asset IDs Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
|
@nhoening the latest commits does these things.
|
Signed-off-by: joshuaunity <oghenerobojosh01@gmail.com>
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