From 4b3090e4468b0a07a6b5530791625de12a43acb8 Mon Sep 17 00:00:00 2001 From: jiuling Date: Sun, 26 Oct 2025 11:10:44 +0800 Subject: [PATCH 1/2] Draft MR From a4d6807f7685a35ea48d96341e1b7e07d6494982 Mon Sep 17 00:00:00 2001 From: "Jiuling.Lei" Date: Mon, 27 Oct 2025 02:23:46 +0000 Subject: [PATCH 2/2] Main feature space allow to set min replica --- .../ApplicationSpaceSettings.vue | 65 ++++++++++++++++++- .../NewApplicationSpace.vue | 29 ++++++++- frontend/src/components/shared/RepoTabs.vue | 1 + 3 files changed, 93 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/application_spaces/ApplicationSpaceSettings.vue b/frontend/src/components/application_spaces/ApplicationSpaceSettings.vue index 4b34ceb3f..8d6edb557 100644 --- a/frontend/src/components/application_spaces/ApplicationSpaceSettings.vue +++ b/frontend/src/components/application_spaces/ApplicationSpaceSettings.vue @@ -301,6 +301,47 @@ + + + +
+
+
+ {{ $t('endpoints.settings.minReplica') }} +
+
+
+

+ {{ $t('endpoints.settings.currentMinReplica') }} +

+ + + + + +
+
+
@@ -541,7 +582,8 @@ cloudResource: String, coverImage: String, variables: Object, - tags: { type: Object, default: () => ({}) } + tags: { type: Object, default: () => ({}) }, + minReplica: Number }, components: { ApplicationSpaceEnvEditor }, @@ -555,11 +597,13 @@ theVariables: this.variables || {}, theClusterId: this.clusterId || '', theCloudResource: this.cloudResource != null ? String(this.cloudResource) : '', + theMinReplica: this.minReplica != null ? this.minReplica : 0, originalApplicationSpaceNickname: this.applicationSpaceNickname || '', originalApplicationSpaceDesc: this.applicationSpaceDesc || '', originalVariables: JSON.stringify(this.variables || {}), originalClusterId: this.clusterId || '', originalCloudResource: this.cloudResource != null ? String(this.cloudResource) : '', + originalMinReplica: this.minReplica != null ? this.minReplica : 0, options: [ { value: 'Private', label: this.$t('all.private') }, { value: 'Public', label: this.$t('all.public') } @@ -656,6 +700,9 @@ const originalTagIds = this.originalTags.map(tag => tag.uid).sort() const currentTagIds = this.selectedTags.map(tag => tag.uid).sort() return JSON.stringify(originalTagIds) !== JSON.stringify(currentTagIds) + }, + hasMinReplicaChanged() { + return this.theMinReplica !== this.originalMinReplica } }, @@ -1103,6 +1150,11 @@ this.updateApplicationSpace(payload,this.$t('application_spaces.edit.spaceVariables')) }, + updateMinReplica() { + const payload = { min_replica: this.theMinReplica } + this.updateApplicationSpace(payload, this.$t('endpoints.settings.minReplica')) + }, + async updateApplicationSpace(payload,field) { const applicationSpaceUpdateEndpoint = `/spaces/${this.path}` const options = { @@ -1168,6 +1220,17 @@ } }, immediate: true + }, + minReplica: { + handler(newVal) { + if (newVal != null) { + this.theMinReplica = newVal + if (this.originalMinReplica === (this.minReplica != null ? this.minReplica : 0)) { + this.originalMinReplica = newVal + } + } + }, + immediate: true } } } diff --git a/frontend/src/components/application_spaces/NewApplicationSpace.vue b/frontend/src/components/application_spaces/NewApplicationSpace.vue index a11ea2b27..7ac11c940 100644 --- a/frontend/src/components/application_spaces/NewApplicationSpace.vue +++ b/frontend/src/components/application_spaces/NewApplicationSpace.vue @@ -142,6 +142,31 @@ /> + + + + + + + +