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

MIR-1412 Show MD5 sum for each file in the derivate file list #1089

Conversation

levshyn
Copy link
Contributor

@levshyn levshyn commented Nov 26, 2024

The list of derivate files should have the ability to display the MD5 amount

MIR-1412.

@levshyn levshyn requested a review from Possommi November 26, 2024 07:56
@levshyn levshyn self-assigned this Nov 26, 2024
@Possommi Possommi changed the base branch from 2024.06.x to 2023.06.x November 26, 2024 09:18
@Possommi Possommi changed the title Show MD5 sum for each file in the derivate file list MIR-1412 Show MD5 sum for each file in the derivate file list Nov 26, 2024
@Possommi Possommi self-requested a review November 26, 2024 11:26
Copy link
Member

@golsch golsch left a comment

Choose a reason for hiding this comment

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

change target branch version to 2024.06.x

Comment on lines 333 to 362
const toggleMD5LinkElement = '#toggleMD5Link';
// Derivate action dropdown toggle button element
const derivateActionDropdownToggleButton = '.headline .dropdown.options .dropdown-toggle';
// Element selector with md5 information
const md5ElementSelector = '.file_md5';

// Show md5 sums by derivate files by clicking on the 'toggleMD5LinkElement' element
$(toggleMD5LinkElement).click((evt) => {
evt.preventDefault();
// Get the element to show/hide
const elements = document.querySelectorAll(md5ElementSelector);

elements.forEach(element => {
element.classList.toggle('hidden');
});
});

// Getting i18n translation for the link to switch state 'show/hide MD5 amounts' depending on the visibility of the
// message with this amount when clicking on the 'derivateActionDropdownToggleButton' element
$(derivateActionDropdownToggleButton).click((evt) => {
if ($(md5ElementSelector)) {
let i18nKey = '';
if ($(md5ElementSelector).hasClass('hidden')) {
i18nKey = 'component.mods.metaData.options.MD5.show';
} else {
i18nKey = 'component.mods.metaData.options.MD5.hide';
}
getI18n(i18nKey, toggleMD5LinkElement);
}
});
Copy link
Member

Choose a reason for hiding this comment

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

use 2 spaces. Encapsulate the code to improve overview (IIFE).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 354 to 359
let i18nKey = '';
if ($(md5ElementSelector).hasClass('hidden')) {
i18nKey = 'component.mods.metaData.options.MD5.show';
} else {
i18nKey = 'component.mods.metaData.options.MD5.hide';
}
Copy link
Member

Choose a reason for hiding this comment

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

const i18nKey = md5Elements.hasClass('hidden') 
  ? 'component.mods.metaData.options.MD5.show' 
  : 'component.mods.metaData.options.MD5.hide';

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

// Getting i18n translation for the link to switch state 'show/hide MD5 amounts' depending on the visibility of the
// message with this amount when clicking on the 'derivateActionDropdownToggleButton' element
$(derivateActionDropdownToggleButton).click((evt) => {
if ($(md5ElementSelector)) {
Copy link
Member

Choose a reason for hiding this comment

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

use $(md5ElementSelector).length > 0, because this check is always true.

Copy link
Contributor Author

@levshyn levshyn Dec 3, 2024

Choose a reason for hiding this comment

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


// Getting i18n translation for the link to switch state 'show/hide MD5 amounts' depending on the visibility of the
// message with this amount when clicking on the 'derivateActionDropdownToggleButton' element
$(derivateActionDropdownToggleButton).click((evt) => {
Copy link
Member

@golsch golsch Dec 2, 2024

Choose a reason for hiding this comment

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

I would define the dropdown more explicitly, the display should only refer to a specific derivate.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@Possommi
Copy link
Contributor

Possommi commented Dec 2, 2024

change target branch version to 2024.06.x

but we need this in 2023.06.x

@kkrebs kkrebs merged commit a0f3e9b into 2023.06.x Dec 5, 2024
2 checks passed
@kkrebs kkrebs deleted the issues/MIR-1412-Show_MD5_sum_for_each_file_in_the_derivate_file_list branch December 5, 2024 17:45
yagee-de added a commit that referenced this pull request Dec 18, 2024
* 2023.06.x:
  MIR-1416 pin glassfish jaxb-runtime to MIRAccessKeyPairTransformer
  MIR-1412 Show MD5 sum for each file in the derivate file list (#1089)
  MIR-1413-subject xml:lang should not be removed
  MIR-1408 Added class attributes to list items in action menu (#1083)
  MIR-1361 Allow to enter ROR as affiliation for authors (#1074)
  MIR-1365 Allow to configure max value for xed template subject.simple and subject.simple.required
  MIR-1359 fix choose publication button in related item (#1071)
  Bump express in /mir-webapp/src/main/vue/name-search
  Bump dompurify in /mir-webapp/src/main/vue/editor-tools
  Bump webpack in /mir-webapp/src/main/vue/editor-tools
  Bump braces from 3.0.2 to 3.0.3 in /mir-wizard
yagee-de added a commit that referenced this pull request Dec 18, 2024
* 2024.06.x:
  Bump nanoid from 3.3.6 to 3.3.8 in /mir-webapp/src/main/vue/name-search
  MIR-1416 pin glassfish jaxb-runtime to MIRAccessKeyPairTransformer
  MIR-1412 Show MD5 sum for each file in the derivate file list (#1089)
  Update README.md (#1091)
  MIR-1413-subject xml:lang should not be removed
  MIR-1408 Added class attributes to list items in action menu (#1083)
  Bump http-proxy-middleware in /mir-webapp/src/main/vue/name-search
  Bump express in /mir-webapp/src/main/vue/editor-tools
  Update README.md (#1086)
  MIR-1361 Allow to enter ROR as affiliation for authors (#1074)
  update PMD ruleset.xml (#1082)
  MIR-1365 Allow to configure max value for xed template subject.simple and subject.simple.required
  MIR-1359 fix choose publication button in related item (#1071)
  Bump express in /mir-webapp/src/main/vue/name-search
  Bump dompurify in /mir-webapp/src/main/vue/editor-tools
  Bump webpack in /mir-webapp/src/main/vue/editor-tools
  Bump braces from 3.0.2 to 3.0.3 in /mir-wizard
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