-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Workflow knowledge base import button error #4429
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 |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ | |
| {{ $t('views.document.buttons.next') }} | ||
| </el-button> | ||
| <el-button | ||
| v-if="base_form_list.length > 0 ? active == 'knowledge_base' : true" | ||
| v-if="base_form_list.length > 0 ? active == 'knowledge_base' : active == 'data_source'" | ||
| @click="upload" | ||
| type="primary" | ||
| :loading="loading" | ||
|
|
@@ -133,14 +133,14 @@ const permissionPrecise = computed(() => { | |
| const upload = () => { | ||
| if (permissionPrecise.value.doc_create(id)) { | ||
| ActionRef.value.validate().then(() => { | ||
| form_data.value[active.value] = ActionRef.value.get_data() | ||
| loadSharedApi({ type: 'knowledge', systemType: apiType.value }) | ||
| .workflowAction(id, form_data.value, loading) | ||
| .then((ok: any) => { | ||
| action_id.value = ok.data.id | ||
| active.value = 'result' | ||
| }) | ||
| }) | ||
| form_data.value[active.value] = ActionRef.value.get_data() | ||
| loadSharedApi({ type: 'knowledge', systemType: apiType.value }) | ||
| .workflowAction(id, form_data.value, loading) | ||
| .then((ok: any) => { | ||
| action_id.value = ok.data.id | ||
| active.value = 'result' | ||
| }) | ||
| }) | ||
| } else { | ||
| MsgError(t('views.application.tip.noDocPermission')) | ||
| } | ||
|
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. No significant irregularities were found in the provided code. However, here are some optimization suggestions:
if (permissionPrecise.value.doc_create(id)) {
ActionRef.value.validate().then(() => {
form_data.value[active.value] = ActionRef.value.get_data();
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
.workflowAction(id, form_data.value, loading)
.then((ok: any) => {
action_id.value = ok.data.id;
active.value = 'result';
});
});
} else {
MsgError(t('views.application.tip.noDocPermission'));
}To optimize further within performance constraints and reduce unnecessary computations, ensure that the API requests are efficient and do not introduce delays where non-critical tasks could wait:
These optimizations aim to enhance both usability and efficiency while keeping the code clean and readable. |
||
|
|
||
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.
The provided code has two small issues that need addressing:
Logical Error: The condition
active == 'knowledge_base'is followed bytrue, which does not make sense logically. It should be removed sincev-ifexpressions evaluate to either true or false.Code Duplication: Using
$t('views.document.buttons.next')twice with different attributes (typeand:disabled) can be optimized. You can extract this static string into a variable if it's the same across these instances.Here is the modified version of the code:
Additionally, you might consider storing this translation key in a single place for better readability and maintainability. For example:
This would give you more flexibility to change labels without affecting multiple locations in your codebase.