rohityadavcloud commented on code in PR #7846:
URL: https://github.com/apache/cloudstack/pull/7846#discussion_r1290066848
##########
ui/src/views/AutogenView.vue:
##########
@@ -918,19 +922,37 @@ export default {
break
}
}
- this.itemCount = 0
+ var apiItemCount = 0
for (const key in json[responseName]) {
if (key === 'count') {
- this.itemCount = json[responseName].count
+ apiItemCount = json[responseName].count
continue
}
objectName = key
break
}
+
+ if ((this.apiName.toLowerCase() + 'response') !==
responseName.toLowerCase()) {
+ console.log('DEBUG - Discarding API response as expected API
response key does not match response name:', responseName)
+ return
+ }
+ if ('id' in this.$route.params && this.$route.params.id !== params.id)
{
+ console.log('DEBUG - Discarding API response as its `id` does not
match $route.param.id')
+ return
+ }
+ if (this.dataView && apiItemCount > 1) {
+ console.log('DEBUG - Discarding API response as got more than one
item in data view', this.$route.params, this.items)
+ return
+ }
+
this.items = json[responseName][objectName]
if (!this.items || this.items.length === 0) {
this.items = []
}
+ this.itemCount = apiItemCount
+ if (this.itemCount !== this.items.length) {
+ console.log('WARN: API items length does not match the API return
count, something is wrong')
Review Comment:
this is one part that needs testing, I observed it a few times
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]