@@ -1392,7 +1392,7 @@ export default {
13921392 return this .$route .query .arch || null
13931393 },
13941394 querySnapshotId () {
1395- return this .$route .query .snapshotid | null
1395+ return this .$route .query .snapshotid || null
13961396 },
13971397 queryVolumeId () {
13981398 return this .$route .query .volumeid || null
@@ -2645,21 +2645,28 @@ export default {
26452645 args .showicon = ' true'
26462646 args .id = this .queryVolumeId
26472647 args .isvnf = false
2648+ args .state = ' Ready'
2649+ const pageSize = args .pageSize ? args .pageSize : 10
2650+ const pageStart = (args .page ? args .page - 1 : 0 ) * pageSize
2651+ const pageEnd = pageSize * (pageStart + 1 )
26482652
26492653 delete args .category
26502654 delete args .public
26512655 delete args .featured
2656+ delete args .page
2657+ delete args .pageSize
26522658
26532659 return new Promise ((resolve , reject ) => {
26542660 getAPI (' listVolumes' , args).then ((response ) => {
2655- const listvolumesresponse = { count: 0 , volume: [] }
2661+ let count = 0
2662+ const volumes = []
26562663 response .listvolumesresponse .volume .forEach (volume => {
2657- if (! volume .virtualmachineid && volume . state === ' Ready ' ) {
2658- listvolumesresponse . count += 1
2659- listvolumesresponse . volume .push ({ ... volume, displaytext: volume .name })
2664+ if (! volume .virtualmachineid ) {
2665+ count += 1
2666+ volumes .push ({ ... volume, displaytext: volume .name })
26602667 }
26612668 })
2662- resolve ({ listvolumesresponse })
2669+ resolve ({ listvolumesresponse: { count, volume : volumes . slice (pageStart, pageEnd) } })
26632670 }).catch ((reason ) => {
26642671 // ToDo: Handle errors
26652672 reject (reason)
@@ -2686,21 +2693,27 @@ export default {
26862693 args .details = ' all'
26872694 args .showicon = ' true'
26882695 args .isvnf = false
2696+ const pageSize = args .pageSize ? args .pageSize : 10
2697+ const pageStart = (args .page ? args .page - 1 : 0 ) * pageSize
2698+ const pageEnd = pageSize * (pageStart + 1 )
26892699
26902700 delete args .category
26912701 delete args .public
26922702 delete args .featured
2703+ delete args .page
2704+ delete args .pageSize
26932705
26942706 return new Promise ((resolve , reject ) => {
26952707 getAPI (' listSnapshots' , args).then ((response ) => {
2696- const listsnapshotsresponse = { count: 0 , snapshot: [] }
2708+ let count = 0
2709+ const snapshots = []
26972710 response .listsnapshotsresponse .snapshot .forEach (snapshot => {
26982711 if (snapshot .volumetype === ' ROOT' ) {
2699- listsnapshotsresponse . count += 1
2700- listsnapshotsresponse . snapshot .push ({ ... snapshot, displaytext: snapshot .name })
2712+ count += 1
2713+ snapshots .push ({ ... snapshot, displaytext: snapshot .name })
27012714 }
27022715 })
2703- resolve ({ listsnapshotsresponse })
2716+ resolve ({ listsnapshotsresponse: { count, snapshot : snapshots . slice (pageStart, pageEnd) } })
27042717 }).catch ((reason ) => {
27052718 // ToDo: Handle errors
27062719 reject (reason)
@@ -2842,7 +2855,7 @@ export default {
28422855 this .imageSearchFilters = params
28432856 const volumeFilters = this .getImageFilters (params)
28442857 volumeFilters .forEach ((filter ) => {
2845- volumes[filter] = { count: 0 , iso : [] }
2858+ volumes[filter] = { count: 0 , volume : [] }
28462859 promises .push (this .fetchUnattachedVolumes (filter, params))
28472860 })
28482861 this .options .volumes = volumes
@@ -2864,7 +2877,7 @@ export default {
28642877 this .imageSearchFilters = params
28652878 const snapshotFilters = this .getImageFilters (params)
28662879 snapshotFilters .forEach ((filter ) => {
2867- snapshots[filter] = { count: 0 , iso : [] }
2880+ snapshots[filter] = { count: 0 , snapshot : [] }
28682881 promises .push (this .fetchRootSnapshots (filter, params))
28692882 })
28702883 this .options .snapshots = snapshots
0 commit comments