update highlight
This commit is contained in:
parent
36986bfd8b
commit
9fdaa4031a
|
|
@ -5,7 +5,7 @@ import LogDetectFile from 'App/Models/LogDetectFile';
|
|||
import axios from 'axios';
|
||||
|
||||
export default class LogsController {
|
||||
public async showLog({request, response}: HttpContextContract) {
|
||||
public async showLog({ request, response }: HttpContextContract) {
|
||||
try {
|
||||
// fghf
|
||||
const checkSpecialVersion = async (paragraph) => {
|
||||
|
|
@ -23,11 +23,11 @@ export default class LogsController {
|
|||
if (match) {
|
||||
return match[0];
|
||||
}
|
||||
|
||||
|
||||
if (match1) {
|
||||
return match1[0];
|
||||
}
|
||||
|
||||
|
||||
if (match2) {
|
||||
return match2[0];
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ export default class LogsController {
|
|||
let logsDetect = await Database.rawQuery(
|
||||
"select * from log_reports where id_file = " + fileDetect?.id_ldf
|
||||
);
|
||||
|
||||
|
||||
let modelSpecialDetected = [];
|
||||
let issueSpecialDetected = [];
|
||||
let listLine = logsDetect[0]
|
||||
|
|
@ -55,7 +55,7 @@ export default class LogsController {
|
|||
return self.indexOf(value) === index;
|
||||
})
|
||||
.sort((a, b) => a - b);
|
||||
|
||||
|
||||
const content = await axios.get(
|
||||
request.params().name.search("AUTO") !== -1
|
||||
? "http://192.168.5.7:8080/AUTOlog/" + request.params().name
|
||||
|
|
@ -67,30 +67,30 @@ export default class LogsController {
|
|||
i.$original.key === "MODEL_SPECIAL" ||
|
||||
i.$original.key === "CATCH_FAULTY"
|
||||
);
|
||||
|
||||
|
||||
let MODEL_SPECIAL = allValue
|
||||
.filter((i) => i.$original.key === "MODEL_SPECIAL")
|
||||
.map((obj) => obj.$original.value);
|
||||
|
||||
|
||||
let listExcludeErr = allValue
|
||||
.filter((i) => i.$original.key === "EXCLUDE_ERR")
|
||||
.map((obj) => obj.$original.value);
|
||||
|
||||
|
||||
let data = content.data.split("\n");
|
||||
data.map(async(line, index) => {
|
||||
data.map(async (line, index) => {
|
||||
data[index] = index + 1 + "|-|" + line;
|
||||
|
||||
if(await checkSpecialVersion(line)!==""){
|
||||
if (await checkSpecialVersion(line) !== "") {
|
||||
const specialVersion = await checkSpecialVersion(line)
|
||||
// console.log("version ", specialVersion)
|
||||
console.log("data.search ", data[index].indexOf(specialVersion))
|
||||
console.log(data[index].slice(0, data[index].indexOf(specialVersion)) )
|
||||
console.log(data[index].slice(0, data[index].indexOf(specialVersion)))
|
||||
console.log(specialVersion)
|
||||
console.log(data[index].slice(data[index].indexOf(specialVersion) + specialVersion.length))
|
||||
// console.log("data.length ", data[index].length)
|
||||
// console.log(data[index].slice(0, data[index].indexOf(await specialVersion-specialVersion.length)))
|
||||
data[index] =
|
||||
data[index].slice(0, data[index].indexOf(specialVersion))
|
||||
data[index].slice(0, data[index].indexOf(specialVersion))
|
||||
+
|
||||
"|-|" +
|
||||
specialVersion +
|
||||
|
|
@ -115,19 +115,22 @@ export default class LogsController {
|
|||
}
|
||||
});
|
||||
});
|
||||
|
||||
listLine.map(async(u) => {
|
||||
|
||||
listLine.map(async (u) => {
|
||||
if (
|
||||
listExcludeErr.filter((err) => data[u - 1].includes(err)).length === 0
|
||||
) {
|
||||
if(await checkSpecialVersion(data[u - 1])!==""){
|
||||
console.log("GOOD")
|
||||
modelSpecialDetected.push(data[u - 1]);
|
||||
}
|
||||
if (MODEL_SPECIAL.filter((i) => data[u - 1].includes(i)).length > 0 ) {
|
||||
|
||||
if (MODEL_SPECIAL.filter((i) => data[u - 1].includes(i)).length > 0) {
|
||||
modelSpecialDetected.push(data[u - 1]);
|
||||
} else {
|
||||
issueSpecialDetected.push(data[u - 1]);
|
||||
if (await checkSpecialVersion(data[u - 1]) !== "") {
|
||||
console.log("GOOD")
|
||||
modelSpecialDetected.push(data[u - 1]);
|
||||
} else {
|
||||
console.log("ISSUE")
|
||||
issueSpecialDetected.push(data[u - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -146,7 +149,7 @@ export default class LogsController {
|
|||
}
|
||||
}
|
||||
|
||||
public async getAllLogDetect({request, response}: HttpContextContract) {
|
||||
public async getAllLogDetect({ request, response }: HttpContextContract) {
|
||||
try {
|
||||
let fileDetect = await LogDetectFile.all();
|
||||
let listFiles = fileDetect.map((obj) => obj.file_name);
|
||||
|
|
@ -156,13 +159,13 @@ export default class LogsController {
|
|||
}
|
||||
}
|
||||
|
||||
public async store({}: HttpContextContract) {}
|
||||
public async store({ }: HttpContextContract) { }
|
||||
|
||||
public async show({}: HttpContextContract) {}
|
||||
public async show({ }: HttpContextContract) { }
|
||||
|
||||
public async edit({}: HttpContextContract) {}
|
||||
public async edit({ }: HttpContextContract) { }
|
||||
|
||||
public async update({}: HttpContextContract) {}
|
||||
public async update({ }: HttpContextContract) { }
|
||||
|
||||
public async destroy({}: HttpContextContract) {}
|
||||
public async destroy({ }: HttpContextContract) { }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue