Allow PK in metric panel

This commit is contained in:
rijkvanzanten
2021-05-27 14:24:20 -04:00
parent c16063f14b
commit ee34aef212
2 changed files with 6 additions and 1 deletions

View File

@@ -51,6 +51,10 @@ export default defineComponent({
type: Boolean,
default: false,
},
allowPrimaryKey: {
type: Boolean,
default: false,
},
},
setup(props) {
const fieldsStore = useFieldsStore();
@@ -66,7 +70,7 @@ export default defineComponent({
fields.value.map((field: Field) => {
let disabled = false;
if (field?.schema?.is_primary_key === true) disabled = true;
if (props.allowPrimaryKey === false && field?.schema?.is_primary_key === true) disabled = true;
if (props.typeAllowList.length > 0 && props.typeAllowList.includes(field.type) === false) disabled = true;
return {

View File

@@ -26,6 +26,7 @@ export default definePanel({
options: {
collectionField: 'collection',
typeAllowList: ['integer', 'bigInteger', 'float', 'decimal'],
allowPrimaryKey: true,
},
width: 'half',
},