Skip to content

Commit 36e01f7

Browse files
committed
feat(cdi-preview): improve user notifications and validation messages for better clarity and guidance
1 parent afe1c9e commit 36e01f7

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

previewers/betatest/CdiPreview.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<!-- Header -->
6464
<div class="preview-header">
6565
<h3>CDI Data Viewer & Editor</h3>
66-
<p>Displaying DDI-CDI (Cross Domain Integration) metadata. Edit mode allows you to modify properties and validate against SHACL shapes.</p>
66+
<p>Displaying DDI-CDI (Cross Domain Integration) metadata. Edit mode allows you to modify properties. Use the Validate button to check conformance against SHACL shapes.</p>
6767
<div id="normalization-notice" style="display: none; margin-top: 10px; padding: 8px; background: #d1ecf1; border-left: 3px solid #17a2b8; border-radius: 3px;">
6868
<span class="glyphicon glyphicon-info-sign" style="margin-right: 5px;"></span>
6969
<strong>Note:</strong> This JSON-LD was automatically normalized to <code>@graph</code> format for editing. The structure has been preserved.

previewers/betatest/js/cdi-preview/cdi-graph-helpers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function addRootNode() {
123123
if (availableTypes.length === 0) {
124124
// No SHACL shapes loaded, allow custom type
125125
const customType = prompt(
126-
"Enter node type (e.g., DataSet, Study, Variable):"
126+
"No SHACL shapes loaded. Enter a custom node type (e.g., Dataset, Study, Variable):"
127127
);
128128
if (!customType) return;
129129

@@ -160,7 +160,7 @@ function addRootNode() {
160160
</div>
161161
<div class="form-group">
162162
<label for="customNodeType"><strong>Or enter custom type:</strong></label>
163-
<input type="text" id="customNodeType" class="form-control" placeholder="e.g., DataSet, Study, Variable">
163+
<input type="text" id="customNodeType" class="form-control" placeholder="e.g., Dataset, Study, Variable">
164164
</div>
165165
</div>
166166
<div class="modal-footer">

previewers/betatest/js/cdi-preview/cdi-shacl-loader.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ async function loadShapes(shapeSource, customUrl = null) {
6666

6767
// Show user notification
6868
alert(
69-
`Note: Could not load shapes from ${shapeUrl}.\nUsing local built-in shapes instead.\n\nError: ${error.message}`
69+
`Could not load shapes from:\n${shapeUrl}\n\nFalling back to local built-in DDI-CDI shapes.\n\nError: ${error.message}`
7070
);
7171

7272
return true;

previewers/betatest/js/cdi-preview/data-extraction.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ async function saveToDataverse() {
170170
} catch (error) {
171171
console.error("Save error:", error);
172172
alert(
173-
"Failed to save to Dataverse:\n" +
173+
"Failed to save to Dataverse:\n\n" +
174174
error.message +
175-
"\n\nPlease check:\n- Your API token is valid\n- You have write access to this dataset\n- The dataset is accessible"
175+
"\n\nPlease check:\n Your API token is valid\n You have write access to this dataset\n The Dataverse server is accessible"
176176
);
177177
} finally {
178178
// Reset button

previewers/betatest/js/cdi-preview/event-handlers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ function setupEventHandlers() {
109109
// Check if validation passed
110110
setTimeout(() => {
111111
if (validationReport && !validationReport.conforms) {
112-
if (!confirm("Data has validation errors. Save anyway?")) {
112+
if (!confirm("Your data has validation errors. Do you want to save anyway?")) {
113113
return;
114114
}
115115
}
@@ -302,7 +302,7 @@ function setupEventHandlers() {
302302
'<span class="validation-badge invalid">Custom shape load failed</span>'
303303
);
304304
alert(
305-
`Failed to load custom SHACL shape from:\n${customUrl}\n\nError: ${error.message}`
305+
`Failed to load custom SHACL shapes from:\n${customUrl}\n\nError: ${error.message}\n\nPlease check:\n• The URL is accessible\n• The file is valid Turtle (.ttl) format\n• CORS is enabled on the server`
306306
);
307307
}
308308
}

previewers/betatest/js/cdi-preview/validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ async function validateData() {
170170
if (error.message.includes("SPARQLConstraintComponent")) {
171171
errorMsg =
172172
"The selected SHACL shapes contain SPARQL constraints, which are not supported in the browser. " +
173-
"Please use the 'DDI-CDI 1.0 (Official)' shapes instead, which use Core SHACL constraints only.";
173+
"Please use Core SHACL-compatible shapes (e.g., 'DDI-CDI 1.0 (Official)' or 'CDIF Discovery Core').";
174174
}
175175

176176
$("#validation-status").html(

0 commit comments

Comments
 (0)