Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ui/src/layout/components/top-bar/avatar/APIKeyDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
:close-on-press-escape="false"
>
<el-card shadow="never" class="layout-bg mb-16">
<el-text type="info" class="color-secondary">{{
$t('layout.apiServiceAddress')
}}</el-text>
<el-text type="info" class="color-secondary">{{ $t('layout.apiServiceAddress') }}</el-text>
<p style="margin-top: 10px">
<span class="vertical-middle lighter break-all">
{{ apiUrl }}
Expand Down Expand Up @@ -113,7 +111,7 @@ function deleteApiKey(row: any) {
`${t('views.applicationOverview.appInfo.APIKeyDialog.msgConfirm1')}: ${row.secret_key}?`,
t(t('views.applicationOverview.appInfo.APIKeyDialog.msgConfirm2')),
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
cancelButtonText: t('common.cancel'),
confirmButtonClass: 'danger'
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an identical line of code that needs to be removed. Please correct this issue.

Expand Down
1 change: 0 additions & 1 deletion ui/src/locales/lang/en-US/views/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default {
placeholder: 'Enter username to search'
},
delete: {
button: 'Remove',
confirmTitle: 'Confirm removal of member:',
confirmMessage:
'Removing the member will revoke their access to knowledge and APP.'
Expand Down
1 change: 0 additions & 1 deletion ui/src/locales/lang/zh-CN/views/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default {
placeholder: '请输入用户名搜索'
},
delete: {
button: '移除',
confirmTitle: '是否移除成员:',
confirmMessage: '移除后将会取消成员拥有的知识库和应用权限。'
},
Expand Down
1 change: 0 additions & 1 deletion ui/src/locales/lang/zh-Hant/views/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export default {
placeholder: '請輸入使用者名稱搜尋'
},
delete: {
button: '移除',
confirmTitle: '是否移除成員:',
confirmMessage: '移除後將會取消成員擁有之知識庫和應用程式權限。'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function deleteApiKey(row: any) {
`${t('views.applicationOverview.appInfo.APIKeyDialog.msgConfirm1')}: ${row.secret_key}?`,
t('views.applicationOverview.appInfo.APIKeyDialog.msgConfirm2'),
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
cancelButtonText: t('common.cancel'),
confirmButtonClass: 'danger'
}
Expand Down
3 changes: 1 addition & 2 deletions ui/src/views/application-overview/component/LimitDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,10 @@ import { ref, watch } from 'vue'
import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus'
import applicationApi from '@/api/application'
import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { MsgSuccess } from '@/utils/message'
import { t } from '@/locales'
import { copyClick } from '@/utils/clipboard'
import { ComplexPermission } from '@/utils/permission/type'
import { first } from 'lodash'

const route = useRoute()
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { useRoute } from 'vue-router'
import type { FormInstance, FormRules } from 'element-plus'
import overviewApi from '@/api/application-overview'
import overviewSystemApi from '@/api/system-api-key'
import { MsgSuccess, MsgConfirm } from '@/utils/message'
import { MsgSuccess } from '@/utils/message'
import { t } from '@/locales'

const route = useRoute()
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/dataset/component/ParagraphList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const deleteHandle = (item: any, cIndex: number) => {
`${t('views.paragraph.delete.confirmTitle')}${item.title || '-'} ?`,
t('views.paragraph.delete.confirmMessage'),
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/dataset/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function deleteDataset(row: any) {
`${t('views.dataset.delete.confirmTitle')}${row.name} ?`,
`${t('views.dataset.delete.confirmMessage1')} ${row.application_mapping_count} ${t('views.dataset.delete.confirmMessage2')}`,
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Expand Down
4 changes: 2 additions & 2 deletions ui/src/views/document/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ function deleteMulDocument() {
`${t('views.document.delete.confirmTitle1')} ${multipleSelection.value.length} ${t('views.document.delete.confirmTitle2')}`,
t('views.document.delete.confirmMessage'),
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Expand Down Expand Up @@ -749,7 +749,7 @@ function deleteDocument(row: any) {
`${t('views.document.delete.confirmTitle3')} ${row.name} ?`,
`${t('views.document.delete.confirmMessage1')} ${row.paragraph_count} ${t('views.document.delete.confirmMessage2')}`,
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code has some minor adjustments that do not directly affect functionality but could improve readability or maintainability:

  1. In deleteMulDocument, change 'common.delete' to 'common.confirm'.

  2. In both deleteMulDocument and deleteDocument, remove the space before ${} in template literals.

These changes make the strings more concise while keeping their meaning consistent.

Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/function-lib/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function deleteFunctionLib(row: any) {
`${t('views.functionLib.delete.confirmTitle')}${row.name} ?`,
t('views.functionLib.delete.confirmMessage'),
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
cancelButtonText: t('common.cancel'),
confirmButtonClass: 'danger'
}
Expand Down
4 changes: 2 additions & 2 deletions ui/src/views/paragraph/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ function deleteMulParagraph() {
`${t('views.document.delete.confirmTitle1')} ${multipleSelection.value.length} ${t('views.document.delete.confirmTitle2')}`,
t('views.paragraph.delete.confirmMessage'),
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Expand Down Expand Up @@ -294,7 +294,7 @@ function deleteParagraph(row: any) {
`${t('views.paragraph.delete.confirmTitle')} ${row.title || '-'} ?`,
t('views.paragraph.delete.confirmMessage'),
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The provided code snippets look relatively clean and efficient compared to their original versions, with minor changes that aim to improve readability and usability. However, there are a few points you might consider optimizing for future maintainability:

Improvements:

  1. Consistency: Ensure that throughout the codebase, consistent usage of pluralization and tense is maintained in translations (e.g., confirmTitle vs. deleteConfirmMessage). Using the same phrases consistently can avoid duplication and potential errors.

  2. Function Naming: Consider renaming helper functions to make them more descriptive and easier to understand what they do (getDeleteConfirmationText instead of deleteMulParagraph) if this function performs multiple operations related to document deletion.

  3. Type Annotations: Add type annotations where applicable to help TypeScript users and other developers quickly grasp the types expected by functions (e.g., row.any could be specified as { title?: string }).

  4. Default Values: If the confirmation message contains placeholders that should have default values depending on context, ensure these defaults are set explicitly or calculated within the function parameters.

  5. Error Handling: Although not evident from the snippet, it would be good to add error handling around calls to t() to manage cases where translation fails.

  6. Modular Design: Refactor common logic into separate modules/functions if needed, especially if similar patterns appear across different parts of the application.

While the current implementation works well, these adjustments will enhance both functionality and developer experience over time.

Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/problem/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function deleteProblem(row: any) {
`${t('views.problem.delete.confirmTitle')} ${row.content} ?`,
`${t('views.problem.delete.confirmMessage1')} ${row.paragraph_count} ${t('views.problem.delete.confirmMessage2')}`,
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/team/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function deleteMember(row: TeamMember) {
t('views.team.delete.confirmMessage'),

{
confirmButtonText: t('views.team.delete.button'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/template/component/ModelCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const deleteModel = () => {
t('views.template.delete.confirmTitle'),
`${t('views.template.delete.confirmMessage')}${props.model.name} ?`,
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/views/user-manage/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function deleteUserManage(row: any) {
`${t('views.user.delete.confirmTitle')}${row.username} ?`,
t('views.user.delete.confirmMessage'),
{
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}
)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow/common/NodeContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ const copyNode = () => {
}
const deleteNode = () => {
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.delete.confirmTitle'), {
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}).then(() => {
props.nodeModel.graphModel.deleteNode(props.nodeModel.id)
Expand Down
2 changes: 1 addition & 1 deletion ui/src/workflow/common/shortcut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export function initDefaultShortcut(lf: LogicFlow, graph: GraphModel) {
return
}
MsgConfirm(t('common.tip'), t('views.applicationWorkflow.delete.confirmTitle'), {
confirmButtonText: t('common.delete'),
confirmButtonText: t('common.confirm'),
confirmButtonClass: 'danger'
}).then(() => {
if (!keyboardOptions?.enabled) return true
Expand Down