@@ -454,6 +454,77 @@ export default {
454454 }
455455 ]
456456 } ,
457+ {
458+ name : 'vmsnapshot' ,
459+ title : 'label.vm.snapshots' ,
460+ icon : 'camera-outlined' ,
461+ docHelp : 'adminguide/storage.html#working-with-volume-snapshots' ,
462+ permission : [ 'listVMSnapshot' ] ,
463+ resourceType : 'VMSnapshot' ,
464+ columns : ( ) => {
465+ const fields = [ 'displayname' , 'state' , 'name' , 'type' , 'current' , 'parentName' , 'created' ]
466+ if ( [ 'Admin' , 'DomainAdmin' ] . includes ( store . getters . userInfo . roletype ) ) {
467+ fields . push ( 'domain' )
468+ fields . push ( 'account' )
469+ }
470+ return fields
471+ } ,
472+ details : [ 'name' , 'id' , 'displayname' , 'description' , 'type' , 'current' , 'parentName' , 'virtualmachineid' , 'account' , 'domain' , 'created' ] ,
473+ searchFilters : [ 'name' , 'domainid' , 'account' , 'tags' ] ,
474+ tabs : [
475+ {
476+ name : 'details' ,
477+ component : shallowRef ( defineAsyncComponent ( ( ) => import ( '@/components/view/DetailsTab.vue' ) ) )
478+ } ,
479+ {
480+ name : 'comments' ,
481+ component : shallowRef ( defineAsyncComponent ( ( ) => import ( '@/components/view/AnnotationsTab.vue' ) ) )
482+ }
483+ ] ,
484+ actions : [
485+ {
486+ api : 'createSnapshotFromVMSnapshot' ,
487+ icon : 'camera-outlined' ,
488+ label : 'label.action.create.snapshot.from.vmsnapshot' ,
489+ message : 'message.action.create.snapshot.from.vmsnapshot' ,
490+ dataView : true ,
491+ popup : true ,
492+ show : ( record ) => { return ( record . state === 'Ready' && record . hypervisor === 'KVM' ) } ,
493+ component : shallowRef ( defineAsyncComponent ( ( ) => import ( '@/views/storage/CreateSnapshotFromVMSnapshot.vue' ) ) )
494+ } ,
495+ {
496+ api : 'revertToVMSnapshot' ,
497+ icon : 'sync-outlined' ,
498+ label : 'label.action.vmsnapshot.revert' ,
499+ message : 'label.action.vmsnapshot.revert' ,
500+ dataView : true ,
501+ show : ( record ) => { return record . state === 'Ready' } ,
502+ args : [ 'vmsnapshotid' ] ,
503+ mapping : {
504+ vmsnapshotid : {
505+ value : ( record ) => { return record . id }
506+ }
507+ }
508+ } ,
509+ {
510+ api : 'deleteVMSnapshot' ,
511+ icon : 'delete-outlined' ,
512+ label : 'label.action.vmsnapshot.delete' ,
513+ message : 'message.action.vmsnapshot.delete' ,
514+ dataView : true ,
515+ show : ( record ) => { return [ 'Ready' , 'Expunging' , 'Error' ] . includes ( record . state ) } ,
516+ args : [ 'vmsnapshotid' ] ,
517+ mapping : {
518+ vmsnapshotid : {
519+ value : ( record ) => { return record . id }
520+ }
521+ } ,
522+ groupAction : true ,
523+ popup : true ,
524+ groupMap : ( selection ) => { return selection . map ( x => { return { vmsnapshotid : x } } ) }
525+ }
526+ ]
527+ } ,
457528 {
458529 name : 'kubernetes' ,
459530 title : 'label.kubernetes' ,
0 commit comments