-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathembed-customizations2.html
More file actions
299 lines (289 loc) · 8.96 KB
/
embed-customizations2.html
File metadata and controls
299 lines (289 loc) · 8.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Contract Editor - Customization Example</title>
<link rel="stylesheet" href="./dist/datacontract-editor.css">
<style>
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
}
html, body {
height: 100%;
}
#editor {
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="editor"></div>
<script type="module">
import { init } from './dist/datacontract-editor.es.js';
// Sample customizations configuration demonstrating all features
const customizations = {
dataContract: {
// Root level customizations
root: {
standardProperties: [
// Hide tenant field
{ property: 'tenant', hidden: true },
// Customize status with fixed enum
{
property: 'status',
title: 'Contract Status',
description: 'Current lifecycle stage of this contract',
enum: ['draft', 'review', 'approved', 'active', 'deprecated']
},
// Customize domain with enum
// {
// property: 'domain',
// title: 'Business Domain',
// enum: ['finance', 'marketing', 'sales', 'engineering', 'hr']
// }
],
// customProperties: [
// {
// property: 'dataOwner',
// title: 'Data Owner',
// type: 'text',
// description: 'Person responsible for the data',
// required: true,
// placeholder: 'john.doe@company.com'
// },
// {
// property: 'costCenter',
// title: 'Cost Center',
// type: 'select',
// description: 'Department cost center',
// enum: ['CC-100', 'CC-200', 'CC-300', 'CC-400']
// },
// {
// property: 'complianceFrameworks',
// title: 'Compliance Frameworks',
// type: 'multiselect',
// description: 'Applicable compliance frameworks',
// enum: ['GDPR', 'CCPA', 'HIPAA', 'SOX', 'PCI-DSS']
// },
// {
// property: 'retentionDays',
// title: 'Retention Period (Days)',
// type: 'integer',
// description: 'How long to retain data',
// minimum: 1,
// maximum: 3650,
// placeholder: '365'
// },
// {
// property: 'isPublic',
// title: 'Public Dataset',
// type: 'boolean',
// description: 'Is this dataset publicly accessible?'
// },
// {
// property: 'effectiveDate',
// title: 'Effective Date',
// type: 'date',
// description: 'When this contract becomes effective'
// },
// {
// property: 'notes',
// title: 'Internal Notes',
// type: 'textarea',
// description: 'Internal notes about this contract',
// rows: 4
// }
// ],
// customSections: [
// {
// section: 'governance',
// title: 'Governance',
// customProperties: ['dataOwner', 'costCenter', 'complianceFrameworks']
// },
// {
// section: 'lifecycle',
// title: 'Lifecycle',
// customProperties: ['retentionDays', 'effectiveDate', 'isPublic']
// }
// ]
},
// Schema properties level customizations
'schema.properties': {
standardProperties: [
// Hide some advanced fields
{ property: 'encryptedName', hidden: true },
{ property: 'transformSourceObjects', hidden: true },
// Customize classification with fixed options
{
property: 'classification',
title: 'Data Classification',
enum: ['public', 'internal', 'confidential', 'restricted']
}
],
customProperties: [
{
property: 'piiCategory',
title: 'PII Category',
type: 'select',
description: 'Type of personally identifiable information',
enum: ['none', 'direct', 'indirect', 'sensitive']
},
{
property: 'piiHandling',
title: 'PII Handling Instructions',
type: 'textarea',
description: 'How to handle this PII data',
condition: "piiCategory != 'none'"
},
{
property: 'maskingRequired',
title: 'Masking Required',
type: 'boolean',
description: 'Does this field require data masking?',
condition: "classification == 'confidential' || classification == 'restricted'"
},
{
property: 'gdprLegalBasis',
title: 'GDPR Legal Basis',
type: 'select',
description: 'Legal basis for processing under GDPR',
enum: ['consent', 'contract', 'legal_obligation', 'vital_interests', 'public_task', 'legitimate_interests'],
condition: "piiCategory != 'none'"
}
],
customSections: [
{
section: 'privacy',
title: 'Privacy & Compliance',
customProperties: ['piiCategory', 'piiHandling', 'maskingRequired', 'gdprLegalBasis']
}
]
},
// // Schema level customizations
// schema: {
// standardProperties: [
// { property: 'dataGranularityDescription', hidden: true }
// ],
// customProperties: [
// {
// property: 'dataRetentionPolicy',
// title: 'Data Retention Policy',
// type: 'select',
// enum: ['30days', '90days', '1year', '3years', '7years', 'indefinite']
// }
// ]
// },
//
// // Server level customizations
// servers: {
// customProperties: [
// {
// property: 'slaLevel',
// title: 'SLA Level',
// type: 'select',
// enum: ['gold', 'silver', 'bronze']
// },
// {
// property: 'maintenanceWindow',
// title: 'Maintenance Window',
// type: 'text',
// placeholder: 'Sunday 2:00-4:00 UTC'
// }
// ]
// },
team: {
standardProperties: [{
property: "name",
enum: [
"controlling-team",
"data--ai",
"finance--legal"
]}]},
// Team level customizations
// team: {
// customProperties: [
// {
// property: 'slackChannel',
// title: 'Slack Channel',
// type: 'text',
// placeholder: '#data-team'
// }
// ]
// },
// Team members level customizations
// 'team.members': {
// standardProperties: [
// { property: 'dateOut', hidden: true }
// ],
// customProperties: [
// {
// property: 'department',
// title: 'Department',
// type: 'select',
// enum: ['Engineering', 'Data Science', 'Analytics', 'Platform']
// }
// ]
// }
}
};
// Sample YAML with some custom properties pre-filled (using ODCS array format)
const sampleYaml = `apiVersion: "v3.1.0"
kind: "DataContract"
id: customization-test
name: Customization Test Contract
version: "1.0.0"
status: draft
domain: finance
customProperties:
- property: dataOwner
value: jane.doe@company.com
- property: costCenter
value: CC-200
- property: complianceFrameworks
value:
- GDPR
- SOX
- property: retentionDays
value: 365
- property: isPublic
value: false
schema:
- name: transactions
description: Financial transactions
physicalType: table
properties:
- name: customer_id
logicalType: string
description: Customer identifier
classification: confidential
customProperties:
- property: piiCategory
value: direct
- property: maskingRequired
value: true
- name: amount
logicalType: number
description: Transaction amount
`;
// Initialize the editor with customizations
const editor = init({
container: '#editor',
yaml: sampleYaml,
customizations: customizations,
initialView: 'form',
showPreview: true,
tests: {
enabled: false
},
persistence: 'none'
});
console.log('Editor initialized with customizations');
console.log('Customizations config:', customizations);
</script>
</body>
</html>