Skip to content
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

Clean up EML211EditorView to address issues with submitting datasets #2565

Open
robyngit opened this issue Nov 6, 2024 · 1 comment
Open

Comments

@robyngit
Copy link
Member

robyngit commented Nov 6, 2024

The EML211EditorView is currently difficult to maintain and extend due to its size and complexity. We need to make it more modular and readable in order to address issues users are encountering with submitting datasets.

During the clean-up, we will:

  • Fix all linting errors (includes switching to modern JS syntax). Add missing JSdoc comments.
  • Refactor long methods into smaller & reusable functions, especially the render method. Maybe split the view into smaller sub-views.
  • Use async/await for to replace nested callbacks
  • Improve error handling and prevent silent failures
  • Extract repeated code into reusable functions
  • Cleanup of event listeners by using stopListening to prevent memory leaks and zombie event handlers
  • Move model logic out of the view and into models to leverage Backbone's built-in methods like defaults and validate
  • Simplify conditional assignments and avoid deep nesting
@robyngit robyngit self-assigned this Nov 6, 2024
robyngit added a commit that referenced this issue Nov 7, 2024
robyngit added a commit that referenced this issue Nov 7, 2024
Remove unused render renderChildren function and fix JSdocs in EML211EditorView

Issue #2565
robyngit added a commit that referenced this issue Nov 7, 2024
Remove unused render renderChildren function and fix JSdocs in EML211EditorView

Issue #2565
robyngit added a commit that referenced this issue Nov 7, 2024
- Including replacing the underscore templates with ES6 template literals
- Remove the editor.html template file that is now unused.

Issue #2565, #2027
robyngit added a commit that referenced this issue Nov 7, 2024
Missing from the template methods

Issue #2565
robyngit added a commit that referenced this issue Nov 7, 2024
Missing from the template methods

Issue #2565
@robyngit
Copy link
Member Author

There are a series of steps taken in the EML211EditorView to ensure that the user has the correct permissions to edit the metadata and resource map and metadata:

  1. Make sure the user is signed in
  2. Fetch the metadata
  3. Use the metadata to identify and then fetch the resource map
  4. Make sure the user has write permission on the metadata
  5. Make sure the user has write permission on the resource map

These steps add quite a bit of complexity to the view and really fit better in a model. The DataPackage model is a natural place to move this logic to, and would simplify the process. There may be other views that could reuse these methods as well. Before moving them, we should first finish the DataPackage clean-up. So this issue is on the back-burner until issue #2567 is completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant