Untitled
unknown
plain_text
3 years ago
1.7 kB
10
Indexable
importNodesArray() {
let dataArray = JSON.parse(this.cSVJSONUtilityLib.convertRowCSVToJS(this.fileContentString, true));
console.log(dataArray);
this.appService.masterWrapperAdmin({
params: {
'allparameters': dataArray,
'allconfig': this.commonUtilitiesLib.copy({
'verbtype': 'post',
'apiname': ['ADMINUSERNODENAMES;'],
'responseformat': {
'format': 'rest'
}
})
}
}).subscribe(
(response: any) => {
if (response.status === 'Success') {
const data = response.data[0].ADMINUSERNODENAMES[0];
if (data.messageCode === 200) {
this.toastr.success('Import Successful');
this.router.navigate(['/admin', 'list', 'all']);
} else {
// Handle specific error message
const skippedNodes = data.message.match(/(?<=skipped nodes : \[)(.*?)(?=\])/);
if (skippedNodes) {
const nodes = skippedNodes[0].split(', ');
console.log('Skipped Nodes:', nodes);
// Handle skipped nodes
} else {
// Handle other error messages
console.log('Error Message:', data.message);
}
}
} else {
// Handle general error case
console.error('Error:', response.errorCode);
}
},
(error: any) => {
// Handle general error case
console.error(error);
}
);
}
Editor is loading...