diff --git a/frontend/src/components/__tests__/collections/CollectionsSettings.spec.js b/frontend/src/components/__tests__/collections/CollectionsSettings.spec.js index bbb34b2c9..056ea001b 100644 --- a/frontend/src/components/__tests__/collections/CollectionsSettings.spec.js +++ b/frontend/src/components/__tests__/collections/CollectionsSettings.spec.js @@ -83,11 +83,15 @@ describe('CollectionsSettings.vue', () => { it('更新集合名称和描述', async () => { const wrapper = createWrapper() - const updateButtons = wrapper.findAll('.btn-secondary-gray') const nicknameInputs = wrapper.findAll('.el-input__inner') // 使用第一个输入框(集合名称) await nicknameInputs[0].setValue('New Name') + await nextTick() // 等待响应式更新 + + // 现在更新按钮应该显示了,因为内容发生了变化 + const updateButtons = wrapper.findAll('.btn-secondary-gray') + expect(updateButtons.length).toBeGreaterThan(0) await updateButtons[0].trigger('click') expect(useFetchApiMock).toHaveBeenCalledWith( @@ -138,8 +142,15 @@ it('删除集合需要正确输入名称', async () => { it('处理API错误情况', async () => { mockPut.mockResolvedValueOnce({ data: { value: null }, error: { value: { msg: 'Error' } } }) const wrapper = createWrapper() - // 使用更精确的选择器找到第一个更新按钮 + + // 先修改输入内容以触发按钮显示 + const nicknameInputs = wrapper.findAll('.el-input__inner') + await nicknameInputs[0].setValue('Modified Name') + await nextTick() // 等待响应式更新 + + // 现在更新按钮应该显示了 const updateButtons = wrapper.findAll('.btn-secondary-gray') + expect(updateButtons.length).toBeGreaterThan(0) await updateButtons[0].trigger('click') expect(ElMessage.warning).toHaveBeenCalled() diff --git a/frontend/src/components/application_spaces/ApplicationSpaceSettings.vue b/frontend/src/components/application_spaces/ApplicationSpaceSettings.vue index e1d01a499..32df5a570 100644 --- a/frontend/src/components/application_spaces/ApplicationSpaceSettings.vue +++ b/frontend/src/components/application_spaces/ApplicationSpaceSettings.vue @@ -41,7 +41,114 @@
+ class="flex flex-col gap-6 my-8 md:my-0 md:border-none py-6"> + +
+
+
+ {{ $t('application_spaces.name') }} +
+
+ {{ $t('application_spaces.nameTips') }} +
+
+
+

+ {{ $t('application_spaces.namespaceName') }} +

+
+ {{ applicationSpacePath }} +
+
+
+ + + +
+
+
+ {{ $t('application_spaces.nickname') }} +
+
+ {{ $t('application_spaces.edit.tips') }} +
+
+
+ + +
+
+ + + +
+
+
+ {{ $t('application_spaces.desc') }} +
+
+ {{ $t('application_spaces.edit.tips2') }} +
+
+
+ + +
+
+ + + + +
+
+
+ {{ $t('application_spaces.new.cluster') }} +
+
+
+
+ + + +
+
+
+
@@ -70,6 +177,14 @@ :disabled="!item.is_available" /> +
@@ -102,7 +217,6 @@
-
@@ -121,87 +235,7 @@ />
- - - - -
-
-
- {{ $t('application_spaces.name') }} -
-
- {{ $t('application_spaces.nameTips') }} -
-
-
-

- {{ $t('application_spaces.namespaceName') }} -

-
- {{ applicationSpacePath }} -
-
-
- - - - -
-
-
- {{ $t('application_spaces.nickname') }} -
-
- {{ $t('application_spaces.edit.tips') }} -
-
-
- - -
-
- - - - -
-
-
- {{ $t('application_spaces.desc') }} -
-
- {{ $t('application_spaces.edit.tips2') }} -
-
-
- - -
-
- +
@@ -220,6 +254,7 @@
-
@@ -22,7 +22,6 @@
-
@@ -41,6 +40,7 @@ size="large" class="!w-[512px] sm:!w-full" />
-
@@ -68,6 +67,7 @@ type="textarea" class="!w-[512px] sm:!w-full" /> @@ -115,7 +115,6 @@
-
@@ -178,6 +177,8 @@ theCodeNickname: this.codeNickname || '', theCodeDesc: this.codeDesc || '', codePath: this.path, + originalCodeNickname: this.codeNickname || '', + originalCodeDesc: this.codeDesc || '', options: [ { value: 'Private', label: this.$t('all.private') }, { value: 'Public', label: this.$t('all.public') } @@ -187,6 +188,12 @@ computed: { ...mapState(useRepoDetailStore, ['isPrivate']), ...mapWritableState(useRepoDetailStore, ['privateVisibility']), + hasNicknameChanged() { + return this.theCodeNickname.trim() !== this.originalCodeNickname.trim() + }, + hasDescChanged() { + return this.theCodeDesc.trim() !== this.originalCodeDesc.trim() + }, visibilityName: { get() { return !!this.privateVisibility ? 'Private' : 'Public' diff --git a/frontend/src/components/collections/CollectionsSettings.vue b/frontend/src/components/collections/CollectionsSettings.vue index bcb08cf1d..c0e79bfe8 100644 --- a/frontend/src/components/collections/CollectionsSettings.vue +++ b/frontend/src/components/collections/CollectionsSettings.vue @@ -1,7 +1,6 @@