[PR #371] [MERGED] Refactor Buttons component to use a ButtonLink for cleaner code, simplifying the source URL generation and layout #2699

Closed
opened 2026-02-26 13:31:04 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/371
Author: @BramSuurdje
Created: 11/19/2024
Status: Merged
Merged: 11/19/2024
Merged by: @MickLesk

Base: mainHead: main


📝 Commits (3)

  • 4dc3357 Refactor Buttons component to use a ButtonLink for cleaner code, simplifying the source URL generation and layout
  • ef648f1 Refactor DefaultPassword component to simplify credential handling and enhance code readability with map function
  • 3826006 Refactor DefaultSettings component to improve resource display logic and enhance readability using a new ResourceDisplay subcomponent

📊 Changes

3 files changed (+104 additions, -118 deletions)

View changed files

📝 frontend/src/app/scripts/_components/ScriptItems/Buttons.tsx (+42 -34)
📝 frontend/src/app/scripts/_components/ScriptItems/DefaultPassword.tsx (+30 -46)
📝 frontend/src/app/scripts/_components/ScriptItems/DefaultSettings.tsx (+32 -38)

📄 Description

[!NOTE]

We are meticulous when it comes to merging code into the main branch, so please understand that we may reject pull requests that do not meet the project's standards. It's never personal. Also, game-related scripts have a lower chance of being merged.

Description

This pull request includes several changes to the frontend/src/app/scripts/_components/ScriptItems directory. The changes focus on refactoring and simplifying the code, as well as improving readability and maintainability.

Refactoring and code simplification:

Fixes # (issue)

Type of change

Please check the relevant option(s):

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would cause existing functionality to change unexpectedly)
  • New script (a fully functional and thoroughly tested script or set of scripts.)

Prerequisites

The following efforts must be made for the PR to be considered. Please check when completed:

  • Self-review performed (I have reviewed my code, ensuring it follows established patterns and conventions)
  • Testing performed (I have tested my changes, ensuring everything works as expected)
  • Documentation updated (I have updated any relevant documentation)

Additional Information (optional)

Provide any additional context or screenshots about the feature or fix here.

If there are other pull requests or discussions related to this change, please link them here:

  • Related PR #

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/371 **Author:** [@BramSuurdje](https://github.com/BramSuurdje) **Created:** 11/19/2024 **Status:** ✅ Merged **Merged:** 11/19/2024 **Merged by:** [@MickLesk](https://github.com/MickLesk) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (3) - [`4dc3357`](https://github.com/community-scripts/ProxmoxVE/commit/4dc33573e4b793b9484c761776b9d03332253602) Refactor Buttons component to use a ButtonLink for cleaner code, simplifying the source URL generation and layout - [`ef648f1`](https://github.com/community-scripts/ProxmoxVE/commit/ef648f17595f7f2b1ccb02b9769528b82f257040) Refactor DefaultPassword component to simplify credential handling and enhance code readability with map function - [`3826006`](https://github.com/community-scripts/ProxmoxVE/commit/382600689c0e36fdd715bc8bf7c59fff089ca041) Refactor DefaultSettings component to improve resource display logic and enhance readability using a new ResourceDisplay subcomponent ### 📊 Changes **3 files changed** (+104 additions, -118 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/app/scripts/_components/ScriptItems/Buttons.tsx` (+42 -34) 📝 `frontend/src/app/scripts/_components/ScriptItems/DefaultPassword.tsx` (+30 -46) 📝 `frontend/src/app/scripts/_components/ScriptItems/DefaultSettings.tsx` (+32 -38) </details> ### 📄 Description [!NOTE] > We are meticulous when it comes to merging code into the main branch, so please understand that we may reject pull requests that do not meet the project's standards. It's never personal. Also, game-related scripts have a lower chance of being merged. ## Description This pull request includes several changes to the `frontend/src/app/scripts/_components/ScriptItems` directory. The changes focus on refactoring and simplifying the code, as well as improving readability and maintainability. Refactoring and code simplification: * [`frontend/src/app/scripts/_components/ScriptItems/Buttons.tsx`](diffhunk://#diff-4a03a47cda83b0855cc43fe0bfa5254af0d232631f0d3e3bb022fdc68ca4738eL8-R54): Refactored the `Buttons` component to use a new `ButtonLink` component for rendering button links. This change reduces code duplication and improves readability. * [`frontend/src/app/scripts/_components/ScriptItems/DefaultPassword.tsx`](diffhunk://#diff-414235315292901d5bb30ccf6ce354f33a9436163404bc11e0a0fd98aa2ba738L7-L55): Simplified the `DefaultPassword` component by destructuring `username` and `password` from `item.default_credentials` and introducing a `copyCredential` function to handle copying credentials. * [`frontend/src/app/scripts/_components/ScriptItems/DefaultSettings.tsx`](diffhunk://#diff-3c1b6dd11bee29dc79d91bc380cc1b53450354673218ede600a38a4dbbdae3f7R4-R47): Introduced a `ResourceDisplay` component to handle the display of resource settings, reducing code duplication. The `getDisplayValueFromRAM` function was also moved inside the `DefaultSettings` component for better encapsulation. Fixes # (issue) ## Type of change Please check the relevant option(s): - [ ] Bug fix (non-breaking change that resolves an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (a fix or feature that would cause existing functionality to change unexpectedly) - [ ] New script (a fully functional and thoroughly tested script or set of scripts.) ## Prerequisites The following efforts must be made for the PR to be considered. Please check when completed: - [ ] Self-review performed (I have reviewed my code, ensuring it follows established patterns and conventions) - [x] Testing performed (I have tested my changes, ensuring everything works as expected) - [ ] Documentation updated (I have updated any relevant documentation) ## Additional Information (optional) Provide any additional context or screenshots about the feature or fix here. ## Related Pull Requests / Discussions If there are other pull requests or discussions related to this change, please link them here: - Related PR # --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 13:31:04 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#2699
No description provided.