Skip to content

Commit 4fc90c1

Browse files
committed
Address comments
1 parent 99dca08 commit 4fc90c1

File tree

9 files changed

+20
-28
lines changed

9 files changed

+20
-28
lines changed

ui/src/components/view/DedicateDomain.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ export default {
102102
this.selectedAccount = null
103103
this.$emit('domainChange', domainId)
104104
this.domainError = false
105-
// InfiniteScrollSelect will auto-reload accounts when apiParams changes
106105
},
107106
handleChangeAccount (accountName) {
108107
this.selectedAccount = accountName

ui/src/components/widgets/InfiniteScrollSelect.vue

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,23 @@ export default {
191191
}
192192
// When a valid value is selected, show all options
193193
return this.options
194+
},
195+
apiOptionsCount () {
196+
if (this.defaultOption) {
197+
const defaultOptionValue = this.defaultOption[this.optionValueKey]
198+
return this.options.filter(option => option[this.optionValueKey] !== defaultOptionValue).length
199+
}
200+
return this.options.length
201+
},
202+
preselectedMatchValue () {
203+
// Extract the first value from preselectedOptionValue if it's an array, otherwise return the value itself
204+
if (!this.preselectedOptionValue) return null
205+
return Array.isArray(this.preselectedOptionValue) ? this.preselectedOptionValue[0] : this.preselectedOptionValue
206+
},
207+
preselectedMatch () {
208+
// Find the matching option for the preselected value
209+
if (!this.preselectedMatchValue) return null
210+
return this.options.find(entry => entry[this.optionValueKey] === this.preselectedMatchValue) || null
194211
}
195212
},
196213
watch: {
@@ -246,13 +263,10 @@ export default {
246263
this.resetPreselectedOptionValue()
247264
return
248265
}
249-
const matchValue = Array.isArray(this.preselectedOptionValue) ? this.preselectedOptionValue[0] : this.preselectedOptionValue
250-
const match = this.options.find(entry => entry[this.optionValueKey] === matchValue)
251-
if (!match) {
266+
if (!this.preselectedMatch) {
252267
this.successiveFetches++
253268
// Exclude defaultOption from count when comparing with totalCount
254-
const apiOptionsCount = this.getApiOptionsCount()
255-
if (apiOptionsCount < this.totalCount) {
269+
if (this.apiOptionsCount < this.totalCount) {
256270
this.fetchItems()
257271
} else {
258272
this.resetPreselectedOptionValue()
@@ -274,14 +288,6 @@ export default {
274288
this.preselectedOptionValue = null
275289
this.successiveFetches = 0
276290
},
277-
getApiOptionsCount () {
278-
// Return count of options excluding the locally added defaultOption
279-
if (this.defaultOption) {
280-
const defaultOptionValue = this.defaultOption[this.optionValueKey]
281-
return this.options.filter(option => option[this.optionValueKey] !== defaultOptionValue).length
282-
}
283-
return this.options.length
284-
},
285291
autoSelectFirstOptionIfNeeded () {
286292
if (!this.selectFirstOption || this.hasAutoSelectedFirst) {
287293
return
@@ -331,8 +337,7 @@ export default {
331337
onScroll (e) {
332338
const nearBottom = e.target.scrollTop + e.target.clientHeight >= e.target.scrollHeight - 10
333339
// Exclude defaultOption from count when comparing with totalCount
334-
const apiOptionsCount = this.getApiOptionsCount()
335-
const hasMore = apiOptionsCount < this.totalCount
340+
const hasMore = this.apiOptionsCount < this.totalCount
336341
if (nearBottom && hasMore && !this.loading) {
337342
this.fetchItems()
338343
}

ui/src/views/compute/wizard/OwnershipSelection.vue

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,24 +132,20 @@ export default {
132132
}
133133
},
134134
created () {
135-
// Set initial domain selection
136135
const ownerDomainId = this.$store.getters.project?.domainid || this.$store.getters.userInfo.domainid
137136
if (ownerDomainId) {
138137
this.selectedDomain = ownerDomainId
139138
}
140139
},
141140
methods: {
142141
changeAccountType () {
143-
// Reset account/project selection when switching types
144142
this.selectedAccount = null
145143
this.selectedProject = null
146144
147-
// Trigger initial selection based on type
148145
this.handleDomainChange(this.selectedDomain)
149146
},
150147
handleDomainChange (domainId) {
151148
this.selectedDomain = domainId
152-
// Reset child selections
153149
this.selectedAccount = null
154150
this.selectedProject = null
155151

ui/src/views/iam/AddUser.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ export default {
249249
handleDomainChange (domainId) {
250250
this.form.domainid = domainId
251251
this.form.account = null
252-
// InfiniteScrollSelect will auto-reload accounts when apiParams changes
253252
},
254253
fetchTimeZone (value) {
255254
this.timeZoneMap = []

ui/src/views/infra/UsageRecords.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,6 @@ export default {
564564
handleDomainChange (domainId) {
565565
this.form.domain = domainId
566566
this.form.account = null
567-
// InfiniteScrollSelect will auto-reload accounts when apiParams changes
568567
},
569568
handleDomainOptionChange (option) {
570569
if (option && option.id) {

ui/src/views/storage/CreateTemplate.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ export default {
314314
this.domainid = domainId
315315
this.form.account = null
316316
this.account = null
317-
// InfiniteScrollSelect will auto-reload accounts when apiParams changes
318317
},
319318
handleAccountChange (accountName) {
320319
if (accountName) {

ui/src/views/storage/UploadLocalVolume.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ export default {
262262
this.form.domainid = domainId
263263
this.domainId = domainId
264264
this.form.account = null
265-
// InfiniteScrollSelect will auto-reload accounts when apiParams changes
266265
},
267266
handleAccountChange (accountName) {
268267
this.form.account = accountName

ui/src/views/storage/UploadVolume.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,6 @@ export default {
234234
this.form.domainid = domainId
235235
this.domainId = domainId
236236
this.form.account = null
237-
// InfiniteScrollSelect will auto-reload accounts when apiParams changes
238237
},
239238
handleAccountChange (accountName) {
240239
this.form.account = accountName

ui/src/views/tools/CreateWebhook.vue

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,14 +292,11 @@ export default {
292292
}, 1)
293293
},
294294
handleScopeChange (e) {
295-
// Reset domain and account when scope changes
296295
this.form.domainid = null
297296
this.form.account = null
298297
},
299298
handleDomainChanged (domainid) {
300-
// Reset account when domain changes
301299
this.form.account = null
302-
// InfiniteScrollSelect will auto-reload accounts when apiParams changes
303300
}
304301
}
305302
}

0 commit comments

Comments
 (0)