diff --git a/frontend/src/components/business/ms-assertion/index.vue b/frontend/src/components/business/ms-assertion/index.vue new file mode 100644 index 0000000000..52419b8463 --- /dev/null +++ b/frontend/src/components/business/ms-assertion/index.vue @@ -0,0 +1,152 @@ + + + + + diff --git a/frontend/src/components/business/ms-assertion/locale/en-US.ts b/frontend/src/components/business/ms-assertion/locale/en-US.ts new file mode 100644 index 0000000000..8ddc6428df --- /dev/null +++ b/frontend/src/components/business/ms-assertion/locale/en-US.ts @@ -0,0 +1,3 @@ +export default { + 'ms.assertion.button': 'Assertion', +}; diff --git a/frontend/src/components/business/ms-assertion/locale/zh-CN.ts b/frontend/src/components/business/ms-assertion/locale/zh-CN.ts new file mode 100644 index 0000000000..fb8b4b416e --- /dev/null +++ b/frontend/src/components/business/ms-assertion/locale/zh-CN.ts @@ -0,0 +1,9 @@ +export default { + 'ms.assertion.button': '断言', + 'ms.assertion.statusCode': '状态码', + 'ms.assertion.responseHeader': '响应头', + 'ms.assertion.responseBody': '响应体', + 'ms.assertion.responseTime': '响应时间', + 'ms.assertion.param': '变量', + 'ms.assertion.script': '脚本', +}; diff --git a/frontend/src/components/business/ms-comment/comment-item.vue b/frontend/src/components/business/ms-comment/comment-item.vue index 5be414d669..f2f1b92c1a 100644 --- a/frontend/src/components/business/ms-comment/comment-item.vue +++ b/frontend/src/components/business/ms-comment/comment-item.vue @@ -26,7 +26,7 @@ {{ t('ms.comment.edit') }} -
+
{{ t('ms.comment.delete') }}
@@ -51,14 +51,19 @@ const userStore = useUserStore(); const { t } = useI18n(); + defineOptions({ name: 'MsCommentItem' }); + const props = defineProps<{ element: CommentItem; // 评论的具体内容 mode: 'parent' | 'child'; // 父级评论还是子级评论 + onReply?: () => void; // 回复 + onEdit?: () => void; // 编辑 + onDelete?: () => void; // 删除 }>(); // 是否拥有编辑|删除权限 const hasEditAuth = computed(() => { - return props.element.commentUserInfo.id === userStore.id; + return props.element.createUser === userStore.id; }); const emit = defineEmits<{ diff --git a/frontend/src/components/business/ms-comment/comment.tsx b/frontend/src/components/business/ms-comment/comment.tsx index a702ba6053..4e537988ae 100644 --- a/frontend/src/components/business/ms-comment/comment.tsx +++ b/frontend/src/components/business/ms-comment/comment.tsx @@ -16,6 +16,10 @@ export default defineComponent({ type: Array as PropType, default: () => [], }, + disabled: { + type: Boolean as PropType, + default: false, + }, }, emits: { /* eslint-disable @typescript-eslint/no-unused-vars */ @@ -23,11 +27,19 @@ export default defineComponent({ delete: (value: string) => true, // 删除评论 }, setup(props, { emit }) { - const { commentList } = toRefs(props); - const currentItem = reactive<{ id: string; parentId: string }>({ id: '', parentId: '' }); + const { commentList, disabled } = toRefs(props); + const currentItem = reactive<{ id: string; parentId?: string }>({ + id: '', + parentId: '', + }); const { t } = useI18n(); const { openModal } = useModal(); + const resetCurrentItem = () => { + currentItem.id = ''; + currentItem.parentId = ''; + }; + const handlePublish = (content: string, item: CommentItem) => { const params: CommentParams = { ...item, @@ -36,9 +48,10 @@ export default defineComponent({ }; emit('updateOrAdd', params, (result: boolean) => { if (result) { - message.success(t('common.publishSuccess')); + message.success(t('common.publishSuccessfully')); + resetCurrentItem(); } else { - message.error(t('common.publishFail')); + message.error(t('common.publishFailed')); } }); }; @@ -60,12 +73,30 @@ export default defineComponent({ }); }; + const handleReply = (item: CommentItem) => { + if (item.childComments) { + // 父级评论 + currentItem.id = item.id; + } else { + // 子级评论 + currentItem.id = item.parentId || ''; + currentItem.parentId = item.id; + } + }; + + const handelEdit = (item: CommentItem) => { + currentItem.id = item.id; + currentItem.parentId = item.parentId || ''; + }; + const renderInput = (item: CommentItem) => { return ( handlePublish(content, item)} + defaultValue={item.content || ''} + onCancel={() => resetCurrentItem()} {...item} /> ); @@ -79,14 +110,8 @@ export default defineComponent({ return (
{ - currentItem.id = item.id; - currentItem.parentId = item.parentId || ''; - }} - onEdit={() => { - currentItem.id = item.id; - currentItem.parentId = item.parentId || ''; - }} + onReply={() => handleReply(item)} + onEdit={() => handelEdit(item)} onDelete={() => handleDelete(item)} mode={'child'} element={item} @@ -100,11 +125,18 @@ export default defineComponent({ const renderParentList = (list: CommentItem[]) => { return list.map((item) => { return ( - handleDelete(item)} element={item}> -
- {renderChildrenList(item.childComments)} -
-
+ <> + handleReply(item)} + onEdit={() => handelEdit(item)} + onDelete={() => handleDelete(item)} + element={item} + > +
+
+ {item.id === currentItem.id && renderInput(item)} + ); }); }; diff --git a/frontend/src/components/business/ms-comment/input.vue b/frontend/src/components/business/ms-comment/input.vue index 572307316d..0d8b131074 100644 --- a/frontend/src/components/business/ms-comment/input.vue +++ b/frontend/src/components/business/ms-comment/input.vue @@ -22,28 +22,32 @@ diff --git a/frontend/src/locale/en-US/common.ts b/frontend/src/locale/en-US/common.ts index 6b49250fa8..f5e8eca78b 100644 --- a/frontend/src/locale/en-US/common.ts +++ b/frontend/src/locale/en-US/common.ts @@ -82,6 +82,7 @@ export default { 'common.newSuccess': 'Added successfully', 'common.publish': 'Publish', 'common.publishSuccessfully': 'Published successfully', + 'common.publishFailed': 'Published failed', 'common.string': 'String', 'common.number': 'Number', 'common.boolean': 'Boolean', diff --git a/frontend/src/locale/zh-CN/common.ts b/frontend/src/locale/zh-CN/common.ts index ef0169539e..c251210e02 100644 --- a/frontend/src/locale/zh-CN/common.ts +++ b/frontend/src/locale/zh-CN/common.ts @@ -83,6 +83,7 @@ export default { 'common.newSuccess': '新增成功', 'common.publish': '发布', 'common.publishSuccessfully': '发布成功', + 'common.publishFailed': '发布失败', 'common.string': '字符串', 'common.number': '数字', 'common.boolean': '布尔', diff --git a/frontend/src/views/project-management/environmental/components/envGroup/EnvGroupBox.vue b/frontend/src/views/project-management/environmental/components/EnvGroupBox.vue similarity index 98% rename from frontend/src/views/project-management/environmental/components/envGroup/EnvGroupBox.vue rename to frontend/src/views/project-management/environmental/components/EnvGroupBox.vue index 3a820d77ba..5a4899af8d 100644 --- a/frontend/src/views/project-management/environmental/components/envGroup/EnvGroupBox.vue +++ b/frontend/src/views/project-management/environmental/components/EnvGroupBox.vue @@ -49,7 +49,7 @@