Skip to content

Commit 104e0b8

Browse files
committed
fix(data catalog): prefix icons disappear after saving
1 parent 7a1333e commit 104e0b8

2 files changed

Lines changed: 14 additions & 12 deletions

File tree

testgen/ui/components/frontend/js/components/tree.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @property {number?} iconSize
99
* @property {string?} iconClass
1010
* @property {string?} iconTooltip
11-
* @property {Element?} prefix
11+
* @property {Element|function?} prefix
1212
* @property {TreeNode[]?} children
1313
* @property {number?} level
1414
* @property {boolean?} expanded

testgen/ui/components/frontend/js/pages/data_catalog.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -118,24 +118,26 @@ const DataCatalog = (/** @type Properties */ props) => {
118118
};
119119
TAG_KEYS.forEach(key => tables[table_id][key] = item[`table_${key}`]);
120120
}
121-
const prefixIcons = [];
122-
if (item.critical_data_element ?? item.table_critical_data_element) {
123-
prefixIcons.push(withTooltip(Icon({ size: 15, classes: 'text-purple' }, 'star'), { text: 'Critical data element', position: 'right' }));
124-
}
125-
if (item.excluded_data_element) {
126-
prefixIcons.push(withTooltip(Icon({ size: 15, classes: 'text-brown' }, 'visibility_off'), { text: 'Excluded data element', position: 'right' }));
127-
}
128-
if (item.pii_flag) {
129-
prefixIcons.push(withTooltip(Icon({ size: 15, classes: 'text-orange' }, 'shield_person'), { text: 'PII data', position: 'right' }));
130-
}
131121
const columnNode = {
132122
id: column_id,
133123
label: column_name,
134124
classes: `column ${drop_date ? 'text-disabled' : (add_date && (Date.now() - new Date(add_date * 1000).getTime()) < 7 * 86400000) ? 'text-bold' : ''}`,
135125
...getColumnIcon(item),
136126
iconClass: value_ct === 0 ? 'text-error' : null,
137127
iconTooltip: value_ct === 0 ? 'No non-null values detected' : null,
138-
prefix: span({ class: 'tg-dh--column-prefix' }, ...prefixIcons),
128+
prefix: () => {
129+
const icons = [];
130+
if (item.critical_data_element ?? item.table_critical_data_element) {
131+
icons.push(withTooltip(Icon({ size: 15, classes: 'text-purple' }, 'star'), { text: 'Critical data element', position: 'right' }));
132+
}
133+
if (item.excluded_data_element) {
134+
icons.push(withTooltip(Icon({ size: 15, classes: 'text-brown' }, 'visibility_off'), { text: 'Excluded data element', position: 'right' }));
135+
}
136+
if (item.pii_flag) {
137+
icons.push(withTooltip(Icon({ size: 15, classes: 'text-orange' }, 'shield_person'), { text: 'PII data', position: 'right' }));
138+
}
139+
return span({ class: 'tg-dh--column-prefix' }, ...icons);
140+
},
139141
criticalDataElement: !!(item.critical_data_element ?? item.table_critical_data_element),
140142
excludedDataElement: !!item.excluded_data_element,
141143
piiFlag: !!item.pii_flag,

0 commit comments

Comments
 (0)