feat(lite/pool/vms): ability to export selected VMs as JSON file (#6911)
This commit is contained in:
parent
3de928c488
commit
de8abd5b63
@ -3,6 +3,7 @@
|
||||
## **next**
|
||||
|
||||
- Ability to export selected VMs as CSV file (PR [#6915](https://github.com/vatesfr/xen-orchestra/pull/6915))
|
||||
- [Pool/VMs] Ability to export selected VMs as JSON file (PR [#6911](https://github.com/vatesfr/xen-orchestra/pull/6911))
|
||||
|
||||
## **0.1.1** (2023-07-03)
|
||||
|
||||
|
@ -9,8 +9,10 @@
|
||||
{{ $t("export-vms") }}
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
v-tooltip="{ content: $t('coming-soon'), placement: 'left' }"
|
||||
:icon="faCode"
|
||||
@click="
|
||||
exportVmsAsJsonFile(vms, `vms_${new Date().toISOString()}.json`)
|
||||
"
|
||||
>
|
||||
{{ $t("export-table-to", { type: ".json" }) }}
|
||||
</MenuItem>
|
||||
@ -26,7 +28,7 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from "vue";
|
||||
import { exportVmsAsCsvFile } from "@/libs/vm";
|
||||
import { exportVmsAsCsvFile, exportVmsAsJsonFile } from "@/libs/vm";
|
||||
import MenuItem from "@/components/menu/MenuItem.vue";
|
||||
import {
|
||||
faCode,
|
||||
|
@ -30,3 +30,12 @@ export function exportVmsAsCsvFile(vms: XenApiVm[], fileName: string) {
|
||||
fileName
|
||||
);
|
||||
}
|
||||
|
||||
export function exportVmsAsJsonFile(vms: XenApiVm[], fileName: string) {
|
||||
saveAs(
|
||||
new Blob([JSON.stringify(vms, null, 2)], {
|
||||
type: "application/json",
|
||||
}),
|
||||
fileName
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user