Skip to content

Commit 6e6cbb3

Browse files
ice201508Jiuling.Lei
andauthored
fix-settings-update-flash (#1341)
Co-authored-by: Jiuling.Lei <[email protected]>
1 parent 1fa7df8 commit 6e6cbb3

File tree

9 files changed

+28
-20
lines changed

9 files changed

+28
-20
lines changed

frontend/src/components/application_spaces/ApplicationSpaceDetail.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,13 @@
244244
}
245245
}
246246
247-
const fetchRepoDetail = async () => {
247+
const fetchRepoDetail = async (isUpdate = false) => {
248248
if (isDataLoading.value) {
249249
return false
250250
}
251-
252-
isDataLoading.value = true
251+
if (!isUpdate) {
252+
isDataLoading.value = true
253+
}
253254
254255
const url = `/${props.repoType}s/${props.namespace}/${props.repoName}`
255256

frontend/src/components/application_spaces/ApplicationSpaceSettings.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,10 @@
828828
if (payload.hasOwnProperty('private')) {
829829
this.updateVisibility(payload.private)
830830
}
831-
await this.fetchRepoDetail()
831+
const shouldRefreshRepo = !(payload.hasOwnProperty('cluster_id') || payload.hasOwnProperty('resource_id'))
832+
if (shouldRefreshRepo) {
833+
await this.fetchRepoDetail(true)
834+
}
832835
}
833836
},
834837

frontend/src/components/codes/CodeSettings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@
301301
if (payload.hasOwnProperty('private')) {
302302
this.updateVisibility(payload.private)
303303
}
304-
this.fetchRepoDetail()
304+
this.fetchRepoDetail(true)
305305
}
306306
},
307307

frontend/src/components/datasets/DatasetSettings.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@
665665
}
666666
const { error } = await useFetchApi(updateReadmeEndpoint, option).put().json()
667667
if (!error.value) {
668-
this.fetchRepoDetail()
668+
this.fetchRepoDetail(true)
669669
ElMessage({ message: this.$t('all.updateSuccess'), type: 'success' })
670670
} else {
671671
ElMessage({ message: error.value.msg, type: 'warning' })
@@ -686,7 +686,7 @@
686686
ElMessage({ message: error.value.msg, type: 'warning' })
687687
throw new Error(error.value.msg)
688688
} else {
689-
this.fetchRepoDetail()
689+
this.fetchRepoDetail(true)
690690
ElMessage({ message: this.$t('all.updateSuccess'), type: 'success' })
691691
}
692692
},
@@ -725,7 +725,7 @@
725725
if (error.value) {
726726
ElMessage.warning(error.value.msg)
727727
} else {
728-
this.fetchRepoDetail()
728+
this.fetchRepoDetail(true)
729729
ElMessage.success(this.$t('datasets.edit.updateSuccess'))
730730
}
731731
},

frontend/src/components/endpoints/EndpointDetail.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,13 @@
141141
}
142142
}
143143
144-
const fetchRepoDetail = async () => {
144+
const fetchRepoDetail = async (isUpdate = false) => {
145145
if (isDataLoading.value) {
146146
return false
147147
}
148-
isDataLoading.value = true
148+
if (!isUpdate) {
149+
isDataLoading.value = true
150+
}
149151
150152
const url = `/models/${props.namespace}/${props.modelName}/run/${props.endpointId}`
151153

frontend/src/components/endpoints/EndpointSettings.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,14 +491,14 @@
491491
const { data, error } = await useFetchApi(endpointUpdateEndpoint, options)
492492
.put()
493493
.json()
494-
494+
495495
if (error.value) {
496496
ElMessage({ message: error.value.msg, type: 'warning' })
497497
} else {
498498
if (payload.hasOwnProperty('private')) {
499499
repoDetailStore.updateVisibility(payload.private)
500500
}
501-
fetchRepoDetail()
501+
fetchRepoDetail(true)
502502
ElMessage({ message: data.value.msg, type: 'success' })
503503
}
504504
}

frontend/src/components/mcp/McpSettings.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@
539539
.json()
540540
541541
if (data.value) {
542-
fetchRepoDetail(false)
542+
fetchRepoDetail(true)
543543
ElMessage({ message: t('all.updateSuccess'), type: 'success' })
544544
} else {
545545
ElMessage({ message: error.value.msg, type: 'warning' })
@@ -585,7 +585,7 @@
585585
if (payload.hasOwnProperty('private')) {
586586
updateVisibility(payload.private)
587587
}
588-
fetchRepoDetail(false)
588+
fetchRepoDetail(true)
589589
ElMessage({ message: 'Success', type: 'success' })
590590
}
591591
}

frontend/src/components/models/ModelSettings.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@
652652
}
653653
const { data, error } = await useFetchApi(updateReadmeEndpoint, option).put().json()
654654
if (data.value) {
655-
this.fetchRepoDetail()
655+
this.fetchRepoDetail(true)
656656
ElMessage({ message: this.$t('all.updateSuccess'), type: 'success' })
657657
} else {
658658
ElMessage({ message: error.value.msg, type: 'warning' })
@@ -670,7 +670,7 @@
670670
if (error.value) {
671671
ElMessage({ message: error.value.msg, type: 'warning' })
672672
} else {
673-
this.fetchRepoDetail()
673+
this.fetchRepoDetail(true)
674674
ElMessage({ message: this.$t('all.addSuccess'), type: 'success' })
675675
}
676676
},
@@ -712,7 +712,7 @@
712712
if (payload.hasOwnProperty('private')) {
713713
this.updateVisibility(payload.private)
714714
}
715-
this.fetchRepoDetail()
715+
this.fetchRepoDetail(true)
716716
ElMessage({ message: 'Success', type: 'success' })
717717
}
718718
}

frontend/src/components/shared/RepoDetail.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,15 @@
100100
)
101101
})
102102
103-
const fetchRepoDetail = async () => {
103+
const fetchRepoDetail = async (isUpdate = false) => {
104104
if (isDataLoading.value) {
105105
return false
106106
}
107107
108-
isDataLoading.value = true
109-
lastFetchTime.value = Date.now()
108+
if (!isUpdate) {
109+
isDataLoading.value = true
110+
lastFetchTime.value = Date.now()
111+
}
110112
111113
const timestamp = Date.now()
112114
const url = `/${props.repoType}s/${props.namespace}/${props.repoName}?_t=${timestamp}`

0 commit comments

Comments
 (0)