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';
|
import axios from 'axios';
|
||||||
|
|
||||||
export default class LogsController {
|
export default class LogsController {
|
||||||
public async showLog({request, response}: HttpContextContract) {
|
public async showLog({ request, response }: HttpContextContract) {
|
||||||
try {
|
try {
|
||||||
// fghf
|
// fghf
|
||||||
const checkSpecialVersion = async (paragraph) => {
|
const checkSpecialVersion = async (paragraph) => {
|
||||||
|
|
@ -23,11 +23,11 @@ export default class LogsController {
|
||||||
if (match) {
|
if (match) {
|
||||||
return match[0];
|
return match[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match1) {
|
if (match1) {
|
||||||
return match1[0];
|
return match1[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match2) {
|
if (match2) {
|
||||||
return match2[0];
|
return match2[0];
|
||||||
}
|
}
|
||||||
|
|
@ -46,7 +46,7 @@ export default class LogsController {
|
||||||
let logsDetect = await Database.rawQuery(
|
let logsDetect = await Database.rawQuery(
|
||||||
"select * from log_reports where id_file = " + fileDetect?.id_ldf
|
"select * from log_reports where id_file = " + fileDetect?.id_ldf
|
||||||
);
|
);
|
||||||
|
|
||||||
let modelSpecialDetected = [];
|
let modelSpecialDetected = [];
|
||||||
let issueSpecialDetected = [];
|
let issueSpecialDetected = [];
|
||||||
let listLine = logsDetect[0]
|
let listLine = logsDetect[0]
|
||||||
|
|
@ -55,7 +55,7 @@ export default class LogsController {
|
||||||
return self.indexOf(value) === index;
|
return self.indexOf(value) === index;
|
||||||
})
|
})
|
||||||
.sort((a, b) => a - b);
|
.sort((a, b) => a - b);
|
||||||
|
|
||||||
const content = await axios.get(
|
const content = await axios.get(
|
||||||
request.params().name.search("AUTO") !== -1
|
request.params().name.search("AUTO") !== -1
|
||||||
? "http://192.168.5.7:8080/AUTOlog/" + request.params().name
|
? "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 === "MODEL_SPECIAL" ||
|
||||||
i.$original.key === "CATCH_FAULTY"
|
i.$original.key === "CATCH_FAULTY"
|
||||||
);
|
);
|
||||||
|
|
||||||
let MODEL_SPECIAL = allValue
|
let MODEL_SPECIAL = allValue
|
||||||
.filter((i) => i.$original.key === "MODEL_SPECIAL")
|
.filter((i) => i.$original.key === "MODEL_SPECIAL")
|
||||||
.map((obj) => obj.$original.value);
|
.map((obj) => obj.$original.value);
|
||||||
|
|
||||||
let listExcludeErr = allValue
|
let listExcludeErr = allValue
|
||||||
.filter((i) => i.$original.key === "EXCLUDE_ERR")
|
.filter((i) => i.$original.key === "EXCLUDE_ERR")
|
||||||
.map((obj) => obj.$original.value);
|
.map((obj) => obj.$original.value);
|
||||||
|
|
||||||
let data = content.data.split("\n");
|
let data = content.data.split("\n");
|
||||||
data.map(async(line, index) => {
|
data.map(async (line, index) => {
|
||||||
data[index] = index + 1 + "|-|" + line;
|
data[index] = index + 1 + "|-|" + line;
|
||||||
|
|
||||||
if(await checkSpecialVersion(line)!==""){
|
if (await checkSpecialVersion(line) !== "") {
|
||||||
const specialVersion = await checkSpecialVersion(line)
|
const specialVersion = await checkSpecialVersion(line)
|
||||||
// console.log("version ", specialVersion)
|
// console.log("version ", specialVersion)
|
||||||
console.log("data.search ", data[index].indexOf(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(specialVersion)
|
||||||
console.log(data[index].slice(data[index].indexOf(specialVersion) + specialVersion.length))
|
console.log(data[index].slice(data[index].indexOf(specialVersion) + specialVersion.length))
|
||||||
// console.log("data.length ", data[index].length)
|
// console.log("data.length ", data[index].length)
|
||||||
// console.log(data[index].slice(0, data[index].indexOf(await specialVersion-specialVersion.length)))
|
// console.log(data[index].slice(0, data[index].indexOf(await specialVersion-specialVersion.length)))
|
||||||
data[index] =
|
data[index] =
|
||||||
data[index].slice(0, data[index].indexOf(specialVersion))
|
data[index].slice(0, data[index].indexOf(specialVersion))
|
||||||
+
|
+
|
||||||
"|-|" +
|
"|-|" +
|
||||||
specialVersion +
|
specialVersion +
|
||||||
|
|
@ -115,19 +115,22 @@ export default class LogsController {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
listLine.map(async(u) => {
|
listLine.map(async (u) => {
|
||||||
if (
|
if (
|
||||||
listExcludeErr.filter((err) => data[u - 1].includes(err)).length === 0
|
listExcludeErr.filter((err) => data[u - 1].includes(err)).length === 0
|
||||||
) {
|
) {
|
||||||
if(await checkSpecialVersion(data[u - 1])!==""){
|
|
||||||
console.log("GOOD")
|
if (MODEL_SPECIAL.filter((i) => data[u - 1].includes(i)).length > 0) {
|
||||||
modelSpecialDetected.push(data[u - 1]);
|
|
||||||
}
|
|
||||||
if (MODEL_SPECIAL.filter((i) => data[u - 1].includes(i)).length > 0 ) {
|
|
||||||
modelSpecialDetected.push(data[u - 1]);
|
modelSpecialDetected.push(data[u - 1]);
|
||||||
} else {
|
} 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 {
|
try {
|
||||||
let fileDetect = await LogDetectFile.all();
|
let fileDetect = await LogDetectFile.all();
|
||||||
let listFiles = fileDetect.map((obj) => obj.file_name);
|
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