-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add issue specification guidance to issueTable page #818
base: main
Are you sure you want to change the base?
Add issue specification guidance to issueTable page #818
Conversation
WalkthroughThis pull request introduces a new function Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🪛 Markdownlint (0.37.0).github/PULL_REQUEST_TEMPLATE.md23-23: null (MD034, no-bare-urls) ⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (2)
✨ Finishing Touches
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Coverage Report
File Coverage
|
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.
Actionable comments posted: 3
🧹 Nitpick comments (1)
src/views/organisations/issueTable.html (1)
100-128
: Improve accessibility of the guidance link.The implementation follows GOV.UK Design System patterns well. However, the guidance link could be more accessible.
Apply this diff to improve the link's accessibility:
- <p class="govuk-body">The <a href="{{ dataset.dataset | getDatasetGuidanceUrl }}" target="_blank">{{ dataset.name }}</a> guidance explains how to fix the issue:</p> + <p class="govuk-body">The <a href="{{ dataset.dataset | getDatasetGuidanceUrl }}" target="_blank" rel="noopener noreferrer">{{ dataset.name }} guidance (opens in new tab)</a> explains how to fix the issue:</p>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/middleware/common.middleware.js
(1 hunks)src/middleware/issueTable.middleware.js
(4 hunks)src/routes/schemas.js
(1 hunks)src/views/organisations/issueTable.html
(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: run-tests / test
🔇 Additional comments (3)
src/middleware/issueTable.middleware.js (1)
Line range hint
77-89
: LGTM! Template parameters are correctly updated.The
issueSpecification
parameter is properly destructured from the request object and added to the template parameters.src/routes/schemas.js (1)
214-219
: LGTM! Schema definition is well-structured.The
issueSpecification
property is properly defined with:
- Appropriate optional wrapper
- Strict object validation
- Required and optional fields with proper types
src/views/organisations/issueTable.html (1)
7-7
: LGTM! Macro import is correctly placed.The
govukInsetText
macro is properly imported from the GOV.UK Design System.
@@ -7,7 +7,7 @@ | |||
*/ | |||
|
|||
import config from '../../config/index.js' | |||
import { createPaginationTemplateParams, fetchDatasetInfo, fetchOrgInfo, fetchResources, filterOutEntitiesWithoutIssues, getErrorSummaryItems, getSetBaseSubPath, getSetDataRange, logPageError, processEntitiesMiddlewares, processRelevantIssuesMiddlewares, processSpecificationMiddlewares, show404IfPageNumberNotInRange, validateQueryParams } from './common.middleware.js' | |||
import { createPaginationTemplateParams, fetchDatasetInfo, fetchOrgInfo, fetchResources, filterOutEntitiesWithoutIssues, getErrorSummaryItems, getIssueSpecfication, getSetBaseSubPath, getSetDataRange, logPageError, processEntitiesMiddlewares, processRelevantIssuesMiddlewares, processSpecificationMiddlewares, show404IfPageNumberNotInRange, validateQueryParams } from './common.middleware.js' |
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.
Fix the typo in the imported function name.
The imported function name contains a typo: getIssueSpecfication
should be getIssueSpecification
.
@@ -122,6 +123,7 @@ | |||
show404IfPageNumberNotInRange, | |||
getSetBaseSubPath(), | |||
getErrorSummaryItems, | |||
getIssueSpecfication, |
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.
Fix the typo in the middleware chain function name.
The function name in the middleware chain contains the same typo: getIssueSpecfication
.
src/middleware/common.middleware.js
Outdated
export function getIssueSpecfication (req, res, next) { | ||
const { issue_field: issueField } = req.params | ||
const { specification } = req | ||
|
||
const fieldSpecification = specification.fields.find(f => f.field === issueField) | ||
req.issueSpecification = fieldSpecification ?? undefined | ||
|
||
next() | ||
} |
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.
🛠️ Refactor suggestion
Fix the typo and add JSDoc documentation.
The function implementation is correct, but there are two improvements needed:
- Fix the typo in the function name:
getIssueSpecfication
→getIssueSpecification
- Add JSDoc documentation to describe the function's purpose, parameters, and behaviour
Apply this diff to implement the improvements:
-export function getIssueSpecfication (req, res, next) {
+/**
+ * Middleware to retrieve issue field specification.
+ *
+ * @param {Object} req - Express request object
+ * @param {Object} req.params - Request parameters
+ * @param {string} req.params.issue_field - The issue field to get specification for
+ * @param {Object} req.specification - The dataset specification
+ * @param {Array} req.specification.fields - Array of field specifications
+ * @param {Object} res - Express response object
+ * @param {Function} next - Express next middleware function
+ */
+export function getIssueSpecification (req, res, next) {
const { issue_field: issueField } = req.params
const { specification } = req
const fieldSpecification = specification.fields.find(f => f.field === issueField)
req.issueSpecification = fieldSpecification ?? undefined
next()
}
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export function getIssueSpecfication (req, res, next) { | |
const { issue_field: issueField } = req.params | |
const { specification } = req | |
const fieldSpecification = specification.fields.find(f => f.field === issueField) | |
req.issueSpecification = fieldSpecification ?? undefined | |
next() | |
} | |
/** | |
* Middleware to retrieve issue field specification. | |
* | |
* @param {Object} req - Express request object | |
* @param {Object} req.params - Request parameters | |
* @param {string} req.params.issue_field - The issue field to get specification for | |
* @param {Object} req.specification - The dataset specification | |
* @param {Array} req.specification.fields - Array of field specifications | |
* @param {Object} res - Express response object | |
* @param {Function} next - Express next middleware function | |
*/ | |
export function getIssueSpecification (req, res, next) { | |
const { issue_field: issueField } = req.params | |
const { specification } = req | |
const fieldSpecification = specification.fields.find(f => f.field === issueField) | |
req.issueSpecification = fieldSpecification ?? undefined | |
next() | |
} |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/PULL_REQUEST_TEMPLATE.md
(1 hunks)
🧰 Additional context used
🪛 Markdownlint (0.37.0)
.github/PULL_REQUEST_TEMPLATE.md
17-17: null
Bare URL used
(MD034, no-bare-urls)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: run-tests / test
🔇 Additional comments (1)
.github/PULL_REQUEST_TEMPLATE.md (1)
Line range hint
1-14
: The PR template structure looks good!The template follows GitHub's best practices and includes comprehensive sections for documenting PRs effectively.
Also applies to: 19-89
🧰 Tools
🪛 Markdownlint (0.37.0)
17-17: null
Bare URL used(MD034, no-bare-urls)
.github/PULL_REQUEST_TEMPLATE.md
Outdated
## Preview Link | ||
|
||
https://submit-pr-[PR_NUMBER].herokuapp.com/ |
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.
🛠️ Refactor suggestion
Add guidance for the preview link section and format the URL properly.
The preview link section would benefit from clear instructions on how to use it. Additionally, the URL should be properly formatted as a Markdown link.
Apply this diff to improve the section:
## Preview Link
-https://submit-pr-[PR_NUMBER].herokuapp.com/
+<!--
+Replace [PR_NUMBER] with the actual PR number to generate the preview URL.
+For example, for PR #818, the preview link would be:
+https://submit-pr-818.herokuapp.com/
+-->
+
+[Preview deployment](https://submit-pr-[PR_NUMBER].herokuapp.com/)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
## Preview Link | |
https://submit-pr-[PR_NUMBER].herokuapp.com/ | |
## Preview Link | |
<!-- | |
Replace [PR_NUMBER] with the actual PR number to generate the preview URL. | |
For example, for PR #818, the preview link would be: | |
https://submit-pr-818.herokuapp.com/ | |
--> | |
[Preview deployment](https://submit-pr-[PR_NUMBER].herokuapp.com/) |
🧰 Tools
🪛 Markdownlint (0.37.0)
17-17: null
Bare URL used
(MD034, no-bare-urls)
What type of PR is this? (check all applicable)
Description
Please replace this line with a brief description of the changes made.
Related Tickets & Documents
QA Instructions, Screenshots, Recordings
Before
Before screenshot here
After
After screenshot here
Added/updated tests?
We encourage you to keep the code coverage percentage at 80% and above.
QA sign off
[optional] Are there any post-deployment tasks we need to perform?
[optional] Are there any dependencies on other PRs or Work?
Summary by CodeRabbit
Release Notes
New Features
Improvements
Chores
The update provides a more informative user experience by displaying contextual information about potential dataset issues and their recommended resolutions.