Skip to content

Conversation

gustavogama-cll
Copy link
Collaborator

@gustavogama-cll gustavogama-cll commented May 22, 2025

Description

Display the "Approve" button on the latest two versions of a job spec in the "job proposal details" page that have the "cancelled" status. This allows users to approve older versions of a job spec.

This PR must be deployed along with PR # from the core repo.

DX-534

Steps to Test

  1. yarn && yarn setup
  2. yarn start
  3. Select a job proposal that has multiple versions
  4. Check that all versions in the "cancelled" state have an Approve button
  5. Approve an order version of a job spec
  6. If there was another job previously in the "approved", an error message should be displayed
  7. If needed, cancel the version that is currently approved (likely the newest one)
  8. Try to approve an older job spec.
  9. If no other version was in the "approved" state, the approval operation should complete successfully

Checklist

  • This PR has an accompanying changeset if needed.

Screenshots

operator-ui-approve-old-job-spec-version.mp4

Update after Sebastian's suggestion to limit the set of cancelled specs that can be approved to the last two versions:

(error returned by backend attempting to approve an older spec using the previous patch)
image

(new UI version; only the last 2 cancelled proposals are "approvable"; a different message is displayed when approving an older spec version)

operator-ui-approve-old-job-spec-version-v3.mp4

@gustavogama-cll gustavogama-cll force-pushed the ggama/feat-allow-approval-previous-job-specs branch from 8b097ba to 6b2650d Compare May 22, 2025 06:36
@gustavogama-cll gustavogama-cll requested a review from jkongie May 22, 2025 23:06
jkongie
jkongie previously approved these changes May 27, 2025
Display the "Approve" button on all versions of a job spec in the "job
proposal details" page that have the "cancelled" status. This allows
users to approve older versions of a job spec.

This PR must be deployed along with PR # from the core repo.

[DX-534](https://smartcontract-it.atlassian.net/browse/DX-534)
@gustavogama-cll gustavogama-cll force-pushed the ggama/feat-allow-approval-previous-job-specs branch from 90b4068 to ab9474d Compare June 10, 2025 06:50
@gustavogama-cll gustavogama-cll requested a review from jkongie June 10, 2025 18:15
@gustavogama-cll gustavogama-cll force-pushed the ggama/feat-allow-approval-previous-job-specs branch from 779893d to 5d06377 Compare June 10, 2025 20:02
@gustavogama-cll gustavogama-cll force-pushed the ggama/feat-allow-approval-previous-job-specs branch from 5d06377 to 8dab59c Compare June 10, 2025 20:06
@sebawo sebawo requested review from sebawo and Copilot June 11, 2025 10:35
sebawo
sebawo previously approved these changes Jun 11, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables users to approve up to two previous cancelled versions of a job spec by introducing a new approvePrevious action and updating the UI and tests accordingly.

  • Add approvePrevious to ConfirmationDialogArgs, dialog text, and handler logic
  • Compute approvableCancelledJobSpecs to show approve buttons only on the two most recent cancelled specs
  • Add data-testid to panels and extend tests for button visibility across statuses

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/screens/JobProposal/SpecsView.tsx Add approvePrevious action, confirmation dialog text, approval logic, and data-testid
src/screens/JobProposal/SpecsView.test.tsx Expand tests to cover Approve button visibility for pending, cancelled, deleted, and revoked
.changeset/flat-toys-roll.md Add changeset entry for allowing approval of previous job spec versions
Comments suppressed due to low confidence (2)

src/screens/JobProposal/SpecsView.tsx:253

  • [nitpick] Consider using a more specific data-testid (e.g., spec-expansion-panel) to clearly identify these panels in tests and prevent collisions with other components.
data-testid="expansion-panel"

src/screens/JobProposal/SpecsView.test.tsx:409

  • [nitpick] Add a test to verify that clicking the "Approve" button on a previous version opens the confirmation dialog with the correct title (Approve Previous Version of Job Proposal) and body content, ensuring the new approvePrevious variant is displayed as intended.
  })

jkongie
jkongie previously approved these changes Jun 11, 2025
fix spec id comparison

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@gustavogama-cll gustavogama-cll dismissed stale reviews from jkongie and sebawo via 6d9785c June 11, 2025 14:33
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@cl-sonarqube-production
Copy link

@jkongie jkongie merged commit 752bbd4 into main Jun 11, 2025
10 checks passed
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