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(form-workspaces/2): add form workspaces modals #4051

Merged

Conversation

hanstirtaputra
Copy link
Contributor

This PR builds on #4041

Problem

We need to have modals to confirm user actions for workspace-related functionality

Closes #4036

Solution

Add workspace related modal views for create/rename/delete workspace

Breaking Changes

  • No - this PR is backwards compatible

Before & After Screenshots

Storybooks added under Pages/WorkspacePage/DeleteWorkspaceModal and Pages/WorkspacePage/CreateOrRenameWorkspaceModal

Copy link
Contributor

@karrui karrui left a comment

Choose a reason for hiding this comment

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

lgtm for now, since there is no logic yet.

@hanstirtaputra hanstirtaputra force-pushed the form-v2/feat/add-workspace-side-menu branch from 6741ba9 to 145a3cb Compare July 5, 2022 09:25
@hanstirtaputra hanstirtaputra force-pushed the form-v2/feat/add-workspace-modals branch from 39d124c to c158a18 Compare July 5, 2022 11:07
@hanstirtaputra hanstirtaputra force-pushed the form-v2/feat/add-workspace-side-menu branch from fab0698 to d0a3733 Compare July 20, 2022 03:45
@hanstirtaputra hanstirtaputra force-pushed the form-v2/feat/add-workspace-modals branch from c158a18 to 53ee64d Compare July 20, 2022 06:08
Copy link
Contributor

@karrui karrui left a comment

Choose a reason for hiding this comment

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

lgtm again, will we be merging all the approved PRs?

message: 'Workspace title cannot contain special characters',
},
validate: {
trimMinLength: (value: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

with this validation we probably do not need the minLength validation above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the minLength validation

@hanstirtaputra
Copy link
Contributor Author

lgtm again, will we be merging all the approved PRs?

I'm waiting to merge #4041 first though before this, since this one builds on top of that. Will rebase #4041 and this

@hanstirtaputra hanstirtaputra force-pushed the form-v2/feat/add-workspace-side-menu branch from d0a3733 to 33cba17 Compare August 2, 2022 10:41
Base automatically changed from form-v2/feat/add-workspace-side-menu to form-v2/form-workspaces August 4, 2022 12:00
@hanstirtaputra hanstirtaputra force-pushed the form-v2/feat/add-workspace-modals branch from 53ee64d to 1e03a10 Compare August 4, 2022 14:43
@hanstirtaputra hanstirtaputra force-pushed the form-v2/feat/add-workspace-modals branch from 1e03a10 to 0787589 Compare August 4, 2022 14:49
@hanstirtaputra hanstirtaputra merged commit d55ed75 into form-v2/form-workspaces Aug 5, 2022
@hanstirtaputra hanstirtaputra deleted the form-v2/feat/add-workspace-modals branch August 5, 2022 02:51
foochifa added a commit that referenced this pull request Oct 25, 2023
* feat(form-workspaces): add workspace api endpoints (#4182)

* feat: add get workspaces endpoint skeleton

* feat: add create workspace API endpoint

* feat: add update workspace title API endpoint

* feat: add delete workspace API endpoint

* feat: add get workspace forms API endpoint

* feat: add delete workspace forms API endpoint

* feat: add move workspace forms API endpoint

* feat: add auth and logging for workspace routes

* feat: update workspace service to take in necessasry parameters

* feat: add request body for delete workspace api

* feat(form-workspaces-be/1): add workspace db model (#4200)

* feat: add workspace database model

* feat: add workspace db model tests

* refactor: update variable naming in workspace tests

* feat: update workspace formId validation to test for existent admin

* feat: add WorkspaceDto

* fix: update workspace formIds validation rules

* fix: removed unused database fields renaming

* refactor: simplify expression for workspace formIds validation

* feat: add timestamps for workspace db model

* fix: add more workspace model tests and rename test descriptions

* fix: reduce maximum title length of workspace to 50 chars

* feat(form-workspaces-be/2): add get workspaces functionality (#4247)

* fix: removed unused database fields renaming

* feat: add timestamps for workspace db model

* feat: add get workspaces functionality

* feat: add get workspaces tests

* feat: update workspace mapRouteError to include more MongoErrors

* refactor: remove unused MissingUserError in workspace service

* fix: include _id in Workspace type

* feat: add test to check workspace ordering in GET API

* refactor: rename mock constant in model tests

* refactor: remove unused virtual count in workspace model

* feat: add controller test for database conflict error

* feat(form-workspaces-be/3): add create workspace logic  (#4251)

* feat: add create workspace functionality

* feat: add tests for create workspace functionality

* fix: remove return type for create workspace method in model

* feat: add database conflict error test for workspace controller

* fix: failing tests

* fix: update joi validation for workspace title to 50 chars

* feat(form-workspaces-be/4): add update workspace title logic (#4252)

* feat: add update workspace title functionality

* feat: add update workspace title functionality tests

* refactor: workspace model to simplify function call

* feat: add workspace admin permissions check for udpate workspace title

* fix: return appropriate error when unable to update workspace title

* refactor: use object arguments for updateWorkspaceTitle

* fix: broken test cases

* feat: add route test for update title when user has no permissions

* refactor: remove admin field from updateWorkspaceTitle

* fix: update workspace validation implementation

* refactor: workspace utils error messaging

* feat(form-workspaces/1): add form workspaces side menu (#4041)

* refactor: move Workspace contents to a WorkspaceContent component

* feat: add side menu view to WorkspacePage

* feat: add mobile view for workspace page

* feat: use msw for GET workspaces instead of hardcoding in WorkspacePage

* refactor: WorkspacePage to combine mobile and desktop views

* fix: update size and page validation in useWorkspaceForms

* fix: remove react rollout banner since workspaces is released after rollout

* feat: update workspace page to include AdminNavBar

* feat(form-workspaces/2): add form workspaces modals (#4051)

* feat: add create workspace modal view for desktop and mobile

* refactor: move create workspace modal to CreateOrRenameWorkspaceModal.tsx

* feat: add storybook for create workspace modal

* feat: add edit workspace icon button

* chore: cleanup unused formCount prop in WorkspaceHeader

* feat: add rename workspace modal

* feat: add storybook for rename workspace modal

* feat: add delete workspace modal

* feat: add delete workspace modal storybook

* refactor: split CreateOrRenameWorkspaceModal to Create and Rename modals

* feat: add RenameWorkspaceModal storybook

* fix: add isFullWidth for mobile viewport modal buttons

* refactor: cleanup unused minLength validator in workspaceValidation

* feat(form-workspaces-be/5): add delete workspace logic (#4254)

* feat: add delete workspace functionality

* feat: add delete workspace functionality tests

* refactor: use object function argument for deleteWorkspace

* fix: move deleteWorkspace transaction logic to WorkspaceService

* feat: update deleteWorkspace to return boolean instead of void

* refactor: deleteWorkspace transaction to use mongoose withTransaction

* fix: use form document method to archive forms instead of static method

This resolves the issue of failing transaction due to 'nearest' readPreference for FormSchema.
Setting readPreference for static queries throws an error.

* fix: tests for deleteWorkspace functionality

* refactor: remove admin field from deleteWorkspace

* fix: delete workspace transaction to update model instead of documents

Fixed the readPreference issue in multi-document transactions by setting
readPreference in updateMany function on FormModel to be 'primary'

* refactor: workspace service test to reduce db queries

* fix: remove unused session parameter from form model archive method

* feat(form-workspaces-be/7): add move forms from multiple source workspaces functionality (#6418)

* feat: add delete workspace functionality

* feat: add delete workspace functionality tests

* refactor: use object function argument for deleteWorkspace

* fix: move deleteWorkspace transaction logic to WorkspaceService

* feat: update deleteWorkspace to return boolean instead of void

* refactor: deleteWorkspace transaction to use mongoose withTransaction

* fix: use form document method to archive forms instead of static method

This resolves the issue of failing transaction due to 'nearest' readPreference for FormSchema.
Setting readPreference for static queries throws an error.

* fix: tests for deleteWorkspace functionality

* refactor: remove admin field from deleteWorkspace

* fix: delete workspace transaction to update model instead of documents

Fixed the readPreference issue in multi-document transactions by setting
readPreference in updateMany function on FormModel to be 'primary'

* refactor: workspace service test to reduce db queries

* fix: remove unused session parameter from form model archive method

* fix: add new flag to deleteWorkspace findOneAndDelete

* feat: add move forms to another workspace functionality

* test: happy path remove and add formIds to workspace

* test: fix delete and add move form happy path workspace routes

* test: happy path test for workspace service move form

* test: add error test for workspace routes

---------

Co-authored-by: Hans Tirtaputra <[email protected]>

* test: modernise test cases

* feat(workspaces): Integrating BE with FE (#6560)

* feat: add api services for workspace

* feat: update Workspace page with default workspace

* feat: update workspace context

* feat: add workspace mutations

* chore: trim workspace content props

* feat: add functionality for rename and delete workspace

* feat: add default workspace to menu

* feat: implement create workspace

* feat: update workspace header

* feat: implement row action and move form to workspace

* feat: remove workspace mocks from browser

* feat: remove form from workspaces after archive

* feat: reset rename modal useform value

* fix: do not mutate if title is same

* fix: move to selected workspace even form exists

* fix: do not switch to workspace after moving

* fix: mobile mode for workspace

* chore: clean unused attributes

* chore: improve spacing for desktop workspace header

* chore: improve spacing for mobile view too

* fix: align workspace with develop

* fix: useQuery keys

* feat: delete workspace message

* fix: BE tests

* fix: delete workspace copy

* chore: abstract out use context form workspace modals

* fix: mock workspace for storybook

* fix: mobile workspace page grid and menu padding

* feat: display checkbox on form's current workspace

* feat: use callback and memo for workspace row actions

* feat: mobile drawer actions

* fix: move emptyworkspace to WorkspaceContent

* fix(workspaces): remove form from workspace upon collaborator removal (#6592)

* fix: remove form from workspace upon collaborator removal

* fix: typing of default workspace

* fix: return promise and catch error

* fix(workspaces): workspace design review (#6632)

* fix: UI updates from design review

* feat: change text style of default workspace

* feat: bold deleted workspace name

* feat: drawer for mobile workspace edit

* fix: separate form count from the workspace title

* feat: update workspace content and removed unused WorkspacePageContent

* feat: update empty workspace component with folder variation

* feat: display emptyworkspace based on whether default

* chore: copy fixes

* chore: copy for aria-label

* feat(workspaces): create and duplicate form into active workspace (#6755)

* feat: create and move form to workspace transaction

* feat: inject workspace Id to create form handler

* fix: promise return of create form transaction

* fix: invalidate workspace query cache when creating form

* feat: allow for optional workspaceId param in duplicate form

* feat: update dupe form wizard to duplicate to active workspace

* fix: do not send workspaceId if is default workspace

* test: fix admin controller tests

* test: add workspaceId test to admin controller

* chore: abstract processing of form into workspace for testing

* test: form into workspace processing

* chore: use duplicate dto for duplicate controller

* chore: use duplicate dto in FE mutations

* docs: improve explanation of workspaceId logic

* chore: use CreateFormBodyDto type for validator

* feat(workspaces): remove form from workspace (#6754)

* feat: route to remove workspace from forms

* feat: FE mutation to remove form from workspaces

* feat: add remove form from workspace to row actions

* chore: remove deprecated workspace form routes

* fix: design review

* fix: show workspace header for empty workspaces

* fix: span the workspace content

* test: workspace route test for removing from

* feat: use a post request for removing forms for extensibility

* test: update tests

* fix: update remove form workspace service users

* test: fix admin form controller tests

* refactor: abstract out empty workspace components

* chore: update meta action name and messages

* refactor: de-DRY workspace click

* chore: remove unused method and imports

* fix: revert mobile margins

* fix: prevent overflow of folder name in mobile

* feat(workspaces): feature announcement  (#6831)

* chore: update copy of workspace validation messages

* chore: remove bolding from workspace titel

* feat: folders feature announcement

* fix: conditional rendering of create workspace modal

* fix: change border to grid level

* fix: make content bg always neutral 100

* fix: apply column length to both md and lg

* fix: create form modal stories

* fix: additional provider for create default modal

* fix(workspaces): QA issues (#6836)

* fix: empty grey scrollbars

* fix: alignment of text in empty folder

* fix: reduce length of workspace title to 25

* fix: add min width to button to prevent text overflow

* fix: conditionally rename modal

* fix: reset move workspace state on close

* fix: use constants for min and max title length

* fix: use rem over px

* fix(workspaces): use svg for announcement and what's new (#6839)

* feat: use svg

* feat: use svg instead of animation json

* ref: add type to AnnouncementsFeatureList

* fix: use correct import file path

* fix: change announcement date to 2023-10-26

* fix: delete unused json

* fix: typing error of arg of archiveForms

---------

Co-authored-by: Hans Sebastian Tirtaputra <[email protected]>
Co-authored-by: wanlingt <[email protected]>
wanlingt added a commit that referenced this pull request Oct 30, 2023
* feat(form-workspaces): add workspace api endpoints (#4182)

* feat: add get workspaces endpoint skeleton

* feat: add create workspace API endpoint

* feat: add update workspace title API endpoint

* feat: add delete workspace API endpoint

* feat: add get workspace forms API endpoint

* feat: add delete workspace forms API endpoint

* feat: add move workspace forms API endpoint

* feat: add auth and logging for workspace routes

* feat: update workspace service to take in necessasry parameters

* feat: add request body for delete workspace api

* feat(form-workspaces-be/1): add workspace db model (#4200)

* feat: add workspace database model

* feat: add workspace db model tests

* refactor: update variable naming in workspace tests

* feat: update workspace formId validation to test for existent admin

* feat: add WorkspaceDto

* fix: update workspace formIds validation rules

* fix: removed unused database fields renaming

* refactor: simplify expression for workspace formIds validation

* feat: add timestamps for workspace db model

* fix: add more workspace model tests and rename test descriptions

* fix: reduce maximum title length of workspace to 50 chars

* feat(form-workspaces-be/2): add get workspaces functionality (#4247)

* fix: removed unused database fields renaming

* feat: add timestamps for workspace db model

* feat: add get workspaces functionality

* feat: add get workspaces tests

* feat: update workspace mapRouteError to include more MongoErrors

* refactor: remove unused MissingUserError in workspace service

* fix: include _id in Workspace type

* feat: add test to check workspace ordering in GET API

* refactor: rename mock constant in model tests

* refactor: remove unused virtual count in workspace model

* feat: add controller test for database conflict error

* feat(form-workspaces-be/3): add create workspace logic  (#4251)

* feat: add create workspace functionality

* feat: add tests for create workspace functionality

* fix: remove return type for create workspace method in model

* feat: add database conflict error test for workspace controller

* fix: failing tests

* fix: update joi validation for workspace title to 50 chars

* feat(form-workspaces-be/4): add update workspace title logic (#4252)

* feat: add update workspace title functionality

* feat: add update workspace title functionality tests

* refactor: workspace model to simplify function call

* feat: add workspace admin permissions check for udpate workspace title

* fix: return appropriate error when unable to update workspace title

* refactor: use object arguments for updateWorkspaceTitle

* fix: broken test cases

* feat: add route test for update title when user has no permissions

* refactor: remove admin field from updateWorkspaceTitle

* fix: update workspace validation implementation

* refactor: workspace utils error messaging

* feat(form-workspaces/1): add form workspaces side menu (#4041)

* refactor: move Workspace contents to a WorkspaceContent component

* feat: add side menu view to WorkspacePage

* feat: add mobile view for workspace page

* feat: use msw for GET workspaces instead of hardcoding in WorkspacePage

* refactor: WorkspacePage to combine mobile and desktop views

* fix: update size and page validation in useWorkspaceForms

* fix: remove react rollout banner since workspaces is released after rollout

* feat: update workspace page to include AdminNavBar

* feat(form-workspaces/2): add form workspaces modals (#4051)

* feat: add create workspace modal view for desktop and mobile

* refactor: move create workspace modal to CreateOrRenameWorkspaceModal.tsx

* feat: add storybook for create workspace modal

* feat: add edit workspace icon button

* chore: cleanup unused formCount prop in WorkspaceHeader

* feat: add rename workspace modal

* feat: add storybook for rename workspace modal

* feat: add delete workspace modal

* feat: add delete workspace modal storybook

* refactor: split CreateOrRenameWorkspaceModal to Create and Rename modals

* feat: add RenameWorkspaceModal storybook

* fix: add isFullWidth for mobile viewport modal buttons

* refactor: cleanup unused minLength validator in workspaceValidation

* feat(form-workspaces-be/5): add delete workspace logic (#4254)

* feat: add delete workspace functionality

* feat: add delete workspace functionality tests

* refactor: use object function argument for deleteWorkspace

* fix: move deleteWorkspace transaction logic to WorkspaceService

* feat: update deleteWorkspace to return boolean instead of void

* refactor: deleteWorkspace transaction to use mongoose withTransaction

* fix: use form document method to archive forms instead of static method

This resolves the issue of failing transaction due to 'nearest' readPreference for FormSchema.
Setting readPreference for static queries throws an error.

* fix: tests for deleteWorkspace functionality

* refactor: remove admin field from deleteWorkspace

* fix: delete workspace transaction to update model instead of documents

Fixed the readPreference issue in multi-document transactions by setting
readPreference in updateMany function on FormModel to be 'primary'

* refactor: workspace service test to reduce db queries

* fix: remove unused session parameter from form model archive method

* feat(form-workspaces-be/7): add move forms from multiple source workspaces functionality (#6418)

* feat: add delete workspace functionality

* feat: add delete workspace functionality tests

* refactor: use object function argument for deleteWorkspace

* fix: move deleteWorkspace transaction logic to WorkspaceService

* feat: update deleteWorkspace to return boolean instead of void

* refactor: deleteWorkspace transaction to use mongoose withTransaction

* fix: use form document method to archive forms instead of static method

This resolves the issue of failing transaction due to 'nearest' readPreference for FormSchema.
Setting readPreference for static queries throws an error.

* fix: tests for deleteWorkspace functionality

* refactor: remove admin field from deleteWorkspace

* fix: delete workspace transaction to update model instead of documents

Fixed the readPreference issue in multi-document transactions by setting
readPreference in updateMany function on FormModel to be 'primary'

* refactor: workspace service test to reduce db queries

* fix: remove unused session parameter from form model archive method

* fix: add new flag to deleteWorkspace findOneAndDelete

* feat: add move forms to another workspace functionality

* test: happy path remove and add formIds to workspace

* test: fix delete and add move form happy path workspace routes

* test: happy path test for workspace service move form

* test: add error test for workspace routes

---------

Co-authored-by: Hans Tirtaputra <[email protected]>

* test: modernise test cases

* feat(workspaces): Integrating BE with FE (#6560)

* feat: add api services for workspace

* feat: update Workspace page with default workspace

* feat: update workspace context

* feat: add workspace mutations

* chore: trim workspace content props

* feat: add functionality for rename and delete workspace

* feat: add default workspace to menu

* feat: implement create workspace

* feat: update workspace header

* feat: implement row action and move form to workspace

* feat: remove workspace mocks from browser

* feat: remove form from workspaces after archive

* feat: reset rename modal useform value

* fix: do not mutate if title is same

* fix: move to selected workspace even form exists

* fix: do not switch to workspace after moving

* fix: mobile mode for workspace

* chore: clean unused attributes

* chore: improve spacing for desktop workspace header

* chore: improve spacing for mobile view too

* fix: align workspace with develop

* fix: useQuery keys

* feat: delete workspace message

* fix: BE tests

* fix: delete workspace copy

* chore: abstract out use context form workspace modals

* fix: mock workspace for storybook

* fix: mobile workspace page grid and menu padding

* feat: display checkbox on form's current workspace

* feat: use callback and memo for workspace row actions

* feat: mobile drawer actions

* fix: move emptyworkspace to WorkspaceContent

* fix(workspaces): remove form from workspace upon collaborator removal (#6592)

* fix: remove form from workspace upon collaborator removal

* fix: typing of default workspace

* fix: return promise and catch error

* fix(workspaces): workspace design review (#6632)

* fix: UI updates from design review

* feat: change text style of default workspace

* feat: bold deleted workspace name

* feat: drawer for mobile workspace edit

* fix: separate form count from the workspace title

* feat: update workspace content and removed unused WorkspacePageContent

* feat: update empty workspace component with folder variation

* feat: display emptyworkspace based on whether default

* chore: copy fixes

* chore: copy for aria-label

* feat(workspaces): create and duplicate form into active workspace (#6755)

* feat: create and move form to workspace transaction

* feat: inject workspace Id to create form handler

* fix: promise return of create form transaction

* fix: invalidate workspace query cache when creating form

* feat: allow for optional workspaceId param in duplicate form

* feat: update dupe form wizard to duplicate to active workspace

* fix: do not send workspaceId if is default workspace

* test: fix admin controller tests

* test: add workspaceId test to admin controller

* chore: abstract processing of form into workspace for testing

* test: form into workspace processing

* chore: use duplicate dto for duplicate controller

* chore: use duplicate dto in FE mutations

* docs: improve explanation of workspaceId logic

* chore: use CreateFormBodyDto type for validator

* feat(workspaces): remove form from workspace (#6754)

* feat: route to remove workspace from forms

* feat: FE mutation to remove form from workspaces

* feat: add remove form from workspace to row actions

* chore: remove deprecated workspace form routes

* fix: design review

* fix: show workspace header for empty workspaces

* fix: span the workspace content

* test: workspace route test for removing from

* feat: use a post request for removing forms for extensibility

* test: update tests

* fix: update remove form workspace service users

* test: fix admin form controller tests

* refactor: abstract out empty workspace components

* chore: update meta action name and messages

* refactor: de-DRY workspace click

* chore: remove unused method and imports

* fix: revert mobile margins

* fix: prevent overflow of folder name in mobile

* feat(workspaces): feature announcement  (#6831)

* chore: update copy of workspace validation messages

* chore: remove bolding from workspace titel

* feat: folders feature announcement

* fix: conditional rendering of create workspace modal

* fix: change border to grid level

* fix: make content bg always neutral 100

* fix: apply column length to both md and lg

* fix: create form modal stories

* fix: additional provider for create default modal

* fix(workspaces): QA issues (#6836)

* fix: empty grey scrollbars

* fix: alignment of text in empty folder

* fix: reduce length of workspace title to 25

* fix: add min width to button to prevent text overflow

* fix: conditionally rename modal

* fix: reset move workspace state on close

* fix: use constants for min and max title length

* fix: use rem over px

* fix(workspaces): use svg for announcement and what's new (#6839)

* feat: use svg

* feat: use svg instead of animation json

* ref: add type to AnnouncementsFeatureList

* fix: use correct import file path

* fix: change announcement date to 2023-10-26

* fix: delete unused json

* fix: typing error of arg of archiveForms

* fix: update release date to 31 oct 2023

---------

Co-authored-by: Hans Sebastian Tirtaputra <[email protected]>
Co-authored-by: Foo Chi Fa <[email protected]>
Co-authored-by: foochifa <[email protected]>
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.

2 participants