Skip to content

Commit

Permalink
[BUGFIXED]- File copy issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
ndasanayaka committed Jun 24, 2024
1 parent 0846ab0 commit fc47021
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"core-js": "^3.6.5",
"html-screen-capture-js": "^1.0.52",
"html2canvas": "^1.3.0",
"keycloak-js": "^20.0.5",
"keycloak-js": "^22.0.5",
"minimatch": "^3.0.4",
"platform": "^1.3.6",
"roboto-fontface": "*",
Expand Down
29 changes: 12 additions & 17 deletions src/components/TemplateDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
}
},
methods: {
findIndexByName(array,name){
return array.findIndex(item => item.name === name);
},
async open(isnew, settings) {
this.dialog = true
this.isnew = isnew
Expand Down Expand Up @@ -131,31 +134,23 @@
return
}
if(this.name) {
let same =false
console.log(this.name)
for(let i=0; i<this.templates.length;i++){
if(this.name == this.templates[i].name) {
console.log(this.name)
same=true
let options = await this.$refs.templateoverridedialog.open(this.name)
console.log(options)
if(!options.cancelled) {
let index = this.findIndexByName(this.templates, this.name)
console.log(index)
if(index !== -1) {
let options = await this.$refs.templateoverridedialog.open(this.name)
if(!options.cancelled) {
if(options.success) {
await TemplateAPI.delete_template(this.templates[i].id)
await TemplateAPI.delete_template(this.templates[index].id)
await TemplateAPI.create_template(this.name, this.options.settings.setting)
}
}
}else {
same = false
}
}
if(!same) {
console.log(same)
} else {
await TemplateAPI.create_template(this.name, this.options.settings.setting)
}
this.options.success = true
}
Expand Down
27 changes: 21 additions & 6 deletions src/components/vuetify-file-browser/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,28 @@ export default {
console.log("Destination in if")
console.log(destination)
}
let copiedItemPath = _copiedItems.lastIndexOf('/');
let directoryPath2 = _copiedItems.substring(0, copiedItemPath + 1);
console.log(directoryPath2)
if (directoryPath2 == destination ) {
_copiedItems = _copiedItems.replace(/(\.[^.]+)$/, '_copy$1')
if(_copiedItems.length > 0) {
_copiedItems.forEach((item,index) => {
let lastindex = item.lastIndexOf('/');
console.log("index ", lastindex)
console.log("current item ", item)
let directoryPath2 = item.substring(0, (lastindex + 1));
console.log("directoryPath2 ", directoryPath2)
if (directoryPath2 === destination ) {
let dotindex = item.indexOf('.')
let pathtoextenstion = item.substring(0,dotindex)
let newpath = pathtoextenstion+"_copy"
let extention = item.substring(dotindex)
_copiedItems[index] = newpath+extention
console.log(_copiedItems[index])
//item.replace(/(\.[^.]+)$/, '_copy$1')
}
})
}
Vue.$log.info("Copying" + _copiedItems + " to "+ destination)
//let index = _copiedItems[0].lastIndexOf('/');
console.log(_copiedItems)
Vue.$log.info("Copying " + _copiedItems + " to "+ destination)
let confirmOptions = await this.$refs.copyconfirm.open(_copiedItems, destination)
if (!confirmOptions.cancelled) {
try{
Expand Down

0 comments on commit fc47021

Please sign in to comment.