mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:57:08 +00:00
Add option to save local copy of configuration to local file
This commit is contained in:
@@ -103,8 +103,8 @@
|
||||
class="ml-2"
|
||||
color="primary"
|
||||
:disabled="!configuration"
|
||||
:href="`/api/project/${this.$route.params.project}/configuration?mime=application/yaml`"
|
||||
:download="`${this.$route.params.project}.yaml`"
|
||||
@click="saveToFile"
|
||||
title="Save the current configuration to a file, including any changes you might have made but not yet sent to the server."
|
||||
>
|
||||
<v-icon small left>mdi-cloud-download</v-icon>
|
||||
Download
|
||||
@@ -194,6 +194,7 @@
|
||||
|
||||
|
||||
<script>
|
||||
import YAML from 'yaml';
|
||||
import { mapActions, mapGetters } from 'vuex';
|
||||
import { deepSet } from '@/lib/utils';
|
||||
|
||||
@@ -550,6 +551,22 @@ export default {
|
||||
|
||||
upload () {
|
||||
console.log("UPLOAD");
|
||||
async saveToFile () {
|
||||
const payload = YAML.stringify(this.configuration);
|
||||
const blob = new Blob([payload], {type: "application/yaml"});
|
||||
const url = URL.createObjectURL(blob);
|
||||
const filename = `${this.$route.params.project}-configuration.yaml`;
|
||||
|
||||
console.log(payload);
|
||||
console.log(filename);
|
||||
console.log(url);
|
||||
|
||||
const element = document.createElement('a');
|
||||
element.download = filename;
|
||||
element.href = url;
|
||||
element.click();
|
||||
console.log("Download complete. Cleaning up.");
|
||||
URL.revokeObjectURL(url);
|
||||
},
|
||||
|
||||
closeDialog () {
|
||||
|
||||
Reference in New Issue
Block a user