Skip to content

Commit

Permalink
Fix JSdocs in EML211EditorView, remove unused fn
Browse files Browse the repository at this point in the history
Remove unused render renderChildren function and fix JSdocs in EML211EditorView

Issue #2565
  • Loading branch information
robyngit committed Nov 7, 2024
1 parent 01d918c commit 58d9bd5
Showing 1 changed file with 25 additions and 46 deletions.
71 changes: 25 additions & 46 deletions src/js/views/metadata/EML211EditorView.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ define([
*/
const EML211EditorView = EditorView.extend(
/** @lends EML211EditorView.prototype */ {
/**
* The type of View this is
* @type {string}
*/
type: "EML211Editor",

/* The initial editor layout */
Expand All @@ -66,7 +70,7 @@ define([
}),

/**
The identifier of the root package EML being rendered
* The identifier of the root package EML being rendered
* @type {string}
*/
pid: null,
Expand All @@ -93,9 +97,7 @@ define([
return this;
},

/**
* Create a new EML model for this view
*/
/** Create a new EML model for this view */
createModel() {
let model = null;
// If no pid is given, create a new EML model
Expand Down Expand Up @@ -280,9 +282,7 @@ define([
}
},

/**
* @inheritdoc
*/
/** @inheritdoc */
isAccessPolicyEditEnabled() {
if (!MetacatUI.appModel.get("allowAccessPolicyChanges")) {
return false;
Expand Down Expand Up @@ -366,8 +366,7 @@ define([
// 1B. If the root data package does not contain the metadata the user
// is trying to edit, then create a new data package.
else {
// this is a helpful message for debugging submission errors for
// now.
// helpful message for debugging submission errors for now.
// eslint-disable-next-line no-console
console.log(
`Resource map ids could not be found for ${scimetaModel.id}, creating a new resource map.`,
Expand Down Expand Up @@ -414,7 +413,8 @@ define([
!MetacatUI.rootDataPackage ||
!MetacatUI.rootDataPackage.packageModel
) {
// "Could not get the latest verion of the resource map because no resource map is saved.",
// "Could not get the latest verion of the resource map because no
// resource map is saved.",
return;
}
// Make sure we have the latest version of the resource map before we
Expand Down Expand Up @@ -460,9 +460,9 @@ define([

// If there is no access policy, it hasn't been fetched yet, so wait
if (!metadataAccPolicy.length) {
// If the model is of ScienceMetadata class, we need to wait for
// the "replace" function, which happens when the model is fetched
// and an EML211 model is created to replace it.
// If the model is of ScienceMetadata class, we need to wait for the
// "replace" function, which happens when the model is fetched and
// an EML211 model is created to replace it.
if (this.model.type === "ScienceMetadata") {
this.listenTo(this.model, "replace", () => {
this.listenToOnce(this.model, "sysMetaUpdated", () => {
Expand Down Expand Up @@ -522,11 +522,7 @@ define([
);
},

renderChildren() {},

/**
* Render the Data Package View and insert it into this view
*/
/** Render the Data Package View and insert it into this view */
renderDataPackage() {
const view = this;

Expand Down Expand Up @@ -593,12 +589,6 @@ define([

// Save the view as a subview
this.subviews.push(this.dataPackageView);

this.listenTo(
MetacatUI.rootDataPackage.packageModel,
"change:childPackages",
this.renderChildren,
);
},

/**
Expand Down Expand Up @@ -1126,9 +1116,7 @@ define([
}
},

/**
* Shows a message if the user is not authorized to edit this package
*/
/** Shows a message if the user is not authorized to edit this package */
notAuthorized() {
// Don't show the not authorized message if the user is authorized to
// edit the EML and the resource map
Expand Down Expand Up @@ -1196,9 +1184,7 @@ define([
}
},

/**
* Show any errors that occured when trying to save changes
*/
/** Show any errors that occured when trying to save changes */
showValidation() {
// First clear all the error messaging
this.$(".notification.error").empty();
Expand Down Expand Up @@ -1284,9 +1270,7 @@ define([
}
},

/**
* @inheritdoc
*/
/** @inheritdoc */
hasUnsavedChanges() {
// If the form hasn't been edited, we can close this view without
// confirmation
Expand All @@ -1298,9 +1282,7 @@ define([
return false;
},

/**
* @inheritdoc
*/
/** @inheritdoc */
onClose() {
// Execute the parent class onClose() function
// EditorView.prototype.onClose.call(this);
Expand Down Expand Up @@ -1340,8 +1322,8 @@ define([
},

/**
* Handle "fileLoadError" events by alerting the user and removing the
* row from the data package table.
* Handle "fileLoadError" events by alerting the user and removing the row
* from the data package table.
* @param {DataONEObject} item The model item passed by the fileLoadError
* event
*/
Expand Down Expand Up @@ -1404,18 +1386,15 @@ define([
});
},

/**
* Save a draft of the parent EML model
*/
/** Save a draft of the parent EML model */
saveDraft() {
const view = this;

const title = this.model.get("title") || "No title";
// Create a clone of the model that we will use for serialization.
// Don't serialize the model that is currently being edited, since
// serialize may make changes to the model that should not happen
// until the user is ready to save (e.g. - create a contact if there
// is not one)
// Create a clone of the model that we will use for serialization. Don't
// serialize the model that is currently being edited, since serialize
// may make changes to the model that should not happen until the user
// is ready to save (e.g. - create a contact if there is not one)
const draftModel = this.model.clone();

LocalForage.setItem(this.model.get("id"), {
Expand Down

0 comments on commit 58d9bd5

Please sign in to comment.