Added Backup features

This commit is contained in:
Thermo_SIM
2021-03-15 14:51:24 +01:00
parent 9de1286290
commit 1f769677d1
5 changed files with 66 additions and 2 deletions
@@ -15,13 +15,18 @@ export default class backupRecipe extends Vue {
@Prop()
deferred: Deferred<string>;
folderlist = [];
devicelist = [];
device = "";
folder = "";
canDo = false;
mounted() {
if (typeof cmsClient != "undefined") {
this.devicelist = JSON.parse(cmsClient.getOSextDriveList());
this.folderlist = JSON.parse(cmsClient.getAllRecipeDirectories());
}
this.canDo = false;
}
@@ -29,13 +34,21 @@ export default class backupRecipe extends Vue {
@Watch("device")
valueCHange(){
this.canDo = this.device.trim() != "";
this.canDo = this.device.trim() != "" && this.folder.trim() != "";
}
@Watch("folder")
folderCHange(){
this.canDo = this.device.trim() != "" && this.folder.trim() != "";
}
run() {
if (typeof cmsClient != "undefined") {
this.canDo = false;
var obj = JSON.parse(cmsClient.backupRecipes(this.device));
if(this.folder == "ALL_SUBFOLDERS")
var obj = JSON.parse(cmsClient.backupRecipes(this.device));
else
var obj = JSON.parse(cmsClient.backupSubRecipes(this.device,this.folder));
if (obj.error) {
(iziToast as any).error({
title: "error",
@@ -7,6 +7,15 @@
</button>
</header>
<div class="form-group">
<label>{{'select_folder_name' | localize('Cartella')}}</label>
<select v-model="folder" :placeholder="'folder_name' | localize('Nuova Cartella')" >
<optgroup :label="'select_folder_all' | localize('Tutte')">
<option value="ALL_SUBFOLDERS">{{'select_folder_all_folder' | localize('Tutte le cartelle')}}</option>
</optgroup>
<optgroup :label="'select_folder_sub' | localize('Sottocartelle')">
<option v-for="folder in folderlist" :value="folder">{{folder}}</option>
</optgroup>
</select>
<label>{{'select_devices' | localize('Select Devices')}}</label>
<select v-model="device" :placeholder="'select_devices' | localize('Select Devices')">
<option v-for="device in devicelist" :value="device.Path">{{device.Name}}</option>