-
-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add civiimport
core extension with Import api code for viewing import tables
#24230
Conversation
(Standard links)
|
843b63b
to
b7421e2
Compare
'title' => ts('Import') . '_' . $userJobID, | ||
'title_plural' => ts('Import') . $userJobID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kinda ugly and not the right way to use ts()
, is there no user-facing label for these temp tables?
'type' => ['Import'], | ||
'table_name' => $tableName, | ||
'class_args' => [$userJobID], | ||
'label_field' => '_id', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess there's no label field? That could be a problem, how is the user supposed to choose the correct import job entity in SearchKit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I could append the user display name - ie import2-by-Coleman Watts
d201da4
to
028902e
Compare
2be4c6f
to
4176929
Compare
4176929
to
309c6f1
Compare
civiimport
core extension with Import api code for viewing import tables
309c6f1
to
08bab77
Compare
08bab77
to
2a3bf6d
Compare
@eileenmcnaughton - doesn't have to be in this PR but maybe the label could be combination of {entity} {date} {user} like "Contact Import 8/15/2022 by Coleman Watts"... Alternatively, (maybe better) we could add a column for |
@colemanw hmm ok - I'll ponder those ideas - I am inclined to do it as a follow up (if this passes) |
@eileenmcnaughton there's more overiding than necessary going on in the APIv4 classes. Ideally they shouldn't need to do anything special. #24290 ought to make that possible. |
50579ae
to
facfb8e
Compare
facfb8e
to
7b85de9
Compare
|
@eileenmcnaughton I thought create wasn't allowed? Isn't this an update-only entity? |
@colemanw yeah - I don't see a downside to having a CREATE api but not a current need (other than to create in the test) either. We wouldn't want to expose create to afform though |
Ok. I'll add it back. I think we need a way to tell afform what actions are allowed per entity, because I'm also working on CiviCase for Afform and that only supports create not update. |
don't we mark some 'read-only' for that reason? |
Hmm nope CiviApiImportTest::testApiActions |
"Read-only" impies no create AND no update. We want to allow one not the other. |
@colemanw it passed |
Overview
Add
civiimport
core extension with Import api code for viewing import tables.This PR is primary about adding new
pseudo-crud
api for interacting with the data import tables. The data import tables are short-lived (default is a week, although we do not yet have a good cleanup process) tables that hold the data the user is trying to import plus some status & informational fields. The goal of adding an API is to get logic out of quickforms & associated classes & standardise it and to get the ability to leveerage search kit, afform etc.With this PR each import
UserJob
is not passed will be visible as anapi pseudoentity
(similar toeck
) and will support crud actions per below. Note that the fields available are based on the field names in the user's data source - so in the example the user had a column 'Amount Given' (or similar).Because of the above editable search kit displays can be added - although I have opted to keep the commit that adds them for a follow up PR to keep this focussed on
api
rather thanui
.The intent of putting the code in an extension is that it feels like the
import
code should be separated into a core extension as a code management consideration - but it is not intended to be an optional extension (maybe one day in the far far future). I need to work through the steps of making it always enabled & hidden and that tests run on it - but those are not blocking on merging this & generally I find a few steps are required AFTER merging any new extension.I also have the intention to follow up with some additional apis / actions available to search-kit - most obviously
validate
andimport
which will allow a user to edit-in-place a row that failed & re-try it. However, I'm also expecting some metadata functions to facilitate getting more logic out of the forms & potentially replacing some chunks of forms withangular
(the relevant forms are quite modular)Before
No api support for interacting with
Import
pseudo-entities, not available in search kitAfter
Technical Details
We do a couple of checks before exposing an
Import
to the apiexpires_date
so it will be equivalent to the first conditionPermissioning is based on checking if the
UserJob
in question will load for the relevant user - https://github.com/civicrm/civicrm-core/pull/24230/files#diff-4077b8d652237c281456106d3f92c6e6a1cc3ec3f8dd3da117b58fc102c94d37R89-R98Comments
I spun off a couple of PRs #24285 with the changes that are outside the extension #24275