Skip to content
This repository has been archived by the owner on Oct 30, 2023. It is now read-only.

Staging #723

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/views/Tag/productMapping.vue
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default {
this.$Notice.error({title: 'Error!!', desc: 'Tag already mapped.', duration: 2})
}
else {
if(Array.isArray(tag_list)) {
if(Array.isArray(tag_list) && tag_list.length > 0) {
tag_list.push(res.data.tag_name);
}
else {
Expand Down
34 changes: 34 additions & 0 deletions src/views/Tag/productTags.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,40 @@ export default {
}).catch(err => {
this.$Notice.error({ title: 'Error!', desc: 'Not Deleted.', duration: 3})
})

//change in elasticsearch product
let websiteDetails = _.find(this.webOptions, {value: this.tdata.website});
axios.get(tagsUrl + '/' + this.ptdata.data[finx].tag_id).then(tagRes => {
axios.get(
productApiUrl + '?_id=' + this.ptdata.data[finx].product_id,
{ headers: { 'vid': websiteDetails.vid } }
)
.then(productRes => {
let tag_list = productRes.data.hits.hits[0]._source.tags;

if(tag_list.includes(tagRes.data.tag_name)) {
if(Array.isArray(tag_list) && tag_list.length > 0) {
const index = tag_list.indexOf(tagRes.data.tag_name);
tag_list.splice(index, 1);
}

let esData = { "supplier_id":productRes.data.hits.hits[0]._source.supplier_id, "tags":tag_list };
axios({
method: 'PATCH',
url: productApiUrl+"/"+this.ptdata.data[finx].product_id,
data: esData,
headers: {'vid':websiteDetails.vid}
}).then(res3 => {
this.$Spin.hide();
this.$Notice.success({title: 'Success!!', desc: 'Product removed from ES.', duration: 2})
}).catch(err => {
this.$Spin.hide();
this.$Notice.error({title: 'Error!!', desc: 'Not removed from ES.', duration: 2})
})
}
})
})
//end elasticsearch
}
},
async init (item) {
Expand Down
14 changes: 11 additions & 3 deletions src/views/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5836,8 +5836,11 @@
async remove(store, data) {
// console.log('remove called:')
// Get Config.json file data
let configFileUrl = this.$store.state.fileUrl.replace(/\\/g, "\/");
let urlparts = configFileUrl.split("/");
let configFileUrl = this.$store.state.fileUrl;

if(configFileUrl!=undefined){
configFileUrl.replace(/\\/g, "\/")
let urlparts = configFileUrl.split("/");
let fileNameOrginal = urlparts[urlparts.length - 1];
let foldername = urlparts[urlparts.length - 2];
// let fileName = '/' + urlparts[urlparts.length - 2] + '/' + urlparts[urlparts.length - 1];
Expand Down Expand Up @@ -6171,6 +6174,8 @@
// }).catch((dismiss) => {
// console.log('error', dismiss)
// })
}

},

// Remove Folder manipulating config.json
Expand Down Expand Up @@ -6345,6 +6350,7 @@
async removeProject(store, data) {
// Get Config File
let folderUrl = this.$store.state.fileUrl.replace(/\\/g, "\/");
if(folderUrl!=undefined){
let foldername = folderUrl.split('/');
foldername = foldername[(foldername.length - 1)];

Expand Down Expand Up @@ -6432,7 +6438,7 @@
})

// delete project configuration from RethinkDB
axios.delete(config.baseURL + '/project-configuration/' + foldername, {})
await axios.delete(config.baseURL + '/project-configuration/' + foldername, {})
.then((res) => {
this.$message({
showClose: true,
Expand Down Expand Up @@ -6519,6 +6525,8 @@
location.reload()
});
})
}

},

quickPreview(filePath) {
Expand Down