Skip to content
Snippets Groups Projects
Commit 66504d9d authored by Allen Gilliland's avatar Allen Gilliland
Browse files

update frontend data model edit page to use new visibility_type field (also...

update frontend data model edit page to use new visibility_type field (also removes "sensitive" as a field_type option)
parent 2cb78fe7
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,6 @@ import _ from "underscore";
export default class Column extends Component {
constructor(props, context) {
super(props, context);
this.isVisibilityType = this.isVisibilityType.bind(this);
this.onDescriptionChange = this.onDescriptionChange.bind(this);
this.onNameChange = this.onNameChange.bind(this);
this.onSpecialTypeChange = this.onSpecialTypeChange.bind(this);
......@@ -29,16 +28,6 @@ export default class Column extends Component {
updateFieldTarget: PropTypes.func.isRequired
};
isVisibilityType(visibility) {
switch(visibility.id) {
case "do_not_include": return (this.props.field.field_type === "sensitive");
case "everywhere": return (this.props.field.field_type !== "sensitive" && this.props.field.preview_display === true);
case "detail_views": return (this.props.field.field_type !== "sensitive" && this.props.field.preview_display === false);
}
return false;
}
updateProperty(name, value) {
this.props.field[name] = value;
this.props.updateField(this.props.field);
......@@ -57,24 +46,8 @@ export default class Column extends Component {
this.updateProperty("description", event.target.value);
}
onVisibilityChange(visibility) {
switch(visibility.id) {
case "do_not_include":
this.updateProperty("field_type", "sensitive");
return;
case "everywhere":
if (this.props.field.field_type === "sensitive") {
this.props.field.field_type = "info";
}
this.updateProperty("preview_display", true);
return;
case "detail_views":
if (this.props.field.field_type === "sensitive") {
this.props.field.field_type = "info";
}
this.updateProperty("preview_display", false);
return;
}
onVisibilityChange(type) {
this.updateProperty("visibility_type", type.id);
}
onTypeChange(type) {
......@@ -123,7 +96,7 @@ export default class Column extends Component {
<Select
className="TableEditor-field-visibility block"
placeholder="Select a field visibility"
value={_.find(MetabaseCore.field_visibility_types, this.isVisibilityType)}
value={_.find(MetabaseCore.field_visibility_types, (type) => type.id === this.props.field.visibility_type)}
options={MetabaseCore.field_visibility_types}
onChange={this.onVisibilityChange}
/>
......
......@@ -98,22 +98,18 @@ export const field_field_types = [{
'id': 'dimension',
'name': 'Dimension',
'description': 'A high or low-cardinality numerical string value that is meant to be used as a grouping.'
}, {
'id': 'sensitive',
'name': 'Sensitive Information',
'description': 'A field that should never be shown anywhere.'
}];
export const field_visibility_types = [{
'id': 'everywhere',
'id': 'normal',
'name': 'Everywhere',
'description': 'The default setting. This field will be displayed normally in tables and charts.'
}, {
'id': 'detail_views',
'id': 'details-only',
'name': 'Only in Detail Views',
'description': "This field will only be displayed when viewing the details of a single record. Use this for information that's lengthy or that isn't useful in a table or chart."
}, {
'id': 'do_not_include',
'id': 'sensitive',
'name': 'Do Not Include',
'description': 'Metabase will never retrieve this field. Use this for sensitive or irrelevant information.'
}];
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