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

feat: Pennsieve guest contributors can use Prepare Dataset Step-by-Step #378

Merged
merged 42 commits into from
Dec 26, 2024

Conversation

aaronm-2112
Copy link
Member

@aaronm-2112 aaronm-2112 commented Dec 26, 2024

Summary by Sourcery

Update the Prepare Dataset Step-by-Step feature to allow guest contributors on Pennsieve datasets to use it.

New Features:

  • Allow guest contributors on Pennsieve datasets to use the Prepare Dataset Step-by-Step feature.

Tests:

  • Check if the user has permissions to modify the Pennsieve dataset metadata.

aaronm-2112 and others added 30 commits December 2, 2024 15:14
Copy link

Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again!

Copy link
Contributor

sourcery-ai bot commented Dec 26, 2024

Reviewer's Guide by Sourcery

This pull request introduces a change that allows guest contributors in Pennsieve to utilize the "Prepare Dataset Step-by-Step" feature. The core implementation revolves around checking the user's permissions to modify Pennsieve dataset metadata. If a user lacks these permissions, specific steps within the guided dataset preparation workflow are skipped.

Sequence diagram for guest contributor dataset preparation flow

sequenceDiagram
    actor Guest as Guest Contributor
    participant SODA as SODA App
    participant API as Pennsieve API

    Guest->>SODA: Start dataset preparation
    SODA->>API: getDatasetAccessDetails()
    API-->>SODA: Return {userRole, userCanModifyPennsieveMetadata}
    alt userCanModifyPennsieveMetadata is false
        SODA->>SODA: Skip permissions tab
        SODA->>SODA: Skip banner image tab
        SODA->>SODA: Skip license tab
    else userCanModifyPennsieveMetadata is true
        SODA->>SODA: Show all tabs
    end
    SODA-->>Guest: Display appropriate workflow steps
Loading

State diagram for dataset preparation permissions

stateDiagram-v2
    [*] --> CheckPermissions
    CheckPermissions --> GuestFlow: userCanModifyPennsieveMetadata = false
    CheckPermissions --> FullFlow: userCanModifyPennsieveMetadata = true

    state GuestFlow {
        [*] --> LimitedAccess
        LimitedAccess: - No permissions management
        LimitedAccess: - No banner image
        LimitedAccess: - No license management
    }

    state FullFlow {
        [*] --> FullAccess
        FullAccess: - All features available
        FullAccess: - Can modify permissions
        FullAccess: - Can set banner image
        FullAccess: - Can manage license
    }
Loading

File-Level Changes

Change Details Files
Check User Permissions to Modify Metadata
  • Added a check to determine if the user has permissions to modify Pennsieve dataset metadata.
  • If the user lacks modification permissions, the metadata editing steps are skipped.
  • Added error handling to catch and log potential issues during the permission check.
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
Skip Steps for Guest Contributors
  • Implemented logic to skip specific pages in the guided workflow if the user is identified as a guest contributor.
  • The skipped pages include banner image, license assignment, and permissions designation.
  • Added functions to dynamically skip and unskip pages based on user role and permissions.
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
Update Pennsieve Account Confirmation Logic
  • Revised the account confirmation process to account for changes in user role or guest status.
  • Added a check to ensure users reconfirm their account details if their role or guest status changes within the workspace.
  • Implemented a function to determine the user's guest status in the workspace.
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
src/renderer/src/scripts/globals.js
Refactor Dataset Name Handling
  • Improved the handling of dataset names by retrieving the name directly from Pennsieve.
  • Added logging to track dataset name retrieval and usage.
  • Updated the UI to reflect the retrieved dataset name.
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
Update Dataset Upload Logic
  • Modified the dataset upload process to account for user permissions.
  • Added a check to skip metadata editing steps if the user lacks the necessary permissions.
  • Updated logging to track metadata editing actions during upload.
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
Patch Previous Guided Mode Versions
  • Removed the automatic skipping of the Pennsieve login tab for datasets started from Pennsieve.
  • Ensured the validation page is always unskipped for non-SPARC datasets.
  • Updated the handling of skipped pages to maintain consistency across different SODA versions.
src/renderer/src/scripts/guided-mode/guided-curate-dataset.js
Add Dataset Access Details API
  • Introduced a new API endpoint to retrieve detailed dataset access information, including user role and metadata modification permissions.
  • Updated relevant functions and components to utilize the new API endpoint.
  • Improved error handling and logging related to dataset access and permissions.
src/renderer/src/scripts/others/api/api.js
src/pyflask/manageDatasets/manage_datasets.py
src/pyflask/permissions/permissions.py
src/renderer/src/scripts/disseminate/prePublishingReview.js
src/pyflask/organizeDatasets/organize_datasets.py
Update UI Elements and Styling
  • Adjusted the font size of dropdown button text for better readability.
  • Improved the wording of user directions in the guided curate dataset section for clarity.
src/renderer/src/components/utils/ui/DropDownNote/index.jsx
src/renderer/src/sections/guided_mode/guided_curate_dataset.html
Update Package Version and Changelog
  • Updated the package version to reflect the changes introduced in this pull request.
  • Added a changelog entry to document the new features and bug fixes.
  • Updated the build and deploy workflows to include the latest changes.
package.json
CHANGELOG.md
.github/workflows/Build-and-deploy-linux.yml
.github/workflows/Build-and-deploy-mac.yml
.github/workflows/Build-and-deploy-win.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions!

Copy link
Contributor

@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 @aaronm-2112 - I've reviewed your changes and they look great!

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.

@aaronm-2112 aaronm-2112 merged commit a00ba2c into pre-staging Dec 26, 2024
7 of 11 checks passed
Copy link

Thanks for closing this pull request! If you have any further questions, please feel free to open a new issue. We are always happy to help!

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