-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: ✨ dashboard page #123
Conversation
* 🐛 fix: update sorting on updated time * ⚰️ chore: remove yarn.lock * 💄 style: uipdate profile ui
* ✨ feat: add a dashboard page * 🐛 fix: remove old code * 🐛 fix: add response checks * refactor: ♻️ dashboard link in nav directs to /dashboard * refactor: ♻️ update variables for GET /dashboard api --------- Co-authored-by: slugb0t <wheresdorian@gmail.com>
Thank you for submitting this pull request! We appreciate your contribution to the project. Before we can merge it, we need to review the changes you've made to ensure they align with our code standards and meet the requirements of the project. We'll get back to you as soon as we can with feedback. Thanks again! |
Reviewer's Guide by SourceryThis PR implements significant changes to improve the dashboard functionality and user experience. The changes include code formatting updates, navigation improvements, and the addition of a new dashboard landing page. The implementation focuses on better organization of user and organization data, enhanced error handling, and improved UI components. Class Diagram for Dashboard API ChangesclassDiagram
class DashboardAPI {
+fetchUserOrgs(user: User)
+fetchOrgDetails(user: User)
+combineOrgs(orgsOne, orgsTwo)
+uniqueOrgs(combinedOrgs)
}
class User {
+id: String
+username: String
+github_id: String
+access_token: String
}
DashboardAPI --> User: uses
note for DashboardAPI "Handles fetching and combining user and organization data from GitHub API"
Class Diagram for CWL Validation ProcessclassDiagram
class CWLValidation {
+getCWLFiles(context, owner, repository)
+validateCWLFile(downloadUrl)
+applyCWLTemplate(subjects, baseTemplate, repository, owner, context)
}
class Repository {
+id: String
+name: String
}
class CWLFile {
+path: String
+validation_status: String
+validation_message: String
}
CWLValidation --> Repository: interacts with
CWLValidation --> CWLFile: processes
note for CWLValidation "Manages CWL file retrieval, validation, and template application"
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Thanks for closing this pull request! If you have any further questions, please feel free to open a new issue. We are always happy to help! |
Thanks for making updates to your pull request. Our team will take a look and provide feedback as soon as possible. Please wait for any GitHub Actions to complete before editing your pull request. If you have any additional questions or concerns, feel free to let us know. Thank you for your contributions! |
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.
Hey @slugb0t - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
resolve(cwlObject) | ||
} catch (error) { | ||
console.log('Error getting CWL files:', error) | ||
throw new Error( |
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.
issue (bug_risk): Error constructor usage is incorrect - subsequent arguments will be ignored
The Error constructor only uses the first argument as the message. Consider concatenating the message and stringified error like: new Error(\
Error getting the CWL files: ${JSON.stringify(error)}`)`
@@ -21,74 +21,82 @@ | |||
* @returns {Array} - Array of CWL files in the repository | |||
*/ | |||
export function getCWLFiles(context, owner, repository) { |
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.
issue (complexity): Consider simplifying the searchDirectory
function by removing the redundant Promise wrapper and using a single try/catch block.
The searchDirectory
function can be simplified by removing the redundant Promise wrapper and consolidating error handling. Here's a cleaner approach:
export async function getCWLFiles(context, owner, repository) {
logwatch.info('Checking for CWL files in the repository...')
const cwlObject = {
contains_cwl_files: false,
files: [],
removed_files: []
}
async function searchDirectory(path) {
const repoContent = await context.octokit.repos.getContent({
owner,
path,
repo: repository.name
})
for (const file of repoContent.data) {
if (file.type === 'file' && file.name.endsWith('.cwl')) {
cwlObject.files.push(file)
}
if (file.type === 'dir') {
await searchDirectory(file.path)
}
}
}
try {
await searchDirectory('')
const existingCWL = await dbInstance.cwlValidation.findUnique({
where: { repository_id: repository.id }
})
if (existingCWL?.contains_cwl_files) {
cwlObject.contains_cwl_files = existingCWL.contains_cwl_files
}
cwlObject.contains_cwl_files = cwlObject.files.length > 0
return cwlObject
} catch (error) {
if (error.status === 404) {
return cwlObject // Repository is empty
}
logwatch.error({
message: 'Error finding CWL files throughout the repository:',
error
}, true)
throw error
}
}
Key improvements:
- Removed redundant Promise wrapper since async functions return promises
- Consolidated error handling into a single try/catch block
- Flattened the code structure while maintaining all error cases
- Kept all existing functionality intact
Summary by Sourcery
Add a new dashboard page for users to manage repositories and organizations, enhance CWL file validation with improved logging, refactor UI components for better readability, update package version, and suppress output in CI workflows.
New Features:
Enhancements:
Build:
CI:
Documentation: