-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Assessment settings table columns empty (#1391)
Closes https://issues.redhat.com/browse/MTA-1317 <img width="1903" alt="Screenshot 2023-09-22 at 1 25 39 PM" src="https://github.com/konveyor/tackle2-ui/assets/11218376/c994020a-7915-4710-bfdb-c6cc2c96d261"> This pull request addresses the issue of empty columns in the Assessment settings table by making the following changes: Updated Models: Modified the Questionnaire model in client/src/app/api/models.ts to include the createTime field, which is now used for the "Date imported" column in the Assessment settings table. Date Formatting: Utilized the dayjs library to format the date from the createTime field into a human-readable format ("YYYY-MM-DD HH:mm:ss") for display in the table. Thresholds Display: Modified the rendering of thresholds in the "Rating" column to display each color and its percentage. These changes should resolve the issue of empty columns and ensure that the table displays the relevant data correctly. Signed-off-by: ibolton336 <ibolton@redhat.com>
- Loading branch information
1 parent
e893ec8
commit fbd5e3d
Showing
9 changed files
with
82 additions
and
25 deletions.
There are no files selected for viewing
This file contains 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 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
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...s/assessment-management/assessment-settings/components/questionnaire-questions-column.tsx
This file contains 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,15 @@ | ||
import React from "react"; | ||
import { Text } from "@patternfly/react-core"; | ||
import { Questionnaire } from "@app/api/models"; | ||
|
||
export const QuestionnaireQuestionsColumn: React.FC<{ | ||
questionnaire: Questionnaire; | ||
}> = ({ questionnaire }) => { | ||
const totalQuestions = (questionnaire.sections || []).reduce( | ||
(total, section) => { | ||
return total + (section.questions ? section.questions.length : 0); | ||
}, | ||
0 | ||
); | ||
return <Text>{totalQuestions}</Text>; | ||
}; |
27 changes: 27 additions & 0 deletions
27
.../assessment-management/assessment-settings/components/questionnaire-thresholds-column.tsx
This file contains 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,27 @@ | ||
import React from "react"; | ||
import { ListItem } from "@patternfly/react-core"; | ||
import { Questionnaire, Thresholds } from "@app/api/models"; | ||
|
||
export const QuestionnaireThresholdsColumn: React.FC<{ | ||
questionnaire: Questionnaire; | ||
}> = ({ questionnaire }) => { | ||
const thresholdsToListItems = (thresholds: Thresholds) => { | ||
const thresholdKeys: (keyof Thresholds)[] = Object.keys( | ||
thresholds | ||
) as (keyof Thresholds)[]; | ||
|
||
return ( | ||
<> | ||
{thresholdKeys.map((color) => { | ||
const percentage: number = thresholds[color] || 0; | ||
return ( | ||
<ListItem key={color}> | ||
{color} {percentage}% | ||
</ListItem> | ||
); | ||
})} | ||
</> | ||
); | ||
}; | ||
return thresholdsToListItems(questionnaire.thresholds || {}); | ||
}; |
This file contains 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 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 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 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