Unverified Commit 23069d60 authored by Alberto Nale's avatar Alberto Nale Committed by GitHub
Browse files

Gdpr metaweb dev

New columns will be hidden for the old Business models.
parents 143db709 9248968b
......@@ -2186,6 +2186,7 @@
},
"businessClass": "Business Class",
"businessView": "Business View",
"decrypt": "Decrypt",
"editJoin": "Edit Join Relationship",
"inbound": {
"name": "Insert a Business Relationship Name",
......@@ -2195,6 +2196,7 @@
"newBusiness": "New Business Class",
"newView": "New Business View",
"noUnusedFields": "No columns to add",
"personal": "Personal",
"physTable": "Physical Table",
"physicalColumn": "Physical Column",
"physicalColumnHint": "The original physical column of this column",
......@@ -2203,6 +2205,7 @@
"sourceAttr": "Source Attributes",
"sourceHint": "Select source table",
"sourceTable": "Source Table",
"subjectId": "Subject Id",
"summary": "Summary",
"summaryHint": "Link tables to see the summary",
"tabView": {
......
......@@ -2,16 +2,21 @@
<div>
<DataTable v-if="businessModel" class="p-datatable-sm kn-table p-m-2" :value="businessModel.columns" :loading="loading" responsiveLayout="stack" breakpoint="960px" @rowReorder="onRowReorder">
<Column :rowReorder="true" :headerStyle="metawebAttributesTabDescriptor.reorderColumnStyle" :reorderableColumn="false" />
<Column class="kn-truncated" v-for="(column, index) in metawebAttributesTabDescriptor.columns" :key="index" :field="column.field" :header="$t(column.header)">
<template #body="slotProps">
<div class="p-d-flex p-flex-row">
<Checkbox v-if="column.field === 'identifier'" v-model="slotProps.data[slotProps.column.props.field]" :binary="true" @change="$emit('metaUpdated')"></Checkbox>
<Checkbox v-else-if="column.field === 'visible'" v-model="columnsVisibility[slotProps.data.uniqueName]" :binary="true" @change="onChange(slotProps.data, 'visibility')"></Checkbox>
<span v-else-if="column.field === 'type'">{{ columnsType[slotProps.data.uniqueName] }}</span>
<span v-else>{{ slotProps.data[slotProps.column.props.field] }}</span>
</div>
</template>
</Column>
<template v-for="(column, index) in metawebAttributesTabDescriptor.columns" :key="index">
<Column class="kn-truncated" v-if="columnIsVisible(column)" :field="column.field" :header="$t(column.header)">
<template #body="slotProps">
<div class="p-d-flex p-flex-row">
<Checkbox v-if="column.field === 'identifier'" v-model="slotProps.data[slotProps.column.props.field]" :binary="true" @change="$emit('metaUpdated')"></Checkbox>
<Checkbox v-else-if="column.field === 'visible'" v-model="columnsVisibility[slotProps.data.uniqueName]" :binary="true" @change="onChange(slotProps.data, 'visibility')"></Checkbox>
<Checkbox v-else-if="column.field === 'personal' && columnsPersonal[slotProps.data.uniqueName] !== undefined" v-model="columnsPersonal[slotProps.data.uniqueName]" :binary="true" @change="onChange(slotProps.data, 'personal')"></Checkbox>
<Checkbox v-else-if="column.field === 'decrypt' && columnsDecrypt[slotProps.data.uniqueName] !== undefined" v-model="columnsDecrypt[slotProps.data.uniqueName]" :binary="true" @change="onChange(slotProps.data, 'decrypt')"></Checkbox>
<Checkbox v-else-if="column.field === 'subjectId' && columnsSubjectId[slotProps.data.uniqueName] !== undefined" v-model="columnsSubjectId[slotProps.data.uniqueName]" :binary="true" @change="onChange(slotProps.data, 'subjectId')"></Checkbox>
<span v-else-if="column.field === 'type'">{{ columnsType[slotProps.data.uniqueName] }}</span>
<span v-else>{{ slotProps.data[slotProps.column.props.field] }}</span>
</div>
</template>
</Column>
</template>
<Column :style="metawebAttributesTabDescriptor.iconColumnStyle">
<template #header>
<Button class="kn-button kn-button--primary p-button-link p-jc-center" @click="openUnusedFieldsDialog" data-test="add-button"> {{ $t('common.add') }}</Button>
......@@ -56,11 +61,15 @@ export default defineComponent({
businessModel: null as iBusinessModel | null,
columnsVisibility: {} as any,
columnsType: {} as any,
columnsPersonal: {} as any,
columnsDecrypt: {} as any,
columnsSubjectId: {} as any,
attributeDetailDialogVisible: false,
selectedAttribute: null as iBusinessModelColumn | null,
unusedFieldDialogVisible: false,
unusedFields: [] as any[],
metaObserver: null as any,
propertyKeys: [] as string[],
loading: false
}
},
......@@ -89,10 +98,19 @@ export default defineComponent({
for (let i = 0; i < column.properties.length; i++) {
const tempProperty = column.properties[i]
const key = Object.keys(tempProperty)[0]
if (!this.propertyKeys.includes(key)) this.propertyKeys.push(key)
if (key === 'structural.visible') {
this.columnsVisibility[column.uniqueName] = tempProperty[key].value === 'true'
} else if (key === 'structural.columntype') {
this.columnsType[column.uniqueName] = tempProperty[key].value
} else if (key === 'structural.personal') {
this.columnsPersonal[column.uniqueName] = tempProperty[key].value === 'true'
} else if (key === 'structural.decrypt') {
this.columnsDecrypt[column.uniqueName] = tempProperty[key].value === 'true'
} else if (key === 'structural.subjectId') {
this.columnsSubjectId[column.uniqueName] = tempProperty[key].value === 'true'
}
}
})
......@@ -118,6 +136,12 @@ export default defineComponent({
tempProperty[key].value = this.columnsVisibility[column.uniqueName]
} else if (key === 'structural.columntype' && type === 'type') {
tempProperty[key].value = this.columnsType[column.uniqueName]
} else if (key === 'structural.personal' && type === 'personal') {
tempProperty[key].value = this.columnsPersonal[column.uniqueName]
} else if (key === 'structural.decrypt' && type === 'decrypt') {
tempProperty[key].value = this.columnsDecrypt[column.uniqueName]
} else if (key === 'structural.subjectId' && type === 'subjectId') {
tempProperty[key].value = this.columnsSubjectId[column.uniqueName]
}
}
......@@ -180,7 +204,6 @@ export default defineComponent({
continue
} else {
const index = this.businessModel.columns.findIndex((el: any) => el.uniqueName === tempColumn.name)
if (index === -1) this.unusedFields.push(tempColumn)
}
}
......@@ -203,6 +226,11 @@ export default defineComponent({
.catch(() => {})
.finally(() => generate(this.observer))
this.loading = false
},
columnIsVisible(column: any) {
if ((column.field === 'personal' && !this.propertyKeys.includes('structural.personal')) || (column.field === 'decrypt' && !this.propertyKeys.includes('structural.decrypt')) || (column.field === 'subjectId' && !this.propertyKeys.includes('structural.subjectId'))) return false
return true
}
}
})
......
......@@ -19,6 +19,18 @@
{
"field": "description",
"header": "common.description"
},
{
"field": "personal",
"header": "metaweb.businessModel.personal"
},
{
"field": "decrypt",
"header": "metaweb.businessModel.decrypt"
},
{
"field": "subjectId",
"header": "metaweb.businessModel.subjectId"
}
],
"iconColumnStyle": {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment