Skip to content

Commit 13b1796

Browse files
committed
fix pages
1 parent ee01c9b commit 13b1796

File tree

2 files changed

+26
-13
lines changed

2 files changed

+26
-13
lines changed

ui/public/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3875,7 +3875,7 @@
38753875
"message.template.arch": "Please select a Template architecture.",
38763876
"message.template.desc": "OS image that can be used to boot Instances.",
38773877
"message.template.import.vm.temporary": "If a temporary Template is used, the reset Instance operation will not work after importing it.",
3878-
"message.template.iso": "Please select a Template or ISO to continue.",
3878+
"message.template.iso": "Please select a Template, ISO, volume or a snapshot to continue.",
38793879
"message.template.type.change.warning": "WARNING: Changing the Template type to SYSTEM will disable further changes to the Template.",
38803880
"message.tooltip.reserved.system.netmask": "The Network prefix that defines the Pod subnet. Uses CIDR notation.",
38813881
"message.traffic.type.deleted": "Successfully deleted traffic type",

ui/src/views/compute/DeployVM.vue

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,7 +1411,7 @@ export default {
14111411
return this.$route.query.arch || null
14121412
},
14131413
querySnapshotId () {
1414-
return this.$route.query.snapshotid | null
1414+
return this.$route.query.snapshotid || null
14151415
},
14161416
queryVolumeId () {
14171417
return this.$route.query.volumeid || null
@@ -2682,21 +2682,28 @@ export default {
26822682
args.showicon = 'true'
26832683
args.id = this.queryVolumeId
26842684
args.isvnf = false
2685+
args.state = 'Ready'
2686+
const pageSize = args.pageSize ? args.pageSize : 10
2687+
const pageStart = (args.page ? args.page - 1 : 0) * pageSize
2688+
const pageEnd = pageSize * (pageStart + 1)
26852689
26862690
delete args.category
26872691
delete args.public
26882692
delete args.featured
2693+
delete args.page
2694+
delete args.pageSize
26892695
26902696
return new Promise((resolve, reject) => {
26912697
getAPI('listVolumes', args).then((response) => {
2692-
const listvolumesresponse = { count: 0, volume: [] }
2698+
let count = 0
2699+
const volumes = []
26932700
response.listvolumesresponse.volume.forEach(volume => {
2694-
if (!volume.virtualmachineid && volume.state === 'Ready') {
2695-
listvolumesresponse.count += 1
2696-
listvolumesresponse.volume.push({ ...volume, displaytext: volume.name })
2701+
if (!volume.virtualmachineid) {
2702+
count += 1
2703+
volumes.push({ ...volume, displaytext: volume.name })
26972704
}
26982705
})
2699-
resolve({ listvolumesresponse })
2706+
resolve({ listvolumesresponse: { count, volume: volumes.slice(pageStart, pageEnd) } })
27002707
}).catch((reason) => {
27012708
// ToDo: Handle errors
27022709
reject(reason)
@@ -2723,21 +2730,27 @@ export default {
27232730
args.details = 'all'
27242731
args.showicon = 'true'
27252732
args.isvnf = false
2733+
const pageSize = args.pageSize ? args.pageSize : 10
2734+
const pageStart = (args.page ? args.page - 1 : 0) * pageSize
2735+
const pageEnd = pageSize * (pageStart + 1)
27262736
27272737
delete args.category
27282738
delete args.public
27292739
delete args.featured
2740+
delete args.page
2741+
delete args.pageSize
27302742
27312743
return new Promise((resolve, reject) => {
27322744
getAPI('listSnapshots', args).then((response) => {
2733-
const listsnapshotsresponse = { count: 0, snapshot: [] }
2745+
let count = 0
2746+
const snapshots = []
27342747
response.listsnapshotsresponse.snapshot.forEach(snapshot => {
27352748
if (snapshot.volumetype === 'ROOT') {
2736-
listsnapshotsresponse.count += 1
2737-
listsnapshotsresponse.snapshot.push({ ...snapshot, displaytext: snapshot.name })
2749+
count += 1
2750+
snapshots.push({ ...snapshot, displaytext: snapshot.name })
27382751
}
27392752
})
2740-
resolve({ listsnapshotsresponse })
2753+
resolve({ listsnapshotsresponse: { count, snapshot: snapshots.slice(pageStart, pageEnd) } })
27412754
}).catch((reason) => {
27422755
// ToDo: Handle errors
27432756
reject(reason)
@@ -2882,7 +2895,7 @@ export default {
28822895
this.imageSearchFilters = params
28832896
const volumeFilters = this.getImageFilters(params)
28842897
volumeFilters.forEach((filter) => {
2885-
volumes[filter] = { count: 0, iso: [] }
2898+
volumes[filter] = { count: 0, volume: [] }
28862899
promises.push(this.fetchUnattachedVolumes(filter, params))
28872900
})
28882901
this.options.volumes = volumes
@@ -2904,7 +2917,7 @@ export default {
29042917
this.imageSearchFilters = params
29052918
const snapshotFilters = this.getImageFilters(params)
29062919
snapshotFilters.forEach((filter) => {
2907-
snapshots[filter] = { count: 0, iso: [] }
2920+
snapshots[filter] = { count: 0, snapshot: [] }
29082921
promises.push(this.fetchRootSnapshots(filter, params))
29092922
})
29102923
this.options.snapshots = snapshots

0 commit comments

Comments
 (0)