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 @@ /> + + + + + + + +