From ab345f7f99e50b79cfccea763265442a8d3b033a Mon Sep 17 00:00:00 2001 From: = Date: Wed, 23 Sep 2020 17:49:03 +0200 Subject: [PATCH] folder create --- .../base-components/cards/card-folder-path.ts | 14 ++-- .../cards/card-folder-path.vue | 17 +++-- .../cards/{modalRename.ts => modalAskName.ts} | 22 ++++--- .../{modalRename.vue => modalAskName.vue} | 8 +-- .../base-components/modal-load-program.ts | 66 ++++++++++--------- .../base-components/modal-load-program.vue | 2 + 6 files changed, 75 insertions(+), 54 deletions(-) rename Thermo.Active/wwwroot/src/modules/base-components/cards/{modalRename.ts => modalAskName.ts} (63%) rename Thermo.Active/wwwroot/src/modules/base-components/cards/{modalRename.vue => modalAskName.vue} (61%) diff --git a/Thermo.Active/wwwroot/src/modules/base-components/cards/card-folder-path.ts b/Thermo.Active/wwwroot/src/modules/base-components/cards/card-folder-path.ts index 5580105a..d7774af5 100644 --- a/Thermo.Active/wwwroot/src/modules/base-components/cards/card-folder-path.ts +++ b/Thermo.Active/wwwroot/src/modules/base-components/cards/card-folder-path.ts @@ -2,7 +2,7 @@ import { ModalHelper } from '@/components/modals'; import Vue from 'vue'; import Component from 'vue-class-component'; import { Prop } from 'vue-property-decorator'; -import renameModal from "./modalRename.vue"; +import askNameModal from "./modalAskName.vue"; import moveModal from "./modalMove.vue"; @Component({}) @@ -30,18 +30,18 @@ export default class CardFolderPath extends Vue { this.$emit("click"); }; - async renameFile() { - let result = await ModalHelper.ShowModalAsync(renameModal, this.name); + async renameFolder() { + let result = await ModalHelper.ShowModalAsync(askNameModal, { title: 'folder_rename', message: 'new_folder_name', name: this.name }); // funzione di rename - this.$emit("fileRename", { oldname: this.name, newname: result }); + this.$emit("folderRename", { oldname: this.name, newname: result }); } - deleteFile() { + deleteFolder() { ModalHelper.AskConfirm(this.$options.filters.localize("modal_delete_confirm", "Richiesta di conferma"), - this.$options.filters.localize("modal_confirm_delete_recipe", "Confermi di voler cancellare la ricetta?"), + this.$options.filters.localize("modal_confirm_delete_folder", "Confermi di voler cancellare la cartella?"), async () => { //funzione di cancellazione del file - this.$emit("fileDelete", { name: this.name }); + this.$emit("folderDelete", { name: this.name }); }, () => void (0)) } diff --git a/Thermo.Active/wwwroot/src/modules/base-components/cards/card-folder-path.vue b/Thermo.Active/wwwroot/src/modules/base-components/cards/card-folder-path.vue index 44f2795c..c454c16a 100644 --- a/Thermo.Active/wwwroot/src/modules/base-components/cards/card-folder-path.vue +++ b/Thermo.Active/wwwroot/src/modules/base-components/cards/card-folder-path.vue @@ -21,15 +21,24 @@
diff --git a/Thermo.Active/wwwroot/src/modules/base-components/cards/modalRename.ts b/Thermo.Active/wwwroot/src/modules/base-components/cards/modalAskName.ts similarity index 63% rename from Thermo.Active/wwwroot/src/modules/base-components/cards/modalRename.ts rename to Thermo.Active/wwwroot/src/modules/base-components/cards/modalAskName.ts index b51d6df7..2e3c356f 100644 --- a/Thermo.Active/wwwroot/src/modules/base-components/cards/modalRename.ts +++ b/Thermo.Active/wwwroot/src/modules/base-components/cards/modalAskName.ts @@ -13,24 +13,28 @@ export default class Rename extends Vue { deferred: Deferred; @Prop() - value: string; + value: { + title: string, + message: string, + value: string + }; - recipeName: string = null; + finalName: string = null; mounted() { - if (this.value) - this.value = this.value.replace(".rcp", ""); + if (this.value && this.value.value) + this.value.value = this.value.value.replace(".rcp", ""); } - get RecipeName() { - return this.recipeName || this.value; + get FinalName() { + return this.finalName || this.value.value; } - set RecipeName(value: string) { - this.recipeName = value; + set FinalName(value: string) { + this.finalName = value; } save(value: string) { - this.deferred.resolve(this.RecipeName + ".rcp") + this.deferred.resolve(this.FinalName + ".rcp") ModalHelper.HideModal(); } diff --git a/Thermo.Active/wwwroot/src/modules/base-components/cards/modalRename.vue b/Thermo.Active/wwwroot/src/modules/base-components/cards/modalAskName.vue similarity index 61% rename from Thermo.Active/wwwroot/src/modules/base-components/cards/modalRename.vue rename to Thermo.Active/wwwroot/src/modules/base-components/cards/modalAskName.vue index 9286c169..fc17b235 100644 --- a/Thermo.Active/wwwroot/src/modules/base-components/cards/modalRename.vue +++ b/Thermo.Active/wwwroot/src/modules/base-components/cards/modalAskName.vue @@ -1,6 +1,6 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/Thermo.Active/wwwroot/src/modules/base-components/modal-load-program.ts b/Thermo.Active/wwwroot/src/modules/base-components/modal-load-program.ts index 0a146331..be958f4e 100644 --- a/Thermo.Active/wwwroot/src/modules/base-components/modal-load-program.ts +++ b/Thermo.Active/wwwroot/src/modules/base-components/modal-load-program.ts @@ -9,6 +9,7 @@ import * as iziToast from "izitoast"; import ZoomImage from './zoom-image.vue' import { recipeService } from "@/services/recipeService"; import duplicateModal from "@/app_modules_thermo/save/duplicate.vue"; +import askNameModal from "./cards/modalAskName.vue"; declare var cmsClient: any; @@ -82,8 +83,8 @@ export default class ModalLoadProgram extends Vue { return this.$store.state.process.canLoadProgram; } - async duplicate(){ - let result = await ModalHelper.ShowModalAsync(duplicateModal,{name:this.selectedFile.Name,folder:this.currentPath}); + async duplicate() { + let result = await ModalHelper.ShowModalAsync(duplicateModal, { name: this.selectedFile.Name, folder: this.currentPath }); this.relaodFiles(); } @@ -91,12 +92,14 @@ export default class ModalLoadProgram extends Vue { if (typeof cmsClient != "undefined") { this.driveList = JSON.parse(cmsClient.getOSdriveList()); this.recentPath = cmsClient.RECENT_FOLDER_KEY - this.navigateTo(null,"C:\\CMS\\Recipes",this.isLocalNavigation,1,1); + this.navigateTo(null, "C:\\CMS\\Recipes", this.isLocalNavigation, 1, 1); } this.loadClicked = false } + + async navigateTo(path: string, absolutePath: string, local: boolean, todepth: number, fromdepth: number) { this.currentPath = absolutePath; this.lastClickPath = absolutePath; @@ -154,12 +157,12 @@ export default class ModalLoadProgram extends Vue { } async relaodFiles() { - + this.selectedFile = null; this.selectedFileMetadata = null; var files = await this.getFilesForPath(this.currentPath, null); // controlla se impostare il currentDrive - + // Check destination depth if (this.navigationDepth == 1) { @@ -268,7 +271,7 @@ export default class ModalLoadProgram extends Vue { } as FileInfo; } - porva(){ + porva() { return this.selectedFile.PreviewBase64.replace(/"/g, '\\"'); } async fileInfo(str, isJob, fromdepth: number) { @@ -321,7 +324,7 @@ export default class ModalLoadProgram extends Vue { try { this.cleanFileWatcher() messageService.deleteChannel("esc_pressed"); - } catch{ } + } catch { } // ModalHelper.HideModal(); this.$router.back(); } @@ -329,6 +332,11 @@ export default class ModalLoadProgram extends Vue { reload() { this.driveList = JSON.parse(cmsClient.getOSdriveList()); } + async createFolder() { + let result = await ModalHelper.ShowModalAsync(askNameModal, { title: 'folder_create', message: 'new_folder_name', name: "" }); + // funzione di creazione del folder + + } getDate(date) { return moment(date).format("L"); @@ -380,34 +388,32 @@ export default class ModalLoadProgram extends Vue { this.showZoomedImage = !this.showZoomedImage; } - duplicateprogram() - { + duplicateprogram() { var res = cmsClient.editProgram(this.selectedFile.AbsolutePath, this.fileChanged); } - deleteprogram() - { + deleteprogram() { ModalHelper.AskConfirm(this.$options.filters.localize("modal_confirm_title", "Richiesta di conferma"), - this.$options.filters.localize("modal_confirm_delete_recipe", "Confermi di voler eliminare la ricetta?"), - async () => { - var res = cmsClient.deleteFile(this.selectedFile.AbsolutePath); - if (res) { - var obj = JSON.parse(res); - if (obj.error) { - (iziToast as any).error({ - title: "error", - message: obj.error, - theme: "dark", - timeout: 10000, - class: "t-error", - transitionOut: "fadeOut", - }) + this.$options.filters.localize("modal_confirm_delete_recipe", "Confermi di voler eliminare la ricetta?"), + async () => { + var res = cmsClient.deleteFile(this.selectedFile.AbsolutePath); + if (res) { + var obj = JSON.parse(res); + if (obj.error) { + (iziToast as any).error({ + title: "error", + message: obj.error, + theme: "dark", + timeout: 10000, + class: "t-error", + transitionOut: "fadeOut", + }) + } } - } - else { - this.relaodFiles(); - } - }, () => void (0)) + else { + this.relaodFiles(); + } + }, () => void (0)) } diff --git a/Thermo.Active/wwwroot/src/modules/base-components/modal-load-program.vue b/Thermo.Active/wwwroot/src/modules/base-components/modal-load-program.vue index 04112231..51193fdc 100644 --- a/Thermo.Active/wwwroot/src/modules/base-components/modal-load-program.vue +++ b/Thermo.Active/wwwroot/src/modules/base-components/modal-load-program.vue @@ -78,6 +78,7 @@ :placeholder="'modal_load_program_search_placeholder' | localize('Cerca un programma per nome')" /> +
+