@@ -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
@@ -2669,21 +2669,28 @@ export default {
26692669 args .showicon = ' true'
26702670 args .id = this .queryVolumeId
26712671 args .isvnf = false
2672+ args .state = ' Ready'
2673+ const pageSize = args .pageSize ? args .pageSize : 10
2674+ const pageStart = (args .page ? args .page - 1 : 0 ) * pageSize
2675+ const pageEnd = pageSize * (pageStart + 1 )
26722676
26732677 delete args .category
26742678 delete args .public
26752679 delete args .featured
2680+ delete args .page
2681+ delete args .pageSize
26762682
26772683 return new Promise ((resolve , reject ) => {
26782684 getAPI (' listVolumes' , args).then ((response ) => {
2679- const listvolumesresponse = { count: 0 , volume: [] }
2685+ let count = 0
2686+ const volumes = []
26802687 response .listvolumesresponse .volume .forEach (volume => {
2681- if (! volume .virtualmachineid && volume . state === ' Ready ' ) {
2682- listvolumesresponse . count += 1
2683- listvolumesresponse . volume .push ({ ... volume, displaytext: volume .name })
2688+ if (! volume .virtualmachineid ) {
2689+ count += 1
2690+ volumes .push ({ ... volume, displaytext: volume .name })
26842691 }
26852692 })
2686- resolve ({ listvolumesresponse })
2693+ resolve ({ listvolumesresponse: { count, volume : volumes . slice (pageStart, pageEnd) } })
26872694 }).catch ((reason ) => {
26882695 // ToDo: Handle errors
26892696 reject (reason)
@@ -2710,21 +2717,27 @@ export default {
27102717 args .details = ' all'
27112718 args .showicon = ' true'
27122719 args .isvnf = false
2720+ const pageSize = args .pageSize ? args .pageSize : 10
2721+ const pageStart = (args .page ? args .page - 1 : 0 ) * pageSize
2722+ const pageEnd = pageSize * (pageStart + 1 )
27132723
27142724 delete args .category
27152725 delete args .public
27162726 delete args .featured
2727+ delete args .page
2728+ delete args .pageSize
27172729
27182730 return new Promise ((resolve , reject ) => {
27192731 getAPI (' listSnapshots' , args).then ((response ) => {
2720- const listsnapshotsresponse = { count: 0 , snapshot: [] }
2732+ let count = 0
2733+ const snapshots = []
27212734 response .listsnapshotsresponse .snapshot .forEach (snapshot => {
27222735 if (snapshot .volumetype === ' ROOT' ) {
2723- listsnapshotsresponse . count += 1
2724- listsnapshotsresponse . snapshot .push ({ ... snapshot, displaytext: snapshot .name })
2736+ count += 1
2737+ snapshots .push ({ ... snapshot, displaytext: snapshot .name })
27252738 }
27262739 })
2727- resolve ({ listsnapshotsresponse })
2740+ resolve ({ listsnapshotsresponse: { count, snapshot : snapshots . slice (pageStart, pageEnd) } })
27282741 }).catch ((reason ) => {
27292742 // ToDo: Handle errors
27302743 reject (reason)
@@ -2869,7 +2882,7 @@ export default {
28692882 this .imageSearchFilters = params
28702883 const volumeFilters = this .getImageFilters (params)
28712884 volumeFilters .forEach ((filter ) => {
2872- volumes[filter] = { count: 0 , iso : [] }
2885+ volumes[filter] = { count: 0 , volume : [] }
28732886 promises .push (this .fetchUnattachedVolumes (filter, params))
28742887 })
28752888 this .options .volumes = volumes
@@ -2891,7 +2904,7 @@ export default {
28912904 this .imageSearchFilters = params
28922905 const snapshotFilters = this .getImageFilters (params)
28932906 snapshotFilters .forEach ((filter ) => {
2894- snapshots[filter] = { count: 0 , iso : [] }
2907+ snapshots[filter] = { count: 0 , snapshot : [] }
28952908 promises .push (this .fetchRootSnapshots (filter, params))
28962909 })
28972910 this .options .snapshots = snapshots
0 commit comments