Skip to content

feat(VE-7062-dev): disable editing based on workflow stage rules#489

Merged
faraazb merged 12 commits intodevelop_v3from
dev-VE-7062-disable-entry-edit-workflow-stage
Aug 13, 2025
Merged

feat(VE-7062-dev): disable editing based on workflow stage rules#489
faraazb merged 12 commits intodevelop_v3from
dev-VE-7062-disable-entry-edit-workflow-stage

Conversation

@faraazb
Copy link
Copy Markdown
Contributor

@faraazb faraazb commented Aug 7, 2025

  • Fetch entry workflow stage details from parent
  • Disable inline editing when workflow stage rules disallow updating

Code changes

  • Refactors fetching entry permissions and workflow stage details into a single function which also does post message error handling.
  • Introduce new messages in isFieldDisabled.ts similar to QuickFormInfoBanner in Visual Builder
  • Fix broken unit tests
  • Add new cases for isFieldDisabled.ts utility

Fetch workflow stage details for the entry from parent and
disable editing based on the received data
@faraazb faraazb requested a review from a team as a code owner August 7, 2025 11:56
@faraazb faraazb changed the title feat(VE-7062): disable editing when workflow stage rules restrict the same feat(VE-7062-dev): disable editing when workflow stage rules restrict the same Aug 7, 2025
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 7, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 72.39% 9223 / 12740
🔵 Statements 72.39% 9223 / 12740
🔵 Functions 72.17% 332 / 460
🔵 Branches 83.95% 1146 / 1365
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/visualBuilder/components/FieldToolbar.tsx 77.26% 75% 37.5% 77.26% 62-110, 133, 172, 207-224, 245-248, 271-280, 309-317, 325-326, 329-330, 382-388, 405-406, 470, 507, 588-595
src/visualBuilder/components/fieldLabelWrapper.tsx 80.55% 70% 80% 80.55% 45-47, 55-57, 139-150, 153-157, 218-219, 223-228, 232, 287-289, 295-313, 318-330
src/visualBuilder/generators/generateToolbar.tsx 90% 86.66% 83.33% 90% 28-29, 90-95, 143-147, 190-191
src/visualBuilder/listeners/mouseClick.ts 73.23% 66.66% 90.9% 73.23% 88, 98-104, 109-110, 113-118, 131-159, 171-172, 185-186, 231, 290-296, 334-340, 358-368
src/visualBuilder/listeners/mouseHover.ts 63.15% 43.24% 61.11% 63.15% 49-56, 73-74, 121-131, 137-138, 145-148, 151-153, 159, 173-174, 183-199, 206-208, 210-251, 259-261, 263-265, 273-281, 284-287, 289-291, 306-310, 373-374
src/visualBuilder/utils/fetchEntryPermissionsAndStageDetails.ts 77.27% 20% 100% 77.27% 31-35, 37-41
src/visualBuilder/utils/getEntryPermissions.ts 0% 0% 0% 0% 1-47
src/visualBuilder/utils/getWorkflowStageDetails.ts 100% 100% 100% 100%
src/visualBuilder/utils/handleIndividualFields.ts 98.37% 85.71% 100% 98.37% 94-95
src/visualBuilder/utils/isFieldDisabled.ts 100% 97.61% 100% 100%
src/visualBuilder/utils/updateFocussedState.ts 56.5% 60.71% 100% 56.5% 45, 57-59, 61-63, 65, 203-206, 208-239, 326-330, 333-350, 353-363, 366-383, 390-435, 442-464, 470-472
src/visualBuilder/utils/types/postMessage.types.ts 100% 100% 100% 100%
Generated in workflow #517 for commit 289c505 by the Vitest Coverage Report Action

@faraazb faraazb changed the title feat(VE-7062-dev): disable editing when workflow stage rules restrict the same feat(VE-7062-dev): disable editing based on workflow stage rules Aug 8, 2025
Copy link
Copy Markdown
Contributor

@csAyushDubey csAyushDubey left a comment

Choose a reason for hiding this comment

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

Changes look good, just a few suggestions

Comment thread src/visualBuilder/utils/isFieldDisabled.ts Outdated
Comment thread src/visualBuilder/utils/isFieldDisabled.ts Outdated
});
} else if (
eventName ===
VisualBuilderPostMessageEvents.GET_WORKFLOW_STAGE_DETAILS
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@faraazb - Why not use switch instead of so many else if's?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can. Will make the change. Will do it across all the 3 files.

VisualBuilderPostMessageEvents.GET_WORKFLOW_STAGE_DETAILS
) {
return Promise.resolve({
stage: { name: "Example Stage" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we move "Example Stage" to a constant since its used at multiple places?

VisualBuilderPostMessageEvents.GET_WORKFLOW_STAGE_DETAILS
) {
return Promise.resolve({
stage: { name: "Example Stage" },
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same comment on applicable cases where string name is "Example Stage"

entryAclPromise,
entryWorkflowStageDetailsPromise,
]);
if (results[0].status === "rejected") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

use constants for rejected and fulfilled.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

"rejected" or "fulfilled" are built in values for Promise status. I think this is fine.

@faraazb faraazb force-pushed the dev-VE-7062-disable-entry-edit-workflow-stage branch from a2d04f6 to b26c4ac Compare August 11, 2025 18:02
Copy link
Copy Markdown
Contributor

@csAyushDubey csAyushDubey left a comment

Choose a reason for hiding this comment

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

LGTM

@faraazb faraazb merged commit fb85e53 into develop_v3 Aug 13, 2025
10 checks passed
@faraazb faraazb deleted the dev-VE-7062-disable-entry-edit-workflow-stage branch August 13, 2025 09:18
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