-
Notifications
You must be signed in to change notification settings - Fork 92
Questionnaire workflow UI for privacy assessments #7515
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
11 commits
Select commit
Hold shift + click to select a range
bfa55ae
WIP
lucanovera d29c81d
Update evaluate form to allow multiple templates and multiple systems…
lucanovera 90e4f60
code improvements
lucanovera ceb6f61
update changelog
lucanovera af0dcb8
improve code
lucanovera 6602040
improve param
lucanovera 06dc9c5
update layout
lucanovera cd17afa
update tags
lucanovera 440fe3e
remove logo
lucanovera 346521e
optimize code
lucanovera 15e599e
changes to use dayjs
lucanovera 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,4 @@ | ||
| type: Added | ||
| description: Added questionnaire workflow for privacy assessments, including request input modal, questionnaire status bar, and send reminder | ||
| pr: 7515 | ||
| labels: [] |
39 changes: 39 additions & 0 deletions
39
clients/admin-ui/src/features/common/hooks/useRelativeTime.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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import dayjs from "dayjs"; | ||
| import relativeTime from "dayjs/plugin/relativeTime"; | ||
| import { useEffect, useState } from "react"; | ||
|
|
||
| dayjs.extend(relativeTime); | ||
|
|
||
| const MINUTE_S = 60; | ||
|
|
||
| const getRelativeTime = (date: Date) => dayjs(date).fromNow(); | ||
|
|
||
| /** | ||
| * Returns a human-readable relative time string (e.g. "5 minutes ago") for | ||
| * the given date, refreshing at the given interval. Returns an empty string | ||
| * when date is null or undefined. | ||
| */ | ||
| export const useRelativeTime = ( | ||
| date: Date | null | undefined, | ||
| intervalSeconds: number = MINUTE_S, | ||
| ): string => { | ||
| const [timeAgo, setTimeAgo] = useState(() => | ||
| date ? getRelativeTime(date) : "", | ||
| ); | ||
|
|
||
| useEffect(() => { | ||
| if (!date) { | ||
| setTimeAgo(""); | ||
| return undefined; | ||
| } | ||
| setTimeAgo(getRelativeTime(date)); | ||
| const interval = setInterval(() => { | ||
| setTimeAgo(getRelativeTime(date)); | ||
| }, intervalSeconds * 1000); | ||
| return () => { | ||
| clearInterval(interval); | ||
| }; | ||
lucanovera marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, [date, intervalSeconds]); | ||
|
|
||
| return timeAgo; | ||
| }; | ||
45 changes: 45 additions & 0 deletions
45
clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.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,45 @@ | ||
| import { Space, Tag, Tooltip } from "fidesui"; | ||
|
|
||
| import { | ||
| ANSWER_SOURCE_LABELS, | ||
| ANSWER_SOURCE_TAG_COLORS, | ||
| ANSWER_STATUS_LABELS, | ||
| ANSWER_STATUS_TAG_COLORS, | ||
| } from "./constants"; | ||
| import { AnswerStatus, AssessmentQuestion } from "./types"; | ||
|
|
||
| interface AnswerStatusTagsProps { | ||
| question: AssessmentQuestion; | ||
| } | ||
|
|
||
| export const AnswerStatusTags = ({ question }: AnswerStatusTagsProps) => { | ||
| if (question.answer_status === AnswerStatus.COMPLETE) { | ||
| return ( | ||
| <Space size="small"> | ||
| <Tag color={ANSWER_STATUS_TAG_COLORS[question.answer_status]}> | ||
| {ANSWER_STATUS_LABELS[question.answer_status]} | ||
| </Tag> | ||
| <Tag color={ANSWER_SOURCE_TAG_COLORS[question.answer_source]}> | ||
| {ANSWER_SOURCE_LABELS[question.answer_source]} | ||
| </Tag> | ||
| </Space> | ||
| ); | ||
| } | ||
|
|
||
| const statusTag = ( | ||
| <Tag color={ANSWER_STATUS_TAG_COLORS[question.answer_status]}> | ||
| {ANSWER_STATUS_LABELS[question.answer_status]} | ||
| </Tag> | ||
| ); | ||
|
|
||
| if (question.answer_status === AnswerStatus.PARTIAL) { | ||
| const tooltipTitle = | ||
| question.missing_data && question.missing_data.length > 0 | ||
| ? `This answer can be automatically derived if you populate: ${question.missing_data.join(", ")}` | ||
| : "This answer can be derived from Fides data if the relevant field is populated"; | ||
|
|
||
| return <Tooltip title={tooltipTitle}>{statusTag}</Tooltip>; | ||
| } | ||
|
|
||
| return statusTag; | ||
| }; |
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
11 changes: 11 additions & 0 deletions
11
clients/admin-ui/src/features/privacy-assessments/QuestionnaireStatusBar.module.scss
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 @@ | ||
| .container { | ||
| background-color: var(--fidesui-bg-corinth); | ||
| border-radius: var(--ant-border-radius-lg); | ||
| padding: 16px; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .checkIcon { | ||
| color: var(--fidesui-success); | ||
| font-size: var(--ant-font-size-lg); | ||
| } |
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.