-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow adding, removing, and changing the "canonical dataset" in the Editor #2551
base: develop
Are you sure you want to change the base?
Changes from all commits
0ac3cce
6189421
bea2d7b
4df698d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-var> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EML211.js Lines 53 to 2663 in 43c3062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EML211.js Lines 57 to 131 in 43c3062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EML211.js Lines 135 to 156 in 43c3062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EML211.js Lines 158 to 169 in 43c3062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EML211.js Lines 508 to 767 in 43c3062
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -86,6 +86,7 @@ define([ | |||||
methods: new EMLMethods(), // An EMLMethods objects | ||||||
project: null, // An EMLProject object, | ||||||
annotations: null, // Dataset-level annotations | ||||||
canonicalDataset: null, | ||||||
dataSensitivityPropertyURI: | ||||||
"http://purl.dataone.org/odo/SENSO_00000005", | ||||||
nodeOrder: [ | ||||||
|
@@ -143,6 +144,13 @@ define([ | |||||
this.set("synced", true); | ||||||
}); | ||||||
|
||||||
this.stopListening(this, "change:canonicalDataset"); | ||||||
this.listenTo( | ||||||
this, | ||||||
"change:canonicalDataset", | ||||||
this.updateCanonicalDataset, | ||||||
); | ||||||
|
||||||
//Create a Unit collection | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <spaced-comment> reported by reviewdog 🐶
Suggested change
|
||||||
if (!this.units.length) this.createUnits(); | ||||||
}, | ||||||
|
@@ -160,6 +168,17 @@ define([ | |||||
); | ||||||
}, | ||||||
|
||||||
updateCanonicalDataset() { | ||||||
let uri = this.get("canonicalDataset"); | ||||||
uri = uri?.length ? uri[0] : null; | ||||||
let annotations = this.get("annotations"); | ||||||
if (!annotations) { | ||||||
annotations = new EMLAnnotations(); | ||||||
this.set("annotations", annotations); | ||||||
} | ||||||
annotations.updateCanonicalDataset(uri); | ||||||
}, | ||||||
|
||||||
/* | ||||||
* Maps the lower-case EML node names (valid in HTML DOM) to the camel-cased EML node names (valid in EML). | ||||||
* Used during parse() and serialize() | ||||||
|
@@ -734,6 +753,16 @@ define([ | |||||
} | ||||||
} | ||||||
|
||||||
// Once all the nodes have been parsed, check if any of the annotations | ||||||
// make up a canonical dataset reference | ||||||
const annotations = modelJSON["annotations"]; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <prefer-destructuring> reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <dot-notation> reported by reviewdog 🐶
Suggested change
|
||||||
if (annotations) { | ||||||
const canonicalDataset = annotations.getCanonicalURI(); | ||||||
if (canonicalDataset) { | ||||||
modelJSON["canonicalDataset"] = canonicalDataset; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <dot-notation> reported by reviewdog 🐶
Suggested change
|
||||||
} | ||||||
} | ||||||
|
||||||
return modelJSON; | ||||||
}, | ||||||
|
||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <prefer-arrow-callback> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EMLAnnotation.js Lines 1 to 185 in 43c3062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-var> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EMLAnnotation.js Lines 9 to 182 in 43c3062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EMLAnnotation.js Lines 13 to 23 in 43c3062
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/models/metadata/eml211/EMLAnnotation.js Lines 30 to 56 in 43c3062
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -23,7 +23,8 @@ define(["jquery", "underscore", "backbone"], function ($, _, Backbone) { | |||||
}, | ||||||
|
||||||
initialize: function (attributes, opions) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-unused-vars> reported by reviewdog 🐶 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-unused-vars> reported by reviewdog 🐶 |
||||||
this.on("change", this.trickleUpChange); | ||||||
this.stopListening(this, "change", this.trickleUpChange); | ||||||
this.listenTo(this, "change", this.trickleUpChange); | ||||||
}, | ||||||
|
||||||
parse: function (attributes, options) { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-unused-vars> reported by reviewdog 🐶 |
||||||
|
@@ -175,7 +176,7 @@ define(["jquery", "underscore", "backbone"], function ($, _, Backbone) { | |||||
|
||||||
/* Let the top level package know of attribute changes from this object */ | ||||||
trickleUpChange: function () { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶
Suggested change
|
||||||
MetacatUI.rootDataPackage.packageModel.set("changed", true); | ||||||
MetacatUI.rootDataPackage.packageModel?.set("changed", true); | ||||||
}, | ||||||
}, | ||||||
); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <prefer-arrow-callback> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 29 to 3151 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-var> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 64 to 3149 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 243 to 336 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <vars-on-top> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 299 to 302 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-var> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 299 to 302 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 1894 to 1978 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <one-var> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 1910 to 1916 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <vars-on-top> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 1910 to 1916 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-var> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 1910 to 1916 in 4df698d
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <object-shorthand> reported by reviewdog 🐶 metacatui/src/js/views/metadata/EML211View.js Lines 1980 to 2032 in 4df698d
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -302,6 +302,13 @@ define([ | |||||
); | ||||||
$(overviewEl).find(".altids").append(altIdsEls); | ||||||
|
||||||
// Canonical Identifier | ||||||
const canonicalIdEl = this.createBasicTextFields( | ||||||
"canonicalDataset", | ||||||
"Add a new canonical identifier", | ||||||
); | ||||||
$(overviewEl).find(".canonical-id").append(canonicalIdEl); | ||||||
|
||||||
//Usage | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <spaced-comment> reported by reviewdog 🐶
Suggested change
|
||||||
//Find the model value that matches a radio button and check it | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <spaced-comment> reported by reviewdog 🐶
Suggested change
|
||||||
// Note the replace() call removing newlines and replacing them with a single space | ||||||
|
@@ -1909,7 +1916,7 @@ define([ | |||||
.addClass("basic-text"); | ||||||
textRow.append(input.clone().val(value)); | ||||||
|
||||||
if (category != "title") | ||||||
if (category !== "title" && category !== "canonicalDataset") | ||||||
textRow.append( | ||||||
this.createRemoveButton( | ||||||
null, | ||||||
|
@@ -1922,7 +1929,11 @@ define([ | |||||
textContainer.append(textRow); | ||||||
|
||||||
//At the end, append an empty input for the user to add a new one | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <spaced-comment> reported by reviewdog 🐶
Suggested change
|
||||||
if (i + 1 == allModelValues.length && category != "title") { | ||||||
if ( | ||||||
i + 1 == allModelValues.length && | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
category !== "title" && | ||||||
category !== "canonicalDataset" | ||||||
) { | ||||||
var newRow = $( | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
$(document.createElement("div")).addClass("basic-text-row"), | ||||||
); | ||||||
Comment on lines
1937
to
1939
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <vars-on-top> reported by reviewdog 🐶 |
||||||
|
@@ -2006,7 +2017,12 @@ define([ | |||||
} | ||||||
|
||||||
//Add another blank text input | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <spaced-comment> reported by reviewdog 🐶
Suggested change
|
||||||
if ($(e.target).is(".new") && value != "" && category != "title") { | ||||||
if ( | ||||||
$(e.target).is(".new") && | ||||||
value != "" && | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
category != "title" && | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
category !== "canonicalDataset" | ||||||
) { | ||||||
$(e.target).removeClass("new"); | ||||||
this.addBasicText(e); | ||||||
} | ||||||
|
@@ -2036,12 +2052,12 @@ define([ | |||||
allBasicTexts = $( | ||||||
".basic-text.new[data-category='" + category + "']", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <prefer-template> reported by reviewdog 🐶
Suggested change
|
||||||
); | ||||||
|
||||||
//Only show one new row at a time | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <spaced-comment> reported by reviewdog 🐶
Suggested change
|
||||||
if (allBasicTexts.length == 1 && !allBasicTexts.val()) return; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
else if (allBasicTexts.length > 1) return; | ||||||
//We are only supporting one title right now | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <spaced-comment> reported by reviewdog 🐶
Suggested change
|
||||||
else if (category == "title") return; | ||||||
else if (category === "title" || category === "canonicalDataset") | ||||||
return; | ||||||
Comment on lines
2057
to
+2060
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <no-else-return> reported by reviewdog 🐶 reviewdog suggestion errorGitHub comment range and suggestion line range must be same. L2057-L2060 v.s. L2050-L2057 |
||||||
|
||||||
//Add another blank text input | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚫 [eslint] <spaced-comment> reported by reviewdog 🐶
Suggested change
|
||||||
var newRow = $(document.createElement("div")).addClass( | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚫 [eslint] <prefer-arrow-callback> reported by reviewdog 🐶
Unexpected function expression.
metacatui/src/js/models/metadata/eml211/EML211.js
Lines 23 to 2666 in 43c3062