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

Changes role access #1617

Merged
merged 16 commits into from
Oct 22, 2024
Merged

Changes role access #1617

merged 16 commits into from
Oct 22, 2024

Conversation

abishekTa-egov
Copy link
Collaborator

@abishekTa-egov abishekTa-egov commented Oct 22, 2024

Made preseleceting boundary for national level, also changed css of role-table

Summary by CodeRabbit

  • New Features

    • Updated stylesheet for health-related CSS to the latest version for improved styling.
    • Enhanced RoleTableComposer component with improved logic for boundary selection and user interaction.
  • Bug Fixes

    • Improved layout and navigation within the DataTable by adding a vertical scroll capability.
  • Style

    • Extensive styling adjustments across various components for better visual consistency and responsiveness.
    • New styles introduced for buttons, modals, upload sections, and employee interface elements, ensuring a cohesive design language.

Copy link
Contributor

coderabbitai bot commented Oct 22, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The changes in this pull request primarily involve updates to the HTML and SCSS files within the micro-ui project. The HTML file's stylesheet link for health-related CSS has been updated from version 0.1.6 to 0.1.7. The SCSS file has undergone extensive modifications, including new styles, variable adjustments, and mixin definitions, to enhance the visual consistency and responsiveness of various UI components. Additionally, the JavaScript component RoleTableComposer.js has seen changes to improve boundary selection logic and user interface layout.

Changes

File Change Summary
health/micro-ui/web/micro-ui-internals/example/public/index.html Updated stylesheet link for @egovernments/digit-ui-health-css from version 0.1.6 to 0.1.7.
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss Extensive styling adjustments, including new styles, variable definitions, mixins, and responsive changes.
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js Added logic for boundary selection based on country; modified rendering for better layout and usability.
health/micro-ui/web/public/index.html Updated stylesheet link for @egovernments/digit-ui-health-css from version 0.1.6 to 0.1.7.
health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss Comprehensive styling updates for employee interface, focusing on layout, responsiveness, and visual consistency.

Possibly related PRs

  • css fix #1374: The main PR updates the stylesheet link in index.html, which is also reflected in this PR that updates the stylesheet link for @egovernments/digit-ui-css in the same file.
  • bug fixes for sandbox #1439: Similar to the main PR, this PR updates the stylesheet link in index.html for the @egovernments/digit-ui-css package, indicating a related change in versioning.
  • Sandbox UI fixes #1442: This PR also updates the stylesheet link in index.html, specifically for the @egovernments/digit-ui-css package, aligning with the changes made in the main PR.
  • Boundary screen #1451: The main PR's focus on updating stylesheet links is echoed in this PR, which modifies the stylesheet link in index.html for the @egovernments/digit-ui-css package.
  • Assumptions #1457: This PR updates the stylesheet link in index.html, similar to the main PR's changes, indicating a related version update.
  • SN 261 #1460: This PR updates the stylesheet link in index.html, which aligns with the main PR's changes regarding stylesheet versioning.
  • fixes #1466: The stylesheet link update in this PR for index.html is related to the main PR's focus on updating stylesheet links.
  • updated versions #1469: This PR updates the stylesheet link in index.html, which is consistent with the changes made in the main PR.
  • HCMPRE-700, HCMPRE-701 and HCMPRE-741 #1471: The update to the stylesheet link in this PR for index.html aligns with the main PR's changes regarding stylesheet versioning.
  • Mp assumptions #1477: This PR updates the stylesheet link in index.html, similar to the main PR's changes, indicating a related version update.
  • Home page break issue fix, landing page css fix #1487: This PR updates the stylesheet link in index.html, which is consistent with the changes made in the main PR.
  • User management screen #1496: The update to the stylesheet link in this PR for index.html aligns with the main PR's changes regarding stylesheet versioning.
  • Mp hypothesis #1505: This PR updates the stylesheet link in index.html, similar to the main PR's changes, indicating a related version update.
  • Boundary screen1 #1511: The update to the stylesheet link in this PR for index.html aligns with the main PR's changes regarding stylesheet versioning.
  • Boundary screen1 #1522: This PR updates the stylesheet link in index.html, which is consistent with the changes made in the main PR.
  • User download file #1531: This PR updates the stylesheet link in index.html, similar to the main PR's changes, indicating a related version update.
  • side bar faq-component changes #1534: The update to the stylesheet link in this PR for index.html aligns with the main PR's changes regarding stylesheet versioning.
  • Role screen #1535: This PR updates the stylesheet link in index.html, which is consistent with the changes made in the main PR.
  • Css button fix #1542: This PR updates the stylesheet link in index.html, similar to the main PR's changes, indicating a related version update.
  • Simple view village screen with static popup #1548: The update to the stylesheet link in this PR for index.html aligns with the main PR's changes regarding stylesheet versioning.
  • User download changes #1559: This PR updates the stylesheet link in index.html, which is consistent with the changes made in the main PR.
  • resolved the HCMPRE-909, 910 ,911 #1566: This PR updates the stylesheet link in index.html, similar to the main PR's changes, indicating a related version update.
  • User download changes #1568: The update to the stylesheet link in this PR for index.html aligns with the main PR's changes regarding stylesheet versioning.
  • Role access table #1606: This PR updates the stylesheet link in index.html, which is consistent with the changes made in the main PR.

Suggested reviewers

  • jagankumar-egov

Poem

🐇 In the garden of code, where styles bloom bright,
A CSS update brings colors to light.
With mixins and variables, we dance with delight,
Each button and label, a beautiful sight.
So hop with us, friends, let’s cheer and unite,
For a UI that sparkles, a true coding flight! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (1)

Line range hint 434-446: Improve styling approach and fix indentation.

The addition of a scrollable container for the DataTable is a good UI improvement. However, let's enhance it further:

  1. Replace inline styling with a CSS class:

    <div className="data-table-container">

    Add this to your CSS file:

    .data-table-container {
      overflow-y: scroll;
      max-height: [appropriate-value]; /* Consider setting a max-height */
    }
  2. Fix the indentation of the DataTable component to align with the opening div tag.

These changes will improve code maintainability and readability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between 569c551 and e49949a.

⛔ Files ignored due to path filters (1)
  • health/micro-ui/web/micro-ui-internals/packages/css/package.json is excluded by !**/*.json
📒 Files selected for processing (3)
  • health/micro-ui/web/micro-ui-internals/example/public/index.html (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (2 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (6 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (1)

Pattern **/*.js: check

📓 Learnings (1)
health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (3)
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392
Timestamp: 2024-06-14T14:10:38.086Z
Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392
Timestamp: 2024-10-08T20:11:07.772Z
Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
Learnt from: siddhant-nawale-egov
PR: egovernments/DIGIT-Frontend#876
File: micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss:1940-2392
Timestamp: 2024-10-08T20:11:12.539Z
Learning: Classes related to interactive elements in the microplan preview section are mostly passed to Higher Order Components (HOCs), and ARIA attributes for non-HOC elements will be managed directly by adding them where necessary.
🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js

[error] 323-323: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

🔇 Additional comments (3)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (2)

57-58: Verify handling of undefined topBoundaryValue for national roles.

The updated logic for selectedBoundaries looks good and aligns with the introduction of topBoundaryValue. However, ensure that the logic handles cases where topBoundaryValue might be undefined for national roles.

Consider adding a fallback or validation:

selectedBoundaries: nationalRoles?.includes(category)
  ? (topBoundaryValue ? [topBoundaryValue] : [])
  : data?.planData?.find((i) => i.employeeId === item?.user?.userServiceUuid)?.jurisdiction,

This ensures that even if topBoundaryValue is undefined, an empty array is used instead of potentially causing issues downstream.


Line range hint 1-456: Overall, good improvements with minor suggestions for refinement.

The changes in this file effectively implement the preselecting boundary for the national level, as mentioned in the PR objectives. The modifications consistently handle national roles across different parts of the component, improving its functionality. The UI enhancements, such as the scrollable DataTable container, align with the goal of modifying the CSS of the role-table.

To further refine the code:

  1. Ensure robust null checking where nested objects are accessed.
  2. Consider performance optimizations, especially in data filtering and mapping operations.
  3. Maintain consistent code style, particularly in the use of arrow functions and boolean assignments.
  4. Prefer CSS classes over inline styles for better maintainability.

These minor adjustments will enhance the overall quality and maintainability of the component.

health/micro-ui/web/micro-ui-internals/packages/css/src/components/microplanning.scss (1)

2593-2593: Consider the impact of min-width: 90vw on smaller screens

Setting min-width: 90vw may cause layout issues on devices with smaller screens, potentially leading to horizontal scrolling. Please verify that this change maintains responsive design across all viewports.

nabeelmd-eGov
nabeelmd-eGov previously approved these changes Oct 22, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range comments (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (1)

Line range hint 435-447: Consider moving inline styles to a CSS class

The inline style style={{overflowY:"auto"}} can be moved to a CSS class for better maintainability and consistency.

Example:

-          <div style={{overflowY:"auto"}}>
+          <div className="dataTableContainer">

And in your CSS file, add:

.dataTableContainer {
  overflow-y: auto;
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between e49949a and cc28f04.

📒 Files selected for processing (2)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (8 hunks)
  • health/micro-ui/web/public/index.html (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (1)

Pattern **/*.js: check

🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js

[error] 324-324: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

🔇 Additional comments (4)
health/micro-ui/web/public/index.html (1)

14-14: CSS version update looks good, but verify consistency across the project.

The update of the health CSS version from 0.1.6 to 0.1.7 is in line with the PR objectives of modifying the CSS of the role-table. This change should bring in the latest styles for the health module.

To ensure consistency across the project, please run the following script to check if this CSS version is used in other files:

This will help ensure that the CSS version is updated consistently across all relevant files in the project.

✅ Verification successful

CSS version update is consistent across relevant HTML files.

  • Updated to version 0.1.7 in:

    • health/micro-ui/web/public/index.html
    • health/micro-ui/web/micro-ui-internals/example/public/index.html
  • No occurrences of the old version 0.1.6 found.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for other occurrences of the health CSS version

# Search for both old and new versions
echo "Occurrences of old version (0.1.6):"
rg -i "[email protected]" --type html

echo "Occurrences of new version (0.1.7):"
rg -i "[email protected]" --type html

# Check package.json for health CSS dependency
echo "Health CSS dependency in package.json:"
jq '.dependencies["@egovernments/digit-ui-health-css"]' package.json

Length of output: 801


Script:

#!/bin/bash
# Description: Locate all package.json files and check for the health CSS dependency

# Find all package.json files in the repository
echo "Searching for all package.json files..."
fd package.json

# Assuming package.json files are found, check each for the health CSS dependency
echo "Checking for '@egovernments/digit-ui-health-css' dependency in found package.json files:"
fd package.json --exec sh -c 'echo "File: {}"; jq ".dependencies[\"@egovernments/digit-ui-health-css\"] // .devDependencies[\"@egovernments/digit-ui-health-css\"]" {} || echo "Dependency not found."' \;

Length of output: 4640

health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (3)

31-33: Approved: Null checks have been appropriately implemented

The introduction of topBoundaryValue with null checks enhances robustness and prevents potential runtime errors.


57-58: Approved: Conditional assignment of selectedBoundaries is appropriate

The logic for assigning selectedBoundaries based on nationalRoles and category correctly handles different scenarios.


87-90: Approved: Row data initialization logic is sound

The updated initialization of rowData effectively manages selectedBoundaries for national roles and other categories.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range comments (2)
health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss (1)

Line range hint 419-423: Consider revising the submit bar styling for better maintainability and responsiveness.

The current implementation has a few potential issues:

  1. The use of !important for the background color may lead to specificity issues and make future style overrides difficult.
  2. Setting width: max-content could cause layout problems on smaller screens if the content is too wide.
  3. The hardcoded color #c84c0e might not be consistent with the application's color scheme.

Consider the following improvements:

  1. Remove !important and increase the specificity of the selector if needed.
  2. Use a more responsive width setting, such as width: 100% with max-width.
  3. Use a color variable for consistency with the overall theme.
 .addProductActionClass {
   .submit-bar {
-    background-color: #c84c0e !important;
-    width: max-content;
+    background-color: var(--primary-color);
+    width: 100%;
+    max-width: 300px;
     padding-left: 1.5rem;
     padding-right: 1.5rem;
   }
 }
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (1)

Line range hint 434-446: Avoid inline styles for better maintainability.

Consider moving the inline style style={{overflowY:"auto"}} to a CSS class. This promotes separation of concerns and improves maintainability.

Apply this change:

-          <div style={{overflowY:"auto"}}>
+          <div className="dataTableContainer">

Then, in your CSS file, add:

.dataTableContainer {
  overflow-y: auto;
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE

📥 Commits

Files that changed from the base of the PR and between cc28f04 and 938cae6.

📒 Files selected for processing (2)
  • health/micro-ui/web/micro-ui-internals/packages/css/src/pages/employee/index.scss (1 hunks)
  • health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (7 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (1)

Pattern **/*.js: check

🪛 Biome
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js

[error] 323-323: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

🔇 Additional comments (4)
health/micro-ui/web/micro-ui-internals/packages/modules/microplan/src/components/RoleTableComposer.js (4)

31-33: Consider adding null checks for better robustness.

The previous review comment about adding null checks is still applicable to ensure code robustness.


87-90: Refactoring suggestion remains valid.

The previous review comment about improving readability and performance for the selectedBoundaries logic is still applicable.


308-308: Simplify the filter condition for better readability.

The previous suggestion to simplify the condition is still valid.


323-323: Simplify the disabled prop assignment.

The previous review comment about simplifying the disabled prop assignment is still applicable.

🧰 Tools
🪛 Biome

[error] 323-323: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

@nipunarora-eGov nipunarora-eGov merged commit 35b75fc into console Oct 22, 2024
3 checks passed
@nipunarora-eGov nipunarora-eGov deleted the changes-role-access branch October 22, 2024 12:45
@coderabbitai coderabbitai bot mentioned this pull request Oct 22, 2024
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.

3 participants