Skip to content
This repository was archived by the owner on Jan 20, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add storage backups
  • Loading branch information
utchoang
utchoang committed Mar 20, 2020
commit b802817a07a7086bd65ca309d7b30e98f409a08e
7 changes: 6 additions & 1 deletion src/components/view/InfoCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</div>
<slot name="name">
<h4 class="name">
{{ resource.displayname || resource.displaytext || resource.name || resource.hostname || resource.username || resource.ipaddress }}
{{ resource.displayname || resource.displaytext || resource.name || resource.hostname || resource.username || resource.ipaddress || resource.virtualmachinename }}
</h4>
<console style="margin-left: 10px" :resource="resource" size="default" v-if="resource.id" />
</slot>
Expand Down Expand Up @@ -646,6 +646,11 @@ export default {
return
}

if (typeof this.resource.volumes === 'string') {
const volumes = JSON.parse(this.resource.volumes)
this.$set(this.resource, 'volumes', volumes)
}

this.resourceType = this.$route.meta.resourceType
this.annotationType = ''
this.showKeys = false
Expand Down
6 changes: 6 additions & 0 deletions src/components/view/ListView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<router-link :to="{ path: $route.path + '/' + record.name }" v-else>{{ text }}</router-link>
</div>
</a>
<a slot="virtualmachinename" slot-scope="text, record" href="javascript:;">
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
</a>
<a slot="displayname" slot-scope="text, record" href="javascript:;">
<router-link :to="{ path: $route.path + '/' + record.id }">{{ text }}</router-link>
</a>
Expand All @@ -96,6 +99,9 @@
<template slot="state" slot-scope="text">
<status :text="text ? text : ''" displayText />
</template>
<template slot="status" slot-scope="text">
<status :text="text ? text : ''" displayText />
</template>
<template slot="allocationstate" slot-scope="text">
<status :text="text ? text : ''" displayText />
</template>
Expand Down
48 changes: 48 additions & 0 deletions src/config/section/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,54 @@ export default {
}
}
]
},
{
name: 'backups',
title: 'Backups',
icon: 'rollback',
permission: ['listBackups'],
resourceType: 'backup',
columns: ['virtualmachinename', 'status', 'type', 'created', 'account', 'zone'],
details: ['virtualmachinename', 'id', 'volumename', 'intervaltype', 'account', 'domain', 'created'],
filters: ['name', 'domainid', 'account', 'tags'],
actions: [
{
api: 'deleteBackup',
icon: 'delete',
label: 'label.backup.delete',
dataView: true
},
{
api: 'restoreBackup',
icon: 'undo',
label: 'label.backup.restore',
dataView: true
},
{
api: 'restoreVolumeFromBackupAndAttachToVM',
icon: 'paper-clip',
label: 'label.backup.restore.and.attach.vm',
dataView: true,
args: ['volumeid', 'virtualmachineid'],
mapping: {
backupid: {
value: (record) => { return record.id }
}
}
},
{
api: 'removeVirtualMachineFromBackupOffering',
icon: 'stop',
label: 'label.backup.delete.chain',
dataView: true,
args: ['forced'],
mapping: {
virtualmachineid: {
value: (record) => { return record.virtualmachineid }
}
}
}
]
}
]
}
16 changes: 15 additions & 1 deletion src/views/AutogenView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
}"
>
<a-select-option v-for="(opt, optIndex) in field.opts" :key="optIndex">
{{ opt.name || opt.description || opt.traffictype || opt.publicip }}
<template v-if="!field.listLocal">{{ opt.name || opt.description || opt.traffictype || opt.publicip }}</template>
<template v-else>{{ opt.name || opt.description || opt.type }}</template>
</a-select-option>
</a-select>
</span>
Expand Down Expand Up @@ -549,6 +550,19 @@ export default {
if (param.type === 'list' && param.name === 'hosttags') {
param.type = 'string'
}
if (param.name === 'volumeid' && param.type === 'string') {
if (this.resource && this.resource.volumes && this.resource.volumes.length > 0) {
param.type = 'uuid'
param.listLocal = true
param.opts = this.resource.volumes
this.$forceUpdate()
}
}

if (param.listLocal) {
continue
}

if (param.type === 'uuid' || param.type === 'list' || param.name === 'account' || (this.currentAction.mapping && param.name in this.currentAction.mapping)) {
this.listUuidOpts(param)
}
Expand Down