-
-
Notifications
You must be signed in to change notification settings - Fork 825
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
(dev/core#5614) Search Kit - Allow DB Entity with custom column names #31919
base: master
Are you sure you want to change the base?
Conversation
🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷 Introduction for new contributors...
Quick links for reviewers...
|
The value of `confirmed` can be pre-computed. If set to true, then we can skip the confirmation dialog.
f9fc5da
to
b08d0d9
Compare
I haven't tested but this appears to be exactly what I was imagining plus more. |
I still think this is good in terms of handling upgrades safely. However, there is a visual factor that would feel quirky (esp over time) -- in the UI, it defaults to an empty
(In both cases, there's probably some consideration about how the JS+PHP code interact, though I'm not sure which variations are easy/hard.) (EDIT) IMHO, the changes are safe regardless of whether we prepopulate |
@@ -18,7 +18,7 @@ <h1 crm-page-title>{{ ($ctrl.savedSearch.is_template ? ts('Search Template') : t | |||
</div> | |||
<div class="crm-flex-1 form-inline"> | |||
<div class="btn-group"> | |||
<button type="button" class="btn" ng-class="{'btn-primary': status === 'unsaved', 'btn-warning': status === 'saving', 'btn-success': status === 'saved'}" ng-disabled="status !== 'unsaved'" ng-click="$ctrl.save()"> | |||
<button type="button" class="btn" ng-class="{'btn-primary': status === 'unsaved', 'btn-warning': status === 'saving', 'btn-success': status === 'saved'}" ng-disabled="status !== 'unsaved'" crm-confirm="$ctrl.confirmSave()" on-yes="$ctrl.save()"> |
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.
Small thought: There are common critiques of confirmation dialogs -- they get annoying; people get de-sensitized; etc. That's well and good.
IMHO, this is consistent with that:
- The call to
$ctrl.confirmSave()
is a computation that decides whether a prompt is worthwhile. - For most usual edits to regular saved-searches, it will proceed as directed by the user. No need to confirm.
- It only prompts for confirmation if you are deleting or renaming a schema-element (because other things might depend on the schema-element). And it specifically identifies the changed elements.
I would vote for option 3: use the formula to set the |
Overview
When creating a saved-search, one may define a "DB Entity" (eg SQL TABLE or VIEW derived from the query). This update allows the administrator to define the SQL column names.
(See also: https://lab.civicrm.org/dev/core/-/issues/5614)
Steps to Reproduce
Before
For each column, you may define the visible label:
These labels will appear as the headings in downstream searches.
The SQL column-name is auto-generated from the original
SELECT
expression that provided the data. In simple scenarios, the generated name is intuitive. But in complex scenarios, the name becomes opaque (egGROUP_CONCAT_Contact_RelationshipCache_Conc51a580ccf5b246a
).After
For each column, you may define both the SQL column-name and the visible label.
Technical Details
Existing configurations for DB entities do not have an explicit
name
property -- they strictly rely on auto-generated column-names. For continuity, this data is treated the same as before. (A blankname
means that the column-name will be auto-generated.)Additionally, this adds some guards to the admin UI -- if you try to rename an existing column, it will show warning like this:
Similarly, if you try to delete a DB Entity, it will also show a warning: