Skip to content
Snippets Groups Projects
Commit a8626f0a authored by Tom Robinson's avatar Tom Robinson
Browse files

Add display_name column to field table, make editable in UI, and reflect in human_readable_name

parent b73da4ef
Branches
Tags
No related merge requests found
......@@ -29,7 +29,9 @@
<input ng-model="field.preview_display" type="checkbox" ng-change="inlineSaveField($index)">
<h3 class="TableField-name inline-block">
{{field.name}}
<a e-class="full" href="#" ng-class="{EditedEntity: field.display_name }" editable-text="field.display_name" onaftersave="inlineSaveField($index)">
{{field.display_name || field.name}}
</a>
</h3>
<span class="EntityOriginalType inline-block">{{field.base_type}}</span>
......
{
"databaseChangeLog": [
{
"changeSet": {
"id": "7",
"author": "tlrobinson",
"changes": [
{
"addColumn": {
"tableName": "metabase_field",
"columns": [
{
"column": {
"name": "display_name",
"type": "varchar(254)"
}
}
]
}
}
]
}
}
]
}
......@@ -4,6 +4,7 @@
{"include": {"file": "migrations/002_add_session_table.json"}},
{"include": {"file": "migrations/004_add_setting_table.json"}},
{"include": {"file": "migrations/005_add_org_report_tz_column.json"}},
{"include": {"file": "migrations/006_disconnect_orgs.json"}}
{"include": {"file": "migrations/006_disconnect_orgs.json"}},
{"include": {"file": "migrations/007_add_field_display_name_column.json"}}
]
}
......@@ -35,13 +35,15 @@
(defendpoint PUT "/:id"
"Update `Field` with ID."
[id :as {{:keys [field_type special_type preview_display description]} :body}]
[id :as {{:keys [field_type special_type preview_display description display_name]} :body}]
{field_type FieldType
special_type FieldSpecialType}
special_type FieldSpecialType
display_name NonEmptyString}
(write-check Field id)
(check-500 (m/mapply upd Field id (merge {:description description ; you're allowed to unset description and special_type
:special_type special_type} ; but field_type and preview_display must be replaced
(when field_type {:field_type field_type}) ; with new non-nil values
(check-500 (m/mapply upd Field id (merge {:description description ; you're allowed to unset description, special_type
:special_type special_type ; and display_name but field_type and preview_display
:display_name display_name} ; must be replaced with new non-nil values
(when field_type {:field_type field_type})
(when (not (nil? preview_display)) {:preview_display preview_display}))))
(sel :one Field :id id))
......
......@@ -98,7 +98,9 @@
:can_read (delay @(:can_read @(:table <>)))
:can_write (delay @(:can_write @(:table <>)))
:human_readable_name (when (:name field)
(delay (common/name->human-readable-name (:name field))))))
(delay (or (:display_name field)
(common/name->human-readable-name (:name field)))))))
(defmethod pre-insert Field [_ field]
(let [defaults {:active true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment