-
Notifications
You must be signed in to change notification settings - Fork 7
Fix notes not cleared when changing pages #1686
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bed2ac0
Fix notes not cleared when changing pages
Georgi2704 2db85f8
Fixed some type issues, detail pages work in progress
Georgi2704 1e92cfd
Working build, added note detail page editor
Georgi2704 216012a
Added changeset
Georgi2704 67e077c
Make boolean parameters non-optional
Georgi2704 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@orchestrator-ui/orchestrator-ui-components': minor | ||
| --- | ||
|
|
||
| Fix notes not updating when changing pages, fix cancel button resetting note to older value |
Submodule wfo-ui
updated
3 files
| +13 −16 | package-lock.json | |
| +1 −1 | package.json | |
| +57 −37 | pages/_app.tsx |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...estrator-ui-components/src/components/WfoInlineNoteEdit/WfoSubscriptionDetailNoteEdit.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import type { FC } from 'react'; | ||
| import React from 'react'; | ||
|
|
||
| import { WfoInlineNoteEdit } from '@/components'; | ||
| import { useGetSubscriptionDetailQuery } from '@/rtk'; | ||
| import { useStartProcessMutation } from '@/rtk/endpoints/forms'; | ||
| import { useUpdateSubscriptionDetailNoteOptimisticMutation } from '@/rtk/endpoints/subscriptionListMutation'; | ||
| import { SubscriptionDetail } from '@/types'; | ||
| import { INVISIBLE_CHARACTER } from '@/utils'; | ||
|
|
||
| interface WfoSubscriptionDetailNoteEditProps { | ||
| subscriptionId: SubscriptionDetail['subscriptionId']; | ||
| onlyShowOnHover?: boolean; | ||
| } | ||
|
|
||
| export const WfoSubscriptionDetailNoteEdit: FC< | ||
| WfoSubscriptionDetailNoteEditProps | ||
| > = ({ subscriptionId, onlyShowOnHover = false }) => { | ||
| const { data, endpointName } = useGetSubscriptionDetailQuery({ | ||
| subscriptionId, | ||
| }); | ||
|
|
||
| const selectedItem = data?.subscription ?? { note: '' }; | ||
| const [startProcess] = useStartProcessMutation(); | ||
| const [updateSub] = useUpdateSubscriptionDetailNoteOptimisticMutation(); | ||
|
|
||
| const triggerNoteModifyWorkflow = (note: string) => { | ||
| const noteModifyPayload = [ | ||
| { subscription_id: subscriptionId }, | ||
| { note: note === INVISIBLE_CHARACTER ? '' : note }, | ||
| ]; | ||
| startProcess({ | ||
| workflowName: 'modify_note', | ||
| userInputs: noteModifyPayload, | ||
| }); | ||
|
|
||
| updateSub({ | ||
| queryName: endpointName ?? '', | ||
| subscriptionId: subscriptionId, | ||
| note: note, | ||
| }); | ||
| }; | ||
|
|
||
| return ( | ||
| <WfoInlineNoteEdit | ||
| value={ | ||
| selectedItem?.note?.trim() | ||
| ? selectedItem.note | ||
| : INVISIBLE_CHARACTER | ||
| } | ||
| onlyShowOnHover={onlyShowOnHover} | ||
| triggerNoteModifyWorkflow={triggerNoteModifyWorkflow} | ||
| /> | ||
| ); | ||
| }; | ||
64 changes: 64 additions & 0 deletions
64
...s/orchestrator-ui-components/src/components/WfoInlineNoteEdit/WfoSubscriptionNoteEdit.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import type { FC } from 'react'; | ||
| import React from 'react'; | ||
|
|
||
| import { WfoInlineNoteEdit } from '@/components'; | ||
| import { ApiResult, SubscriptionListResponse, UseQuery } from '@/rtk'; | ||
| import { useStartProcessMutation } from '@/rtk/endpoints/forms'; | ||
| import { useUpdateSubscriptionNoteOptimisticMutation } from '@/rtk/endpoints/subscriptionListMutation'; | ||
| import { Subscription } from '@/types'; | ||
| import { INVISIBLE_CHARACTER } from '@/utils'; | ||
|
|
||
| interface WfoSubscriptionNoteEditProps { | ||
| subscriptionId: Subscription['subscriptionId']; | ||
| onlyShowOnHover?: boolean; | ||
| queryVariables: Record<string, unknown>; | ||
| useQuery: UseQuery<SubscriptionListResponse, Subscription>; | ||
| } | ||
|
|
||
| export const WfoSubscriptionNoteEdit: FC<WfoSubscriptionNoteEditProps> = ({ | ||
| subscriptionId, | ||
| onlyShowOnHover = false, | ||
| queryVariables, | ||
| useQuery, | ||
| }) => { | ||
| const { selectedItem } = useQuery(queryVariables, { | ||
| selectFromResult: (result: ApiResult<SubscriptionListResponse>) => ({ | ||
| selectedItem: result?.data?.subscriptions?.find( | ||
| (sub) => sub.subscriptionId === subscriptionId, | ||
| ), | ||
| }), | ||
| }); | ||
| const endpointName = useQuery().endpointName; | ||
| const [startProcess] = useStartProcessMutation(); | ||
| const [updateSub] = useUpdateSubscriptionNoteOptimisticMutation(); | ||
|
|
||
| const triggerNoteModifyWorkflow = (note: string) => { | ||
| const noteModifyPayload = [ | ||
| { subscription_id: subscriptionId }, | ||
| { note: note === INVISIBLE_CHARACTER ? '' : note }, | ||
| ]; | ||
| startProcess({ | ||
| workflowName: 'modify_note', | ||
| userInputs: noteModifyPayload, | ||
| }); | ||
|
|
||
| updateSub({ | ||
| queryName: endpointName ?? '', | ||
| subscriptionId: subscriptionId, | ||
| graphQlQueryVariables: queryVariables, | ||
| note: note, | ||
| }); | ||
| }; | ||
|
|
||
| return ( | ||
| <WfoInlineNoteEdit | ||
| value={ | ||
| selectedItem?.note?.trim() | ||
| ? selectedItem.note | ||
| : INVISIBLE_CHARACTER | ||
| } | ||
| onlyShowOnHover={onlyShowOnHover} | ||
| triggerNoteModifyWorkflow={triggerNoteModifyWorkflow} | ||
| /> | ||
| ); | ||
| }; |
2 changes: 2 additions & 0 deletions
2
packages/orchestrator-ui-components/src/components/WfoInlineNoteEdit/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,3 @@ | ||
| export * from './WfoInlineNoteEdit'; | ||
| export * from './WfoSubscriptionNoteEdit'; | ||
| export * from './WfoSubscriptionDetailNoteEdit'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.