-
Notifications
You must be signed in to change notification settings - Fork 3
Opt-In / Opt-Out program flow #34
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
Open
kevinepena
wants to merge
27
commits into
txstate-etc:main
Choose a base branch
from
kevinepena:optin-out
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
606a032
add optOut to PromptDefinition txstate-etc/reqquest-txstate#314
kevinepena 46ad12c
Merge branch 'txstate-etc:main' into optin-out
kevinepena 1e3ab0c
adding optOut flag to prompt txstate-etc/reqquest-txstate#314
kevinepena a91020c
removing optout from db
kevinepena d45c0d1
Merge branch 'txstate-etc:main' into optin-out
kevinepena 850f940
removing optout prompts from nav
kevinepena 33ea176
prompt optOut is coming from prompt registry
kevinepena 55b7f78
adding optOut prompt and requirement, adding it to software dev progr…
kevinepena 52a5892
returning optOut from getAppRequest fetch txstate-etc/reqquest-txstat…
kevinepena 0c1f297
adding optOut components to UI txstate-etc/reqquest-txstate#268
kevinepena acf234d
Merge branch 'txstate-etc:main' into optin-out
kevinepena 72203a4
opt out ui txstate-etc/reqquest-txstate#268
kevinepena e79f1f8
needed for not opting out
kevinepena 79b732d
removing optout from api and moving it to UI
kevinepena befc593
updating UI to look for optOut flag in prompt registry
kevinepena 1f8423e
updating Modal to PanelFormDialog
kevinepena fe15155
updating form title to use application/program title
kevinepena 89cfce8
dont pass store and use form context
kevinepena b8a35f6
only returning not applicable if modal is never opened and disqualify…
kevinepena f79fed1
updating OptOut prompt to be clenaer
kevinepena 63ab1fc
clean up
kevinepena b6f1e31
removing optOut from prompt class
kevinepena 39525ee
moving optOut flag back to API
kevinepena 432fb8d
updating evaluate function to not mark prompt unreachable when is opt…
kevinepena 6ba2669
ignoring first promptId if optout
kevinepena 2df0409
also skip the first one if answered and optout
kevinepena e8922c8
awaiting promt info before opening modal
kevinepena 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
Some comments aren't visible on the classic Files Changed page.
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
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
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
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,11 @@ | ||
| import type { SchemaObject } from '@txstate-mws/fastify-shared' | ||
| import type { FromSchema } from 'json-schema-to-ts' | ||
|
|
||
| export const OptOutSchema = { | ||
| type: 'object', | ||
| properties: { | ||
| optOut: { type: 'boolean' } | ||
| }, | ||
| additionalProperties: false | ||
| } as const satisfies SchemaObject | ||
| export type OptOutData = FromSchema<typeof OptOutSchema> |
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
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
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
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
15 changes: 15 additions & 0 deletions
15
demos/src/rc/definitions/requirements/softwareDevelopment.requirements.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
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 |
|---|---|---|
|
|
@@ -492,7 +492,8 @@ class API extends APIBase { | |
| invalidatedReason: true, | ||
| configurationData: true, | ||
| gatheredConfigData: true, | ||
| prestage: true | ||
| prestage: true, | ||
| optOut: true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't need this, it's in the uiRegistry. |
||
| } | ||
| } | ||
| }, | ||
|
|
||
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,73 @@ | ||
| <script lang="ts"> | ||
| import { Form, PanelFormDialog } from '@txstate-mws/carbon-svelte' | ||
| import type { FormStore } from '@txstate-mws/svelte-forms' | ||
| import { afterNavigate, invalidate, invalidateAll } from '$app/navigation' | ||
| import { uiRegistry } from '../../local/index.js' | ||
| import { api } from '../api.js' | ||
| import { stagedprompts } from '../prompt-utils.js' | ||
| import { Loading } from "carbon-components-svelte"; | ||
| import type { OptOutApplication } from '$lib' | ||
|
|
||
| export let open = false | ||
| export let optIn = false | ||
| export let prompt: any | ||
| export let appRequest: any | ||
| export let optOutSelected: OptOutApplication | undefined | ||
|
|
||
| $: def = uiRegistry.getPrompt(prompt.key) | ||
| $: loading = false | ||
|
|
||
|
|
||
| let store: FormStore | undefined | ||
|
|
||
| async function submit (data: any) { | ||
| loading = true | ||
| const { success, messages } = await api.updatePrompt(prompt.id, { optOut: data?.optOut }, false) | ||
| data = {} | ||
| open = false | ||
| loading = false | ||
| invalidateAll() | ||
| return { | ||
| success, | ||
| messages, | ||
| data | ||
| } | ||
| } | ||
|
|
||
| async function onValidate (data: any) { | ||
| const { messages } = await api.updatePrompt(prompt.id, data, true) | ||
| return messages | ||
| } | ||
|
|
||
| let lastPromptId: string | undefined | ||
| $: if (prompt.id !== lastPromptId) { | ||
| lastPromptId = prompt.id | ||
| store = undefined | ||
| } | ||
|
|
||
| afterNavigate(async () => { | ||
| stagedprompts.clear() // clear references to staged prompts since we may be navigating to a different prompt that needs staging | ||
| await invalidate('request:apply') // required to redraw the nav tree if potential staged data affects prompt visibility or status | ||
| }) | ||
| </script> | ||
|
|
||
| {#if loading} | ||
| <Loading /> | ||
| {/if} | ||
|
|
||
| <PanelFormDialog | ||
| let:data | ||
| bind:store | ||
| centered | ||
| open={open} | ||
| on:cancel={() => { open = false }} | ||
| on:validate={onValidate} | ||
| {submit} | ||
| title={`${optIn ? 'Opt in to' : 'Opt out of'} ${optOutSelected?.title}?`} | ||
| submitText={optIn ? 'Opt in' : 'Opt out'} | ||
| cancelText="Cancel" | ||
| preload={prompt.preloadData} | ||
| preloadAsDraft={!prompt.hasSavedData} | ||
| > | ||
| <svelte:component this={def!.formComponent} {data} appRequestId={appRequest.id} appRequestData={appRequest.data} fetched={prompt.fetchedData} configData={prompt.configurationData} gatheredConfigData={prompt.gatheredConfigData} /> | ||
| </PanelFormDialog> |
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
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this validate could be omitted once the requirement is updated to accept
undefinedas MET. No big deal to include it but I want to be sure it's not needed because that'd be an ugly thing for downstream to have to remember to do.