Skip to content

Commit abdbe96

Browse files
committed
test gemini cli
1 parent 15c2e50 commit abdbe96

3 files changed

Lines changed: 90 additions & 119 deletions

File tree

ui/src/views/dashboard/CapacityDashboard.vue

Lines changed: 22 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -506,61 +506,29 @@ export default {
506506
routers: 0
507507
}
508508
this.loading = true
509-
getAPI('listPods', { zoneid: zone.id }).then(json => {
510-
this.loading = false
511-
this.data.pods = json?.listpodsresponse?.count
512-
if (!this.data.pods) {
513-
this.data.pods = 0
514-
}
515-
})
516-
getAPI('listClusters', { zoneid: zone.id }).then(json => {
517-
this.loading = false
518-
this.data.clusters = json?.listclustersresponse?.count
519-
if (!this.data.clusters) {
520-
this.data.clusters = 0
521-
}
522-
})
523-
getAPI('listHosts', { zoneid: zone.id, listall: true, details: 'min', type: 'routing', page: 1, pagesize: 1 }).then(json => {
524-
this.loading = false
525-
this.data.totalHosts = json?.listhostsresponse?.count
526-
if (!this.data.totalHosts) {
527-
this.data.totalHosts = 0
528-
}
529-
})
530-
getAPI('listHosts', { zoneid: zone.id, listall: true, details: 'min', type: 'routing', state: 'alert', page: 1, pagesize: 1 }).then(json => {
531-
this.loading = false
532-
this.data.alertHosts = json?.listhostsresponse?.count
533-
if (!this.data.alertHosts) {
534-
this.data.alertHosts = 0
535-
}
536-
})
537-
getAPI('listStoragePools', { zoneid: zone.id }).then(json => {
538-
this.loading = false
539-
this.data.pools = json?.liststoragepoolsresponse?.count
540-
if (!this.data.pools) {
541-
this.data.pools = 0
542-
}
543-
})
544-
getAPI('listSystemVms', { zoneid: zone.id }).then(json => {
545-
this.loading = false
546-
this.data.systemvms = json?.listsystemvmsresponse?.count
547-
if (!this.data.systemvms) {
548-
this.data.systemvms = 0
549-
}
550-
})
551-
getAPI('listRouters', { zoneid: zone.id, listall: true, projectid: '-1' }).then(json => {
552-
this.loading = false
553-
this.data.routers = json?.listroutersresponse?.count
554-
if (!this.data.routers) {
555-
this.data.routers = 0
556-
}
557-
})
558-
getAPI('listVirtualMachines', { zoneid: zone.id, listall: true, projectid: '-1', details: 'min', page: 1, pagesize: 1 }).then(json => {
509+
510+
const promises = [
511+
getAPI('listPods', { zoneid: zone.id }),
512+
getAPI('listClusters', { zoneid: zone.id }),
513+
getAPI('listHosts', { zoneid: zone.id, listall: true, details: 'min', type: 'routing', page: 1, pagesize: 1 }),
514+
getAPI('listHosts', { zoneid: zone.id, listall: true, details: 'min', type: 'routing', state: 'alert', page: 1, pagesize: 1 }),
515+
getAPI('listStoragePools', { zoneid: zone.id }),
516+
getAPI('listSystemVms', { zoneid: zone.id }),
517+
getAPI('listRouters', { zoneid: zone.id, listall: true, projectid: '-1' }),
518+
getAPI('listVirtualMachines', { zoneid: zone.id, listall: true, projectid: '-1', details: 'min', page: 1, pagesize: 1 })
519+
]
520+
521+
Promise.all(promises).then(json => {
522+
this.data.pods = json[0]?.listpodsresponse?.count || 0
523+
this.data.clusters = json[1]?.listclustersresponse?.count || 0
524+
this.data.totalHosts = json[2]?.listhostsresponse?.count || 0
525+
this.data.alertHosts = json[3]?.listhostsresponse?.count || 0
526+
this.data.pools = json[4]?.liststoragepoolsresponse?.count || 0
527+
this.data.systemvms = json[5]?.listsystemvmsresponse?.count || 0
528+
this.data.routers = json[6]?.listroutersresponse?.count || 0
529+
this.data.instances = json[7]?.listvirtualmachinesresponse?.count || 0
530+
}).finally(() => {
559531
this.loading = false
560-
this.data.instances = json?.listvirtualmachinesresponse?.count
561-
if (!this.data.instances) {
562-
this.data.instances = 0
563-
}
564532
})
565533
},
566534
listAlerts () {
@@ -569,10 +537,8 @@ export default {
569537
pagesize: 8,
570538
listall: true
571539
}
572-
this.loading = true
573540
getAPI('listAlerts', params).then(json => {
574541
this.alerts = []
575-
this.loading = false
576542
if (json && json.listalertsresponse && json.listalertsresponse.alert) {
577543
this.alerts = json.listalertsresponse.alert
578544
}
@@ -584,10 +550,8 @@ export default {
584550
pagesize: 8,
585551
listall: true
586552
}
587-
this.loading = true
588553
getAPI('listEvents', params).then(json => {
589554
this.events = []
590-
this.loading = false
591555
if (json && json.listeventsresponse && json.listeventsresponse.event) {
592556
this.events = json.listeventsresponse.event
593557
}

ui/src/views/dashboard/OnboardingDashboard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div class="title">{{ $t('label.what.is.cloudstack') }}</div>
2727
<div class="subtitle">{{ $t('label.introduction.to.cloudstack') }}</div>
2828
<p>{{ $t('message.installwizard.copy.whatiscloudstack') }}</p>
29-
<img class="center" src="assets/bg-what-is-cloudstack.png">
29+
<img class="center" src="assets/bg-what-is-cloudstack.png" loading="lazy">
3030
<pre>{{ $t('message.installwizard.cloudstack.helptext.header') }}</pre>
3131
<pre>{{ $t('message.installwizard.cloudstack.helptext.website') }}<a href="https://cloudstack.apache.org" target="_blank">https://cloudstack.apache.org</a></pre>
3232
<pre>{{ $t('message.installwizard.cloudstack.helptext.document') }}<a :href="'https://docs.cloudstack.apache.org/en/' + cloudstackminorversion" target="_blank">https://docs.cloudstack.apache.org/en/{{ cloudstackminorversion }}</a></pre>

ui/src/views/dashboard/UsageDashboard.vue

Lines changed: 67 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ export default {
466466
return available <= 0 ? '#ff4d4f' : '#52c41a'
467467
},
468468
fetchData () {
469+
this.loading = true
469470
if (store.getters.project.id) {
470471
this.listProject()
471472
} else {
@@ -474,22 +475,18 @@ export default {
474475
this.updateData()
475476
},
476477
listAccount () {
477-
this.loading = true
478478
getAPI('listAccounts', { id: this.$store.getters.userInfo.accountid }).then(json => {
479-
this.loading = false
480479
if (json && json.listaccountsresponse && json.listaccountsresponse.account) {
481480
this.account = json.listaccountsresponse.account[0]
482481
}
483482
})
484483
},
485484
listProject () {
486-
this.loading = true
487485
const params = {
488486
id: store.getters.project.id,
489487
listall: true
490488
}
491489
getAPI('listProjects', params).then(json => {
492-
this.loading = false
493490
if (json?.listprojectsresponse?.project) {
494491
this.project = json.listprojectsresponse.project[0]
495492
}
@@ -510,82 +507,94 @@ export default {
510507
}
511508
this.listInstances()
512509
this.listEvents()
510+
511+
const promises = []
513512
if ('listKubernetesClusters' in this.$store.getters.apis) {
514-
this.loading = true
515-
getAPI('listKubernetesClusters', { listall: true, page: 1, pagesize: 1 }).then(json => {
516-
this.loading = false
517-
this.data.kubernetes = json?.listkubernetesclustersresponse?.count
518-
})
513+
promises.push(getAPI('listKubernetesClusters', { listall: true, page: 1, pagesize: 1 }))
519514
}
520515
if ('listVolumes' in this.$store.getters.apis) {
521-
this.loading = true
522-
getAPI('listVolumes', { listall: true, page: 1, pagesize: 1 }).then(json => {
523-
this.loading = false
524-
this.data.volumes = json?.listvolumesresponse?.count
525-
})
516+
promises.push(getAPI('listVolumes', { listall: true, page: 1, pagesize: 1 }))
526517
}
527518
if ('listSnapshots' in this.$store.getters.apis) {
528-
this.loading = true
529-
getAPI('listSnapshots', { listall: true, page: 1, pagesize: 1 }).then(json => {
530-
this.loading = false
531-
this.data.snapshots = json?.listsnapshotsresponse?.count
532-
})
519+
promises.push(getAPI('listSnapshots', { listall: true, page: 1, pagesize: 1 }))
533520
}
534521
if ('listNetworks' in this.$store.getters.apis) {
535-
this.loading = true
536-
getAPI('listNetworks', { listall: true, page: 1, pagesize: 1 }).then(json => {
537-
this.loading = false
538-
this.data.networks = json?.listnetworksresponse?.count
539-
})
522+
promises.push(getAPI('listNetworks', { listall: true, page: 1, pagesize: 1 }))
540523
}
541524
if ('listVPCs' in this.$store.getters.apis) {
542-
this.loading = true
543-
getAPI('listVPCs', { listall: true, page: 1, pagesize: 1 }).then(json => {
544-
this.loading = false
545-
this.data.vpcs = json?.listvpcsresponse?.count
546-
})
525+
promises.push(getAPI('listVPCs', { listall: true, page: 1, pagesize: 1 }))
547526
}
548527
if ('listPublicIpAddresses' in this.$store.getters.apis) {
549-
this.loading = true
550-
getAPI('listPublicIpAddresses', { listall: true, page: 1, pagesize: 1 }).then(json => {
551-
this.loading = false
552-
this.data.ips = json?.listpublicipaddressesresponse?.count
553-
})
528+
promises.push(getAPI('listPublicIpAddresses', { listall: true, page: 1, pagesize: 1 }))
554529
}
555530
if ('listTemplates' in this.$store.getters.apis) {
556-
this.loading = true
557-
getAPI('listTemplates', { templatefilter: 'self', listall: true, page: 1, pagesize: 1 }).then(json => {
558-
this.loading = false
559-
this.data.templates = json?.listtemplatesresponse?.count
560-
})
531+
promises.push(getAPI('listTemplates', { templatefilter: 'self', listall: true, page: 1, pagesize: 1 }))
532+
}
533+
534+
if (promises.length === 0) {
535+
return
561536
}
537+
538+
this.loading = true
539+
Promise.all(promises).then(json => {
540+
let index = 0
541+
if ('listKubernetesClusters' in this.$store.getters.apis) {
542+
this.data.kubernetes = json[index]?.listkubernetesclustersresponse?.count || 0
543+
index++
544+
}
545+
if ('listVolumes' in this.$store.getters.apis) {
546+
this.data.volumes = json[index]?.listvolumesresponse?.count || 0
547+
index++
548+
}
549+
if ('listSnapshots' in this.$store.getters.apis) {
550+
this.data.snapshots = json[index]?.listsnapshotsresponse?.count || 0
551+
index++
552+
}
553+
if ('listNetworks' in this.$store.getters.apis) {
554+
this.data.networks = json[index]?.listnetworksresponse?.count || 0
555+
index++
556+
}
557+
if ('listVPCs' in this.$store.getters.apis) {
558+
this.data.vpcs = json[index]?.listvpcsresponse?.count || 0
559+
index++
560+
}
561+
if ('listPublicIpAddresses' in this.$store.getters.apis) {
562+
this.data.ips = json[index]?.listpublicipaddressesresponse?.count || 0
563+
index++
564+
}
565+
if ('listTemplates' in this.$store.getters.apis) {
566+
this.data.templates = json[index]?.listtemplatesresponse?.count || 0
567+
}
568+
}).finally(() => {
569+
this.loading = false
570+
})
562571
},
563572
listInstances () {
564573
if (!('listVirtualMachines' in this.$store.getters.apis)) {
565574
return
566575
}
567576
this.loading = true
568-
getAPI('listVirtualMachines', { listall: true, details: 'min', page: 1, pagesize: 1 }).then(json => {
569-
this.loading = false
570-
this.data.instances = json?.listvirtualmachinesresponse?.count
571-
})
572-
getAPI('listVirtualMachines', { listall: true, details: 'min', state: 'running', page: 1, pagesize: 1 }).then(json => {
573-
this.loading = false
574-
this.data.running = json?.listvirtualmachinesresponse?.count
575-
})
576-
getAPI('listVirtualMachines', { listall: true, details: 'min', state: 'stopped', page: 1, pagesize: 1 }).then(json => {
577-
this.loading = false
578-
this.data.stopped = json?.listvirtualmachinesresponse?.count
579-
})
577+
578+
const promises = [
579+
getAPI('listVirtualMachines', { listall: true, details: 'min', page: 1, pagesize: 1 }),
580+
getAPI('listVirtualMachines', { listall: true, details: 'min', state: 'running', page: 1, pagesize: 1 }),
581+
getAPI('listVirtualMachines', { listall: true, details: 'min', state: 'stopped', page: 1, pagesize: 1 })
582+
]
583+
580584
if (this.isLeaseFeatureEnabled) {
581-
getAPI('listVirtualMachines', { leased: true, listall: true, details: 'min', page: 1, pagesize: 1 }).then(json => {
582-
this.loading = false
583-
this.data.leasedinstances = json?.listvirtualmachinesresponse?.count
584-
if (!this.data.leasedinstances) {
585-
this.data.leasedinstances = 0
586-
}
587-
})
585+
promises.push(getAPI('listVirtualMachines', { leased: true, listall: true, details: 'min', page: 1, pagesize: 1 }))
588586
}
587+
588+
Promise.all(promises).then(json => {
589+
this.data.instances = json[0]?.listvirtualmachinesresponse?.count || 0
590+
this.data.running = json[1]?.listvirtualmachinesresponse?.count || 0
591+
this.data.stopped = json[2]?.listvirtualmachinesresponse?.count || 0
592+
if (this.isLeaseFeatureEnabled) {
593+
this.data.leasedinstances = json[3]?.listvirtualmachinesresponse?.count || 0
594+
}
595+
}).finally(() => {
596+
this.loading = false
597+
})
589598
},
590599
listEvents () {
591600
if (!('listEvents' in this.$store.getters.apis)) {
@@ -596,10 +605,8 @@ export default {
596605
pagesize: 8,
597606
listall: true
598607
}
599-
this.loading = true
600608
getAPI('listEvents', params).then(json => {
601609
this.events = []
602-
this.loading = false
603610
if (json && json.listeventsresponse && json.listeventsresponse.event) {
604611
this.events = json.listeventsresponse.event
605612
}

0 commit comments

Comments
 (0)