Skip to content
Snippets Groups Projects
Unverified Commit 79ad33ed authored by Paul Rosenzweig's avatar Paul Rosenzweig Committed by GitHub
Browse files

sort idfields in datamodel (#10083)

parent 153bf8e8
No related branches found
No related tags found
No related merge requests found
......@@ -185,7 +185,7 @@ export class SpecialTypeAndTargetPicker extends Component {
};
render() {
const { field, idfields, className, selectSeparator } = this.props;
const { field, className, selectSeparator } = this.props;
let specialTypes = MetabaseCore.field_special_types.slice(0);
specialTypes.push({
......@@ -202,11 +202,17 @@ export class SpecialTypeAndTargetPicker extends Component {
const showCurrencyTypeSelect = isCurrency(field);
let { idfields } = this.props;
// If all FK target fields are in the same schema (like `PUBLIC` for sample dataset)
// or if there are no schemas at all, omit the schema name
const includeSchema =
_.uniq(idfields.map(idField => idField.table.schema)).length > 1;
idfields = _.sortBy(idfields, field =>
field.displayName({ includeTable: true, includeSchema }),
);
return (
<div>
<Select
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment