folder create
This commit is contained in:
@@ -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))
|
||||
}
|
||||
|
||||
|
||||
@@ -21,15 +21,24 @@
|
||||
<div class="context-menu">
|
||||
<div
|
||||
class="card-folder-dots"
|
||||
v-if="iconType=='FILE'"
|
||||
v-if="iconType=='FILE' || iconType == 'FOLDER'"
|
||||
@click.stop.prevent="showactions = !showactions"
|
||||
>
|
||||
<i class="fa fa-ellipsis-v"></i>
|
||||
</div>
|
||||
<ul class="context-area" :class="{'show': showactions}">
|
||||
<li @click="showactions = false; renameFile()">{{'file_rename' | localize('Rinomina')}}</li>
|
||||
<li @click="showactions = false; deleteFile()">{{'file_delete' | localize('Cancella')}}</li>
|
||||
<li @click="showactions = false; moveFile()">{{'file_move' | localize('Sposta')}}</li>
|
||||
<li
|
||||
v-if="iconType == 'FOLDER'"
|
||||
@click="showactions = false; renameFolder()"
|
||||
>{{'file_rename' | localize('Rinomina')}}</li>
|
||||
<li
|
||||
v-if="iconType == 'FOLDER'"
|
||||
@click="showactions = false; deleteFolder()"
|
||||
>{{'file_delete' | localize('Cancella')}}</li>
|
||||
<li
|
||||
v-if="iconType=='FILE'"
|
||||
@click="showactions = false; moveFile()"
|
||||
>{{'file_move' | localize('Sposta')}}</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="card-folder-path-arrow" v-if="withArrow">
|
||||
|
||||
+13
-9
@@ -13,24 +13,28 @@ export default class Rename extends Vue {
|
||||
deferred: Deferred<string>;
|
||||
|
||||
@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();
|
||||
}
|
||||
|
||||
+4
-4
@@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div class="setup">
|
||||
<modal type="save-as" :title="'modal_title_rename' | localize('File Rename')">
|
||||
<modal type="save-as" :title="value.title | localize(value.title)">
|
||||
<div slot="header-buttons">
|
||||
<button class="modal-close" @click="close()">
|
||||
<i class="fa fa-remove"></i>
|
||||
@@ -8,8 +8,8 @@
|
||||
</div>
|
||||
<section>
|
||||
<article>
|
||||
<label>{{'file_name' | localize('Nome del file')}}</label>
|
||||
<input v-model="RecipeName" :placeholder="'file_name' | localize('Nome del file')" />
|
||||
<label>{{value.message | localize(value.message)}}</label>
|
||||
<input v-model="FinalName" :placeholder="value.message | localize(value.message)" />
|
||||
</article>
|
||||
</section>
|
||||
<footer>
|
||||
@@ -19,4 +19,4 @@
|
||||
</modal>
|
||||
</div>
|
||||
</template>
|
||||
<script src="./modalRename.ts" lang="ts"></script>
|
||||
<script src="./modalAskName.ts" lang="ts"></script>
|
||||
@@ -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))
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@
|
||||
:placeholder="'modal_load_program_search_placeholder' | localize('Cerca un programma per nome')"
|
||||
/>
|
||||
<i class="fa fa-2x fa-search"></i>
|
||||
<i class="fa fa-2x fa-folder-o" @click="createFolder()"></i>
|
||||
</div>
|
||||
<div class="content scrollable">
|
||||
<card-folder-path
|
||||
@@ -104,6 +105,7 @@
|
||||
:placeholder="'modal_load_program_search_placeholder' | localize('Cerca un programma per nome')"
|
||||
/>
|
||||
<i class="fa fa-2x fa-search"></i>
|
||||
<i class="fa fa-2x fa-folder-o" @click="createFolder()"></i>
|
||||
</div>
|
||||
<div class="label-folder-empty" v-if="secondColumnData.length ==0">
|
||||
<label>{{'modal_load_program_empty_folder' | localize("Cartella vuota")}}</label>
|
||||
|
||||
Reference in New Issue
Block a user