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

fix: fixed and improved some user interface issues. #1666

Merged
merged 12 commits into from
Nov 28, 2024

Conversation

Junjiequan
Copy link
Contributor

@Junjiequan Junjiequan commented Nov 20, 2024

Description

This PR contains a couple of small UI improvements and changes:

  • made large data files download instruction text configurable on the dataset/datafiles page
  • commented out sample editing feature temporarily, as the sample editing feature is broken and there's no strong need for the feature.
  • resized thumbnail image to prevent it from being cut off partially.
  • replaced red cross pdf file thumbnail with default pdf icon on dataset table
  • added tests for the changes.
image

Motivation

Fixes:

Please provide a list of the fixes implemented in this PR

  • Items added

Changes:

Please provide a list of the changes implemented by this PR

  • changes made

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

official documentation info

If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included

Backend version

  • Does it require a specific version of the backend
  • which version of the backend is required:

Summary by Sourcery

Disable the sample editing feature due to bugs and the need for a centralized edit button. Refactor image URL retrieval logic to use the AttachmentService for consistency and maintainability. Update the datafiles component to dynamically replace file size warning messages with configurable values.

Bug Fixes:

  • Disable the sample editing feature due to existing bugs and the need for a centralized edit button.

Enhancements:

  • Refactor the method for retrieving image URLs by moving logic to the AttachmentService.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Junjiequan - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please provide a proper description of the changes in the PR description. Specifically list out: 1) The removal of sample editing functionality 2) The refactoring of image URL handling 3) The improvements to large file download messages
  • The documentation checkboxes are all unchecked. Since this PR removes user-facing functionality and changes UI elements, please update the relevant documentation and check the appropriate boxes.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

src/app/datasets/datafiles/datafiles.component.ts Outdated Show resolved Hide resolved
src/app/shared/services/attachment.service.ts Outdated Show resolved Hide resolved
src/app/shared/services/attachment.service.ts Outdated Show resolved Hide resolved
src/app/shared/services/attachment.service.ts Outdated Show resolved Hide resolved
@@ -268,13 +268,17 @@
<a (click)="onClickSample(sample.sampleId)">
<span>{{ sample.description }}</span>
</a>
<span
<!-- NOTE: Sample editing is currently disabled.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep this or remove it completely from the code for now?

Copy link
Contributor Author

@Junjiequan Junjiequan Nov 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Maybe it's better off to remove this code as we are not certain if we need this feature or not, instead of polluting the source code.
What's your thoughts? @nitrosx

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mixed feelings... THINKING THINKING...
Let's remove it!!!

);
});
});
// NOTE: Sample editing is currently disabled.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it is better to remove this instead of just commenting it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above. Remove it.
Let's clean up the code

});
}
}
// NOTE: Sample editing is currently disabled.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove it

Copy link
Contributor

@nitrosx nitrosx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes requested are not functional. They are in pseudo code, most likely need to be refactored.

@@ -82,6 +82,7 @@ export interface AppConfig {
searchPublicDataEnabled: boolean;
searchSamples: boolean;
sftpHost: string | null;
largeDataFileAccessInstruction?: string;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change name to maxFileSizeWarning

"."
: ""
}}
<span [innerHTML]="hasTooLargeFilesMessage()"></span>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change name to hasFileAboveMaxSizeWarning()

Comment on lines 80 to 81
customSourcefolder: string | null =
this.appConfig.largeDataFileAccessInstruction;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to:

  maxFileSizeWarning: string = 
    this.appConfig.maxFileSizeWarning || 
    `Some files are above the max size (<maxFileSize>)`

Comment on lines 209 to 216
hasTooLargeFilesMessage() {
return `Some files are too big, but they can be downloaded
at our sftp server: <strong>${this.sftpHost}</strong>
at the folder: <strong>${
this.customSourcefolder || this.sourcefolder
}</strong>`;
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to:

  hasFileAboveMaxSizeWarning() {
    const valueMapping = {
      '<sftpHost>' : this.sftpHost,
      '<sourceFolder>': this.sourceFolder
     //  ... any other value that we think might be important ...
    }
    var warning = this.maxFileSizeWarning;
    Object.keys(valaueMapping).forEach((key) => {
      warning = warning.replace('/' + key + '/', valueMapping[key];
    });
    return warning;
  }

This way, site admin can configure the message to their liking. They also can use <sftHost> or <sourceFolder> as placemarks that will be substituted in.

The code is pseudo code. Most likely it needs to be adjusted.

One more thing, with the new data file actions, some facilities will configure them to perform action which do not have size restriction.

Copy link
Contributor

@bpedersen2 bpedersen2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look good.

In the furture we probably need to adjust for different download methods etc.

@Junjiequan Junjiequan merged commit 0d37dfb into master Nov 28, 2024
6 checks passed
@Junjiequan Junjiequan deleted the SWAP-4247-change-sftp-text-on-scicat branch November 28, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants