Repository navigation
feat: The workflow knowledge base supports image documents。 #7751
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ export const systemSharedKnowledgeRoutes: RouteRecordRaw[] = [ | |
| path: 'image', | ||
| name: 'system-shared-knowledge-image-list', | ||
| component: () => import('@/views/knowledge-detail/library/image/index.vue'), | ||
| meta: { permission: () => perm.knowledge.share.image.read(), next: 'system-shared-knowledge-tag', title: '图片', order: 20, detailMenuVisible: (params) => params.type === KNOWLEDGE_TYPE_KEY.BASE }, | ||
| meta: { permission: () => perm.knowledge.share.image.read(), next: 'system-shared-knowledge-tag', title: '图片', order: 20, detailMenuVisible: (params) => params.type === KNOWLEDGE_TYPE_KEY.BASE || params.type === KNOWLEDGE_TYPE_KEY.WORKFLOW }, | ||
| }, | ||
| { | ||
| path: 'tag', | ||
|
Contributor
Author
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. The change modifies the Observations & Suggestions:
Optimization (Optional): detailMenuVisible: (params) => [KNOWLEDGE_TYPE_KEY.BASE, KNOWLEDGE_TYPE_KEY.WORKFLOW].includes(params.type)This makes it easier to maintain if more types are added later. |
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ export const sharedKnowledgeRoutes: RouteRecordRaw[] = [ | |
| path: 'image', | ||
| name: 'workspace-shared-knowledge-image-list', | ||
| component: () => import('@/views/knowledge-detail/library/image/index.vue'), | ||
| meta: { title: '图片', order: 20, detailMenuVisible: (params) => params.type === KNOWLEDGE_TYPE_KEY.BASE }, | ||
| meta: { title: '图片', order: 20, detailMenuVisible: (params) => params.type === KNOWLEDGE_TYPE_KEY.BASE || params.type === KNOWLEDGE_TYPE_KEY.WORKFLOW }, | ||
| }, | ||
| { | ||
| path: 'tag', | ||
|
Contributor
Author
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. Here is an analysis of the provided code diff: 1. Potential Logic/Safety Issue
2. Readability & Maintainability
3. Performance/UX Note
✅ Recommended Improved Version:{
path: 'image',
name: 'workspace-shared-knowledge-image-list',
component: () => import('@/views/knowledge-detail/library/image/index.vue'),
meta: {
title: '图片',
order: 20,
detailMenuVisible: (params) =>
[KNOWLEDGE_TYPE_KEY.BASE, KNOWLEDGE_TYPE_KEY.WORKFLOW].includes(params.type) // Assuming params.type is guaranteed to exist
},
},If detailMenuVisible: (params) =>
!!params && [KNOWLEDGE_TYPE_KEY.BASE, KNOWLEDGE_TYPE_KEY.WORKFLOW].includes(params.type)Let me know if you want help refactoring further! |
||
|
|
||
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.
Both diffs are consistent and look correct, but here are observations:
Issues / suggestions:
Duplicated condition logic —
params.type === KNOWLEDGE_TYPE_KEY.BASE || params.type === KNOWLEDGE_TYPE_KEY.WORKFLOWappears in two places (route gate + menu visibility). Extract a helper to prevent drift:Then use
supportsImageList(params.type)in both spots.Type safety —
params.typeis likelystring | undefined. Use an array-includes check for cleaner, safer matching:Or a typed set:
const IMAGE_SUPPORTED_TYPES = new Set<string>([...])+IMAGE_SUPPORTED_TYPES.has(params.type).Permission vs. visibility coupling — In the route
meta,permissionstill checks onlyimage.read(), whiledetailMenuVisiblenow allows WORKFLOW. That's fine (permission gates access; visibility gates display), but confirm that entering the direct URL for a WORKFLOW image route withoutimage.read()fails gracefully (it should be blocked bypermission). Consider also redirecting/handling the case wheretypeis neither BASE nor WORKFLOW on direct navigation.Potential inconsistency with
next—next: 'system-resource-knowledge-tag'applies regardless of type; ensure the fallback chain infirstAccessibleDetailmatches this behavior when image-list becomes accessible for WORKFLOW but tag may not be.No other irregularities — parentheses precedence is correct; template literal style/formatting unchanged. Logic-wise the change is coherent.
Minor optimization: hoist the supported-types set/constant outside the function to avoid re-allocation on every call.