diff --git a/schemas/json/dandi/create.json b/schemas/json/dandi/create.json
index 0cc1b18a9..dc25095ac 100644
--- a/schemas/json/dandi/create.json
+++ b/schemas/json/dandi/create.json
@@ -14,6 +14,7 @@
},
"embargo_status": {
+ "title": "Would you like to embargo this Dandiset?",
"type": "boolean",
"description": "Embargoed Dandisets are hidden from public access until a specific time period has elapsed. Uploading data to the DANDI archive under embargo requires a relevant NIH award number, and the data will be automatically published when the embargo period expires.",
"default": false
@@ -36,15 +37,27 @@
"license": {
"type": "array",
+ "description": "Provide a set of licenses for this Dandiset. If you are unsure which license to use, we recommend using the CC0 1.0 license.",
"items": {
"type": "string",
+ "enumLinks": {
+ "spdx:CC0-1.0": "https://creativecommons.org/public-domain/cc0/",
+ "spdx:CC-BY-4.0": "https://creativecommons.org/licenses/by/4.0/deed.en"
+ },
+ "enumKeywords": {
+ "spdx:CC0-1.0": ["No Rights Reserved"],
+ "spdx:CC-BY-4.0": ["Attribution 4.0 International"]
+ },
+ "enumLabels": {
+ "spdx:CC0-1.0": "CC0 1.0",
+ "spdx:CC-BY-4.0": "CC BY 4.0"
+ },
"enum": [
"spdx:CC0-1.0",
"spdx:CC-BY-4.0"
]
},
- "uniqueItems": true,
- "description": "Licenses associated with the item.
Note: DANDI only supports a subset of Creative Commons Licenses applicable to datasets"
+ "uniqueItems": true
},
"nih_award_number": {
diff --git a/src/renderer/src/stories/JSONSchemaForm.js b/src/renderer/src/stories/JSONSchemaForm.js
index d0b3a592d..9bb95d4e4 100644
--- a/src/renderer/src/stories/JSONSchemaForm.js
+++ b/src/renderer/src/stories/JSONSchemaForm.js
@@ -817,12 +817,14 @@ export class JSONSchemaForm extends LitElement {
const value = parent[name];
- const skipValidation = !this.validateEmptyValues && value === undefined;
+
+ const skipValidation = this.validateEmptyValues === null && value === undefined;
+
const validateArgs = input.pattern || skipValidation ? [] : [value, schema];
+ // Run validation functions
const jsonSchemaErrors = validateArgs.length === 2 ? this.validateSchema(...validateArgs, name) : [];
-
- const valid = skipValidation ? true : await this.validateOnChange(name, parent, pathToValidate, value);
+ const valid = skipValidation ? true : await this.validateOnChange(name, parent, pathToValidate, value);
if (valid === null) return null; // Skip validation / data change if the value is null
@@ -879,7 +881,9 @@ export class JSONSchemaForm extends LitElement {
type: "error",
missing: true,
});
- } else if (this.validateEmptyValues === null) {
+ }
+
+ else if (this.validateEmptyValues === null) {
warnings.push({
message: `${schema.title ?? header(name)} is a suggested property.`,
type: "warning",
diff --git a/src/renderer/src/stories/JSONSchemaInput.js b/src/renderer/src/stories/JSONSchemaInput.js
index b9a884e34..342d97c22 100644
--- a/src/renderer/src/stories/JSONSchemaInput.js
+++ b/src/renderer/src/stories/JSONSchemaInput.js
@@ -353,7 +353,6 @@ export class JSONSchemaInput extends LitElement {
:host {
margin-top: 1.45rem;
- display: block;
}
:host(.invalid) .guided--input {
@@ -489,6 +488,7 @@ export class JSONSchemaInput extends LitElement {
return {
schema: { type: Object, reflect: false },
validateEmptyValue: { type: Boolean, reflect: true },
+ required: { type: Boolean, reflect: true },
};
}
@@ -499,7 +499,7 @@ export class JSONSchemaInput extends LitElement {
// pattern
// showLabel
controls = [];
- required = false;
+ // required;
validateOnChange = true;
constructor(props) {
@@ -848,24 +848,6 @@ export class JSONSchemaInput extends LitElement {
const allowPatternProperties = isPatternProperties(this.pattern);
const allowAdditionalProperties = isAdditionalProperties(this.pattern);
- const addButton = new Button({
- size: "small",
- });
-
- addButton.innerText = `Add ${canAddProperties ? "Property" : "Item"}`;
-
- const buttonDiv = document.createElement("div");
- Object.assign(buttonDiv.style, { width: "fit-content" });
- buttonDiv.append(addButton);
-
- const disableButton = ({ message, submessage }) => {
- addButton.setAttribute("disabled", true);
- tippy(buttonDiv, {
- content: `
${option.description}
`, allowHTML: true, placement: "right", @@ -443,7 +468,7 @@ export class Search extends LitElement { })}> { clickEvent.stopPropagation(); - if (this.listMode === "click") { + if (ALTERNATIVE_MODES.includes(this.listMode)) { const input = clickEvent.target.value; this.#populate(input); } @@ -455,8 +480,16 @@ export class Search extends LitElement { }} @blur=${(blurEvent) => { - if (blurEvent.relatedTarget.classList.contains("option")) return; - this.submit(); + const relatedTarget = blurEvent.relatedTarget; + if (relatedTarget) { + if (relatedTarget.classList.contains("option")) return; + if (relatedTarget.hasAttribute("data-link")) { + this.#ignore = true + return + } + } + + this.#close(); }} > diff --git a/src/renderer/src/stories/pages/guided-mode/data/GuidedPathExpansion.js b/src/renderer/src/stories/pages/guided-mode/data/GuidedPathExpansion.js index 8f88aec22..b815e3554 100644 --- a/src/renderer/src/stories/pages/guided-mode/data/GuidedPathExpansion.js +++ b/src/renderer/src/stories/pages/guided-mode/data/GuidedPathExpansion.js @@ -115,7 +115,11 @@ export async function autocompleteFormatString(path) { } } } else { - if (!parent.path || !parent.path.includes(value)) + + if (!parent.path) return; + if (!value) return; + + if (!parent.path.includes(value)) return [ { type: "error", diff --git a/src/renderer/src/stories/pages/uploads/UploadsPage.js b/src/renderer/src/stories/pages/uploads/UploadsPage.js index 102d9a5de..3cae6925f 100644 --- a/src/renderer/src/stories/pages/uploads/UploadsPage.js +++ b/src/renderer/src/stories/pages/uploads/UploadsPage.js @@ -55,12 +55,26 @@ export async function createDandiset(results = {}) { paddingBottom: "0px", }); + const updateNIHInput = (embargoed) => { + const nihInput = form.getFormElement([ "nih_award_number" ]); + + // Show the NIH input if embargo is set + if (embargoed) nihInput.removeAttribute("hidden"); + else nihInput.setAttribute("hidden", ""); + + // Make the NIH input required if embargo is set + nihInput.required = embargoed; + } + const form = new JSONSchemaForm({ schema: dandiCreateSchema, results, + validateEmptyValues: false, // Only show errors after submission validateOnChange: async (name, parent) => { const value = parent[name]; + if (name === 'embargo_status') return updateNIHInput(value); + if (name === "nih_award_number") { if (value) return awardNumberValidator(value) || [{ type: "error", message: AWARD_VALIDATION_FAIL_MESSAGE }]; @@ -83,7 +97,7 @@ export async function createDandiset(results = {}) { content.append(form); modal.append(content); - + modal.onClose = async () => notify("Dandiset was not created.", "error"); return new Promise((resolve) => {